Page 1 of 1

madshell.LoadShortCut returns wrong Path

Posted: Sun Feb 26, 2012 4:35 pm
by kgulol
ie :
try to load :

lnkFileName:='C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Oracle VM VirtualBox\Oracle VM VirtualBox.lnk';
ExeFileName:=madshell.LoadShortCut(lnkFileName).Path;


returns
"C:\Program Files (x86)\Oracle\VirtualBox\VirtualBox.exe"

but correct place is (right click to lnk file shows the correct path.)
"C:\Program Files\Oracle\VirtualBox\VirtualBox.exe"

how can I fix this bug on library?
or may you fix it for a newer version to publish ?

thank you so much again for this great library.
(OS:Win7 x64)

Re: madshell.LoadShortCut returns wrong Path

Posted: Sun Feb 26, 2012 5:28 pm
by kgulol
interestingly
JvJVCLUtils.TargetFileName (from jedi)
also returns:
Program Files (x86)\....
instead of
Program Files\...

but shortcut targets me on "Program Files\..." directory.(install Virtualbox for x64.Check lnk file via right click properties. and ofsure nothing installed on x86 PRogram Files)

is Delphi problemmatic or its a windows API problem ?
what do you think ?

Re: madshell.LoadShortCut returns wrong Path

Posted: Mon Feb 27, 2012 9:14 am
by madshi
In madShell.pas in the function TIShortCut.GetPath please try adding the flag "SLGP_RAWPATH" to the last parameters of the "FShellLink.GetPath(...)" call. What do you get then? I suspect that the shortcut uses "%ProgramFiles%". If it does that, IShellLink.GetPath() will return different paths, depending on whether it's being called from a 32bit or 64bit application. The Explorer could be wrong just as much as madShell.