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:
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:
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.
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:
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:
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 ), you have to extract them into a directory on HD, then run SetDevicePath.exe on that directory. Note that you can sort your drivers into as many subdirectories as you like and you can have as many driverpacks as you like, as long as you extract them under a single directory, because SetDevicePath.exe takes only one parameter.
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.
(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:
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:
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.)
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:
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.