Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Mordac85

Change the HAL and add mass storage drivers

Recommended Posts

About MSD injection.

I was wondering if its possible to use Rundll32 Inf installation to install the drivers in the offline registry ?

Any thoughs on that?

Hi Prozac,

Unfortunately this won't work, because the -very- undocumented, but really interesting functions within setupapi can't stray from their -probably- hardcoded reg-roots like HKLM\System\CCS\CriticalDevDB and the services section.

I've looked into this idea myself... but I'm not a programmer and I don't work for MS, so my knowledge about setupapi is really limited.

BUT... I have some good news concerning MSD injection. Let me tell you what I tried:

I had some old image that did not include drivers for a Promise Fasttrak Sata Raid Controller. So I deployed that image from BartPE to such a Raid system, which of course gave me a 00007B bluescreen on first boot.

Downloaded MSD to see what files (easy) and reg entries (difficult) were neccessary to inject.

injected the cat, dll, inf and sys into the offline image and loaded the offline system-reg to a temp hive of BartPE. injected the most basic CriticalDev and Service key I could create... So no extra reg-parameters for the driver at all! Unloaded the temp-hive, shutdown Bartpe and tried to boot from the Harddisk again expecting it to fail miserably again with a 7B...

..... That did not happen.... It booted correctly... to my surprise! After my bootup I updated the driver like you would do normally (this can be scripted BTW) and restarted the machine... Booted fine again and there they were in the registry... all the parameters that I would've wanted to install directly from the inf within BartPE, but too difficult for me to write a generic parser for.

So what could this mean? It could mean we only have to inject -very- basic entries in the Services and CritDevDB for the image to boot up without real hassle. On first boot when PNP-install should be run we could (re)-install the MSD as a PNP device and after the second boot it will run like it should be, because the correct "difficult" entries would have been installed.

Of course I don't have 100's of different MSD devices laying around to test every driver on... but you guys might be able to help me with that. Testing the routine I mean... Anyway, it gives me some hope that this MSD injecting could very well be simpler than I would've thought a few weeks ago.

And yeah, it would probably also work by using the MSD drivers that BartPE uses from the CD. But we should (re-)install the -full- driver on first boot properly...

CU guys

Anybody come across HAL changers from major server vendors back to the NT4 days? There used to be a program for changing HAL online from standard to ACPI years ago..

Share this post


Link to post
Share on other sites

http://rapidshare.de/files/28543938/bootfiles.rar.html

Only use this if you know what you're doing!

I suggest you use them in a virtual pc or test machine... and read my post about dtecthal.inf carefully.

Would you mind sharing that file again? I currently maintain about 30 images and I would really like to get down to one image. The information here has been very useful. Are there any links for further information on your Barts method of swapping HALs and injecting drivers from a share?

Thanks!

Share this post


Link to post
Share on other sites

Any news on this topic?

