Sign in to follow this  
Followers 0
Micha1405

Dll Call Problem Plzzzzz.. Help Me

9 posts in this topic




can anyone help me with this problem ?

http://www.autoitscript.com/forum/index.ph...t=0#entry176066

it will not work :think:

Doesn't belong in Idea lab... moved


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

slight mod to Larry's post

$ptr=DllStructCreate("dword;char[260];char[260];char[260]")
$signed=DllCall("setupapi.dll","int","SetupVerifyInfFile","wstr",@WindowsDir & "\inf\machine.inf", _
    "ptr",0,"ptr",DllStructGetPtr($ptr))

If $signed[0] Then
  MsgBox(0,"Signed?",DllStructGetData($ptr,2) & @LF & DllStructGetData($ptr,3) & @LF & DllStructGetData($ptr,4))
Else
  MsgBox(0,"Error","DllCall")
Endif
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

thx gafrost for fast reply! but it will not work with signed or unsigned driver

Share this post


Link to post
Share on other sites

thx gafrost for fast reply! but it will not work with signed or unsigned driver

http://msdn.microsoft.com/library/default....rifyinffile.asp

make sure you meet the requirements at the bottom of the page.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanks for helping, is it right that ther must be a server ? or can it run only on a standalone XP client ?

sorry for the bad english i'm from germany

Share this post


Link to post
Share on other sites

Thanks for helping, is it right that ther must be a server ? or can it run only on a standalone XP client ?

sorry for the bad english i'm from germany

you can run it on XP client.

think you might want to google on SetupVerifyInfFile


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

i have XP with SP2 and this script to check 2 drivers with $TestInf1 and $TestInf2.

Script:

$TestInf1="E:\Drivers\AtiFireGL500\CX_30107.inf"

;$TestInf2="E:\Drivers\PDA Driver\wceusbsh.inf"

$ptr=DllStructCreate("dword;char[260];char[260];char[260]")

$signed=DllCall("setupapi.dll","int","SetupVerifyInfFile","wstr",$TestInf1, "ptr",0,"ptr",DllStructGetPtr($ptr))

If $signed[0] Then

MsgBox(0,"",$signed[0]) ;debug only

MsgBox(0,"Signed?",DllStructGetData($ptr,2) & @LF & DllStructGetData($ptr,3) & @LF & DllStructGetData($ptr,4))

Else

MsgBox(0,"Error","DllCall")

Endif

both value of $signed[0] will return 1 but $TestInf1 is not signed and $TestInf2 is signed

Edited by Micha1405

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

:think: another solution:

here is my script to check hardware driver is signed or not:

; AutoIt Version: Beta 3.1.110

; Author: michael.hiss@gmx.de

;

; Script Function:

; check driver is signed or not / required chktrust.exe

; ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

#include <Constants.au3>

Dim $DriverDir="c:\mydriver"

Dim $app="Check driver is sign"

Dim $catFile,$TestInf,$rc,$signed

_main();start program

;----------------------------functions------------------------------------------------

func _Main()

$mainForm=GUICreate($app,400,150)

$button1=GUICtrlCreateButton("Select inf File",20,80)

$Label1=GUICtrlCreateLabel("Cat File:",20,15)

$CatLabel=GUICtrlCreateLabel("",20,50,350,20,BitOr($SS_SIMPLE,$SS_SUNKEN))

$Statuslabel=GUICtrlCreateLabel("",0,130,400,20,BitOr($SS_SIMPLE,$SS_SUNKEN))

if not FileExists(@ScriptDir&"\chktrust.exe") Then

MsgBox(64,$app,"File checktrust.exe is not aviable!" &chr(10) &"Please copy 'chktrust.exe' in your scriptdir")

Exit

EndIf

GUISetState(@SW_SHOW)

;

While 1;Run Gui until it closed

$msg = GUIGetMsg()

Select

case $msg=$button1

GUICtrlSetData($CatLabel,"")

GUICtrlSetData($Statuslabel,"")

$TestInf=FileOpenDialog("Select inf File",$DriverDir,"Inf Files (*.inf)", 1 + 4 )

If @error Then

MsgBox(4096,"","No inf file chosen")

Else

$catFile=_RetrieveCatFile($catFile)

if $catFile<>"" then

GUICtrlSetData($CatLabel,@WorkingDir&"\"&$catFile)

if not FileExists(@ScriptDir&"\chkdriver.cmd") then _WriteTempCMD()

_CheckSigned()

GUICtrlSetData($Statuslabel,"Driver "&StringTrimRight($signed,2))

Else

GUICtrlSetData($Statuslabel,"Driver not signed catalogfile file not exist")

EndIf

EndIf

case $msg=$GUI_EVENT_CLOSE

Exit

EndSelect

WEnd

EndFunc

Func _RetrieveCatFile($catFile)

$catFile=IniRead($TestInf,"Version","CatalogFile","NotFound")

if $catFile="NotFound" Then

$catFile=IniRead($TestInf,"Version","CatalogFile.NT","")

if $catFile="" Then

MsgBox(0,"","No Catalog File in inf")

Else

EndIf

EndIf

return $catFile

EndFunc

func _CheckSigned()

$command =@ScriptDir&"\chkdriver.cmd"&" "& @WorkingDir&"\"& $catFile

$rc = Run(@ComSpec & " /c "&$command,@WorkingDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

$signed = StdoutRead($rc)

return $signed

EndFunc

Func _WriteTempCMD()

$Cmdfile=FileOpen(@ScriptDir&"\chkdriver.cmd",2)

FileWriteLine($Cmdfile,"@echo off")

FileWriteLine($Cmdfile,"%CD%\chktrust.exe -q %1 >nul")

FileWriteLine($Cmdfile,"if %errorlevel%==1 goto NoTrust")

FileWriteLine($Cmdfile,"echo is signed")

FileWriteLine($Cmdfile,"goto end")

FileWriteLine($Cmdfile,":NoTrust")

FileWriteLine($Cmdfile,"echo not signed")

FileWriteLine($Cmdfile,":end")

FileClose($Cmdfile)

EndFunc

Edited by Micha1405

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0