Jump to content

DriverSigning UDF


engine
 Share

Recommended Posts

I was having problems using Adlib to click on windows driver signing popups, on some of my scripts. So I made a search on the web, trying to find a better solution. Turns out it's not as simple as changing a simple registry key! I eventually found this code written in C -> http://openvpn.net/archive/openvpn-users/2...1/msg00341.html Finally I decided to translate it to AutoIt so I could include it on my scripts. Turns out it really works!

So here is the result:

DriverSigning.au3

It works at least on Windows XP SP3. And Windows XP SP2 according to the original author. This code is around since 2004!

To use this UDF I recommend something like this:

#include "DriverSigning.au3"

; Backup current state
$iCU = RegRead("HKCU\Software\Policies\Microsoft\Windows NT\Driver Signing", "BehaviorOnFailedVerify")
$iLM = RegRead("HKLM\Software\Microsoft\Driver Signing", "Policy")
If Not @error Then
    $iLM = Number($iLM)
    _SetDriverSigning()
EndIf

; Do your stuff here

Func OnAutoItExit()
    ; Restore back to original state
    If $iLM <> "" Then _SetDriverSigning($iLM, $iCU)
EndFunc

This way you won't even see the popup!

Enjoy!

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

It's missing Then in line:

If Not @error Then _SetDriverSigning()

Other then that it works great. Thank You very much!! I looked for this for years to put this in my program (Pro-S Hardware Installer)!!

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

Thanks.

Looks like that registry key "HKCU\Software\Microsoft\Driver Signing" doesn't work from my Windows Unattended. I checked and it doesn't even exist. It's written when you change driver signing policy under Windows, so it works from regular Windows. Also there is another key ("HKCU\Software\Policies\Microsoft\Windows NT\Driver Signing", "BehaviorOnFailedVerify"). But writing to it makes no difference under my tests. However I will include it in the next release.

Regards.

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

Updated.

Now can set both at the user level and at the machine level.

This is based on the behavior observed in Windows XP.

Here is an example of my script to install Virtual CloneDrive.

#cs ----------------------------------------------------------------------------

 AutoIt Version:    3.2.12.0
 Language:          Multi
 Platform:          Multi
 Author:            engine

 Script Function:
    Install Virtual CloneDrive

#ce ----------------------------------------------------------------------------

$installdir = @ProgramFilesDir & "\Elaborate Bytes\VirtualCloneDrive" ; Set your prefered install location here
$desktop = 0 ; Set the value to "0" to disable the Desktop icon

$AutoMount = 0 ; Automount last image
$bufferedIO = 1
$NumberOfDrives = 1
$VirtualSheep = 1
$LocaleName = "EN" ; Two letter language code from list below

#cs List of available languages

"AR"    Arabic
"CZ"    Czech
"DE"    Deutch
"EL"    Greek
"EN"    English
"FR"    French
"IT"    Italiano
"JP"    Japanese
"PL"    Polish
"RU"    Russian
"SK"    Slovak

#ce List of available languages

#cs ----------------------------------------------------------------------------

Script Start!

#ce ----------------------------------------------------------------------------

#NoTrayIcon

#include <Misc.au3>
#include "..\..\Include\DriverSigning.au3"

_Singleton("Virtual CloneDrive AutoIt v3 Script 1.0", 0) ; It's already running

; Options
AutoItSetOption("WinDetectHiddenText", 1)
AutoItSetOption("WinTitleMatchMode", 4)
AutoItSetOption("WinWaitDelay", 1)

; Search for the installer
$search = FileFindFirstFile(@ScriptDir & "\*VirtualCloneDrive*.exe")
$vcd = FileFindNextFile($search)
FileClose($search)

$iCU = RegRead("HKCU\Software\Policies\Microsoft\Windows NT\Driver Signing", "BehaviorOnFailedVerify")
$iLM = RegRead("HKLM\Software\Microsoft\Driver Signing", "Policy")
If Not @error Then
    $iLM = Number($iLM)
    _SetDriverSigning()
EndIf

; Run the installer
RunWait(@ScriptDir & "\" & $vcd & ' /S /D="' & $installdir & '"')

; Delete desktop icon
If $desktop = 0 Then FileDelete(@DesktopCommonDir & "\Virtual CloneDrive.lnk")

; Write settings to the registry
$KEY = "HKLM\SOFTWARE\Elaborate Bytes\VirtualCloneDrive"
RegWrite($KEY, "AutoMount", "REG_DWORD", $AutoMount)
RegWrite($KEY, "bufferedIO", "REG_DWORD", $bufferedIO)
RegWrite($KEY, "NumberOfDrives", "REG_DWORD", $NumberOfDrives)
RegWrite($KEY, "VirtualSheep", "REG_DWORD", $VirtualSheep)
RegWrite($KEY & "\Settings", "LocaleName", "REG_SZ", $LocaleName)
RegWrite("HKCU\Software\Elaborate Bytes\VirtualCloneDrive\Settings", "LocaleName", "REG_SZ", $LocaleName)

; Make settings active immediately
Run($installdir & "\VCDPrefs.exe", "", @SW_HIDE)
WinWait("[TITLE:Virtual CloneDrive; CLASS:TMainForm]", $NumberOfDrives)
ControlClick("[TITLE:Virtual CloneDrive; CLASS:TMainForm]", $NumberOfDrives, "TButton1")

Exit

Func OnAutoItExit()
    If $iLM <> "" Then _SetDriverSigning($iLM, $iCU)
EndFunc

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

  • 1 month later...
  • 1 month later...

any chance anyone knows a method to install only the driver for Virtual CloneDrive, and nothing else?

that driver can be used with the exellent buring program imgburn

Use devcon.exe (get it from Microsoft website). It should be able to do what you need.

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

Use devcon.exe (get it from Microsoft website). It should be able to do what you need.

I have allready tried that road.

Used uniextractor on the nsis package and inside there it was a driver folder.

Then I used this command:

devcon.exe install VClone.inf @ROOT\SCSIADAPTER\0000

Device node created. Install is complete when drivers are installed...

Updating drivers for @ROOT\SCSIADAPTER\0000 from C:\Documents and Settings\Admin

istrator\Skrivebord\imgburn\SetupVirtualCloneDrive5\Ó\VClone.inf.

devcon.exe failed.

Link to comment
Share on other sites

hehe.

think I got it:

devcon.exe install VClone.inf ROOT\vclone

Edit:

nope. seems to still be something missing...

I 11:45:05 ELBYCDIO.DLL - Elaborate Bytes CDRTools - ElbyCDIO DLL - Version 6.0.7.0

E 11:45:05 ElbyCDIO_InitScsi Failed!

E 11:45:05 Reason: Kernel Mode driver not loaded - try rebooting your machine

Edited by thor918
Link to comment
Share on other sites

  • 2 months 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...