shell shorcuts

Martin Fuchs martin-fuchs at gmx.net
Sat Jan 10 08:24:13 CST 2004


> Hmm..., I KNOW 'SCF_UNICODE' is NOT 0x1000 in the first place, but why do
>  you say it's 0x80 ?
> 
> Going by the copyrights, Marcus Meissner and Juergen Schmied did the initial
> job, and perhaps one of them put this value.
> I don't know about Juergen, but I have tremendous faith in Marcus (I use
> SuSE you see ;) ), and there MUST have been some reason why 'SCF_UNICODE'
> got the value 0x1000, although it seems to be wrong !

I looked into the CVS history logs and found, when SCF_UNC (rev. 1.21)
and SCF_UNICODE (rev. 1.54) have been introduced:

----------------------------
revision 1.21
date: 1999/08/15 14:31:36;  author: julliard;  state: Exp;  lines: +23 -15
Juergen Schmied <juergen.schmied at metronet.de>
More use of rc files for strings and menus, fixes. First internal
icons.
----------------------------
revision 1.54
date: 2003/05/21 18:50:53;  author: julliard;  state: Exp;  lines: +701 -846
Mike McCormack <mike at codeweavers.com>
Remove code that starts wineshelllink, instead create a windows
compatible shortcut (*.lnk) file. After creating that file, start a
link processor (winemenubuilder) on it, which reads it back then calls
wineshelllink.
Rework CreateStreamFromFile to create an IStream object that is
writeable.
----------------------------

Perhaps we should ask Juergen Schmied and Mike McCormack where they
got their defintions from. But I think SCF_UNC = 0x80 is the right one.


> Hence, please consolidate your assigning it 0x80 with some examples/hexedits
> so that I can answer when I get grilled ;)

OK, you want to see some hex dumps.
Here ist one for notepad.exe on WIN95:      (sorry for the likely unreadable formating)

