MSFN Forum: SOLVED: drivers from CD - MSFN Forum

Jump to content


  • 24 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

SOLVED: drivers from CD possible even without winnt.sif! Rate Topic: ***** 1 Votes

#1 User is offline   Pyron 

  • Junior
  • Pip
  • Group: Members
  • Posts: 84
  • Joined: 04-December 03

Posted 21 December 2003 - 08:38 AM

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


#2 User is offline   Spooky 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 718
  • Joined: 12-November 03

Posted 21 December 2003 - 09:35 AM

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 User is offline   stinkywea 

  • Member
  • PipPip
  • Group: Members
  • Posts: 107
  • Joined: 28-October 03

Posted 21 December 2003 - 09:39 AM

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

#4 User is offline   Pyron 

  • Junior
  • Pip
  • Group: Members
  • Posts: 84
  • Joined: 04-December 03

Posted 21 December 2003 - 10:30 AM

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 User is offline   Bachus 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 408
  • Joined: 25-July 03

Posted 21 December 2003 - 11:55 AM

Interesting...very interesting. This should work for Windows 2000, too, right?

#6 User is offline   Gism0 

  • Huh?
  • PipPipPip
  • Group: Members
  • Posts: 473
  • Joined: 11-November 03

Posted 21 December 2003 - 12:22 PM

woah, very very good work :)

#7 User is offline   Pyron 

  • Junior
  • Pip
  • Group: Members
  • Posts: 84
  • Joined: 04-December 03

Posted 21 December 2003 - 12:50 PM

@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 User is offline   disgraceful33 

  • Junior
  • Pip
  • Group: Members
  • Posts: 64
  • Joined: 16-November 03

Posted 21 December 2003 - 01:17 PM

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 User is offline   Bachus 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 408
  • Joined: 25-July 03

Posted 25 December 2003 - 03:31 PM

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 User is offline   Alanoll 

  • CODE tags people, CODE tags!
  • Group: Patrons
  • Posts: 5,496
  • Joined: 25-September 03

Posted 25 December 2003 - 08:02 PM

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

#11 User is offline   Pyron 

  • Junior
  • Pip
  • Group: Members
  • Posts: 84
  • Joined: 04-December 03

Posted 26 December 2003 - 12:35 PM

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 User is offline   bucketbuster 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 649
  • Joined: 16-November 03

Posted 30 December 2003 - 04:17 PM

Hi,

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

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

#13 User is offline   Alanoll 

  • CODE tags people, CODE tags!
  • Group: Patrons
  • Posts: 5,496
  • Joined: 25-September 03

Posted 30 December 2003 - 06:22 PM

bucketbuster, on Dec 30 2003, 04:17 PM, said:

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 User is offline   eirogge 

  • www.eirogge.de
  • PipPip
  • Group: Members
  • Posts: 218
  • Joined: 07-February 04

Posted 18 March 2004 - 11:56 AM

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 User is offline   Bilou_Gateux 

  • Powered by Windows Embedded
  • PipPipPipPipPip
  • Group: Members
  • Posts: 766
  • Joined: 03-January 04

Posted 21 March 2004 - 04:32 AM

@Bachus

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

Quote

rem find cdrom
set tagfile=\WIN51
to

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

#16 User is offline   Pyron 

  • Junior
  • Pip
  • Group: Members
  • Posts: 84
  • Joined: 04-December 03

Posted 26 March 2004 - 12:29 PM

@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 File(s)



#17 User is offline   Alanoll 

  • CODE tags people, CODE tags!
  • Group: Patrons
  • Posts: 5,496
  • Joined: 25-September 03

Posted 26 March 2004 - 03:02 PM

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 User is offline   eirogge 

  • www.eirogge.de
  • PipPip
  • Group: Members
  • Posts: 218
  • Joined: 07-February 04

Posted 30 March 2004 - 12:09 AM

Alanoll, on Mar 26 2004, 11:02 PM, said:

why did you modify ati2mag.sys?

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

#19 User is offline   RyanVM 

  • Like a big surly teddy bear.
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,661
  • Joined: 31-August 03

Posted 05 May 2004 - 08:11 PM

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 User is offline   RyanVM 

  • Like a big surly teddy bear.
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2,661
  • Joined: 31-August 03

Posted 05 May 2004 - 08:13 PM

Argh, so much information to absorb...:)

Share this topic:


  • 24 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

6 User(s) are reading this topic
0 members, 6 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy