OSD_UpdateWindowsHAL

OSD_UpdateWindowsHAL()

When capturing images of Windows 2000, Windows XP, Windows Server 2003/2003R2, the image only supports the HAL of the source computer. Because of this, mulitible images must be created, one for each HAL that is to be targeted. To avoid this double work, this function detects the target computers Hardware Abstraction Layer (HAL) and insert the necessary files in the target operating system, eliminating the need for multiple images.

Arguments

No arguments provided.

Return Type

Boolean, TRUE if function completed successfully.

Remarks

Typpically used in the PreBootScript.wsf

(warning) NOTE: The captured image must be build using the "Standard PC" or "ACPI Uniprocessor PC" to allow for upgrade.

Example

The following example will update the HAL files to match the computers HAL.

Private Function IncludeScript(sScriptFile)
 '...
End Function

'Begin
  bStatus=True
  If bStatus Then bStatus=IncludeScript("customlib.cis")
  If bStatus Then bStatus=IncludeLibrary("Capalib.cin")
  If bStatus Then bStatus=IncludeLibrary("Osdlib.cin")
  If bStatus Then bStatus=Job_Start("WS","Script Name","1.0","ScriptName.log","INSTALL")
  If bStatus Then bStatus=OSD_Initialize()

  If bStatus Then bStatus=OSD_UpdateWindowsHAL()

  Job_End(bStatus)
'End main

HAL file extraction.

The function requires that the different HAL files are available in the "C:\Drivers\HAL" folder on the target computer. These files must be extracted from the installation source media.
To copy the HAL files to the target computer, the HAL folder can be placed in the extras folder for the image found here: <OSD POINT>\Images\<image folder>\Drivers\HAL.

the following script can be used to extract the files and create the needed file structure, in this case from the SP3.cab file from Windows XP.

Sub ExtractFile(sCabFile,sSourceFile,sTargetPath,sTargetFile)
	Err.Clear
	dim oFSO : Set oFSO = WScript.CreateObject("Scripting.FileSystemObject") 

	If oFSO.FileExists(sCabFile) Then
		If NOT oFSO.FolderExists(sTargetPath) Then oFSO.CreateFolder(sTargetPath)
		WshShell.Run "expand " & sCabFile & " -F:" & sSourceFile & " " & sTargetPath & "\",0,1
		If Err.Number = 0 then
			oFSO.MoveFile sTargetPath & "\" & sSourceFile, sTargetPath & "\" & sTargetFile
		End if
	Else
		MsgBox "Cab file not found!"
	End If
	Set oFSO = Nothing
End sub

Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")

Dim sPathToCab
Dim sTargetPath
Dim sHALType

sPathToCab = "C:\Extract\sp3.cab"
sTargetPath = "C:\Extract\HAL"

sHALType = "\ACPIAPIC_MP" 'ACPI Multiprocessor PC
ExtractFile sPathToCab,"halmacpi.dll",sTargetPath & sHALType,"hal.dll"
ExtractFile sPathToCab,"ntkrnlmp.exe",sTargetPath & sHALType,"ntoskrnl.exe"
ExtractFile sPathToCab,"ntkrpamp.exe",sTargetPath & sHALType,"ntkrnlpa.exe"

sHALType = "\ACPIAPIC_UP" 'ACPI Uniprocessor PC
ExtractFile sPathToCab,"halaacpi.dll",sTargetPath & sHALType,"hal.dll"
ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"
ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"

sHALType = "\ACPIPIC_UP" 'Advanced Configuration and Power Interface (ACPI) PC
ExtractFile sPathToCab,"halacpi.dll",sTargetPath & sHALType,"hal.dll"
ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"
ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"

sHALType = "\HALSP" 'Compaq SystemPro Multiprocessor or 100% Compatible
ExtractFile sPathToCab,"halsp.dll",sTargetPath & sHALType,"hal.dll"
ExtractFile sPathToCab,"ntkrnlmp.exe",sTargetPath & sHALType,"ntoskrnl.exe"
ExtractFile sPathToCab,"ntkrpamp.exe",sTargetPath & sHALType,"ntkrnlpa.exe"

sHALType = "\HALAPIC" 'MPS Uniprocessor PC
ExtractFile sPathToCab,"halapic.dll",sTargetPath & sHALType,"hal.dll"
ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"
ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"

sHALType = "\HALMPS" 'MPS Multiprocessor PC
ExtractFile sPathToCab,"halmps.dll",sTargetPath & sHALType,"hal.dll"
ExtractFile sPathToCab,"ntkrnlmp.exe",sTargetPath & sHALType,"ntoskrnl.exe"
ExtractFile sPathToCab,"ntkrpamp.exe",sTargetPath & sHALType,"ntkrnlpa.exe"

sHALType = "\HAL" 'Standard PC
ExtractFile sPathToCab,"hal.dll",sTargetPath & sHALType,"hal.dll"
ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"
ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"

Set WshShell = Nothing

See Also

IncludeScript function