Page 1 of 1

sfProgramFiles or sfProgramFilesX86 returns always same

PostPosted: Sun Feb 26, 2012 6:11 pm
by kgulol
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)

Re: sfProgramFiles or sfProgramFilesX86 returns always same

PostPosted: Sun Feb 26, 2012 6:29 pm
by kgulol
'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion', ProgramFilesDir
returns correct directory for x64 programs installed
may you integrate this into madshell ?

Re: sfProgramFiles or sfProgramFilesX86 returns always same

PostPosted: Mon Feb 27, 2012 9:22 am
by madshi
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.