00000000:  4C 00 00 00-01 14 02 00-00 00 00 00-C0 00 00 00  L   ?¶?     ?
00000010:  00 00 00 46-0B 00 00 00-20 00 00 00-00 92 6A 89     F?        Æjë
00000020:  12 9B BB 01-00 58 E5 4E-04 D7 C3 01-00 92 6A 89  ?ø?? XÕN?Î?? Æjë
00000030:  12 9B BB 01-00 8A 00 00-00 00 00 00-01 00 00 00  ?ø?? è      ?
00000040:  00 00 00 00-00 00 00 00-00 00 00 00-5F 00 14 00              _ ¶
00000050:  1F 00 E0 4F-D0 20 EA 3A-69 10 A2 D8-08 00 2B 30  ? ÓOð Û:i?óÏ? +0
00000060:  30 9D 19 00-23 43 3A 5C-00 00 00 00-00 00 00 00  0Ø? #C:\
00000070:  00 00 00 00-00 00 00 00-00 F1 8A 15-00 31 00 00           ±è§ 1
00000080:  00 00 00 2A-30 9D 64 10-80 57 69 6E-39 35 00 00     *0Ød?ÇWin95
00000090:  1B 00 32 00-00 8A 00 00-25 21 60 59-20 80 4E 6F  ? 2  è  %!`Y ÇNo
000000A0:  74 65 70 61-64 2E 65 78-65 00 00 00-00 48 00 00  tepad.exe    H
000000B0:  00 1C 00 00-00 01 00 00-00 1C 00 00-00 32 00 00   ?   ?   ?   2
000000C0:  00 00 00 00-31 47 00 00-00 16 00 00-00 03 00 00      1G   ?   ?
000000D0:  00 04 13 5F-37 10 00 00-00 57 49 4E-39 35 00 43   ??_7?   WIN95 C
000000E0:  3A 5C 57 49-4E 39 35 5C-4E 4F 54 45-50 41 44 2E  :\WIN95\NOTEPAD.
000000F0:  45 58 45 00-00 0E 00 2E-2E 5C 4E 4F-54 45 50 41  EXE  ? ..\NOTEPA
00000100:  44 2E 45 58-45         -           -             D.EXE


Here is the dump of a XP shourtcut file:

00000000:  4C 00 00 00-01 14 02 00-00 00 00 00-C0 00 00 00  L   ?¶?     ?
00000010:  00 00 00 46-9B 02 00 00-80 00 00 00-A0 A6 B2 00     Fø?  Ç   áª?
00000020:  9B C8 C3 01-76 98 AB AD-7D D7 C3 01-00 C8 2F B0  ø???vÿ½¡}Î?? ?/?
00000030:  E5 27 C1 01-00 02 01 00-00 00 00 00-01 00 00 00  Õ'?? ??     ?
00000040:  00 00 00 00-00 00 00 00-00 00 00 00-F3 00 14 00              ¾ ¶
00000050:  1F 50 E0 4F-D0 20 EA 3A-69 10 A2 D8-08 00 2B 30  ?PÓOð Û:i?óÏ? +0
00000060:  30 9D 19 00-2F 45 3A 5C-00 00 00 00-00 00 00 00  0Ø? /E:\
00000070:  00 00 00 00-00 00 00 00-00 00 00 3C-00 31 00 00             < 1
00000080:  00 00 00 21-30 DC 73 10-00 57 49 4E-44 4F 57 53     !0?s? WINDOWS
00000090:  00 26 00 03-00 04 00 EF-BE 3C 2D 98-18 2A 30 11   & ? ? ´¥<-ÿ?*0?
000000A0:  6A 14 00 00-00 57 00 49-00 4E 00 44-00 4F 00 57  j¶   W I N D O W
000000B0:  00 53 00 00-00 16 00 40-00 31 00 00-00 00 00 25   S   ? @ 1     %
000000C0:  30 47 BE 10-00 73 79 73-74 65 6D 33-32 00 00 28  0G¥? system32  (
000000D0:  00 03 00 04-00 EF BE 3C-2D 98 18 2A-30 11 6A 14   ? ? ´¥<-ÿ?*0?j¶
000000E0:  00 00 00 73-00 79 00 73-00 74 00 65-00 6D 00 33     s y s t e m 3
000000F0:  00 32 00 00-00 18 00 48-00 32 00 00-02 01 00 12   2   ? H 2  ?? ?
00000100:  2B 00 68 80-00 6E 6F 74-65 70 61 64-2E 65 78 65  + hÇ notepad.exe
00000110:  00 2E 00 03-00 04 00 EF-BE 96 2F 5C-76 2A 30 99   . ? ? ´¥û/\v*0Ö
00000120:  6B 14 00 00-00 6E 00 6F-00 74 00 65-00 70 00 61  k¶   n o t e p a
00000130:  00 64 00 2E-00 65 00 78-00 65 00 00-00 1A 00 00   d . e x e   ?
00000140:  00 54 00 00-00 1C 00 00-00 01 00 00-00 1C 00 00   T   ?   ?   ?
00000150:  00 33 00 00-00 00 00 00-00 53 00 00-00 17 00 00   3       S   ?
00000160:  00 03 00 00-00 04 5D C9-28 10 00 00-00 53 79 73   ?   ?]?(?   Sys
...   (snipped here)


Look at the dword from 0x0014 to 0x0017. It is 0xB ("0B 00 00 00") for WIN95 and
0x29B ("9B 02 00 00") for XP. Please don't ask me for the meanging of this 0x200 -
I just don't know it.

But believe me - this bit with value 0x80 has been zero in any WIN95 created .lnk file I saw.
And it has been set in all .lnk files of XP. As you know, WIN95 uses ANSI strings
and XP uses UTF16 strings. Bit "0x1000" was never set in any OS's shortcut files.

If you double-click a WIN95-link on XP it also works. You can even edit its properties.
When saving it using XP, it get overwritten with the new format. The bit in question is
now set! However Windows itself seems to ignore the bit when reading shortcut files.
It can successfully read them regardless of me having changed the bit before.
This is some kind of "file recovery" if you ask me.


> However, I think that we should ALL handle strings as Unicode internally,
> and convert to ANSI when required, and NOT the other way round.
> Hence, we will be compatible with Win98/ME/2K/XP, as that's what M$ does...
> If you see my code carefully, you will notice that EVERYTHING is handled as
> Unicode internally.

Of course. Shell link objects in memory should store the strings in Unicode format.

> The flag 'SCF_UNICODE' is used to test the bit mask and determine if the
> .lnk is serialized in Unicode or not...
> I am pretty sure that Windows >95 handle EVERYTHING in Unicode, and thus a
> wrong value of 'SCF_UNICODE' will ONLY mess up Win95 .lnk files !
> 
> If you can consolidate your defining 'SCF_UNICODE' as 0x80, I will ONLY be
> too happy to incorporate that, else those still using Win95 (?) may suffer,
> as Win95 handles strings as ANSI and not Unicode...


Regards,

   Martin




More information about the wine-devel mailing list