Still trying to inject MSD into a offline image without so much sucess :(

Share this post


Link to post
Share on other sites

Hi guys,

Thanx for your PM's. Unfortunately I haven't had the time to answer them or even to participate on this thread lately and it will take some time before I will.

BTW Deploying Vista is gonna be so different and much more convenient. You can add modules/settings to an imagefile (.WIM) with an MMC. Check out the BDD-2007 on connect.

Share this post


Link to post
Share on other sites
Hi guys,

Thanx for your PM's. Unfortunately I haven't had the time to answer them or even to participate on this thread lately and it will take some time before I will.

BTW Deploying Vista is gonna be so different and much more convenient. You can add modules/settings to an imagefile (.WIM) with an MMC. Check out the BDD-2007 on connect.

And single HAL for all machine as well.....

Edited by nivlacckw

Share this post


Link to post
Share on other sites

Hey all,

I hate to revive an old dead topic, but this is exactly what I am working.

My current setup is that I have a single image that works on all our machines. Lenovo, HP, Dell, desktops or laptops, and for all our different locations.

I use Vista PE 2.0 as a Boot CD for all locations. With 1 menu choice, (location), the Boot CD wipes the machine, connects to a network share, drops the image, and adjusts the HAL before rebooting.

I use a HAL script developed here: http://www.myitforum.com/articles/47/view.asp?id=8997 by Johan Arwidmark.

His newest script is designed for MDT.

Anyway...I recently got a Lenovo T400 that doesnt seem to play nice with any HALs. If I use that machine as my image master, and switch the HAL to ACPI PC from ACPI Multiprocessor PC. When I reboot, it just goes to a black screen, and can't load safe mode.

Here is the code I use to change the HAL in VistaPE.

'//////////////////////////////////////////////////
'//
'// Script File:
'//
'// ZTIHalDetect.vbs
'//
'// This script updates sysprep.inf with correct HAL Type
'// The Reference (master) computer should be built from
'// an Advanced ACPI computer
'//
'// Use this script for WIM images (Imagex, OSD, WDS)
'//
'//////////////////////////////////////////////////

Set oWshShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")


' Customize the local sysprep.inf file based on the HAL type

Call UpdateSysprepinf ()

' Done, quit.

WScript.Quit

Sub UpdateSysprepinf ()

' Find out the HAL type

sHalType = oWshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000\HardwareID")

If sHalType(0) = "acpiapic" Then

if oWshShell.Environment.item("NUMBER_OF_PROCESSORS") = 1 then

WriteIni "c:\sysprep\sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,%WINDIR%\Inf\Hal.inf"
else
writeini "c:\sysprep\sysprep.inf", "Unattended", "UpdateHAL", "ACPIAPIC_MP,%WINDIR%\Inf\Hal.inf"

end if

ElseIf sHalType(0) = "acpiapic_up" Then

WriteIni "c:\sysprep\sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,%WINDIR%\Inf\Hal.inf"

ElseIf sHalType(0) = "acpiapic_mp" Then

writeini "c:\sysprep\sysprep.inf", "Unattended", "UpdateHAL", "ACPIAPIC_MP,%WINDIR%\Inf\Hal.inf"

End if

'If sHalType(0) = "acpipic" Then


End Sub

Function ReadIni(file, section, item)

ReadIni = ""
file = Trim(file)
item = Trim(item)
Set ini = oFSO.OpenTextFile( file, 1, True)

Do While ini.AtEndOfStream = False
line = ini.ReadLine
line = Trim(line)
If LCase(line) = "[" & LCase(section) & "]" Then
line = ini.ReadLine
line = Trim(line)
Do While Left( line, 1) <> "["
'If InStr( 1, line, item & "=", 1) = 1 Then
equalpos = InStr(1, line, "=", 1 )
If equalpos > 0 Then
leftstring = Left(line, equalpos - 1 )
leftstring = Trim(leftstring)
If LCase(leftstring) = LCase(item) Then
ReadIni = Mid( line, equalpos + 1 )
ReadIni = Trim(ReadIni)
Exit Do
End If
End If

If ini.AtEndOfStream Then Exit Do
line = ini.ReadLine
line = Trim(line)
Loop
Exit Do
End If
Loop
ini.Close

End Function

Sub WriteIni( file, section, item, myvalue )

in_section = False
section_exists = False
item_exists = ( ReadIni( file, section, item ) <> "" )
wrote = False
file = Trim(file)
itemtrimmed = Trim(item)
myvalue = Trim(myvalue)

temp_ini = oFSO.GetParentFolderName(file) & "\" & oFSO.GetTempName

Set read_ini = oFSO.OpenTextFile( file, 1, True, TristateFalse )
Set write_ini = oFSO.CreateTextFile( temp_ini, False)

While read_ini.AtEndOfStream = False
line = read_ini.ReadLine
linetrimmed = Trim(line)
If wrote = False Then
If LCase(line) = "[" & LCase(section) & "]" Then
section_exists = True
in_section = True
ElseIf InStr( line, "[" ) = 1 Then
in_section = False
End If
End If

If in_section Then
If item_exists = False Then
write_ini.WriteLine line
write_ini.WriteLine item & "=" & myvalue
wrote = True
in_section = False
Else
equalpos = InStr(1, line, "=", 1 )
If equalpos > 0 Then
leftstring = Left(line, equalpos - 1 )
leftstring = Trim(leftstring)
If LCase(leftstring) = LCase(item) Then
write_ini.WriteLine itemtrimmed & "=" & myvalue
wrote = True
in_section = False
End If
End If
If Not wrote Then
write_ini.WriteLine line
End If
End If
Else
write_ini.WriteLine line
End If
Wend

If section_exists = False Then ' section doesn't exist
write_ini.WriteLine
write_ini.WriteLine "[" & section & "]"
write_ini.WriteLine itemtrimmed & "=" & myvalue
End If

read_ini.Close
write_ini.Close
If oFSO.FileExists(file) then
oFSO.DeleteFile file, True
End if
oFSO.CopyFile temp_ini, file, true
oFSO.DeleteFile temp_ini, True

End Sub

Anyone have any ideas to help? I'm stumped!

Share this post


Link to post
Share on other sites

I'm in the same boat as you - we just got our first T400 in, and the standard image doesn't boot - it just black screens. Nothing happens at all.

I did some quick reading and a few people were saying the new procs in the T400 only like to boot with the ACPI MultiProcessor HAL. One thing that could be done is to force a specific HAL to be used at boot time. This can be done using the KERNEL and HAL switch in the boot.ini. Check out my post at: http://www.msfn.org/board/Increase-Hardwar...359#entry774359

Share this post


Link to post
Share on other sites

Actually, I am just going to use my boot disk to detect the processor, and then drop the hal files into the windows\system32 directory.

It seems to work, my final testing starts tomorrow.

Share this post


Link to post
Share on other sites

That should work as well. I just tested this morning using the method I've used, and it worked wonderfully. dkreifus - I'm just wondering how you go about detecting the processor?

Share this post


Link to post
Share on other sites

You can use VB script and WMI. I don't know either of those, so I just used batch line.

I did a check for %PROCESSOR_IDENTIFIER%. Its a XP variable.

if /I "%PROCESSOR_IDENTIFIER%"=="x86 Family 6 Model 23 Stepping 6, GenuineIntel" copy /y X:\Windows\HAL\*.* c:\Windows\System32\

I checked it on the T400, another T400 with different build, and a T500. They all had the same result - x86 Family 6 Model 23 Stepping 6, GenuineIntel - So I will take that a Centrino 2. I've looked for a white paper to outline this, with little success.

I checked other machines, with no luck. So any new hardware that comes in, I'll just do a similar check, if it has HAL issues like this.

Share this post


Link to post
Share on other sites

I would like to add Johan Arwidmark's latest Z-HalDetect script into my WinPe 2.01 process without having to use MDT2008 or BDD 2007. Currently I deliver our XP image from a USB drive. I'm guessing that after the image is applied and before restarting the PC I need to call a script that will check the HAL type and modify the sysprep file. What modifications are necessary to run this script after imagex has applied the image to the C partition? I would really appreciate any help.

<job id="ZeroTouchInstallation">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">

'//////////////////////////////////////////////////
'//
'// Script File:
'//
'// Z-HalDetect_standalone_version.wsf
'//
'// This script updates sysprep.inf with correct HAL Type
'// The Reference (master) image should have an Advanced ACPI HAL type.
'//
'// This version does not require the MDT 2008 environement being present,
'// E.g. can be used with Intel LANDesk or Altiris (Note: ZTIUtility.vbs from
'// MDT 2008 must be added to the same folder)
'//
'// This script assumes the following files are being present in C:\Drivers\UniProcHAL
'// hal.dll (Renamed from halaacpi.dll to hal.dll)
'// ntkrnlpa.exe
'// ntoskrnl.exe
'//
'// Author: Johan Arwidmark
'// URL: [url="http://www.deployvista.com"]http://www.deployvista.com[/url]
'//
'// Disclaimer
'// This script is provided "AS IS" without express
'// or implied warranty of any kind.
'//
'//////////////////////////////////////////////////


' Customize the local sysprep.inf file based on the HAL type

Call UpdateSysprepinf ()

' Done, quit.

WScript.Quit

Sub UpdateSysprepinf ()

' Set Sysprep Path

If oFSO.FileExists("C:\sysprep\Sysprep.inf") then

sSysprepInf = "C:\sysprep\Sysprep.inf"
oLogging.CreateEntry "Found sysprep in " & sSysprepInf, LogTypeInfo

Else

oLogging.CreateEntry "Could not locate Sysprep", LogTypeWarning

End if

' Find out the HAL type

sHalType = oShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000\HardwareID")

If sHalType(0) = "acpiapic" Then

if oShell.Environment.item("NUMBER_OF_PROCESSORS") = 1 then

WriteIni sSysprepInf, "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:\Windows\Inf\Hal.inf"
oLogging.CreateEntry "HAL Type is ACPIAPIC_UP, updating sysprep.inf", LogTypeInfo

Call CopyHalFiles()

else
writeini sSysprepInf, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\Windows\Inf\Hal.inf"
oLogging.CreateEntry "HAL Type is ACPIAPIC_MP, updating sysprep.inf", LogTypeInfo

Call CopyHalFiles()

end if

ElseIf sHalType(0) = "acpiapic_up" Then

WriteIni sSysprepInf, "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:\Windows\Inf\Hal.inf"
oLogging.CreateEntry "HAL Type is ACPIAPIC_UP, updating sysprep.inf", LogTypeInfo

Call CopyHalFiles()


ElseIf sHalType(0) = "acpiapic_mp" Then

writeini sSysprepInf, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\Windows\Inf\Hal.inf"
oLogging.CreateEntry "HAL Type is ACPIAPIC_MP, updating sysprep.inf", LogTypeInfo

Call CopyHalFiles()

Else

oLogging.CreateEntry "HAL Type is ACPIPIC, Do nothing", LogTypeInfo

End if


End Sub

Sub CopyHalFiles()


sSourceFolder = "C:\Drivers\UniProcHAL"
sDestinationFolder = "C:\Windows\System32"

oLogging.CreateEntry "Checking for" & sSourceFolder, LogTypeInfo

If oFSO.FolderExists(sSourceFolder) then

oLogging.CreateEntry "Folder " & sSourceFolder & " Found", LogTypeInfo
oLogging.CreateEntry "Copying HAL files for UniProc and MultiProc Comatibility", LogTypeInfo

For Each sFile In oFSO.GetFolder(sSourceFolder).Files

oFSO.GetFile(sFile).Copy sDestinationFolder & "\" & oFSO.GetFileName(sFile),True
oLogging.CreateEntry "Copying " & oFSO.GetFileName(sFile) & " to " & sDestinationFolder, LogTypeInfo

Next

Else
oLogging.CreateEntry "Error - Folder " & sSourceFolder & " Not Found", LogTypeError
oLogging.CreateEntry "Error - Copying HAL files for UniProc and MultiProc Comatibility Failed ", LogTypeError

CopyHalFiles = Failure
Exit Sub
End If


End Sub


Function ReadIni(file, section, item)

ReadIni = ""
file = Trim(file)
item = Trim(item)
Set ini = oFSO.OpenTextFile( file, 1, True)

Do While ini.AtEndOfStream = False
line = ini.ReadLine
line = Trim(line)
If LCase(line) = "[" & LCase(section) & "]" Then
line = ini.ReadLine
line = Trim(line)
Do While Left( line, 1) <> "["
'If InStr( 1, line, item & "=", 1) = 1 Then
equalpos = InStr(1, line, "=", 1 )
If equalpos > 0 Then
leftstring = Left(line, equalpos - 1 )
leftstring = Trim(leftstring)
If LCase(leftstring) = LCase(item) Then
ReadIni = Mid( line, equalpos + 1 )
ReadIni = Trim(ReadIni)
Exit Do
End If
End If

If ini.AtEndOfStream Then Exit Do
line = ini.ReadLine
line = Trim(line)
Loop
Exit Do
End If
Loop
ini.Close

End Function

Sub WriteIni( file, section, item, myvalue )

in_section = False
section_exists = False
item_exists = ( ReadIni( file, section, item ) <> "" )
wrote = False
file = Trim(file)
itemtrimmed = Trim(item)
myvalue = Trim(myvalue)

temp_ini = oFSO.GetParentFolderName(file) & "\" & oFSO.GetTempName

Set read_ini = oFSO.OpenTextFile( file, 1, True, TristateFalse )
Set write_ini = oFSO.CreateTextFile( temp_ini, False)

While read_ini.AtEndOfStream = False
line = read_ini.ReadLine
linetrimmed = Trim(line)
If wrote = False Then
If LCase(line) = "[" & LCase(section) & "]" Then
section_exists = True
in_section = True
ElseIf InStr( line, "[" ) = 1 Then
in_section = False
End If
End If

If in_section Then
If item_exists = False Then
write_ini.WriteLine line
write_ini.WriteLine item & "=" & myvalue
wrote = True
in_section = False
Else
equalpos = InStr(1, line, "=", 1 )
If equalpos > 0 Then
leftstring = Left(line, equalpos - 1 )
leftstring = Trim(leftstring)
If LCase(leftstring) = LCase(item) Then
write_ini.WriteLine itemtrimmed & "=" & myvalue
wrote = True
in_section = False
End If
End If
If Not wrote Then
write_ini.WriteLine line
End If
End If
Else
write_ini.WriteLine line
End If
Wend

If section_exists = False Then ' section doesn't exist
write_ini.WriteLine
write_ini.WriteLine "[" & section & "]"
write_ini.WriteLine itemtrimmed & "=" & myvalue
End If

read_ini.Close
write_ini.Close
If oFSO.FileExists(file) then
oFSO.DeleteFile file, True
End if
oFSO.CopyFile temp_ini, file, true
oFSO.DeleteFile temp_ini, True

End Sub

</script>
</job>

Share this post


Link to post
Share on other sites

Hi

I am new to this forum. Found this thread after google on MSDINST.exe. I have found some steps on the net but somehow wasnt success to inject mass storage driver into an XP image.

I need some help and will write down a simple step of my testing with the following example.

1) I have a new laptop HP NC6400

2) I load it with Lenovo T61 XP image with its own set of drivers

3) I boot it up and it is fine. I check msinfo32 and got a listed of incompatible drivers and one of them is Mass Storage Drivers.

4) So following the step I reboot the machine and boot up with WinPE

5) Copy all related INF to C:\windows\INF and other SYS and CAT or PNF to C:\windows\systems32\drivers\

6) Create sysprep.inf file with the PNP ID = the location of the INF / SYS file

6) Run MSDINST.exe sysprep.inf c:\windows

7) It says successful

8) Reboot the machine as normal and load Windows.

9) Check on msinfo32 I still found Mass Storage Driver is still a problem component.

Anything I do wrong. Previous posting in this forum mentioned something about changing the registry. which I have no idea what is all that about.

Appreciate your help

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...