|
On-the-fly HAL Injection
At last week's Raleigh User Group meeting the question of how to inject HAL files was asked. We recently took the time to put together a script that automatically detects and loads the appropriate HAL files on-the-fly in WinPE as the second task after our multiprocessor image is distrbuted to the disk. It was somewhat difficult to find reference material when researching how to get something that would work so hopefully this will help others out there.
In our organization we only have three HAL types to worry about and since the image is a multiprocessor image the script only needs to inject files if an ACPI or ACPI Uniprocessor system is detected.
Essentially, the script works by querying the registry and comparing the workstation's HAL type to the HAL specified in the case statement, if the two match then the errorlevel variable gets a value of 0 and the scripts jumps to the bottom section and injects the files specified under the HAL type a match was found for. If a match was not found, the script continues to the next case statement and checks for a match there, and so on. In our case, if the system is not detected as being ACPI, or ACPI Uniprocessor, we're assuming the system is ACPI Multiprocessor in which case we leave the system as is.
Here's the script:
REM HAL Check
REM Check for 'Advanced Configuration and Power Interface (ACPI) PC' (acpipic_up)
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpipic_up"
IF %ERRORLEVEL% EQU 0 GOTO acpipic_up
REM Check for 'ACPI Uniprocessor PC' (acpiapic_up)
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpiapic_up"
IF %ERRORLEVEL% EQU 0 GOTO acpiapic_up
REM Check for 'ACPI Multiprocessor PC' (acpiapic_mp)
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpiapic_mp"
IF %ERRORLEVEL% EQU 0 GOTO DEFAULT
:acpipic_up
ECHO Copy files for 'Advanced Configuration and Power Interface (ACPI) PC'
RDeploy\Windows\Firm copy f:\drivers\HAL\acpipic_up\halacpi.dll prod:\Windows\System32\HAL.dll
RDeploy\Windows\Firm copy f:\drivers\HAL\acpipic_up\ntkrnlpa.exe prod:\Windows\System32\ntkrnlpa.exe
RDeploy\Windows\Firm copy f:\drivers\HAL\acpipic_up\ntoskrnl.exe prod:\Windows\System32\ntoskrnl.exe
GOTO END
:acpiapic_up
ECHO Copy files for 'ACPI Uniprocessor PC'
RDeploy\Windows\Firm copy f:\drivers\HAL\acpiapic_up\halaacpi.dll prod:\Windows\System32\HAL.dll
RDeploy\Windows\Firm copy f:\drivers\HAL\acpiapic_up\ntkrnlpa.exe prod:\Windows\System32\ntkrnlpa.exe
RDeploy\Windows\Firm copy f:\drivers\HAL\acpiapic_up\ntoskrnl.exe prod:\Windows\System32\ntoskrnl.exe
GOTO END
:DEFAULT
ECHO HAL type did not match ACPIPIC_UP or ACPIAPIC_UP, using default (ACPIAPIC_MP)
GOTO END
:END
|