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

  1. <job id="HAL">
  2. <script language="VBScript" src="ZTIUtility.vbs"/>
  3. <script language="VBScript">
  4. ‘ //***************************************************************************
  5. ‘ // ***** Script Header *****
  6. ‘ //
  7. ‘ // Purpose: Change HAL
  8. ‘ //
  9. ‘ // Prerequsits: The refrence image must be SP2 or SP3
  10. ‘ //
  11. ‘ // Coretech History:
  12. ‘ // 1.0.0     Michael Petersen 19/09/2008  Created initial version.
  13. ‘ //
  14. ‘ // ***** End Header *****
  15. ‘ //***************************************************************************
  16.  
  17. ‘//—————————————————————————-
  18. ‘// Global constant and variable declarations
  19. ‘//—————————————————————————-
  20.  
  21. Option Explicit
  22.  
  23. Dim iRetVal, sHalType, sLocalDrive, sHalSource, sSysprep, sfile, sSystem32, sHal, sNtoskrnl, sNkrnlpa
  24.  
  25. ‘//—————————————————————————-
  26. ‘// End declarations
  27. ‘//—————————————————————————-
  28.  
  29. ‘//—————————————————————————-
  30. ‘// Main routine
  31. ‘//—————————————————————————-
  32.  
  33. On Error Resume Next
  34. iRetVal = ZTIProcess
  35. ProcessResults iRetVal
  36. On Error Goto 0
  37.  
  38. ‘//—————————————————————————
  39. ‘//
  40. ‘// Function: ZTIProcess()
  41. ‘//
  42. ‘// Input: None
  43. ‘//
  44. ‘// Return: Success – 0
  45. ‘// Failure – non-zero
  46. ‘//
  47. ‘// Purpose: Perform main ZTI processing
  48. ‘//
  49. ‘//—————————————————————————
  50. Function ZTIProcess()
  51.  
  52. iRetVal = Success
  53.  
  54. ZTIProcess = iRetval
  55.  
  56. ‘ Check for Sysprep.inf and set Path
  57. sLocalDrive = oEnvironment.Item("DeploySystemDrive")   
  58.  
  59. If oFSO.fileExists(sLocalDrive &amp; "\sysprep\Sysprep.inf") then
  60.      sSysprep = sLocalDrive &amp; "\sysprep\Sysprep.inf"
  61.      oLogging.CreateEntry "Found sysprep in " &amp; sSysprep, LogTypeInfo
  62. Else
  63.       oLogging.CreateEntry "Could not locate Sysprep", LogTypeWarning
  64. End if
  65.      
  66. ‘Set HAL source path from sp2 or sp3
  67.      
  68. If oFSO.fileExists(sLocalDrive &amp; "\WINDOWS\Driver Cache\i386\sp3.cab") then
  69.      sHALsource = sLocalDrive &amp; "\WINDOWS\Driver Cache\i386\sp3.cab"
  70.      oLogging.CreateEntry "HAL replasment files will come from: " &amp; sHALsource, LogTypeInfo
  71. elseIf oFSO.fileExists(sLocalDrive &amp; "\WINDOWS\Driver Cache\i386\sp2.cab") then
  72.      sHALsource = sLocalDrive &amp; "\WINDOWS\Driver Cache\i386\sp2.cab"
  73.      oLogging.CreateEntry "HAL replasment files will come from: " &amp; sHALsource, LogTypeInfo
  74. else
  75.      oLogging.CreateEntry "no HAL replasment fileses present", LogTypeInfo
  76. end if
  77.           
  78. ‘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.
  79.      oLogging.CreateEntry "Configuring HAL replacement", LogTypeInfo
  80.      sHalType = oShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000\HardwareID")
  81.      oLogging.CreateEntry "Windows PE is using HAL " &amp; sHalType(0), LogTypeInfo                 
  82.                
  83. Select Case lCase(sHalType(0))
  84.      
  85. Case "acpipic", "acpipic_up"
  86.      ‘Add the UpdateUPHAL command to the Sysprep.inf file.
  87.      oUtility.WriteINI "C:\Sysprep\Sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIPIC_UP,C:\windows\Inf\Hal.inf"
  88.      oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor PIC HAL", LogTypeInfo
  89.                          
  90.      ‘Configure HAL and Krnl
  91.      sHal = "HALACPI.DLL"
  92.      sNtoskrnl = "NTOSKRNL.EXE"
  93.      sNkrnlpa = "NTKRNLPA.EXE"
  94.           
  95. Case "acpiapic", "acpiapic_up"
  96.      if oShell.Environment.item("NUMBER_OF_PROCESSORS") > 1 then
  97.      ‘If Processors.Count > 1 Then’Add the UpdateHAL command to the Sysprep.inf file.
  98.           oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\windows\Inf\Hal.inf"
  99.           oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo
  100.                          
  101.           ‘Configure HAL and Krnl
  102.           sHal = "HALMACPI.DLL"
  103.           sNtoskrnl = "NTKRNLMP.EXE"
  104.           sNkrnlpa = "NTKRPAMP.EXE"     
  105.                          
  106.      Else
  107.           ‘Add the UpdateUPHAL command to the Sysprep.inf file.
  108.           oUtility.WriteINI sSysprep, "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:\windows\Inf\Hal.inf"
  109.           oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor APIC HAL", LogTypeInfo
  110.                          
  111.           ‘Configure HAL and Krnl
  112.           sHal = "HALAACPI.DLL"
  113.           sNtoskrnl = "NTOSKRNL.EXE"
  114.           sNkrnlpa = "NTKRNLPA.EXE"
  115.      End If
  116.                                              
  117. Case "acpiapic_mp"
  118.      ‘Add the UpdateHAL command to the Sysprep.inf file.
  119.      oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\windows\Inf\Hal.inf"
  120.      oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo 
  121.                               
  122.      ‘Configure HAL and Krnl
  123.      sHal = "HALMACPI.DLL"
  124.      sNtoskrnl = "NTKRNLMP.EXE"
  125.      sNkrnlpa = "NTKRPAMP.EXE"
  126.           
  127. End Select          
  128.  
  129. ‘Check if System32 is present and unpack needed files.
  130. sSystem32 = sLocalDrive  &amp; "\Windows\System32\"
  131. oLogging.CreateEntry "Checking for access to " &amp; sSystem32, LogTypeInfo
  132.  
  133. If oFSO.FolderExists(sSystem32) then
  134.      oLogging.CreateEntry sSystem32 &amp; " Found", LogTypeInfo
  135.  
  136.      For Each sFile in Array(sHal,sNtoskrnl,sNkrnlpa)
  137.           oShell.Run "expand " &amp; Chr(34) &amp; sHalSource &amp; Chr(34) &amp; " -f:" &amp;sFile &amp; " " &amp;sSystem32,0,true
  138.           oLogging.CreateEntry "Copying " &amp; sFile &amp; " to " &amp; sSystem32, LogTypeInfo
  139.  
  140.      Next
  141.           oFSO.CopyFile sSystem32 &amp;sHal, sSystem32 &amp; "HAL.dll", true
  142.           oFSO.CopyFile sSystem32 &amp;sNtoskrnl, sSystem32 &amp; "NTOSKRNL.EXE", true
  143.           oFSO.CopyFile sSystem32 &amp;sNkrnlpa, sSystem32 &amp; "NTKRNLPA.EXE", true
  144.           oLogging.CreateEntry "rename HAL and Kernal files", LogTypeInfo
  145.      Else
  146.           oLogging.CreateEntry "Error – Folder " &amp; sSystem32 &amp; " Not Found", LogTypeError
  147. End If
  148.      
  149. End Function
  150. </script>
  151. </job>

One Comment

  1. Quad:

    Is there any way to make this automatically run?

    Plz email me at Quad2k@gmail.com

    Thanks

Leave a comment