【转】 快捷方式lnk文件格式详解(英文)(中文)
为什么80%的码农都做不了架构师?>>>
【转】 快捷方式lnk文件格式详解(英文)(中文)
2009-11-07 10:55
转自:http://www.stdlib.com/art6-Shortcut-File-Format-lnk.html
You should consider using the
1. Header
Shortcut flags
Target flags
Last Access and Modified time offsets corrected thanks to JimmyW Shell Item Id List Note: This section exists only if the first bit for shortcut flags is set the header section. If that bit is not set then this section does not exists. The first File Location Info This section is always present, but if bit 1 is not set in the flags value, then the length of this section will be zero. The header of this section is described below.
Combine the base path string and the final path string to find the filename of the file on the local volume. To find the filename of the file on the network you need to combine the share name in the network volume table with the final path string. The local volume table
Type of volumes
The network volume table
Description This section is present if bit 2 is set in the flags value in the header. The first word value indicates the length of the string. Following the length value is a string of ASCII characters. It is a description of the item. Relative path string This section is present if bit 3 is set in the flags value in the header. The first word value indicates the length of the string. Following the length value is a string of ASCII characters. It is a relative path to the target. Working directory This section is present if bit 4 is set in the flags value in the header. The first word value indicates the length of the string. Following the length value is a string of ASCII characters. It is the working directory as specified in the shortcut properties. Command line arguments This section is present if bit 5 is set in the flags value in the header. The first word value indicates the length of the string. Following the length value is a string of ASCII characters. The command line string includes everything except the program name. Icon filename This section is present if bit 6 is set in the flags value in the header. The first word value indicates the length of the string. Following the length value is a string of ASCII characters. This the name of the file containing the icon. Additonal Info Usualy consists of a dword with the value 0. 大家知道通过IShellLink接口可以得到快捷方式的各种属性。具体怎么做,网上有很多文章,这里就不介绍了。现在主要是分析一下快捷方式文件的格 式,并且自己写一个解析程序。 一、文件的整体结构
二、文件头 文件头结构,参照下面表格:
① 偏移14h开始的标志标示有哪些可选属性,见下表:
② 偏移18h开始的目标文件属性:
例: 偏移 数据 解释 0000 4c 00 00 00 字符"L" 0004 01 14 02 00 快捷方式的GUID。值固定00 00 00 00C0 00 00 0000 00 00 46 0014 8F 00 00 00 flags。对照表可知有shell item id list目标是文件存在描述字符串存在相对路径 0018 20 00 00 00 文件属性,具体内容可以查上面的属性说明表 001C 40 51 0A 0C 文件创建时间AD CB C4 01 0024 C4 D8 A5 91 文件修改时间AD CB C4 01 002C 00 33 16 74 文件最后一次访问时间F6 C7 C3 01 0034 00 20 01 00 文件长度 0038 00 00 00 00 自定义图标个数 003C 01 00 00 00 打开时窗口为normal状态 0040 00 00 00 00 热键 0044 00 00 00 00 暂时还不清楚用途值常为000 00 00 00 三、Shell item ID list段 typedef struct _SHITEMID { USHORT cb; BYTE abID[0]; } SHITEMID, * LPSHITEMID; cb保存SHITEMID结构的大小。abID是可变长度的对象标识。具体都是什么含义没看明白,可以参阅MSDN。因为item ID list段的开始为这个段的总长度,所以在读取的时候可以把此段跳过不做处理!!:) 例:(文件头段的flags标志显示存在shell item id list段) 偏移 数据 解释 004C 9c 00 item ID list总长度(下一段的起始地址为004E+009C=00EA) 004E 14 00 第一个item ID的长度 0050 1F 50 E0 4F 第一个item ID标示内容D0 20 EA 3A69 10 A2 D808 00 2B 3030 9D 0062 19 00 第二个item ID的长度 0064 23 43 3A 5C 第二个item ID标示内容00 00 00 0000 00 00 0000 00 00 0000 00 00 0000 F1 93 007B 25 00 007D 31 00 00 0000 00 70 3147 3B 31 0050 72 6F 6772 61 6D 2046 69 6C 6573 00 50 524F 47 52 417E 31 00 00A0 2C 00 00A2 31 00 00 0000 00 70 3147 3B 10 0057 69 6E 646F 77 73 204D 65 64 6961 20 50 6C61 79 65 7200 57 49 4E44 4F 57 7E32 00 00CC 1C 00 00CE 32 00 00 2001 00 95 2FA1 99 20 0077 6D 70 6C61 79 65 722E 65 78 6500 00 00E8 00 00 item ID list段结束 四、文件位置信息段
如果文件在本地卷,那么文件名为:本地路径信息+附加信息 紧 跟在段头后面的是本地卷信息表(段内偏移为1ch),结构如下:
然后是本地路径信息串段内偏移决定于10h的值。 再往后就是网络卷信息表段内偏移决定于14h的 值。结构如下:
最后是附加信息串段内偏移决定于18h的值 例: 偏移 数据 解释 段头 00EA 67 00 00 00 文件位置信息段总长度 00EE 1C 00 00 00 段头长度,固定为1ch 00F2 01 00 00 00 本地卷 00F6 1C 00 00 00 本地卷信息表的段内偏移 00FA 33 00 00 00 本地路径信息的偏移 00FE 00 00 00 00 网络卷信息表的偏移 0102 66 00 00 00 附加信息的偏移 本地卷信息表 0106 17 00 00 00 表长度 010A 03 00 00 00 Fixed (Hard disk) 010E AD C9 B2 F0 卷序列号 0112 10 00 00 00 固定为10h 0116 73 79 73 74 卷标"system"65 6D 00 本地路径信息串 011D 43 3A 5C 50 C:/Program Files/Windows Media Player/wmplayer.exe72 6F 67 7261 6D 20 4669 6C 65 735C 57 69 6E64 6F 77 7320 4D 65 6469 61 20 506C 61 79 6572 5C 77 6D70 6C 61 7965 72 2E 6578 65 00 网络卷信息表 因为段头里flags指示仅为本地卷,并且网络卷信息表的偏移值为零。所以不存在网络卷信息表。 0150 00 五、描述字符段 偏移 数据 解释 0151 20 00 描述字符长度 0153 AD 64 3E 6570 65 57 5B92 5A 53 4F0C FF 05 53EC 62 F3 9750 4E 01 30C6 89 91 9801 30 43 0044 00 20 008C 54 20 0049 00 6E 0074 00 65 0072 00 6E 0065 00 74 0020 00 35 75F0 53 02 30 转换成ANSI字符为"播放数字媒体,包括音乐、视频、CD 和 Internet 电台。 六、相对路径段 偏移 数据 解释 0193 38 00 相对路径字符长度 0195 2E 00 2E 005C 00 2E 002E 00 5C 002E 00 2E 005C 00 50 0072 00 6F 0067 00 72 0061 00 6D 0020 00 46 0069 00 6C 0065 00 73 005C 00 57 0069 00 6E 0064 00 6F 0077 00 73 0020 00 4D 0065 00 64 0069 00 61 0020 00 50 006C 00 61 0079 00 65 0072 00 5C 0077 00 6D 0070 00 6C 0061 00 79 0065 00 72 002E 00 65 0078 00 65 00 转换成ANSI字符为"../../../Program Files/Windows Media Player/wmplayer.exe" 七、工作目录段 同上。 例:因为文件头中○1flags的第四位没有置位,所以此段不存在 八、 命令行段 同上。 例:因为文件头中○1flags的第五位没有置位,所以此段不存在 九、图标文件段 同上。 例: 因为文件头中○1flags的第六位没有置位,所以此段不存在 十、 附加信息段 具体信息不清楚!!!!! 以上很多资料来自网上,并不是微软文档,所以难免有理解错误的地方,请包含。所附代码只是为了 跟踪显示,没有输出,嘿嘿,自己改改看吧!!:)有兴趣可以自己写一个类,分析快捷方式的所有信息。 |
转载于:https://my.oschina.net/u/1777508/blog/1786834
【转】 快捷方式lnk文件格式详解(英文)(中文)相关推荐
- 快捷方式lnk文件格式详解 中文版
转自 QQ吻's博客 http://hi.baidu.com/qhack8/blog/item/dcc6c047f015252bcffca3ab.html 大家知道通过IShellLink接口可以得到 ...
- 【转】快捷方式lnk文件格式详解(英文)
转自: http://www.stdlib.com/art6-Shortcut-File-Format-lnk.html You should consider using the IShellLin ...
- S19文件格式详解(总结)以及与hex文件的互转
S19文件格式详解 S-record格式文件是Freescale CodeWarrior编译器生成的后缀名为.S19的程序文件,是一段直接烧写进MCU的ASCII码,英文全称问Motoro ...
- python数据挖掘课程】二十一.朴素贝叶斯分类器详解及中文文本舆情分析
#2018-04-06 13:52:30 April Friday the 14 week, the 096 day SZ SSMR python数据挖掘课程]二十一.朴素贝叶斯分类器详解及中文文本舆 ...
- MP4文件格式详解——文件类型ftyp
原谅地址:http://blog.csdn.net/pirateleo/article/details/7583321 文件类型ftyp(ISO-14496-12) Author:Pirate Leo ...
- MP4文件格式详解——文件类型ftyp(转)
文件类型ftyp(ISO-14496-12) Author:Pirate Leo Email:codeevoship@gmail.com ISO 14496 - 12 定义了一种封装媒体数据的基础文件 ...
- 多媒体 MP4文件格式详解——文件类型ftyp
ISO 14496 - 12 定义了一种封装媒体数据的基础文件格式,mp4.3gp.ismv等我们常见媒体封装格式都是以这种基础文件格式为基础衍生的. 如果从全局角度了解基础文件格式,请看我之前的博文 ...
- MP4文件格式详解——结构概述
MP4文件格式详解(ISO-14496-12/14) 一.基本概念 1. 文件,由许多Box和FullBox组成. 2. Box,每个Box由Header和Data组成. 3. FullBox,是Bo ...
- S19文件格式详解(1)
1.记录结构 0 1 2 3 4 5 S Type Byte Count Address Data Checksum 一个SREC格式文件包含一系列ASCLL格式的的数据.具体如下: Record t ...
最新文章
- python 将列和索引的值变换_【编辑小组成长日记】Python学习第二期
- 5分钟搞懂如何使用探针检查Kubernetes健康
- python头文件math.h_将常量从.h文件导入到python中
- 【错误记录】SeeMusic 一直卡在主界面无法使用 ( 删除 C:\Users\用户名称\AppData\LocalLow\Visual Music Design 应用信息 )
- Linux系统编程之查看文件大小的方法(lseek_fseek_stat)
- 微信公众平台消息接口开发(2)
- @Autowired所有的东西!
- android 自定义进度条_第一百八十九回:Android中自定义ProgressBar三
- 老兵的十年职场之路(二)
- Python+OpenCV:尺度不变特征变换(SIFT)的加速健壮特性(SURF)
- 基于大数据的推荐算法综述
- 电池管理系统(BMS)
- Java jna 中控考勤机_中控考勤机开发 jacob 实现监听
- c语言课设ktv点歌系统1,C语言ktv点歌系统
- IBM Websphere MQ 基础3:Listener监听器
- 论黑客必知DOS命令技术大拳!
- 五笔打字怎么学,负基础
- EFM32 LG232系列单片机干货之LEUART
- 主语从句、宾语从句、表语从句、同位语从句
- Flutter ListView滚动到指定条目