简体   繁体   English

Windows 快捷方式的内部结构是什么?

[英]What is the internal structure of a Windows shortcut?

3 HDD in one computer: 2 with Windows XP, 1 with Windows 7, sequentially load the operating system from each of them.一台计算机中的 3 个硬盘驱动器:2 个使用 Windows XP,1 个使用 Windows 7,依次从每个加载操作系统。

I discover that some working shortcuts (not all) which created in first XP don't work in second XP and Windows 7 (not available for viewing the object for the shortcut).我发现在第一个 XP 中创建的一些工作快捷方式(不是全部)在第二个 XP 和 Windows 7 中不起作用(不可用于查看快捷方式的对象)。

To understand why it's don't work I create the same shortcut in windows 7 and open both files of these shorcuts in hex editor.要了解为什么它不起作用,我在 Windows 7 中创建了相同的快捷方式,并在十六进制编辑器中打开了这些快捷方式的两个文件。

I discover that it's structures is diffrent but I do not know how to compare it.我发现它的结构不同,但我不知道如何比较它。

What is the internal structure of a Windows shortcut? Windows 快捷方式的内部结构是什么?

What start and end bytes of some usefull blocks of shortcut's content?一些有用的快捷方式内容块的开始和结束字节是什么?

Shortcut ( .lnk ) file format information can be found at [MS.Docs]: [MS-SHLLINK]: Shell Link (.LNK) Binary File Format .快捷方式 ( .lnk ) 文件格式信息可在[MS.Docs]: [MS-SHLLINK]: Shell Link (.LNK) Binary File Format 中找到

However, to spare you from reading that whole .pdf , one thing that is stored within a shortcut for sure (can be checked by "looking" at the shortcut using a hex viewer) is the (full) target path that it references ( !!!important!!! at creation time): so it's " DriveLetter: \\the_full_path" .但是,为了让您免于阅读整个.pdf ,肯定存储在快捷方式中的一件事(可以通过使用十六进制查看器“查看”快捷方式来检查)是它引用的(完整)目标路径( ! !!important!!!在创建时):所以它是" DriveLetter: \\the_full_path"

To clear up confusion, I'd suggest playing with shortcuts that have targets on the same drive.为了消除混淆,我建议使用在同一驱动器上具有目标的快捷方式。

When switching HDD s, the DriveLetter s (aka "C:" ) point to different things:当切换HDD 时DriveLetter (又名“C:” )指向不同的东西:

  • Let's say that you created on one of them a shortcut: "C:\\shortcut.lnk" ( "C:" is the DriveLetter assigned to the HDD where Win booted from): let's call this HDD1 .假设您在其中一个上创建了一个快捷方式: “C:\\shortcut.lnk”“C:”是分配给Win从中启动的HDDDriveLetter ):我们称之为HDD1
    The shortcut points to target file located on another HDD (and partition): let's call this HDD2 (eg "E:\\target.txt )快捷方式指向位于另一个HDD (和分区)上的目标文件:我们称之为HDD2 (例如“E:\\target.txt
  • When you'll switch HDD s (making HDD2 primary boot disk) the DriveLetter s will change too, so now:当您切换HDD (制作HDD2主启动盘)时, DriveLetter也会改变,所以现在:

    • HDD2 will be "C:" HDD2将是“C:”
    • HDD1 will be "D:" HDD1将是“D:”


    Things complicate even more when introducing HDD3 and so on.在引入HDD3等时,事情变得更加复杂。

As an answer to our question: the .lnk files don't work because their target is no longer present.作为我们问题的答案: .lnk文件不起作用,因为它们的目标不再存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM