You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Linux下解压Windows预WIM/ESD安装介质中.dl_与.sy_文件的方法咨询

Linux下解压Windows预WIM/ESD安装介质中.dl_与.sy_文件的方法咨询

当然可以在Linux下搞定这些老Windows安装介质里的压缩文件!这类.dl_、.sy_后缀的文件用的是Windows早期的LZ77变种压缩算法,下面给你几个实用的方案:

方案一:用cabextract工具(最推荐)

cabextract本来是用来处理Windows CAB压缩包的,但它完美支持这种老LZ压缩格式,操作也简单:

  1. 先安装工具:
    • Debian/Ubuntu系:sudo apt install cabextract
    • RHEL/CentOS系:sudo dnf install cabextract
  2. 解压文件:
    • 直接解压到当前目录:cabextract shell32.dl_
    • 解压到指定目录:cabextract -d ./output_dir win32k.sy_

方案二:用7-Zip的Linux版本

如果你已经在用7-Zip处理各种压缩格式,它也能识别这类文件:

  1. 安装完整版本的7-Zip:
    • Debian/Ubuntu系:sudo apt install p7zip-full
  2. 执行解压命令:
    7z x shell32.dl_
    7-Zip会自动识别压缩格式,把文件解压到当前目录。

方案三:用Python脚本手动解压(适合自定义需求)

如果你有编程基础,也可以自己写个简单的脚本处理这种LZ压缩格式,下面是一个简化版的实现:

import sys

def expand_lz(input_path, output_path):
    with open(input_path, 'rb') as f_in, open(output_path, 'wb') as f_out:
        # 处理可能的文件头(部分.dl_文件开头有标识字节)
        header = f_in.read(2)
        if header != b'MZ':
            f_in.seek(0)
        
        while True:
            flag_byte = f_in.read(1)
            if not flag_byte:
                break
            flag = ord(flag_byte)
            
            for bit_pos in range(8):
                # 读取每个位对应的压缩标记
                if not f_in.read(1):
                    break
                if flag & (1 << (7 - bit_pos)):
                    # 处理压缩块:读取偏移和长度
                    offset_byte = f_in.read(1)
                    length_byte = f_in.read(1)
                    if not offset_byte or not length_byte:
                        break
                    
                    offset = ord(offset_byte) | ((ord(length_byte) & 0xF0) << 4)
                    length = (ord(length_byte) & 0x0F) + 3
                    
                    # 从输出文件的偏移位置读取数据并写入
                    current_pos = f_out.tell()
                    f_out.seek(current_pos - offset - 1)
                    repeat_data = f_out.read(length)
                    f_out.seek(current_pos)
                    f_out.write(repeat_data)
                else:
                    # 处理未压缩的字节
                    raw_byte = f_in.read(1)
                    if raw_byte:
                        f_out.write(raw_byte)

if __name__ == '__main__':
    if len(sys.argv) != 3:
        print(f"用法:{sys.argv[0]} <输入文件> <输出文件>")
        sys.exit(1)
    expand_lz(sys.argv[1], sys.argv[2])

使用方法:
python expand.py shell32.dl_ shell32.dll

注意:这个脚本是简化实现,可能无法处理所有特殊情况,如果遇到解压失败,优先用前两种工具方案。

备注:内容来源于stack exchange,提问作者0xC0000022L

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 08:59:30