full .lnk support

Devin Teske devinteske@hotmail.com
Sat Jan 21 07:10:00 GMT 2006

Hey there,

first time poster, but I'm not a member of the list, so please reply 

After 8 long months, I have fully reverse-engineered the Windows `.lnk' 
(shortcut) file format and have a core function set for creating/resolving 
them. I know that cygwin ALREADY understands Windows shortcuts, but not only 
barely. Cygwin does not resolve shortcuts created by windows.

It is worth noting that there are multiple versions of the shortcut file 
format (binary fields were added in Windows NT/2000/XP that differ from Win 
9x). Also, when cygwin creates a shortcut, it does not have the icon of the 
source file when viewed in explorer (not going to explain why exactly, I'll 
keep it short for now) because cygwin (to be blunt) creates crappy shortcut 

I can personally attest to the most difficult task it was to decipher the 
binary format of this file (it's not documented anywhere, because Microsoft 
does not want you to create them manually but use the Shell32 API). However, 
I'm able to create them and they have support for all the enhanced features 
of the new format (Win XP) as well as the original version (Win 9x/NT/2000). 
Windows doesn't know any better that they were created manually (as binary 
data). However, cygwin craps out reading them, because it can't read 
anything but the stunted format (cygwin uses a constant string literal for 
the header which doesn't match the real deal).

I know that if you simply just wanted full/native shortcut support, you'd 
just use the Win32 API to create/manage them, however one of the advantages 
of doing it the way I did, means that I can create them without the Win32 
API (ie. on Mac OS X, UNIX, Linux, etc.). Which also means that you could 
say... build this into samba to understand shortcuts that clients running 
windows create on the share.

Well, the whole point of me writing this is to assess the value of something 
like this and whether it is something that is wanted. I think that it might 
be a nice addition (as I've been a long time cygwin user, and am hesitant to 
switch to SFU or anything else). Would like to know that if I contribute 
this, that it is something that will be gladly welcomed since it took such a 
long time to reverse engineer that god-forsaken format.


More information about the Cygwin-patches mailing list