Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

SOLVED: drivers from CD

* * * * * 1 votes

  • Please log in to reply
465 replies to this topic

#1
Pyron

Pyron

    Junior

  • Members
  • Pip
  • 84 posts
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:
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.

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... :rolleyes:
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:
%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 :)), 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.

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.

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:
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.)

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:
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


How to remove advertisement from MSFN

#2
Spooky

Spooky

    Friend of MSFN

  • Members
  • PipPipPipPipPip
  • 718 posts
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.

#3
stinkywea

stinkywea

    Member

  • Members
  • PipPip
  • 107 posts
wow, this may be a huge help...does it still matter the location of the drivers in winnt.sif though?

#4
Pyron

Pyron

    Junior

  • Members
  • Pip
  • 84 posts
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

#5
Bachus

Bachus

    Advanced Member

  • Members
  • PipPipPip
  • 408 posts
Interesting...very interesting. This should work for Windows 2000, too, right?

#6
Gism0

Gism0

    Huh?

  • Members
  • PipPipPip
  • 473 posts
woah, very very good work :)

#7
Pyron

Pyron

    Junior

  • Members
  • Pip
  • 84 posts
@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

#8
disgraceful33

disgraceful33

    Junior

  • Members
  • Pip
  • 64 posts
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.

#9
Bachus

Bachus

    Advanced Member

  • Members
  • PipPipPip
  • 408 posts
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?

#10
Alanoll

Alanoll

    CODE tags people, CODE tags!

  • Patrons
  • 5,496 posts

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

#11
Pyron

Pyron

    Junior

  • Members
  • Pip
  • 84 posts
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
...

SetDevicePath.exe \drivers
will suffice.

But you cannot have two or more drivers directories like this
SetDevicePath.exe \drivers1
SetDevicePath.exe \drivers2
as the second call will overwrite the registry-entries made by
the first!

--
Pyron

#12
bucketbuster

bucketbuster

    Senior Member

  • Members
  • PipPipPipPip
  • 649 posts
Hi,

what should I do with the PnPDriversPath entry in winnt.sif???

Should I leave it blank or.....??

#13
Alanoll

Alanoll

    CODE tags people, CODE tags!

  • Patrons
  • 5,496 posts

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.

#14
eirogge

eirogge

    www.eirogge.de

  • Members
  • PipPip
  • 218 posts
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 :

%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?

#15
Bilou_Gateux

Bilou_Gateux

    Powered by Windows Embedded

  • Members
  • PipPipPipPipPip
  • 766 posts
@Bachus

for Windows 2000, i suggest to edit presetup.cmd and change the 2nd line

rem find cdrom
set tagfile=\WIN51

to

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 :

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.ne...opics/93271.htm
http://www.winguides...splay.php/1298/
http://archives.neoh...02-q1/0455.html
for frenchies
http://www.hotline-p...LER/systeme.htm
[URL=http://e.padrixe.free.fr/Optimise_XP_.txt[/URL]

#16
Pyron

Pyron

    Junior

  • Members
  • Pip
  • 84 posts
@Bilou_Gateux:

I simply use RegCreateKeyEx to set the appropriate Keys and RegNotifyChangeKeyValue to "watch" it like this:

(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

WatchDriverSigningPolicy.cpp

Attached Files



#17
Alanoll

Alanoll

    CODE tags people, CODE tags!

  • Patrons
  • 5,496 posts
the Driver Policy key is restet when GUI install starts, regardless of what it was set to previously.

unsigned don't get installed becuase of teh "score" they get is lower then any other matches.


why did you modify ati2mag.sys?

#18
eirogge

eirogge

    www.eirogge.de

  • Members
  • PipPip
  • 218 posts

why did you modify ati2mag.sys?

unlocking all 8 pixel pipelines on a radeon 9800se with the radeon 9800pro layout

#19
RyanVM

RyanVM

    Like a big surly teddy bear.

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,661 posts
So let me get this right. We're omitting the OEMPnPDriversPath from winnt.sif and are instead running a program which manually sets the path later in installation (and the path can be set to a CD or whatever). It would be a gigantic space and time saver if I could make a self-extracting solid RAR archive will all the driver files in it!

#20
RyanVM

RyanVM

    Like a big surly teddy bear.

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,661 posts
Argh, so much information to absorb...:)

#21
Alanoll

Alanoll

    CODE tags people, CODE tags!

  • Patrons
  • 5,496 posts
this is true, but if you wanted to save space on your disk, why would you install the drivers from the disk? They'd have to be in an uncompressed form.

And actually the Path is set right when Windows Setup starts (before the GUI part starts) same was when it imported from Winnt.sif


I dunno about time saver? I seems like it'd be easier to have the drivers easily editable on a disk, rather then change the drivers make sure structure is correct, and then recreate the archive.

#22
RyanVM

RyanVM

    Like a big surly teddy bear.

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,661 posts
There's two possibilities I'm seeing: First, you could save time by having the drivers install directly from the CD seeing as how they wouldn't need to be copied. Otherwise, you could compress them to save space and have them be extracted, possibly saving time as well since you'd be reading one contiguous file rather than thousands of small ones.

And I don't mind making an archive, I've got a fast computer :). Yes, I would leave them uncompressed on my hard drive.

#23
Alanoll

Alanoll

    CODE tags people, CODE tags!

  • Patrons
  • 5,496 posts
this is true....
you would have one file to copy over, but then you'd have to extract it would might take awhile depending on the size (a few minutes really).


so the real question comes down to , Speed vs. Size, as it always does :)

#24
RyanVM

RyanVM

    Like a big surly teddy bear.

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,661 posts
Just for the sake of experimenting, I made a solid RAR archive of my Drivers folder. It went from 102MB to 21MB! :)

So how would I make sure it executed before PnP device detection?

And if you did it that way, I could extract it to C:\Drivers and never even need to change my winnt.sif.

#25
Alanoll

Alanoll

    CODE tags people, CODE tags!

  • Patrons
  • 5,496 posts
use DetachdProgram

that should get it there before detection begins. I think anywayz...

Or maybe you could use a combined method of this and the rar. Use the setup and presetup.cmd files from this, but only to extract the archive, and then continue the setup.




3 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users


    Exalead (2)


How to remove advertisement from MSFN