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: If oFSO.fileExists("C:\sysprep\sysprep.inf") Then
58: sSysprep = "C:\sysprep\sysprep.inf"
59: sLocalDrive = "C:"
60: oLogging.CreateEntry "Found sysprep in " & sSysprep, LogTypeInfo
61: Else
62: sLocalDrive = oEnvironment.Item("OSDTargetSystemDrive")
63:
64: If oFSO.fileExists(sLocalDrive & "\sysprep\Sysprep.inf") then
65: sSysprep = sLocalDrive & "\sysprep\Sysprep.inf"
66: oLogging.CreateEntry "Found sysprep in " & sSysprep, LogTypeInfo
67: Else
68: oLogging.CreateEntry "Could not locate Sysprep", LogTypeWarning
69: End if
70: End If
71:
72: 'Set HAL source path from sp2 or sp3
73:
74: If oFSO.fileExists(sLocalDrive & "\WINDOWS\Driver Cache\i386\sp3.cab") then
75: sHALsource = sLocalDrive & "\WINDOWS\Driver Cache\i386\sp3.cab"
76: oLogging.CreateEntry "HAL replasment files will come from: " & sHALsource, LogTypeInfo
77: elseIf oFSO.fileExists(sLocalDrive & "\WINDOWS\Driver Cache\i386\sp2.cab") then
78: sHALsource = sLocalDrive & "\WINDOWS\Driver Cache\i386\sp2.cab"
79: oLogging.CreateEntry "HAL replasment files will come from: " & sHALsource, LogTypeInfo
80: else
81: oLogging.CreateEntry "no HAL replasment fileses present", LogTypeInfo
82: end if
83:
84: '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.
85: oLogging.CreateEntry "Configuring HAL replacement", LogTypeInfo
86: sHalType = oShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000\HardwareID")
87: oLogging.CreateEntry "Windows PE is using HAL " & sHalType(0), LogTypeInfo
88:
89: Select Case lCase(sHalType(0))
90:
91: Case "acpipic", "acpipic_up"
92: 'Add the UpdateUPHAL command to the Sysprep.inf file.
93: oUtility.WriteINI sSysprep, "Unattended", "UpdateUPHAL", "ACPIPIC_UP,C:\windows\Inf\Hal.inf"
94: oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor PIC HAL", LogTypeInfo
95:
96: 'Configure HAL and Krnl
97: sHal = "HALACPI.DLL"
98: sNtoskrnl = "NTOSKRNL.EXE"
99: sNkrnlpa = "NTKRNLPA.EXE"
100:
101: Case "acpiapic", "acpiapic_up"
102: if oShell.Environment.item("NUMBER_OF_PROCESSORS") > 1 then
103: 'If Processors.Count > 1 Then'Add the UpdateHAL command to the Sysprep.inf file.
104: oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\windows\Inf\Hal.inf"
105: oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo
106:
107: 'Configure HAL and Krnl
108: sHal = "HALMACPI.DLL"
109: sNtoskrnl = "NTKRNLMP.EXE"
110: sNkrnlpa = "NTKRPAMP.EXE"
111:
112: Else
113: 'Add the UpdateUPHAL command to the Sysprep.inf file.
114: oUtility.WriteINI sSysprep, "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:\windows\Inf\Hal.inf"
115: oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor APIC HAL", LogTypeInfo
116:
117: 'Configure HAL and Krnl
118: sHal = "HALAACPI.DLL"
119: sNtoskrnl = "NTOSKRNL.EXE"
120: sNkrnlpa = "NTKRNLPA.EXE"
121: End If
122:
123: Case "acpiapic_mp"
124: 'Add the UpdateHAL command to the Sysprep.inf file.
125: oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\windows\Inf\Hal.inf"
126: oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo
127:
128: 'Configure HAL and Krnl
129: sHal = "HALMACPI.DLL"
130: sNtoskrnl = "NTKRNLMP.EXE"
131: sNkrnlpa = "NTKRPAMP.EXE"
132:
133: End Select
134:
135: 'Check if System32 is present and unpack needed files.
136: sSystem32 = sLocalDrive & "\Windows\System32\"
137: oLogging.CreateEntry "Checking for access to " & sSystem32, LogTypeInfo
138:
139: If oFSO.FolderExists(sSystem32) then
140: oLogging.CreateEntry sSystem32 & " Found", LogTypeInfo
141:
142: For Each sFile in Array(sHal,sNtoskrnl,sNkrnlpa)
143: oShell.Run "expand " & Chr(34) & sHalSource & Chr(34) & " -f:" &sFile & " " &sSystem32,0,true
144: oLogging.CreateEntry "Copying " & sFile & " to " & sSystem32, LogTypeInfo
145:
146: Next
147: oFSO.CopyFile sSystem32 &sHal, sSystem32 & "HAL.dll", true
148: oFSO.CopyFile sSystem32 &sNtoskrnl, sSystem32 & "NTOSKRNL.EXE", true
149: oFSO.CopyFile sSystem32 &sNkrnlpa, sSystem32 & "NTKRNLPA.EXE", true
150: oLogging.CreateEntry "rename HAL and Kernal files", LogTypeInfo
151: Else
152: oLogging.CreateEntry "Error - Folder " & sSystem32 & " Not Found", LogTypeError
153: End If
154:
155: End Function
156: </script>
157: </job>
158: