Handling HAL switching during XP deployment (no BSOD /0×07 error)
Because of the issue with different HAL’s (Hardware Abstraction Layer) used by XP, it is necessary to make some changes to both Sysprep, and the Kernel files during deployment..
I thought I’d supply my HAL changing script, as it does not require the reference computer to be to build from a specific XXX, and you do not need to add any files to the image beforehand, as that will done by the script.
Just run the script after the image has been deployed, but before booting from WinPE to the MiniSetup
-
<job id="HAL">
-
<script language="VBScript" src="ZTIUtility.vbs"/>
-
<script language="VBScript">
-
‘ //***************************************************************************
-
‘ // ***** Script Header *****
-
‘ //
-
‘ // Purpose: Change HAL
-
‘ //
-
‘ // Prerequsits: The refrence image must be SP2 or SP3
-
‘ //
-
‘ // Coretech History:
-
‘ // 1.0.0 Michael Petersen 19/09/2008 Created initial version.
-
‘ //
-
‘ // ***** End Header *****
-
‘ //***************************************************************************
-
-
‘//—————————————————————————-
-
‘// Global constant and variable declarations
-
‘//—————————————————————————-
-
-
Option Explicit
-
-
Dim iRetVal, sHalType, sLocalDrive, sHalSource, sSysprep, sfile, sSystem32, sHal, sNtoskrnl, sNkrnlpa
-
-
‘//—————————————————————————-
-
‘// End declarations
-
‘//—————————————————————————-
-
-
‘//—————————————————————————-
-
‘// Main routine
-
‘//—————————————————————————-
-
-
On Error Resume Next
-
iRetVal = ZTIProcess
-
ProcessResults iRetVal
-
On Error Goto 0
-
-
‘//—————————————————————————
-
‘//
-
‘// Function: ZTIProcess()
-
‘//
-
‘// Input: None
-
‘//
-
‘// Return: Success – 0
-
‘// Failure – non-zero
-
‘//
-
‘// Purpose: Perform main ZTI processing
-
‘//
-
‘//—————————————————————————
-
Function ZTIProcess()
-
-
iRetVal = Success
-
-
ZTIProcess = iRetval
-
-
‘ Check for Sysprep.inf and set Path
-
sLocalDrive = oEnvironment.Item("DeploySystemDrive")
-
-
If oFSO.fileExists(sLocalDrive & "\sysprep\Sysprep.inf") then
-
sSysprep = sLocalDrive & "\sysprep\Sysprep.inf"
-
oLogging.CreateEntry "Found sysprep in " & sSysprep, LogTypeInfo
-
Else
-
oLogging.CreateEntry "Could not locate Sysprep", LogTypeWarning
-
End if
-
-
‘Set HAL source path from sp2 or sp3
-
-
If oFSO.fileExists(sLocalDrive & "\WINDOWS\Driver Cache\i386\sp3.cab") then
-
sHALsource = sLocalDrive & "\WINDOWS\Driver Cache\i386\sp3.cab"
-
oLogging.CreateEntry "HAL replasment files will come from: " & sHALsource, LogTypeInfo
-
elseIf oFSO.fileExists(sLocalDrive & "\WINDOWS\Driver Cache\i386\sp2.cab") then
-
sHALsource = sLocalDrive & "\WINDOWS\Driver Cache\i386\sp2.cab"
-
oLogging.CreateEntry "HAL replasment files will come from: " & sHALsource, LogTypeInfo
-
else
-
oLogging.CreateEntry "no HAL replasment fileses present", LogTypeInfo
-
end if
-
-
‘Get the HAL type from the registry (from Windows PE). This will tell us if we are running on a PIC or an APIC chipset.
-
oLogging.CreateEntry "Configuring HAL replacement", LogTypeInfo
-
sHalType = oShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000\HardwareID")
-
oLogging.CreateEntry "Windows PE is using HAL " & sHalType(0), LogTypeInfo
-
-
Select Case lCase(sHalType(0))
-
-
Case "acpipic", "acpipic_up"
-
‘Add the UpdateUPHAL command to the Sysprep.inf file.
-
oUtility.WriteINI "C:\Sysprep\Sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIPIC_UP,C:\windows\Inf\Hal.inf"
-
oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor PIC HAL", LogTypeInfo
-
-
‘Configure HAL and Krnl
-
sHal = "HALACPI.DLL"
-
sNtoskrnl = "NTOSKRNL.EXE"
-
sNkrnlpa = "NTKRNLPA.EXE"
-
-
Case "acpiapic", "acpiapic_up"
-
if oShell.Environment.item("NUMBER_OF_PROCESSORS") > 1 then
-
‘If Processors.Count > 1 Then’Add the UpdateHAL command to the Sysprep.inf file.
-
oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\windows\Inf\Hal.inf"
-
oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo
-
-
‘Configure HAL and Krnl
-
sHal = "HALMACPI.DLL"
-
sNtoskrnl = "NTKRNLMP.EXE"
-
sNkrnlpa = "NTKRPAMP.EXE"
-
-
Else
-
‘Add the UpdateUPHAL command to the Sysprep.inf file.
-
oUtility.WriteINI sSysprep, "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:\windows\Inf\Hal.inf"
-
oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor APIC HAL", LogTypeInfo
-
-
‘Configure HAL and Krnl
-
sHal = "HALAACPI.DLL"
-
sNtoskrnl = "NTOSKRNL.EXE"
-
sNkrnlpa = "NTKRNLPA.EXE"
-
End If
-
-
Case "acpiapic_mp"
-
‘Add the UpdateHAL command to the Sysprep.inf file.
-
oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\windows\Inf\Hal.inf"
-
oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo
-
-
‘Configure HAL and Krnl
-
sHal = "HALMACPI.DLL"
-
sNtoskrnl = "NTKRNLMP.EXE"
-
sNkrnlpa = "NTKRPAMP.EXE"
-
-
End Select
-
-
‘Check if System32 is present and unpack needed files.
-
sSystem32 = sLocalDrive & "\Windows\System32\"
-
oLogging.CreateEntry "Checking for access to " & sSystem32, LogTypeInfo
-
-
If oFSO.FolderExists(sSystem32) then
-
oLogging.CreateEntry sSystem32 & " Found", LogTypeInfo
-
-
For Each sFile in Array(sHal,sNtoskrnl,sNkrnlpa)
-
oShell.Run "expand " & Chr(34) & sHalSource & Chr(34) & " -f:" &sFile & " " &sSystem32,0,true
-
oLogging.CreateEntry "Copying " & sFile & " to " & sSystem32, LogTypeInfo
-
-
Next
-
oFSO.CopyFile sSystem32 &sHal, sSystem32 & "HAL.dll", true
-
oFSO.CopyFile sSystem32 &sNtoskrnl, sSystem32 & "NTOSKRNL.EXE", true
-
oFSO.CopyFile sSystem32 &sNkrnlpa, sSystem32 & "NTKRNLPA.EXE", true
-
oLogging.CreateEntry "rename HAL and Kernal files", LogTypeInfo
-
Else
-
oLogging.CreateEntry "Error – Folder " & sSystem32 & " Not Found", LogTypeError
-
End If
-
-
End Function
-
</script>
-
</job>

Quad:
Is there any way to make this automatically run?
Plz email me at Quad2k@gmail.com
Thanks
13th January 2010, 18:49