mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 17:19:19 +02:00
* updated GetWindowsSpecialDir():string so it uses the -A or -W api call
depending on whether the RTL is compiled in Unicode mode to avoid conversions git-svn-id: branches/cpstrrtl@25310 -
This commit is contained in:
parent
63e8d0c31c
commit
40ff1c77ca
@ -59,8 +59,7 @@ uses
|
|||||||
sysutils;
|
sysutils;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
PFNSHGetFolderPath = Function(Ahwnd: HWND; Csidl: Integer; Token: THandle; Flags: DWord; Path: PChar): HRESULT; stdcall;
|
PFNSHGetFolderPath = Function(Ahwnd: HWND; Csidl: Integer; Token: THandle; Flags: DWord; Path: {$ifdef FPC_UNICODE_RTL}PWideChar{$ELSE}PChar{$ENDIF}): HRESULT; stdcall;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
SHGetFolderPath : PFNSHGetFolderPath = Nil;
|
SHGetFolderPath : PFNSHGetFolderPath = Nil;
|
||||||
@ -69,7 +68,7 @@ var
|
|||||||
Procedure InitDLL;
|
Procedure InitDLL;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
pathBuf: array[0..MAX_PATH-1] of char;
|
pathBuf: array[0..MAX_PATH-1] of {$ifdef FPC_UNICODE_RTL}WideChar{$else}Ansichar{$endif};
|
||||||
pathLength: Integer;
|
pathLength: Integer;
|
||||||
begin
|
begin
|
||||||
{ Load shfolder.dll using a full path, in order to prevent spoofing (Mantis #18185)
|
{ Load shfolder.dll using a full path, in order to prevent spoofing (Mantis #18185)
|
||||||
@ -83,7 +82,7 @@ begin
|
|||||||
|
|
||||||
if (CFGDLLHandle<>0) then
|
if (CFGDLLHandle<>0) then
|
||||||
begin
|
begin
|
||||||
Pointer(ShGetFolderPath):=GetProcAddress(CFGDLLHandle,'SHGetFolderPathA');
|
Pointer(ShGetFolderPath):=GetProcAddress(CFGDLLHandle,{$ifdef FPC_UNICODE_RTL}'SHGetFolderPathW'{$else}'SHGetFolderPathA'{$endif});
|
||||||
If @ShGetFolderPath=nil then
|
If @ShGetFolderPath=nil then
|
||||||
begin
|
begin
|
||||||
FreeLibrary(CFGDLLHandle);
|
FreeLibrary(CFGDLLHandle);
|
||||||
|
Loading…
Reference in New Issue
Block a user