cypher175 Posted February 6, 2009 Share Posted February 6, 2009 How Could I use this UDF to make my script a functional windows service..?? Would i need to combine this UDF with the "Run your exe as Service UDF" http://www.autoitscript.com/forum/index.ph...c=80201&hl=How would you combine the 2 UDF's into 1 so your can use one script/app to install & run itself as a service..?? Link to comment Share on other sites More sharing options...
netegg Posted July 1, 2009 Share Posted July 1, 2009 the return value is only the number. Who would like to tell me what each one means? Thanks Link to comment Share on other sites More sharing options...
wraithdu Posted July 1, 2009 Share Posted July 1, 2009 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. Link to comment Share on other sites More sharing options...
PartyPooper Posted August 25, 2009 Share Posted August 25, 2009 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. Link to comment Share on other sites More sharing options...
PartyPooper Posted August 25, 2009 Share Posted August 25, 2009 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)? Link to comment Share on other sites More sharing options...
engine Posted September 25, 2009 Author Share Posted September 25, 2009 (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 typesGlobal Const $SERVICE_BOOT_START = 0x00000000Global Const $SERVICE_SYSTEM_START = 0x00000001Global Const $SERVICE_AUTO_START = 0x00000002Global Const $SERVICE_DEMAND_START = 0x00000003Global Const $SERVICE_DISABLED = 0x00000004Do 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 September 25, 2009 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 More sharing options...
PartyPooper Posted September 25, 2009 Share Posted September 25, 2009 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. Link to comment Share on other sites More sharing options...
engine Posted September 25, 2009 Author Share Posted September 25, 2009 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.aspxSo 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] Link to comment Share on other sites More sharing options...
wraithdu Posted September 25, 2009 Share Posted September 25, 2009 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. Link to comment Share on other sites More sharing options...
ninjabreath Posted February 8, 2010 Share Posted February 8, 2010 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 Link to comment Share on other sites More sharing options...
ninjabreath Posted February 8, 2010 Share Posted February 8, 2010 Forget it.... it isn't returning 0 now. I have no idea why, but as long as it works I'm happy. Link to comment Share on other sites More sharing options...
ninjabreath Posted February 8, 2010 Share Posted February 8, 2010 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. Link to comment Share on other sites More sharing options...
gcue Posted February 22, 2011 Share Posted February 22, 2011 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 Link to comment Share on other sites More sharing options...
engine Posted March 15, 2011 Author Share Posted March 15, 2011 Minor update. 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 More sharing options...
JDouglas60 Posted April 1, 2011 Share Posted April 1, 2011 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]) Link to comment Share on other sites More sharing options...
engine Posted April 3, 2011 Author Share Posted April 3, 2011 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] Link to comment Share on other sites More sharing options...
JDouglas60 Posted April 4, 2011 Share Posted April 4, 2011 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. Link to comment Share on other sites More sharing options...
engine Posted April 4, 2011 Author Share Posted April 4, 2011 Now you can translate the constants if want. 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 More sharing options...
HolmesShelock Posted May 14, 2011 Share Posted May 14, 2011 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] Link to comment Share on other sites More sharing options...
KeithAbbott Posted May 20, 2011 Share Posted May 20, 2011 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? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now