![]() ![]() |
Dec 21 2003, 08:38 AM
Post
#1
|
|
|
Junior ![]() Group: Members Posts: 85 Joined: 4-December 03 Member No.: 10361 OS: none
|
Major Update 12. Sep 2004 (finally!)
You want to install PnP-drivers directly from the CD? Or extract them from an archive before installation? Maybe you want a repair cd without winnt.sif but with custom drivers? All this is possible. NOTE: this only works with drivers that have an .inf! I did some programming in my (rare) spare time and created some custom tools to accomplish the above. This is what you have to do: 1. download the following files: (updated: 12. Sep 2004) SETUP.EX_ ca. 2K presetup.cmd ca. 1K SetDevicePath.exe ca. 12K WatchDriverSigningPolicy.exe ca. 4K In case you are having problems, try this: setup_dbg.exe ca. 5K This works exactly like the above one, except that the window of presetup.cmd is visible, so you can see what is happening. (You have to rename it to setup.exe and cab it yourself) 2. create a directory OEM\bin in the root of your CD-folder and copy WatchDriverSigningPolicy.exe and SetDevicePath.exe into it. 3. go to your I386 directory and uncab SETUP.EX_ like this: CODE expand SETUP.EX_ setupORG.exe 4. copy my SETUP.EX_ to your I386 directory and overwrite the old one. 5. copy my presetup.cmd to your I386 directory. This is an example file which assumes that all user related files reside in \OEM\bin on the CD. Feel free to change it to your needs, I added some comments, shouldn't be too hard. 6. create a directory OEM\drivers in the root of your CD-folder and copy your uncompressed drivers there OR create an archive containing your drivers and put them on the CD, for example OEM\drivers.7z or OEM\data\mydrivers.rar... you get the idea. You can sort them into subdirectories, these will be scanned recursively by SetDevicePath.exe. 7. edit TXTSETUP.SIF directly under [SourceDisksFiles] to include the following entries: CODE setupORG.exe = 1,,,,,,,2,0,0 presetup.cmd = 1,,,,,,,2,0,0 These two are absolutely neccessary, everything else can come from CD later on. Done. This is what happens during installation After the first reboot the installation starts in GUI-mode and executes "setup.exe -newsetup". Well, it *thinks* it does... My setup.exe executes presetup.cmd first (the window is hidden by design) which in turn starts the original setup. It waits till presetup.cmd terminates, then it terminates itself and Windows reboots. So as you might have guessed already, the neat stuff happens in presetup.cmd. The driveletter of the CD is searched first: CODE set tagfile=\WIN51 for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do if exist "%%i:%tagfile%" set CDDRIVE=%%i: (thanks to serialsz for the shorter version, slightly modified) Remark: note that the tagfile might be different for you. You might have to change it to '\WIN51IP' or '\WIN51.SP2'. Uncompressed drivers directly on CD If they are uncompressed on the CD, just do it like this: CODE %CDDRIVE%\OEM\bin\SetDevicePath.exe %CDDRIVE%\OEM\drivers The drivers directory on the CD is scanned for subdirectories. The list of subdirectories is then written to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath. ("%SystemRoot%\Inf" is added in front of it) Compressed drivers from an archive In case you want to use compressed drivers (and who wouldn't want to Unsigned drivers Now comes the tricky part. The installation of unsigned drivers will trigger the usual warning messages. So you may think: "No problem. I just change the 'HKLM\Software\Microsoft\Driver Signing' value in HIVESFT.INF!" Should work, but does not. Windows Setup resets the "Driver Signing" entries when it starts. The following line in presetup.cmd will take care of this issue. CODE start %CDDRIVE%\OEM\bin\WatchDriverSigningPolicy.exe (the 'start' is important, or presetup.cmd will hang!) It installs a notification hook on the "Driver Signing" regkey and changes it back whenever necessary. It changes another key as well: The geniuses at Microsoft implemented a mechanism to disallow the change of the "Driver Signing" keys through regkeys, which is a good thing but at the same time they build a backdoor for circumventing this mechanism. HKCU\Software\Policies\Microsoft\Windows NT\Driver Signing\BehaviorOnFailedVerify (=0) This essentially means that when Windows finds out that the policies have been tampered with, it just does not care... Things to do after the installation: Microsoft recommends to reset the DevicePath to "%SystemRoot%\Inf" after setup: CODE REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion] "DevicePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\ 00,74,00,25,00,5c,00,49,00,6e,00,66,00,00,00 If you used WatchDriverSigningPolicy.exe, you should reset the appropriate keys if you don't want unsigned drivers to be installed without warning: CODE REGEDIT4 [HKEY_CURRENT_USER\Software\Microsoft\Driver Signing] "Policy"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Driver Signing] "Policy"=hex:01 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows NT\Driver Signing] "BehaviorOnFailedVerify"=dword:00000001 (Apparently this does not work at the end of presetup.cmd after the invocation of setup.exe. It seems that Windows is in some weird limbo state there and registry-changes are ignored/reset.) Final notes: Please note that you cannot start all programs in presetup.cmd. The environment is rather limited at this point of the setup. regedit.exe for example does not work, but reg.exe does. taskmgr.exe does not work either. They will work a minute later, when the real setup has started. rundll32.exe works so you can install custom infs. WinRAR-sfx-archives only work with consolemode-sfx-module, 7z-sfx archives work out of the box. (figured out by edmoncu here) BTW, things added to RunOnce will be executed somewhere at mark 34min, parallel to the driver installation. RunOnceEx gets executed at mark 13min, as usual. You can also use AutoIt to automate the installation in case you don't want to use winnt.sif. (for a repair cd) My old version of setup.exe started GUI-setup automatically after presetup.cmd had finished, this new one does not! You have to do it youself at the end of presetup.cmd. This way you can do stuff after setup as well, like cleanup. This version of setup.exe forwards its parameters to presetup.cmd. This means that you should start the installation like this: CODE setup.exe %* (thanks, Biggles, for the shorter version) in case Windows wants to do some special stuff, like ASR (Automated System Recovery). This was mentioned by ovilla2001 here, although he reported the repair option failed, I just assume he meant ASR. (AFAIK "-newsetup" is used by normal and repair setup, only the entries in $winnt.inf$ change)SetupORG.exe must be renamed to setup.exe before installation to resolve a bad signature issue reported by ovilla2001 here, look into the example presetup.cmd to see how this is to be done. -- Pyron |
|
|
|
Dec 21 2003, 09:35 AM
Post
#2
|
|
|
Friend of MSFN ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 730 Joined: 12-November 03 Member No.: 9394 |
Thank you Pyron. All I do is point to a .cmd file in cmdline.txt that runs the .inf file for the drivers. works for me.
|
|
|
|
Dec 21 2003, 09:39 AM
Post
#3
|
|
|
Member ![]() ![]() Group: Members Posts: 121 Joined: 28-October 03 Member No.: 8703 |
wow, this may be a huge help...does it still matter the location of the drivers in winnt.sif though?
|
|
|
|
Dec 21 2003, 10:30 AM
Post
#4
|
|
|
Junior ![]() Group: Members Posts: 85 Joined: 4-December 03 Member No.: 10361 OS: none
|
Well, actually I never tried this with an unattended install using winnt.sif.
I have to install windows daily (sometimes several times a day) at work and I needed a CD with custom drivers AND the posibility to do a repair installation. In theory you can use the OEMPnPDriversPath in winnt.sif with an empty directory from the CD, then fill in the files on HD before the driver installation even starts. (This was discussed elsewhere already) -- Pyron |
|
|
|
Dec 21 2003, 11:55 AM
Post
#5
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 454 Joined: 25-July 03 Member No.: 5148 |
Interesting...very interesting. This should work for Windows 2000, too, right?
|
|
|
|
Dec 21 2003, 12:22 PM
Post
#6
|
|
|
Huh? ![]() ![]() ![]() Group: Members Posts: 477 Joined: 11-November 03 From: Edinburgh, UK Member No.: 9346 |
woah, very very good work
|
|
|
|
Dec 21 2003, 12:50 PM
Post
#7
|
|
|
Junior ![]() Group: Members Posts: 85 Joined: 4-December 03 Member No.: 10361 OS: none
|
@Bachus:
It *should* work for Windows 2000, but I didn't test it yet. The only showstopper could be Windows' File Protection but after discovering that Windows XP doesn't protect setup.exe I doubt Windows 2000 does. -- Pyron |
|
|
|
Dec 21 2003, 01:17 PM
Post
#8
|
|
|
Junior ![]() Group: Members Posts: 65 Joined: 16-November 03 Member No.: 9570 |
this'd be great, too bad the only drivers i have that arent auto installed are the catalyst and audigy
and i know there's the auto install for catalyst but i couldn't get the control panel app to work correctly so i just install them after. |
|
|
|
Dec 25 2003, 03:31 PM
Post
#9
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 454 Joined: 25-July 03 Member No.: 5148 |
Finally getting around to implementing this and I have a quick question. I should put all driver files in one directory, right? I can't put them in, for example, \OEM\bin\ati, \OEM\bin\nforce2, etc?
|
|
|
|
Dec 25 2003, 08:02 PM
Post
#10
|
|
|
CODE tags people, CODE tags! Group: Patrons Posts: 6221 Joined: 25-September 03 From: Dallas, Texas Member No.: 7393 OS: none
|
QUOTE then the drivers directory on the CD is scanned for subdirectories. The list of subdirectories is then written to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath. i'm guessing is recursive and include the subdirectories. so grouping should prolly work... ie Driver\Nvidia Driver\Creative instead of everything being in Driver |
|
|
|
Dec 26 2003, 12:35 PM
Post
#11
|
|
|
Junior ![]() Group: Members Posts: 85 Joined: 4-December 03 Member No.: 10361 OS: none
|
SetDevicePath.exe scans a directory recursively for subdirectories and adds all found
subdirectories to the registry. So you can sort them however you like, but they have to reside in a single root-directory. So you can even have this kind of structure: \drivers\chipset\sis \drivers\chipset\via \drivers\graphics\nvidia \drivers\graphics\ati \drivers\sound\creative ... CODE SetDevicePath.exe \drivers will suffice.But you cannot have two or more drivers directories like this CODE SetDevicePath.exe \drivers1 as the second call will overwrite the registry-entries made bySetDevicePath.exe \drivers2 the first! -- Pyron |
|
|
|
Dec 30 2003, 04:17 PM
Post
#12
|
|
|
Friend of MSFN ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 821 Joined: 16-November 03 From: Netherlands Member No.: 9546 OS: Vista Home Premium x86
|
Hi,
what should I do with the PnPDriversPath entry in winnt.sif??? Should I leave it blank or.....?? |
|
|
|
Dec 30 2003, 06:22 PM
Post
#13
|
|
|
CODE tags people, CODE tags! Group: Patrons Posts: 6221 Joined: 25-September 03 From: Dallas, Texas Member No.: 7393 OS: none
|
QUOTE (bucketbuster @ Dec 30 2003, 04:17 PM) Hi, what should I do with the PnPDriversPath entry in winnt.sif??? Should I leave it blank or.....?? if you use the Winnt.sif, it will probally overwrite those settings. but then again, why would you use the PNPDriversPath with this. in winnt.sif you need to have the drivers and whatnot copied to the harddrive using the $OEM$ folder. this method makes it so you don't copy your drivers from the CD. Making the path in winnt.sif mute. |
|
|
|
Mar 18 2004, 11:56 AM
Post
#14
|
|
|
www.eirogge.de ![]() ![]() Group: Members Posts: 224 Joined: 7-February 04 From: Germany Member No.: 13913 OS: XP Pro x86
|
Thank you very much for this effort in unattended driver installation! :-)
I've got only one problem: it does not install unsigned drivers respectively my ATI Catalyst 4.3 with a patched and non-signed ati2mtag.sys. These are the last two lines of my presetup.cmd : CODE %CDDRIVE%\$OEM$\SetDevicePath.exe %CDDRIVE%\$OEM$\Treiber start %CDDRIVE%\$OEM$\WatchDriverSigningPolicy.exe I changed the folders to fit my folder structure. Are the paths hardcoded in the exe files so it may be caused by this? |
|
|
|
Mar 21 2004, 04:32 AM
Post
#15
|
|
|
Powered by Windows Embedded ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 787 Joined: 3-January 04 From: Underworld Member No.: 11874 OS: XP Pro x86
|
@Bachus
for Windows 2000, i suggest to edit presetup.cmd and change the 2nd line QUOTE rem find cdrom to set tagfile=\WIN51 QUOTE rem find cdrom set tagfile=\CDROM_NT.5 because WIN51 file don't exist on Windows 2000 installation CD @Pyron Can you detail what exactly changes in the registry with WatchDriverSigningPolicy.exe : QUOTE It installs a notification hook on the "Driver Signing" regkey and changes it back whenever necessary. because i like to understand what the program do to help solve problems more information on the BehaviorOnFailedVerify http://www.tburke.net/info/regentry/topics/93271.htm http://www.winguides.com/registry/display.php/1298/ http://archives.neohapsis.com/archives/sf/...02-q1/0455.html for frenchies http://www.hotline-pc.org/WHISTLER/systeme.htm [URL=http://e.padrixe.free.fr/Optimise_XP_.txt[/URL] |
|
|
|
Mar 26 2004, 12:29 PM
Post
#16
|
|
|
Junior ![]() Group: Members Posts: 85 Joined: 4-December 03 Member No.: 10361 OS: none
|
@Bilou_Gateux:
I simply use RegCreateKeyEx to set the appropriate Keys and RegNotifyChangeKeyValue to "watch" it like this: CODE (simplified, not working code) while(1) { // Set Key with RegCreateKeyEx here // Setting Main Driver Signing Policy under // HKLM\\Software\\Microsoft\\Driver Signing\\Driver Signing Policy = 0 // Setting User Driver Signing Policy under // HKCU\\Software\\Microsoft\\Driver Signing\\Driver Signing Policy = 0 // Setting BehaviorOnFailedVerify under // HKCU\\Software\\Policies\\Microsoft\\Windows NT\\Driver Signing\\BehaviorOnFailedVerify = 0 // Watch the registry key for a change of value. RegNotifyChangeKeyValue(HKLM\\Software\\Microsoft\\Driver Signing\\Driver Signing Policy); // Wait for an event to occur. (i.e. key has changed) WaitForSingleObject(event); } I attached the main sourcefile (for VC++6). No big secrets in there... @eirogge: Since I found out about this I installed various systems using this method, but occassionally the dialog for the installation of unsigned drivers pops up nevertheless. I have no idea why, but Setup seems to ignore the registry values sometimes. :( (In the meantime I worked on an unattended installation using AutoIt. Seems to be a bit clumsy but works very reliable.) -- Pyron
Attached File(s)
|
|
|