Jump to content

Drivers/hardware Installer


MadBoy
 Share

Recommended Posts

This little project was written some time ago and is unfinished (as there are probably a lot of things that could be done with it). It works as far as i tested and i would appreciate any tests/advices/suggestions to either my code or the program itself.

What the program is for:

After you install Windows on your computer usually you have to install drivers. One will say you can put drivers on Windows CD and skip that part but i don't realy like that way. What i did was dividing Computer installation into 4 parts. 1st is instalation of Windows, 2nd installation of drivers, 3rd giving computer name/domain and 4th installing software. In this thread 2nd part is covered (3rd i'm trying to build and 4th is done but it would require a lot of work if someone would want to adapt it for himself/his company.)

After compilation you need: Hardware.exe file and Hardware.ini file with settings (same dir). Hardware.ini is generated on first program use or when no hardware.ini is found.

To compile: 7z.exe, devcon32.exe, devcon64.exe.

Those files are attatched to this post but if you would prefer to get it from the official sources just download 7zip and copy 7z.exe and download devcon from microsoft webpages and rename binaries to corespond 32 and 64bit naming.

So far program works with following routine:

1. Checks if hardware.ini is in the right dir. (tested)

2. Checks if path to drivers realy exists (tested)

3. Turns off policy for driver signing (not realy working ;p)

4a. Sets right Device Path in registry to drivers (both 32/64) - (needs testing on 64)

or

4b. Uses SetupCopyOemInf

5. Removes all uknown devices from system (both 32/64) (uses Devcon.exe by Microsoft) - (needs testing on both)

6. Forces system to detect plug&play devices (both 32/64) - (needs testing on both)

7. Sets back registry settings for:

a. Sets default device path in registry - (tested on 32, needs testing on 64)

b. Sets default registry settings for driver signing (TURNS IT ON) - (not realy working ;p)

Hardware.ini settings:

[iNFO]

Start=Manual --> Manual or Auto (manual requires you to press button)

Mode=Standard --> Standard/Unattended/CommandLine (for now only Standard works ;p)

Drivers_drive=REMOVABLE --> CDROM/REMOVABLE or simply drive letter (without : )

Drivers_dir=\All_Drivers --> path on drive

Device_manager=On --> On/Off - Device Manager (to monitor what's happening with devices)

Method=RegistryDevicePath --> RegistryDevicePath (4096 chars max into registry)/SetupCopyOemInf

Logging_to_file=Yes ---> Yes/No - logging to file :D

Logging_option=Advanced --> Simple/Full - full might be slower but usefull for debugging.

Drivers_Packed=No --> Rar/7zip/No --> Packed or not. Set it here.

Copy_drivers=No --> If you wish to copy drivers to your drive before program starts working (Yes/No)

Copy_where=C:\Drivers --> Path where to copy drivers

Delete_drivers=No --> Yes/No - do you want to delete drivers on program close.

Create_backup=No --> Create backup of drivers dir from C:\Windows .. maybe someone got better idea?

Leave_registry_entries=No --> Yes or No (not working yet, just an option). Will be usefull for leaving registry entries (from RegistryDevicePath) in system. So you can use them without problems after reboot (some devices/drivers requires reboot to work)

Problems to solve:

- Signing of drivers isn't 100% working. Unfortunetly Microsoft implemented it the way it can't be realy done just by registry. Tests shown that also during change from Warn to IGNORE mode (My Computer -> Properties -> Hardware -> Driver Signing) besides standard registry keys that can be found all over the internet this key below also changes. On my computer it has 2 values (one for IGNORE and one for WARN). So unless i'll find a way to fix it.. Bummer. Maybe someone has some nice idea? Each computer has their own diffrent keys so it's not that simple as i seen on other forums in some posts :oops:

- HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\PrivateHash 15 CA EF C3 34 E8 C8 78

- HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\PrivateHash 01 32 A3 68 55 C2 D2 00

Problem of signing drivers on unnatended cd doesn't exist because you can set the right value in winnt.sif or sysprep.inf. Or so i have read on Microsoft pages :) Oh well, we will see..

Explanation on RegistryDevicePath vs SetupCopyOemInf:

Orginally RegistryDevicePath and SetupCopyOemInf were written by pyron from MSFN forum. I rewrote them in AutoIt. RegistryDevicePath is nothing else but setting path of Drivers Dir that have .inf in the dir into registry. Keep in mind that reg key can be as long as 4096 chars (never realy got this confirmed but so they say). If you realy have a lot of dir in dirs in dirs with drivers or you just prefer the other way of implementing drivers you can use SetupCopyOemInf method. Oh well, i prefer RegistryDevicePath method ;p

Btw. if you're going to compile the source yourself remember to update FileInstall paths or it wont' realy work.

Least but not last wanted to thank a lot of ppl from this forum that made this possible. A lot of help came from BigDaddy, JdeB, Mhz, Smoke_N, th.meger, Valuater,vollyman, ChrisL, cameronsda, BigDod. If i skipped anyone, it wasn't intentional, lemme know :(

Hopefully all is clear, if not lemme know i'll try to explain better then. Please test it/check code. It prolly have lots of sloppy coding ;p

7z.zip

devcon32.zip

devcon64.zip

AngryMonitor.ico

hardware_v4.01.zip

hardware_0.4.0.au3

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

  • 3 years later...
  • 4 weeks later...

MadBoy

I can't get the latest version of Pro-S Hardware Professional from the msfn forum. I get this:

This domain is parked, pending renewal, or has expired.

Please contact the domain provider with questions.

Can you help me?

Thanks.

Edited by engine

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

Link to comment
Share on other sites

1st link relates to my question about it and it wasn't answered there. 2nd link solution doesn't work. However it's no longer an issue. I've some solution for that. Just no real time to implement it.

@Zetec452 and @engine

I'm working (very very slowly) to release new version. When it will be available i'll make sure to repost it in both places (using non-parked domain).

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

It's not much.. but it's always something :-) Full description at msfn

Changelog for 2.0.0.21 (public)

- Added function to automatically change Signed Drivers option to Ignore and restore it back to original value when done (window management not nessecary)

- Compiled to newest version with special options which should give some speed improvements

- Updated version of 7zip to 4.65 (it's too soon for beta 9.07 or so)

Version 2.0.0.21

pro-s_hardware_installer_2.0.0.21.exe

config file

Thanks engine for your work on signed drivers :-)

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

Hi MadBoy!

Thank you, your code is wonderfull.

With SetupCopyOEMinf method, i get popup "Files needed", it show below:

Type the path where is file located...

Copy file from:...

And when I browser to *.sys file, press "Ok", it still don't except this file.

When I use SetupCopyOEMinf.exe, everything OK. What's the problem?

I think you check again parameter in Dllcall():

$dll_result = DllCall($dll_exe, "int", "SetupCopyOEMInf", "str", $full_path_to_inf, "str", "", "int", 1, "int", 8, "str", "", "int", 0, "int", 0, "str", "")

Thank you!

Edited by john123
Link to comment
Share on other sites

  • 1 year 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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...