mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Show error message if can not load wfx plugin
This commit is contained in:
parent
757298f60d
commit
9e6c706d2d
2 changed files with 46 additions and 26 deletions
|
|
@ -408,23 +408,28 @@ end;
|
|||
constructor TWfxPluginFileSource.Create(aModuleFileName, aPluginRootName: UTF8String);
|
||||
begin
|
||||
inherited Create;
|
||||
FPluginNumber:= -1;
|
||||
FCallbackDataClass:= nil;
|
||||
FModuleFileName:= aModuleFileName;
|
||||
FPluginRootName:= aPluginRootName;
|
||||
FCallbackDataClass:= TCallbackDataClass.Create(Self);
|
||||
FWfxModule:= TWfxModule.Create;
|
||||
if FWfxModule.LoadModule(FModuleFileName) then
|
||||
with FWfxModule do
|
||||
begin
|
||||
FPluginNumber:= WfxOperationList.AddObject(FPluginRootName, FCallbackDataClass);
|
||||
FsInit(FPluginNumber, @MainProgressProcA, @MainLogProcA, @MainRequestProcA);
|
||||
if Assigned(FsInitW) then
|
||||
FsInitW(FPluginNumber, @MainProgressProcW, @MainLogProcW, @MainRequestProcW);
|
||||
if Assigned(FsSetCryptCallback) then
|
||||
FsSetCryptCallback(@CryptProcA, FPluginNumber, 0);
|
||||
if Assigned(FsSetCryptCallbackW) then
|
||||
FsSetCryptCallbackW(@CryptProcW, FPluginNumber, 0);
|
||||
VFSInit(0);
|
||||
end;
|
||||
|
||||
if not FWfxModule.LoadModule(FModuleFileName) then
|
||||
raise EFileSourceException.Create('Cannot load WFX module ' + FModuleFileName);
|
||||
|
||||
with FWfxModule do
|
||||
begin
|
||||
FCallbackDataClass:= TCallbackDataClass.Create(Self);
|
||||
FPluginNumber:= WfxOperationList.AddObject(FPluginRootName, FCallbackDataClass);
|
||||
FsInit(FPluginNumber, @MainProgressProcA, @MainLogProcA, @MainRequestProcA);
|
||||
if Assigned(FsInitW) then
|
||||
FsInitW(FPluginNumber, @MainProgressProcW, @MainLogProcW, @MainRequestProcW);
|
||||
if Assigned(FsSetCryptCallback) then
|
||||
FsSetCryptCallback(@CryptProcA, FPluginNumber, 0);
|
||||
if Assigned(FsSetCryptCallbackW) then
|
||||
FsSetCryptCallbackW(@CryptProcW, FPluginNumber, 0);
|
||||
VFSInit(0);
|
||||
end;
|
||||
|
||||
FOperationsClasses[fsoList] := TWfxPluginListOperation.GetOperationClass;
|
||||
FOperationsClasses[fsoCopy] := TWfxPluginCopyOperation.GetOperationClass;
|
||||
|
|
@ -439,7 +444,8 @@ end;
|
|||
|
||||
destructor TWfxPluginFileSource.Destroy;
|
||||
begin
|
||||
WfxOperationList.Objects[FPluginNumber]:= nil;
|
||||
if (FPluginNumber >= 0) and (FPluginNumber < WfxOperationList.Count) then
|
||||
WfxOperationList.Objects[FPluginNumber]:= nil;
|
||||
FreeThenNil(FCallbackDataClass);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
|
@ -774,4 +780,4 @@ finalization
|
|||
if Assigned(WfxOperationList) then
|
||||
FreeAndNil(WfxOperationList);
|
||||
|
||||
end.
|
||||
end.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
-------------------------------------------------------------------------
|
||||
Virtual File System - class for manage WFX plugins (Version 1.3)
|
||||
|
||||
Copyright (C) 2007-2010 Koblov Alexander (Alexx2000@mail.ru)
|
||||
Copyright (C) 2007-2011 Koblov Alexander (Alexx2000@mail.ru)
|
||||
|
||||
Callback functions based on:
|
||||
Total Commander filesystem plugins debugger
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
unit uWFXmodule;
|
||||
|
||||
{$mode delphi}{$H+}
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
|
|
@ -469,6 +469,17 @@ begin
|
|||
FsFindFirst := TFsFindFirst(GetProcAddress(FModuleHandle,'FsFindFirst'));
|
||||
FsFindNext := TFsFindNext(GetProcAddress(FModuleHandle,'FsFindNext'));
|
||||
FsFindClose := TFsFindClose(GetProcAddress(FModuleHandle,'FsFindClose'));
|
||||
|
||||
if (FsInit = nil) or (FsFindFirst = nil) or
|
||||
(FsFindNext = nil) or (FsFindClose = nil) then
|
||||
begin
|
||||
FsInit:= nil;
|
||||
FsFindFirst:= nil;
|
||||
FsFindNext:= nil;
|
||||
FsFindClose:= nil;
|
||||
Exit(False);
|
||||
end;
|
||||
|
||||
{ Optional }
|
||||
FsSetCryptCallback:= TFsSetCryptCallback(GetProcAddress(FModuleHandle,'FsSetCryptCallback'));
|
||||
FsGetDefRootName := TFsGetDefRootName(GetProcAddress(FModuleHandle,'FsGetDefRootName'));
|
||||
|
|
@ -598,13 +609,16 @@ var
|
|||
begin
|
||||
if Assigned(FsSetDefaultParams) then
|
||||
begin
|
||||
GetMem(dps,SizeOf(tFsDefaultParamStruct));
|
||||
dps.DefaultIniName:=gpCfgDir + WfxIniFileName;
|
||||
dps.PluginInterfaceVersionHi:=1;
|
||||
dps.PluginInterfaceVersionLow:=50;
|
||||
dps.size:=SizeOf(tFsDefaultParamStruct);
|
||||
GetMem(dps, SizeOf(tFsDefaultParamStruct));
|
||||
with dps^ do
|
||||
begin
|
||||
DefaultIniName:= gpCfgDir + WfxIniFileName;
|
||||
PluginInterfaceVersionHi:= 2;
|
||||
PluginInterfaceVersionLow:= 0;
|
||||
Size:= SizeOf(tFsDefaultParamStruct);
|
||||
end;
|
||||
FsSetDefaultParams(dps);
|
||||
FreeMem(dps,SizeOf(tFsDefaultParamStruct));
|
||||
FreeMem(dps, SizeOf(tFsDefaultParamStruct));
|
||||
end;
|
||||
|
||||
// Dialog API
|
||||
|
|
@ -674,7 +688,7 @@ end;
|
|||
|
||||
function TWFXModuleList.GetAEnabled(Index: Integer): Boolean;
|
||||
begin
|
||||
Result:= Boolean(Objects[Index]);
|
||||
Result:= Boolean(PtrInt(Objects[Index]));
|
||||
end;
|
||||
|
||||
function TWFXModuleList.GetAFileName(Index: Integer): String;
|
||||
|
|
@ -689,7 +703,7 @@ end;
|
|||
|
||||
procedure TWFXModuleList.SetAEnabled(Index: Integer; const AValue: Boolean);
|
||||
begin
|
||||
Objects[Index]:= TObject(AValue);
|
||||
Objects[Index]:= TObject(PtrInt(AValue));
|
||||
end;
|
||||
|
||||
procedure TWFXModuleList.SetAFileName(Index: Integer; const AValue: String);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue