FPU, PhotoMetadataHandler.dll. , , , , JPG . , Total Commander ( Delphi) .
, :
procedure TForm1.Button1Click(Sender: TObject);
var
OrgMask : TArithmeticExceptionMask;
begin
OrgMask := GetExceptionMask;
// disable all exceptions
SetExceptioNMask([exInvalidOp,exDenormalized, exZeroDivide, exOverflow,
exUnderflow, exPrecision]);
FileOpenDialog1.Execute;
SetExceptionMask(OrgMask);
end;
, , , .
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Math;
type
ICatchAllFPUExceptions = interface
['{7F429ECA-B458-4F39-832B-429839A8E948}']
end;
TCatchAllFPUExceptions = class(TInterfacedObject, ICatchAllFPUExceptions)
private
OrgExceptionMask : TArithmeticExceptionMask;
public
class function Activate : ICatchAllFPUExceptions; static;
constructor Create;
destructor Destroy; override;
end;
TForm1 = class(TForm)
FileOpenDialog1: TFileOpenDialog;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TCatchAllFPUExceptions }
class function TCatchAllFPUExceptions.Activate: ICatchAllFPUExceptions;
begin
Result := TCatchAllFPUExceptions.Create;
end;
constructor TCatchAllFPUExceptions.Create;
begin
inherited;
OrgExceptionMask := GetExceptionMask;
SetExceptioNMask([exInvalidOp,exDenormalized, exZeroDivide,
exOverflow, exUnderflow, exPrecision]);
end;
destructor TCatchAllFPUExceptions.Destroy;
begin
SetExceptioNMask(OrgExceptionMask);
inherited;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// disable all exceptions
TCatchAllFPUExceptions.Activate;
FileOpenDialog1.Execute;
// mask will be restored here due to internal function variable going out of scope
end;
end.