Jump to content

Recommended Posts

Posted

Thank you but I use Win7 32bits and I have this error :

_opendriver function failed error 1

I put porttalk.sys in the same folder.

Any idea ?

Posted

Thank you but I use Win7 32bits and I have this error :

_opendriver function failed error 1

I put porttalk.sys in the same folder.

Any idea ?

Yes, all.

It's my bad. I haven't anticipated all possible scenarios that could occur when somebody runs the example scripts. If run from within zip or DriverBeep.au3 alone without the driver it would make one step too much and that what you experience would happen. Solution is actually very simple (at least should be). Replace _UnInstallDriver() function from scripts with this function:

Func _UnInstallDriver($sDriver)
    Local $aCall = DllCall("advapi32.dll", "ptr", "OpenSCManager", _
            "ptr", 0, _ ; service control manager on the local computer
            "ptr", 0, _ ; SERVICES_ACTIVE_DATABASE
            "dword", 0x000F003F) ; SC_MANAGER_ALL_ACCESS
    If @error Or Not $aCall[0] Then
        Return SetError(1, 0, 0)
    EndIf
    Local $hSCManager = $aCall[0]

    $aCall = DllCall("advapi32.dll", "ptr", "OpenServiceW", _
            "ptr", $hSCManager, _
            "wstr", $sDriver, _
            "dword", 0x000F01FF) ; SERVICE_ALL_ACCESS

    If @error Or Not $aCall[0] Then
        DllCall("advapi32.dll", "ptr", "CloseServiceHandle", "ptr", $hSCManager)
        Return SetError(2, 0, 0)
    EndIf
    Local $hService = $aCall[0]

    $aCall = DllCall("advapi32.dll", "int", "ControlService", _
            "ptr", $hService, _
            "dword", 1, _ ; SERVICE_CONTROL_STOP
            "ptr*", 0)
    If @error Or Not $aCall[0] Then
;~      DllCall("advapi32.dll", "ptr", "CloseServiceHandle", "ptr", $hService)
;~      DllCall("advapi32.dll", "ptr", "CloseServiceHandle", "ptr", $hSCManager)
;~      Return SetError(3, 0, 0)
    EndIf

    $aCall = DllCall("advapi32.dll", "int", "DeleteService", "ptr", $hService)
    If @error Or Not $aCall[0] Then
        DllCall("advapi32.dll", "ptr", "CloseServiceHandle", "ptr", $hService)
        DllCall("advapi32.dll", "ptr", "CloseServiceHandle", "ptr", $hSCManager)
        Return SetError(4, 0, 0)
    EndIf

    DllCall("advapi32.dll", "ptr", "CloseServiceHandle", "ptr", $hService)
    DllCall("advapi32.dll", "ptr", "CloseServiceHandle", "ptr", $hSCManager)

    Return 1
EndFunc

The only difference is that two commented lines.

Works now? Speak person.

♡♡♡

.

eMyvnE

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