| View previous topic :: View next topic |
| Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Mon Jun 25, 2007 4:58 pm Post subject: Getting all info from a shortcut (.lnk) |
|
|
Is there a way with API to get all the info from a shortcut? I know @file() can get the path from a shortcut, but I would like to get everything. Like any parameters, start in folder etc.
Thanks _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Tue Jun 26, 2007 4:34 am Post subject: |
|
|
I've found that the easiest way is to read the file with @iniread() as *.lnk files are just ini files (as are *.url internet shortcuts).
You can't open them with say notepad to have a look as notepad opens the file that the link points to. But you can load the file into VDS list and use @text() to have a look at it.
EDIT All of my statement above is wrong. _________________ cheers
Dave
Last edited by DaveR on Sun Apr 21, 2019 5:33 am; edited 1 time in total |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Jun 26, 2007 8:52 am Post subject: |
|
|
I never knew that! It's incredible, when you look at the complicated COM code Microsoft says you have to use to get information from .lnk files ... _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Jun 26, 2007 1:07 pm Post subject: |
|
|
| Dave wrote: | I've found that the easiest way is to read the file with @iniread() as *.lnk files are just ini files (as are *.url internet shortcuts).
You can't open them with say notepad to have a look as notepad opens the file that the link points to. But you can load the file into VDS list and use @text() to have a look at it. |
Hmmm I don't think this will work??? When I look at them with a hex editor there are lots of binary bytes in *.lnk files. Also I don't see any section names in a LNK file. Not to mention I have read the LNK file specification at wosit.com and it is definately not a INI file type. Why @iniread() works on your pc Dave I have no idea. Can you send an example of this??? I know you can create a *.lnk file just by renaming a *.url file to *.lnk and this will work but right out of the box *.lnk files are binary.
Below is the hex dump for a LNK on my PC.
| Code: |
4C 00 00 00 01 14 02 00 00 00 00 00 C0 00 00 00
00 00 00 46 9F 00 00 00 20 00 00 00 80 29 8B B2
06 5D C7 01 88 D8 BA B2 06 5D C7 01 00 26 FD FE
06 C8 C6 01 30 0C 32 00 00 00 00 00 01 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 35 01 14 00
1F 50 E0 4F D0 20 EA 3A 69 10 A2 D8 08 00 2B 30
30 9D 19 00 2F 43 3A 5C 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 4A 00 31 00 00
00 00 00 62 36 32 A1 11 00 50 52 4F 47 52 41 7E
31 00 00 32 00 03 00 04 00 EF BE CE 30 3A 4B 62
36 3C A1 14 00 00 00 50 00 72 00 6F 00 67 00 72
00 61 00 6D 00 20 00 46 00 69 00 6C 00 65 00 73
00 00 00 18 00 40 00 31 00 00 00 00 00 62 36 37
A1 10 00 47 49 4D 50 2D 32 2E 30 00 00 28 00 03
00 04 00 EF BE 62 36 32 A1 62 36 3C A1 14 00 00
00 47 00 49 00 4D 00 50 00 2D 00 32 00 2E 00 30
00 00 00 18 00 30 00 31 00 00 00 00 00 62 36 33
A1 10 00 62 69 6E 00 1E 00 03 00 04 00 EF BE 62
36 32 A1 62 36 33 A1 14 00 00 00 62 00 69 00 6E
00 00 00 12 00 4C 00 32 00 30 0C 32 00 19 35 4A
2B 20 00 47 49 4D 50 2D 32 7E 31 2E 45 58 45 00
00 30 00 03 00 04 00 EF BE 62 36 32 A1 62 36 32
A1 14 00 00 00 67 00 69 00 6D 00 70 00 2D 00 32
00 2E 00 32 00 2E 00 65 00 78 00 65 00 00 00 1C
00 00 00 59 00 00 00 1C 00 00 00 01 00 00 00 1C
00 00 00 2D 00 00 00 00 00 00 00 58 00 00 00 11
00 00 00 03 00 00 00 81 AA DC 00 10 00 00 00 00
43 3A 5C 50 72 6F 67 72 61 6D 20 46 69 6C 65 73
5C 47 49 4D 50 2D 32 2E 30 5C 62 69 6E 5C 67 69
6D 70 2D 32 2E 32 2E 65 78 65 00 00 0B 00 47 00
49 00 4D 00 50 00 20 00 32 00 2E 00 32 00 2E 00
31 00 33 00 30 00 2E 00 2E 00 5C 00 2E 00 2E 00
5C 00 2E 00 2E 00 5C 00 50 00 72 00 6F 00 67 00
72 00 61 00 6D 00 20 00 46 00 69 00 6C 00 65 00
73 00 5C 00 47 00 49 00 4D 00 50 00 2D 00 32 00
2E 00 30 00 5C 00 62 00 69 00 6E 00 5C 00 67 00
69 00 6D 00 70 00 2D 00 32 00 2E 00 32 00 2E 00
65 00 78 00 65 00 1B 00 44 00 3A 00 5C 00 4D 00
79 00 20 00 44 00 6F 00 63 00 75 00 6D 00 65 00
6E 00 74 00 73 00 5C 00 4D 00 79 00 20 00 50 00
69 00 63 00 74 00 75 00 72 00 65 00 73 00 10 00
00 00 05 00 00 A0 26 00 00 00 77 00 00 00 60 00
00 00 03 00 00 A0 58 00 00 00 00 00 00 00 65 30
30 38 34 36 31 37 2D 32 00 00 00 00 00 00 B6 5D
43 26 18 EC 60 4F 8D F9 0E 83 7B 5A 83 2A 7B BE
B6 7F F9 C8 DB 11 BF 88 00 02 72 CD B9 63 B6 5D
43 26 18 EC 60 4F 8D F9 0E 83 7B 5A 83 2A 7B BE
B6 7F F9 C8 DB 11 BF 88 00 02 72 CD B9 63 00 00
00 00
|
Below is the text representation of the same file
| Code: |
LF )]غ]&025PO :i+00/C:\J1b62PROGRA~120:Kb6<Program Files@1b67GIMP-2.0(b62b6<GIMP-2.001b63binb62b63binL2025J+ GIMP-2~1.EXE0b62b62gimp-2.2.exeY-XC:\Program Files\GIMP-2.0\bin\gimp-2.2.exeGIMP 2.2.130..\..\..\Program Files\GIMP-2.0\bin\gimp-2.2.exeD:\My Documents\My Pictures&w`Xe0084617-2]C&`O{Z*{rc]C&`O{Z*{rc
|
LiquidCode,
I do have a DLL that can read and write ShellLink's as documented by Microsoft if you are interested. I have to clean it up a little but it does work. Also if I remember it also will handle *.PIF files as well. Dave is correct that *.url files are just INI files however there are a couple of different formats for those types of links. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Jun 26, 2007 1:11 pm Post subject: |
|
|
LiquidCode,
It is just 2 functions maybe I will add them to my GadgetX.dll so you don't have to lug around multiple DLL's? _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Tue Jun 26, 2007 2:36 pm Post subject: |
|
|
Sorry for the partial misinformation . After I posted that I had to leave to go to work... & then I remembered that while *.url files use the ini format, *.lnk files are binary.
On a similar topic *scf files use ini format. And the *.msc Common Console Documents use xml format, as do manifest files. _________________ cheers
Dave |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Jun 26, 2007 6:20 pm Post subject: |
|
|
Thanks for all the info. dragonsphere, I want to keep this program to one exe and as small as I can. If the dll for the shortcuts is small, I would rather have that then along in the GadgetX. I will only be using the shortcut functions.
Thanks! _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Jun 26, 2007 6:37 pm Post subject: |
|
|
LiquidCode,
I have already added this ability to GadgetX. GadgetX is only 122kb? I can still make you a VDS DLL just for this if you like? _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Jun 26, 2007 7:14 pm Post subject: |
|
|
I wouldn't mind if it's not too much trouble. If it is a pain, I'll just use GadgetX. _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Jun 26, 2007 7:58 pm Post subject: |
|
|
Chris,
I have already got a seperate VDS dll working for you. It will probably be around 20kb in size when finished. I am building some demos and will start working on the documentation. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Jun 26, 2007 9:32 pm Post subject: |
|
|
On more thing. Is there a way to change information in a .lnk w/o recreating it? Like file location and parameters? _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jun 27, 2007 2:09 pm Post subject: |
|
|
I already thought of that With my DLL you will be able to update individual parts of the Link without the need to completly recreate the link. You will also be able to clear out individual parts of the Link without affecting other parts. For example if your link has Arguments and you want to remove those arguments you will be able to without the need to recreate the link.
Sorry it is taking a little longer than expected but I wanted you to be able to set Hotkeys using the same syntax as the HOTKEY command in VDS instead of trying to figure out the hotkey from it's numeric value. I have hotkeys completed now. Also you will be able to change the show command using words instead of numeric values.
The only thing you will not be able to do at this time is set links to Non-File objects. The reason is because you would need to get the Non-File objects PIDL list which is not possible with VDS unless you use GadgetX. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Wed Jun 27, 2007 3:13 pm Post subject: |
|
|
Cool Thanks! I'm not sure what you mean by non-file object? _________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jun 27, 2007 3:41 pm Post subject: |
|
|
Hmmm how can I explain Non-FileSystem Objects? I guess the easiest to understand would be objects that resolve back to a registry entry. Like the reason why there is a difference when you tell the Desktop to show the Internet Explorer Icon and when you copy a shortcut to Internet Explorer. You can see the difference by right clicking your desktop and choose properties from the context menu. When the properties dialog opens choose the Desktop tab. If you are on Windows XP click the Customize Desktop button. A desktop Items dialog should show up. In the Desktop Icons group box check the Internet Explorer check box. You should now see and Icon for Internet Explorer on your desktop. If you right click that icon and choose properties from the context menu you will see your Internet Properties and not the shortcut properties. If you just create a shortcut to Internet Explorer you will see the shortcut properties. This is also true for the My Documents, My Computer, My Network Places, and Recycle Bin icons. Eventually they all resolve back to the file system but the icons do not go directly to the file system. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
|