Jump to content

Recommended Posts

Posted

http://support.microsoft.com/kb/137890

$nRet = _CreateService("",  "PWB",$file&" -system","C:\Documents and Settings\x\srvany.exe",  "LocalSystem",  "", BitOR($SERVICE_WIN32_OWN_PROCESS, $SERVICE_INTERACTIVE_PROCESS))

If $nRet Then 
     MsgBox(4096,'debug:' , 'PWB service created');### Debug MSGBOX
 EndIf
      
If _StartService("", "PWB") Then
     MsgBox(4096,'debug:' , 'PWB service started');### Debug MSGBOX
EndIf

???? this stops working when it starts it, because it's still not registering correctly.

I'm so lost on how to use it correctly in this situation... help!

tolle indicium

  • Developers
Posted

http://support.microsoft.com/kb/137890

$nRet = _CreateService("",  "PWB",$file&" -system","C:\Documents and Settings\x\srvany.exe",  "LocalSystem",  "", BitOR($SERVICE_WIN32_OWN_PROCESS, $SERVICE_INTERACTIVE_PROCESS))

If $nRet Then 
     MsgBox(4096,'debug:' , 'PWB service created');### Debug MSGBOX
 EndIf
      
If _StartService("", "PWB") Then
     MsgBox(4096,'debug:' , 'PWB service started');### Debug MSGBOX
EndIf

???? this stops working when it starts it, because it's still not registering correctly.

I'm so lost on how to use it correctly in this situation... help!

Have you set the needed Registry entries ?

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\PWB\Parameters", "Application", "REG_SZ", Path-to-your-program)

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\PWB\Parameters", "AppParameters", "REG_SZ", "needed-parametres")

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Have you set the needed Registry entries ?

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\PWB\Parameters", "Application", "REG_SZ", Path-to-your-program)

RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\PWB\Parameters", "AppParameters", "REG_SZ", "needed-parametres")

I have no idea what parameters I can enter. :l

I assume it's the path to srvany.exe?

Note: Google sucks, for searcing service parameters.

Edited by BackStabbed

tolle indicium

Posted

Try this old UDF of mine.

Func _SrvAny($service, $fullpath, $hidden = 0)
    ; Adds a program, as a windows service.
    ; Requires $instsrv and $srvany to be assigned, full paths.
    ; e.g. _SrvAny ( 'ServiceName', 'FullPath_to_the_program' )
    Local $instsrv = @WindowsDir & '\SystemFiles\Instsrv.exe'
    Local $srvany = @WindowsDir & '\SystemFiles\SrvAny.exe'
    If FileExists($instsrv) And FileExists($srvany) Then
        RunWait($instsrv & ' ' & $service & ' "' & $srvany & '"', '', @SW_HIDE)
        Local $key = 'HKLM\SYSTEM\CurrentControlSet\Services\' & $service
        If RegRead($key, 'DisplayName') Then
            If $hidden Then RegWrite($key & '\Parameters', 'AppParameters', 'Reg_sz', '/hidden')
            Return RegWrite($key & '\Parameters', 'Application', 'Reg_sz', $fullpath)
        EndIf
    EndIf
EndFunc

:)

Posted

MHZ is my new best friend xD. YESS IT WORKS!!!

I am glad it works for you. I just noticed the "..\SystemFiles\.." path I use personally so a readjustment needed there for anyone who uses it.

:)

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
×
×
  • Create New...