madshell.LoadShortCut returns wrong Path

delphi package - easy access to shell apis

madshell.LoadShortCut returns wrong Path

Postby kgulol » Sun Feb 26, 2012 4:35 pm

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)
kgulol
 
Posts: 9
Joined: Sat Jan 07, 2012 5:42 pm

Re: madshell.LoadShortCut returns wrong Path

Postby kgulol » Sun Feb 26, 2012 5:28 pm

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 ?
kgulol
 
Posts: 9
Joined: Sat Jan 07, 2012 5:42 pm

Re: madshell.LoadShortCut returns wrong Path

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

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.
madshi
Site Admin
 
Posts: 9431
Joined: Sun Mar 21, 2004 5:25 pm


Return to madShell

Who is online

Users browsing this forum: No registered users and 1 guest

cron