mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: mbLoadLibraryEx function
This commit is contained in:
parent
9a5583c989
commit
c8e99df6c3
1 changed files with 10 additions and 2 deletions
|
|
@ -1897,19 +1897,27 @@ function mbLoadLibraryEx(const Name: String): TLibHandle;
|
|||
const
|
||||
PATH_ENV = 'PATH';
|
||||
var
|
||||
dwFlags:DWORD;
|
||||
APath: String;
|
||||
APathType: TPathType;
|
||||
usName: UnicodeString;
|
||||
begin
|
||||
usName:= CeUtf8ToUtf16(Name);
|
||||
APathType:= GetPathType(Name);
|
||||
|
||||
if CheckWin32Version(10) or (GetProcAddress(GetModuleHandleW(Kernel32), 'AddDllDirectory') <> nil) then
|
||||
begin
|
||||
Result:= LoadLibraryExW(PWideChar(usName), 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR or LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
|
||||
if APathType <> ptAbsolute then
|
||||
dwFlags:= 0
|
||||
else begin
|
||||
dwFlags:= LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR;
|
||||
end;
|
||||
Result:= LoadLibraryExW(PWideChar(usName), 0, dwFlags or LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
|
||||
end
|
||||
else begin
|
||||
APath:= mbGetEnvironmentVariable(PATH_ENV);
|
||||
try
|
||||
if GetPathType(Name) <> ptAbsolute then
|
||||
if APathType <> ptAbsolute then
|
||||
SetDllDirectoryW(PWideChar(''))
|
||||
else begin
|
||||
SetDllDirectoryW(PWideChar(ExtractFileDir(usName)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue