Jump to content

Recommended Posts

  • 4 months later...
Posted

Have you gone soft? No one has any idea what you mean. You haven't specified a function you're trying to use or anything. Moreover, all the return codes are well documented in the UDF source.

  • 1 month later...
Posted

There is an error in:

Func _Service_QueryStatus($sServiceName, $sComputerName = "")
    Local $hSC, $hService, $tSERVICE_STATUS_PROCESS, $avQSSE, $iQSSE, $aiStatus[9]
    $hSC = OpenSCManager($sComputerName, $SC_MANAGER_CONNECT)
    $hService = OpenService($hSC, $sServiceName, $SERVICE_QUERY_STATUS)
    CloseServiceHandle($hSC)
    $tSERVICE_STATUS_PROCESS = DllStructCreate("dword[9]")
    Local $avQSSE = DllCall( "advapi32.dll", "int", "QueryServiceStatusEx", _

You've declared avQSSE twice. You have a couple of options, however, I've simply removed "Local" from the "Local $avQSSE = DllCall" line for my script.

P.S. Good UDF and thanks for sharing and all the work you've put into it.

Posted

Not that I need it right now, but I noticed Vista has a "delayed autostart" option that's not taken into account in your current service start types:

; Service start types

Global Const $SERVICE_BOOT_START = 0x00000000

Global Const $SERVICE_SYSTEM_START = 0x00000001

Global Const $SERVICE_AUTO_START = 0x00000002

Global Const $SERVICE_DEMAND_START = 0x00000003

Global Const $SERVICE_DISABLED = 0x00000004

Do you have any plans to add it sometime in future (just concerned that it may use one of the pre-existing values above which will end up breaking scripts)?

  • 5 weeks later...
Posted (edited)

Not that I need it right now, but I noticed Vista has a "delayed autostart" option that's not taken into account in your current service start types:

; Service start types

Global Const $SERVICE_BOOT_START = 0x00000000

Global Const $SERVICE_SYSTEM_START = 0x00000001

Global Const $SERVICE_AUTO_START = 0x00000002

Global Const $SERVICE_DEMAND_START = 0x00000003

Global Const $SERVICE_DISABLED = 0x00000004

Do you have any plans to add it sometime in future (just concerned that it may use one of the pre-existing values above which will end up breaking scripts)?

Hi.

Can you tell me the msdn webpage for that?

PS: The error you mentioned is corrected now. Thanks for reporting it.

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]

Posted

Hi.

Can you tell me the msdn webpage for that?

PS: The error you mentioned is corrected now. Thanks for reporting it.

Unfortunately, no. I simply noticed it on my laptop (Vista Home). Along with all the normal service start options, it has a "delayed start" one too.

Posted

Unfortunately, no. I simply noticed it on my laptop (Vista Home). Along with all the normal service start options, it has a "delayed start" one too.

Current available information still stands. Please check -> http://msdn.microsoft.com/en-us/library/ms790708.aspx

So I am sorry, at the moment "delayed start" can't be supported.

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

Posted

It's not a new value for $SERVICE_ constants. On my Win7 system, 'Delayed Start' services have a registry 'Start' value of 2 (Automatic) and a new REG_DWORD value 'DelayedAutoStart' set to 1.

  • 4 months later...
Posted

Great UDF. I use it all the time.

I ran into a bug with _Service_EnumDependent that I can't figure out.

The first value returned for the Service Name is 0. All the other values returned are what they should be.

Any help would be greatly appreciated.

#include 'Privilege.au3'
#include 'Services.au3'

$result = _Service_EnumDependent('winmgmt')

For $i = 1 To $result[0][0]
    MsgBox(0, '', $result[$i][0])
Next
Posted

Ok, so I though it was working, but not really. It returns the 0 sporadically, but just for the Service Name. The Service Display Name populates just fine, as well as the other attributes of the service. Testing it on remote XP machines from a Win7 and an XP machine. I need to get all the processes that the WMI service is using so I can stop it, then restart it.

  • 1 year later...
Posted

im a bit confused...

when i use _Service_QueryConfig on a service that's configured to MANUAL, i get a return value for $SERVICE_AUTO_START when i expect to get a return value of $SERVICE_DEMAND_START

so when i try to use _Service_SetStartType and use $SERVICE_AUTO_START, it sets the service to AUTOMATIC (as expected)

*using winxp pro sp3

  • 3 weeks later...
  • 3 weeks later...
Posted

Is the function _Service_QueryStatus supposed to return words or codes?

In the simple test below on Win XP and Server2008, the value of $result[1] is always the return code.

I can work with the codes ok.. just got the impression that it should return the actual status such as "Running"

#include <Services.au3>

$svc=("Spooler")

$result=_Service_QueryStatus($svc)

MsgBox(0,"Status",$result[1])

Posted

Read the notes before the function.

$Array[1] - The current state of the service. Can be one of the following values:

; $SERVICE_STOPPED - The service has stopped.

; $SERVICE_START_PENDING - The service is starting.

; $SERVICE_STOP_PENDING - The service is stopping.

; $SERVICE_RUNNING - The service is running.

; $SERVICE_CONTINUE_PENDING - The service is about to continue.

; $SERVICE_PAUSE_PENDING - The service is pausing.

; $SERVICE_PAUSED - The service is paused.

$Array[1] Returns one of the constants defined on top of the UDF:

; Service state
Global Const $SERVICE_STOPPED = 0x00000001
Global Const $SERVICE_START_PENDING = 0x00000002
Global Const $SERVICE_STOP_PENDING = 0x00000003
Global Const $SERVICE_RUNNING = 0x00000004
Global Const $SERVICE_CONTINUE_PENDING = 0x00000005
Global Const $SERVICE_PAUSE_PENDING = 0x00000006
Global Const $SERVICE_PAUSED = 0x00000007

Microsoft designed it this way.

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

Posted

Thanks for the quick relpy.

I did read/understand the constants in the UDF, just needed a confirmation that your function was not designed to translate the constants to verbiage. Great script and very useful - thanks for posting it.

  • 1 month later...
Posted

I'm using the following piece of code

#include<Services.au3>
$sServiceName = "AAAA"
$sDisplayName = "AAA"
_Service_Create($sServiceName, $sDisplayName, $SERVICE_INTERACTIVE_PROCESS, $SERVICE_AUTO_START, $SERVICE_ERROR_IGNORE, "C:\WINDOWS\SYSTEM32\CALC.EXE", Default, Default, Default, Default, Default, Default)
MsgBox(0, "", @error)

But it's returning ERROR: 6 which means ERROR_INVALID_HANDLE according to MSDN. Any suggestions, please?

[size="2"][font="arial, verdana, tahoma, sans-serif"]ProtectData - A Data Protection software for floppies[/font][/size] [size="2"][hr][/size][size="2"]Sessionchange - A Windows service capable of tracking session change events[/size][size="2"][b][/b][/size]

Posted

If I stop a service using the _Service_Stop function, does the function wait to return control until the service has stopped, or does it return control while the service is in the process of stopping? Same question for _Service_Start, does the function wait to return control until the service has started, or does it return control while the service is in the process of starting?

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