wfxplugin_updates.patch (6,904 bytes)
Index: src/newdesign/uwfxpluginutil.pas
===================================================================
--- src/newdesign/uwfxpluginutil.pas (revision 4102)
+++ src/newdesign/uwfxpluginutil.pas (working copy)
@@ -201,6 +201,8 @@
Result := WfxCopyMove(aFile.Path + aFile.Name, AbsoluteTargetFileName, iFlags, @RemoteInfo, FInternal, bCopyMoveIn);
case Result of
+ FS_FILE_OK:
+ ;
FS_FILE_EXISTS, // The file already exists, and resume isn't supported
FS_FILE_EXISTSRESUMEALLOWED: // The file already exists, and resume is supported
begin
@@ -215,7 +217,12 @@
raise Exception.Create('Invalid file exists option');
end;
Result := WfxCopyMove(aFile.Path + aFile.Name, AbsoluteTargetFileName, iFlags, @RemoteInfo, FInternal, bCopyMoveIn);
+ { TODO : result not checked }
end;
+ FS_FILE_READERROR: {Happends on F3 on connection name}
+ raise Exception.Create('Error reading file');
+ else
+ raise Exception.Create('Not handled error'); {should be revised}
end;
end;
Index: src/ucryptproc.pas
===================================================================
--- src/ucryptproc.pas (revision 4102)
+++ src/ucryptproc.pas (working copy)
@@ -83,21 +83,21 @@
Base64EncodingStream: TBase64EncodingStream = nil;
BlowFishEncryptStream: TBlowFishEncryptStream = nil;
begin
- Result:= EmptyStr;
BlowFishKeyRec.cBlowFishKey:= MasterKey;
BlowFishKeyRec.dwSize:= Length(MasterKey);
try
StringStream:= TStringStream.Create(EmptyStr);
Base64EncodingStream:= TBase64EncodingStream.Create(StringStream);
+ BlowFishEncryptStream:= TBlowFishEncryptStream.Create(BlowFishKeyRec.bBlowFishKey, BlowFishKeyRec.dwSize, Base64EncodingStream);
- BlowFishEncryptStream:= TBlowFishEncryptStream.Create(BlowFishKeyRec.bBlowFishKey, BlowFishKeyRec.dwSize, Base64EncodingStream);
BlowFishEncryptStream.Write(PAnsiChar(Data)^, Length(Data));
BlowFishEncryptStream.Flush;
+ Base64EncodingStream.Flush;
+ Result:= StringStream.DataString;
finally
FreeThenNil(BlowFishEncryptStream);
FreeThenNil(Base64EncodingStream);
- Result:= StringStream.DataString;
FreeThenNil(StringStream);
end;
end;
@@ -229,4 +229,4 @@
FreeThenNil(PasswordStore);
end.
-
+
Index: src/uwfxmodule.pas
===================================================================
--- src/uwfxmodule.pas (revision 4102)
+++ src/uwfxmodule.pas (working copy)
@@ -267,7 +267,11 @@
FindData:= LoadWfxFindData(FindDataA);
end;
except
- Result:= wfxInvalidHandle;
+ on E: Exception do
+ begin
+ Result:= wfxInvalidHandle;
+ DCDebug(ClassName + '.WfxFindFirst(). Error: ' + E.Message);
+ end;
end;
end;
@@ -441,7 +445,7 @@
constructor TWFXModule.Create;
begin
-
+ inherited;
end;
destructor TWFXModule.Destroy;
@@ -455,13 +459,15 @@
//------------------------------------------------------
UnloadModule;
end;
+ inherited;
end;
function TWFXModule.LoadModule(const sName: String): Boolean;
begin
FModuleHandle := mbLoadLibrary(sName);
Result := (FModuleHandle <> 0);
- if FModuleHandle = 0 then Exit(False);
+ if not Result then
+ Exit;
DCDebug('WFX module loaded ' + sName + ' at ' + hexStr(Pointer(FModuleHandle)));
@@ -606,21 +612,16 @@
procedure TWFXModule.VFSInit(Data: PtrInt);
var
- dps: PFsDefaultParamStruct;
+ dps: tFsDefaultParamStruct;
StartupInfo: TExtensionStartupInfo;
begin
if Assigned(FsSetDefaultParams) then
begin
- 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));
+ dps.DefaultIniName := gpCfgDir + WfxIniFileName;
+ dps.PluginInterfaceVersionHi:= 2;
+ dps.PluginInterfaceVersionLow:= 0;
+ dps.Size:= SizeOf(dps);
+ FsSetDefaultParams(@dps);
end;
// Extension API
@@ -655,23 +656,29 @@
Result:= (WfxExecuteFile(Parent, RemoteName, 'properties') = FS_EXEC_OK);
WFXStatusInfo(PathDelim, FS_STATUS_END, FS_STATUS_OP_EXEC);
except
- Result:= False;
- end;
+ on E: Exception do
+ begin
+ Result:= False;
+ DCDebug(ClassName + '.VFSConfigure(). Error: ' + E.Message);
+ end;
+ end;
end;
function TWFXModule.VFSRootName: UTF8String;
var
pcRootName : PAnsiChar;
begin
- Result:= EmptyStr;
if Assigned(FsGetDefRootName) then
+ begin
+ pcRootName:= GetMem(MAX_PATH);
+ Assert(Assigned(pcRootName));
try
- pcRootName:= GetMem(MAX_PATH);
FsGetDefRootName(pcRootName, MAX_PATH);
Result := StrPas(pcRootName);
finally
FreeMem(pcRootName);
end;
+ end;
end;
function TWFXModule.IsLoaded: Boolean;
@@ -718,19 +725,20 @@
var
I: Integer;
sCurrPlugin: String;
+ LEnabled: Boolean;
begin
Ini.ReadSectionRaw('FileSystemPlugins', Self);
for I:= 0 to Count - 1 do
- if Pos('#', Name[I]) = 0 then
- begin
- Enabled[I]:= True;
- end
- else
- begin
- sCurrPlugin:= Name[I];
- Name[I]:= Copy(sCurrPlugin, 2, Length(sCurrPlugin) - 1);
- Enabled[I]:= False;
- end;
+ begin
+ sCurrPlugin := Name[I];
+ if (sCurrPlugin = '') then
+ Continue;
+
+ LEnabled := (sCurrPlugin[1] <> '#');
+ Enabled[I]:= LEnabled;
+ if not LEnabled then
+ Name[I]:= Copy(sCurrPlugin, 2, MaxInt);
+ end;
end;
procedure TWFXModuleList.Load(AConfig: TXmlConfig; ANode: TXmlNode);
@@ -765,19 +773,18 @@
procedure TWFXModuleList.Save(Ini: TIniFileEx);
var
I: Integer;
+ LName: String;
begin
Ini.EraseSection('FileSystemPlugins');
for I := 0 to Count - 1 do
- begin
- if Enabled[I] then
- begin
- Ini.WriteString('FileSystemPlugins', Name[I], FileName[I])
- end
- else
- begin
- Ini.WriteString('FileSystemPlugins', '#' + Name[I], FileName[I]);
- end;
- end;
+ begin
+ if Enabled[I] then
+ LName := Name[I]
+ else
+ LName := '#' + Name[I];
+
+ Ini.WriteString('FileSystemPlugins', LName, FileName[I]);
+ end;
end;
procedure TWFXModuleList.Save(AConfig: TXmlConfig; ANode: TXmlNode);
@@ -803,15 +810,10 @@
function TWFXModuleList.FindFirstEnabledByName(Name: String): Integer;
begin
- Result:=0;
- while Result < Count do
- begin
+ for Result := 0 to Count - 1 do
if Enabled[Result] and (DoCompareText(Names[Result], Name) = 0) then
- Exit
- else
- Result := Result + 1;
- end;
- if Result=Count then Result:=-1;
+ Exit;
+ Result := -1;
end;
end.