Jump to content

Drivers Instalation in Post-Install stage (New Method)


Recommended Posts

Yes well that code is from older version which had bugs :| It was changed couple of times ;p

Anyways when you remove "&" from $DirOutputOnce &= $DirData you break it for sure :)

&= --> Concatenation assignment. e.g. $var = "one", and then $var &= 10 ($var now equals "one10")

In other words. New variable is being added to end of the current value. So it's nessecary.

Btw. have you tested new version of my program (0.6.7) in registrydevicepath method? I believe the limitation of 4096 chars isn't realy in place on WindowsXP and Windows 2003. As you can notice in log after all drivers get added i measure the line in registry and it says 12000 chars here! So check it out. Maybe it will work.

And how your code would be any diffrent then mine? If my code in Pro-S Hardware Standard hangs for you why my code in your use would be any diffrent? Or maybe you use SetupCopyOEMInf.exe from pyron and not my program (as you should know it has that function builtin in it? maybe it won't hang your system).


I thought about it and it seems you clearly didn't tried to use my program :P Try it first in both modes and check if it works :)

Edited by MadBoy
Link to comment
Share on other sites

You're main mistake was here. $path_to_drivers is used inside the loops and you had it diffrent then the value u used in Run Command. It seems to work. I also commented out DllCall as i don't like integrating drivers when i test. However make sure to test out my program :P It's realy good

$path_to_drivers = "C:\Windows"

$DirOutput = Run(@ComSpec & " /c DIR /A:D /S " & $path_to_drivers, '', @SW_HIDE, 2)

#include <Constants.au3>
Opt("ExpandEnvStrings", 1)
Opt("WinWaitDelay", 0)

$path_to_drivers = "C:\Windows"
$DirOutputOnce = 0

$DirOutput = Run(@ComSpec & " /c DIR /A:D /S " & $path_to_drivers, '', @SW_HIDE, 2)
While 1
$DirData = StdoutRead($DirOutput)
If @error Then ExitLoop
If $DirData Then
$DirOutputOnce &= $DirData
$DirOutputOnce = StringStripWS($DirOutputOnce, 3)
; Split output into array
$DirSplit = StringSplit($DirOutputOnce, @CRLF, 1)

$NrCopiedInfs = 0
For $i = 1 To $DirSplit[0]
If StringInStr($DirSplit[$i], $path_to_drivers) Then
$registrystring = StringSplit($DirSplit[$i], ": ", 1)
If $registrystring[0] = 2 Then; Testing amount of elements in array, if more then 2 Exits
If StringInStr($registrystring[2], $path_to_drivers) Then; Making sure that Drivers path exists in string
$drivers_directory = $registrystring[2]
$search_ini = FileFindFirstFile($drivers_directory & "\*.inf")
If $search_ini = -1 Then
$dll_exe = DllOpen("setupapi.dll")
While 1
$search_file = FileFindNextFile($search_ini)
$full_path_to_inf = $drivers_directory & "\" & $search_file
If @error Then ExitLoop
;$dll_result = DllCall($dll_exe, "int", "SetupCopyOEMInf", "str", $full_path_to_inf, "str", "", "int", 1, "int", 8, "str", "", "int", 0, "int", 0, "str", "")
$NrCopiedInfs = $NrCopiedInfs + 1
; If $logging_option = "Advanced" Then
; If @error = 0 Then
; _AddLineBox("Inf integration passed: " & $drivers_directory & "\" & $search_file)
; $NrCopiedInfs = $NrCopiedInfs + 1
; ElseIf @error = 1 Then
; _AddLineBox("Inf integration failed: " & $drivers_directory & "\" & $search_file)
; ElseIf @error = 2 Or @error = 3 Then
; _AddLineBox("Unknown return type or Function not found in DLL. Tell author about it!")
; EndIf
; EndIf
If $NrCopiedInfs = 1 Then MsgBox(4096, "", "SetupCopyOemInf method completed. " & $NrCopiedInfs & " driver was integrated.",5)
If $NrCopiedInfs = 0 Then MsgBox(4096, "", "SetupCopyOemInf method completed. No drivers were integrated.",5)
If $NrCopiedInfs <> 0 And $NrCopiedInfs <> 1 Then MsgBox(4096, "", "SetupCopyOemInf method completed. " & $NrCopiedInfs & " drivers were integrated.",5)

Link to comment
Share on other sites

Hi Madboy,

in these days I have tested lastest version of your application.

I have tested about 10 PCs with windows XP Pro, it works great.

I have put it with BTS Driverpack on my portable USB hard drive.

If necessary I modify ini file for path and it can recognize almost every hardware.

I have only find a little problem with a RAID controller.

It seems very difficult to recognize.

I have read you want create a client server version of your application, is it right?

I wait your answer

THX for your marvellous work

Link to comment
Share on other sites

@The Glimmerman: you're right. The code might not work. It works on Polish Windows XP version, but as i checked later on English versions are diffrent. So i changed some of the code in my last version. That's why it didn't worked for some ppl. I don't remember exactly now what i changed ;) Anyway, lemme know if maybe my application will work for you as you want it to.

@romsempire: i don't understand what you mean by client-server app. What i want to do is 2 applications. One that will help in setting up name/domain/adding users to administrators grp. Other one is just a bit more advanced version for detecting hardware. Unless you have more ideas that I should do.

Link to comment
Share on other sites

For client server application I mean you can implement a driver distribution server with all driverpacks.

you could combine this one with your new utilities for creating users, policies, etc.

Then you must implement client.

I can install client with silent install after windows installation.

The clients connect to server.

I can update drivers client without copy any driverpacks or connect USB portable hard drive. :thumbup

This technique can be applied in a LAN or in all computers connect to Web.

Today people remain PCs on all days.

I can install server at home. After I can update drivers PC I care with clients software.

Same manner is for creating users, policy, etc.

I think this a great idea for your application

Link to comment
Share on other sites

You're forgetting one thing :) What about LAN drivers? If LAN drivers are installed what you want to achieve can be simply done by Microsoft FileSharing? Either by using \\server\sharename or by using DriveMapping. If that's realy needed as for an option for my program then i can add it, just a bit busy atm and tired :) Kinda lost some motivation ;P

Link to comment
Share on other sites

I would lie if i would say i'm not thinking about it or preparing for that. But i can't do this alone. This requires a lot of work WWW(php,graphics,mysql), database building and the program itself to do it ;>

Edited by MadBoy
Link to comment
Share on other sites

Well... something like a scan of a http/ftp folder..


0. Loads INI configuration file

1. Scans Hardware on system

2. Creates list of hardware needed to be installed

2. Removes Hardware not present

3. Connects to http/ftp folder (username/pass or anonymous) to scan what drivers are available to download according to list created

4. Downloads only pertinent drivers for that system to a predefined location on the hard drive (not all drivers at the folder location)

5. Install Drivers for specific hardware

So kinda like how it is now but instead of connecting to a local drive or mapped drive it's HTTP/FTP... Would you really need a DB to connect to?

Link to comment
Share on other sites

Well first i would have to add DB feature, either in file or other way. As right now the program just points directories where Windows can find drivers. And then Windows just looks in that dir for everything that matches.

It would have to look like this:

1. Scans HW on system

2. Creates lists of HW_ID's used on system and marks the ones that have no drivers installed

3. Connects to DB or reads file from WWW which is in lets say this format:

HW_ID, DriverName, DriverLocation

4. Downloads .zip from WWW for all needed drivers

5. Unpacks them to correseponding dirs.


6a. Adds drivers paths to registry and force Plug&Play redetection


6b. Uses devcon to force Windows to install new inf for specified device (risky method but i guess it's better one)


7. Reboot

That can be done. To make it even better program the DB should have Drivers Version Number so after comparision if OLDER that driver also could be updated (uses 6b or other function).


a) I would need help in DB/Drivers preparation (maybe i would have to make some program that would prepare zip's version for each device for easier download (i guess working together with Bashrat The Sneaky would be the best option here so we wouldn't double it up)

B) I would need some beta-testers :)

To clarify, autoit has option to use Mysql so it wouldn't be that pain in the a**, but i guess to start with we can use just normal file as DB. I just wonder if Bashrat would be up to such project with me :) And in the meantime maybe some nice php, www developer will get in touch and can make some nice web for that :)

Link to comment
Share on other sites

  • 3 weeks later...

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