sfProgramFiles or sfProgramFilesX86 returns always same

delphi package - easy access to shell apis

sfProgramFiles or sfProgramFilesX86 returns always same

Postby kgulol » Sun Feb 26, 2012 6:11 pm

trying to get Program Files Directory
always returns "C:\Program Files (86)\"
but I want somethhing like that
"C:\Program Files\"
because this operating system have both directories.

so I did a small function :

function GetSpecialFolder2(AFolder: TSpecialFolder): string;
var
_ret: AnsiString;
begin
_ret := '';
madshell.GetSpecialFolder(AFolder, _ret);
Result := _ret;
end;

GetSpecialFolder2(sfProgramFilesX86)
and
GetSpecialFolder2(sfProgramFiles)
always returns
"C:\Program Files (86)\"

what causes me to not to Retrieve Correct Program Files Directory ? ("C:\Program Files\")
how can I fix this problem ?

thank you.

(Operating System is Windows Seven x64)
kgulol
 
Posts: 9
Joined: Sat Jan 07, 2012 5:42 pm

Re: sfProgramFiles or sfProgramFilesX86 returns always same

Postby kgulol » Sun Feb 26, 2012 6:29 pm

'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion', ProgramFilesDir
returns correct directory for x64 programs installed
may you integrate this into madshell ?
kgulol
 
Posts: 9
Joined: Sat Jan 07, 2012 5:42 pm

Re: sfProgramFiles or sfProgramFilesX86 returns always same

Postby madshi » Mon Feb 27, 2012 9:22 am

It seems there's a new API for this kind of stuff. See here:

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Supporting this would probably require me to rewrite the whole "special folder" stuff in madShell. I'd like to do that, but I don't really have the time at the moment.

FWIW, sfProgramFiles is officially supposed to return "C:\Program Files (x86)". And "sfProgramFilesX86" is officially supposed to work only for RISC systems.
madshi
Site Admin
 
Posts: 9337
Joined: Sun Mar 21, 2004 5:25 pm


Return to madShell

Who is online

Users browsing this forum: No registered users and 1 guest