众所周知,微软自带系统封装工具SYSPREP,可以方便快捷地进行企业产品部署,但是在WINDOWS LONGHORN之前,运用SYSPREP有一个限制,就是仅适用于用于封装的源计算机和目标计算机必须具有相同硬件抽象层 (HAL),因此,不同的网友均提出了不用的HAL检测解决方案,如ACPI封包、死性不改的电源模式等等,这些解决方案不同程度存在几个缺点:
1、检测的兼容性无法达到100%;
2、检测需要额外的文件,并且可能需要重新启动计算机,耗费了时间;
有没有一个最完美的解决方案呢?答案其实就在微软未公开的技术。
笔者通过对于WINDOWS LONGHORN各内测版本进行分析,现在公开微软部分未公开的技术:
1、微软自WINDOWS LONGHORN后,改写了NTLDR的部分代码,提供了/detecthal 接口
2、BOOT.INI支持/detecthal参数,以实现与NTLDR的结合,并实现开机启动即自动检测HAL
3、/INF/dtecthal.inf是一个关键性文件,提供各种HAL类型检测的参数说明
以下为进行SYSPREP封装后的自动完美检测HAL具体实现方案:
1、从系统中提取相应的HAL文件包:(WIN2000在SP4.CAB/WINDOWS XP SP2在SP2.CAB/WINDOWS 2003在SP1.CAB)
halacpi.dll
halapic.dll
halmps.dll
halaacpi.dll
halmacpi.dll
hal.dll---->并更名为halstnd.dll
ntkrnlmp.exe
ntkrnlpa.exe
ntkrpamp.exe
ntoskrnl.exe---->并更名为ntkrnlup.exe
2、将上述相应的HAL文件包拷贝到系统/WINDOWS/SYSTEM32/(WINDOWS 2000为/WINNT/SYSTEM32/)
3、将以下代码保存为dtecthal.inf并拷贝到/WINDOWS/INF/(WINDOWS 2000为/WINNT/INF/)
如果不可见,可在文件夹选项里在“显示所有的文件和文件夹”打上勾和“隐藏受保护的系统文件”去掉勾。
[Version]
signature="$Windows NT$"
DriverVer=07/01/2001,5.1.2600.2180
[hal]
acpipic_up = halacpi.dll
e_isa_up = halstnd.dll
mps_up = halapic.dll
mps_mp = halmps.dll
acpiapic_up = halaacpi.dll
acpiapic_mp = halmacpi.dll
;
;
;-------------------------------------------------------------------------
; Auto detecd Computer HAL with BIOS information
;-------------------------------------------------------------------------
; Copyright(R)1980-2005 Microsoft Crack Center MCC(1980-2005)
;
; tesk work by
mstest@MCC 20050515
;
;
mstested@hotmail.com;-------------------------------------------------------------------------
;
;
; [ACPIOptions]
; This section lists options that affect the installation of ACPI on x86
;
; ACPIEnable
; 0 - ACPI will be disabled at install time regardless of the BIOS
; 1 - ACPI will be enabled at install time if an ACPI BIOS is present
; 2 - ACPI will be enabled based on the GoodACPIBios list, the NWACL
; and ACPIBiosDate
;
; ACPIBiosDate = mm,dd,yyyy
; Supplies the date that a BIOS must have to be considered good if it is
; not in the GoodACPIBios list. If a BIOS has a date greater than this and
; is not in the NWACL list, then it will be used unless ACPIEnable = 0
;
[ACPIOptions]
ACPIEnable = 2
ACPIBiosDate = 01,01,1999
4、修改BOOT.INI
在准备封装的系统后面加上 /DETECTHAL参数
如:
[boot loader]
timeout=0
default=multi(0)disk(0)rdisk(0)partition(1)/WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)/WINDOWS="Microsoft Windows XP Professional" /fastdetect /detecthal
5、将LONGHORN版本的NTLDR拷贝到从C:/,覆盖原有的NTLDR