|
@@ -1801,16 +1801,19 @@ end;
|
|
function mbLoadLibrary(const Name: String): TLibHandle;
|
|
function mbLoadLibrary(const Name: String): TLibHandle;
|
|
{$IFDEF MSWINDOWS}
|
|
{$IFDEF MSWINDOWS}
|
|
var
|
|
var
|
|
|
|
+ dwErrCode: DWORD;
|
|
sRememberPath: String;
|
|
sRememberPath: String;
|
|
begin
|
|
begin
|
|
try
|
|
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)));
|
|
Result:= LoadLibraryW(PWideChar(CeUtf8ToUtf16(Name)));
|
|
|
|
+ dwErrCode:= GetLastError;
|
|
finally
|
|
finally
|
|
SetCurrentDir(sRememberPath);
|
|
SetCurrentDir(sRememberPath);
|
|
|
|
+ SetLastError(dwErrCode);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
{$ELSE}
|
|
{$ELSE}
|