mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Save last error
This commit is contained in:
parent
0d6d4d4e94
commit
4b6bfe3345
1 changed files with 7 additions and 4 deletions
|
|
@ -1801,16 +1801,19 @@ end;
|
|||
function mbLoadLibrary(const Name: String): TLibHandle;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
dwErrCode: DWORD;
|
||||
sRememberPath: String;
|
||||
begin
|
||||
try
|
||||
//Some plugins using DLL(s) in their directory are loaded correctly only if "CurrentDir" is poining their location.
|
||||
//Also, TC switch "CurrentDir" to their directory when loading them. So let's do the same.
|
||||
sRememberPath:=GetCurrentDir;
|
||||
SetCurrentDir(ExcludeTrailingPathDelimiter(ExtractFilePath(Name)));
|
||||
// Some plugins using DLL(s) in their directory are loaded correctly only if "CurrentDir" is poining their location.
|
||||
// Also, TC switch "CurrentDir" to their directory when loading them. So let's do the same.
|
||||
sRememberPath:= GetCurrentDir;
|
||||
SetCurrentDir(ExtractFileDir(Name));
|
||||
Result:= LoadLibraryW(PWideChar(CeUtf8ToUtf16(Name)));
|
||||
dwErrCode:= GetLastError;
|
||||
finally
|
||||
SetCurrentDir(sRememberPath);
|
||||
SetLastError(dwErrCode);
|
||||
end;
|
||||
end;
|
||||
{$ELSE}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue