AzKay Posted November 8, 2008 Share Posted November 8, 2008 (edited) Any examples with this?This is trying to "Start" a compiled script with just "FileWrite("test.txt", "z") in it. Edited November 8, 2008 by AzKay # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
ProgAndy Posted November 8, 2008 Share Posted November 8, 2008 Possibly, you need to register a ServiceCtrlHandler http://msdn.microsoft.com/en-us/library/ms685054(VS.85).aspx *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
cypher175 Posted December 6, 2008 Share Posted December 6, 2008 is this Windows Services UDF, just to interact with windows services and not to make you script an actual service itself..??How would 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= Link to comment Share on other sites More sharing options...
cypher175 Posted December 6, 2008 Share Posted December 6, 2008 I have solved it :) I'm confused on how to use the _Service_QueryStatus to check the The current state of a service..?? How do get my script to MsgBox the current state of a service, and then do an if/then conditional function based on its state..?? $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. Link to comment Share on other sites More sharing options...
cypher175 Posted December 7, 2008 Share Posted December 7, 2008 can anyone help me out on my above post please..?? Link to comment Share on other sites More sharing options...
engine Posted December 7, 2008 Author Share Posted December 7, 2008 For example: #include "Services.au3" Dim $aiStatus = _ServiceQueryStatus($sYourService) If $aiStatus[1] = $SERVICE_STOPPED Then ; Do your stuff here EndIf 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...
cypher175 Posted December 8, 2008 Share Posted December 8, 2008 (edited) thanks engine, could you also give me an example on how to do _Service_Create() I tired a few times but my service never got registered.. this is what i was trying, whats wrong with it..?? #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", "", "", "", "", "", "") Edited December 8, 2008 by cypher175 Link to comment Share on other sites More sharing options...
engine Posted December 8, 2008 Author Share Posted December 8, 2008 (edited) Hi cypher175. Try: #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) Edited July 10, 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...
cypher175 Posted December 8, 2008 Share Posted December 8, 2008 (edited) I just tried both and "AAA" is still not showing up in the service manager..?? Edited December 8, 2008 by cypher175 Link to comment Share on other sites More sharing options...
engine Posted December 8, 2008 Author Share Posted December 8, 2008 (edited) Check the error code. For example: #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") MsgBox(0, "", @error) Edited December 8, 2008 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...
cypher175 Posted December 8, 2008 Share Posted December 8, 2008 its 87, whats that mean..?? Link to comment Share on other sites More sharing options...
engine Posted December 8, 2008 Author Share Posted December 8, 2008 http://msdn.microsoft.com/en-us/library/ms681382(VS.85).aspx 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...
cypher175 Posted December 8, 2008 Share Posted December 8, 2008 ERROR_INVALID_PARAMETER870x57 The parameter is incorrect.What parameter is incorrect..??all i did is was try the two codes you told me to do here... http://www.autoitscript.com/forum/index.ph...mp;#entry614296so whats incorrect about them..?? Link to comment Share on other sites More sharing options...
engine Posted December 8, 2008 Author Share Posted December 8, 2008 Let's remember your 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") MsgBox(0, "", @error)oÝ÷ Ù8^{Ú'ij¶¦z׫êÞÍ7é!T ÔÄD!QDàI-÷ZzÝý²·vØ^~éܶ*'uë®*mÜj·ºYrªê-xò¢ë)yÈÉèêôߤERb ßc4ôND¢½7é!TXwÙ!ÀDCÑ8!I©Ý¶¬z»âq謮éçx"Ø^rí{h~Ø^.,¬µéqÊ.ܨ¹Æ§j[(²üçèZ0x-ʴߤERSLD=$ë®øyƧ{^§-Â+a¶zÉ-¢êº^J¨ºÈhºW,y·Á秢w¨}º-íëj[^®v÷¬~í«ij¶¦z׫Nü¨»§·MúHDU !51$ÈTCÑ8!I«¢+Ù ¥Ñ=H ÀÌØíMIY% }]%8ÌÉ}=]9}AI= ML°ÀÌØíMIY% }%9QI Q%Y}AI= ML¤) ¥Ñ=H ÀÌØíMIY% }]%8ÌÉ}M!I}AI= ML°ÀÌØíMIY% }%9QI Q%Y}AI= ML¤oÝ÷ Ù:ò¶¬¢w±©ÞÅ©©æ®¶sb6æ6ÇVFRfÇCµ6W'f6W2æS2fwC°¢b33c·56W'f6TæÖRÒgV÷C´gV÷C°¢b33c·4F7ÆæÖRÒgV÷C´gV÷C°¥õ6W'f6Uô7&VFRb33c·56W'f6TæÖRÂb33c·4F7ÆæÖRÂ&Dõ"b33cµ4U%d4Uõtã3%ôõtåõ$ô4U52Âb33cµ4U%d4UôåDU$5DdUõ$ô4U52Âb33cµ4U%d4UôUDõõ5D%BÂb33cµ4U%d4UôU%$õ%ôtäõ$RÂgV÷C´3¢b3#µtäDõu2b3#µ55DTÓ3"b3#´4Ä2äURgV÷C²¤×6t&÷ÂgV÷C²gV÷C²ÂW'&÷" It should return "0" as error code now. 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...
cypher175 Posted December 8, 2008 Share Posted December 8, 2008 ok it seems to be working now thanks engine..!! One more example please..?? this time for _Service_SetFailureActions This is what im trying to do but im stuck on the $aiActions part..?? _Service_SetFailureActions($sServiceName, 0, "", "", $SC_ACTION_RESTART, 0, "") expandcollapse popup $aiActions - [Optional] An array of SC_ACTION_TYPE and respective delay in minutes. The array must be of the form: ; $Array[n][2] = [[Type 1, Delay 1], [Type 2, Delay 2], ... [Type n, Delay n]] ; "Type" represents the action to be performed. It can be one of the following values from the SC_ACTION_TYPE enumeration type: ; $SC_ACTION_NONE - No action. ; $SC_ACTION_RESTART - Restart the service. ; $SC_ACTION_REBOOT - Reboot the computer. ; $SC_ACTION_RUN_COMMAND - Run a command. ; "Delay" represents the time to wait before performing the specified action, in minutes. ; If this parameter is "Default", the service's actions remain unchanged. If the parameter is an empty string (""), ; the service's actions are deleted. ; $sComputerName - [Optional] The name of the target computer. The local computer is default. ; Requirement(s).: Administrative rights on the target computer. ; Return values .: Success - 1 ; Failure - 0 ; Sets @error [\code] Link to comment Share on other sites More sharing options... engine Posted December 8, 2008 engine Active Members 165 Author Share Posted December 8, 2008 There is an example for that one. Take a look at it. 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... cypher175 Posted December 8, 2008 cypher175 Active Members 473 Share Posted December 8, 2008 whoops my bad overlooked that part.. all is good now.. its working fine and dandy.. Thanks for the awesome help-support engine you rock..!!! Link to comment Share on other sites More sharing options... Yorn Posted December 10, 2008 Yorn Active Members 112 Share Posted December 10, 2008 Services.au3 (1363) : ==> Unable to parse line.: $vActions[$i][1] = DllStructGetData($tActions, 1, 2 * $i + 2) / 6E + 4 $vActions[$i][1] = DllStructGetData($tActions, 1, 2 * $i + 2) / 6E^ ERROR ->10:10:22 AutoIT3.exe ended.rc:1 +>10:10:23 AutoIt3Wrapper Finished Link to comment Share on other sites More sharing options...
engine Posted December 10, 2008 Author Share Posted December 10, 2008 Services.au3 (1363) : ==> Unable to parse line.: $vActions[$i][1] = DllStructGetData($tActions, 1, 2 * $i + 2) / 6E + 4 $vActions[$i][1] = DllStructGetData($tActions, 1, 2 * $i + 2) / 6E^ ERROR ->10:10:22 AutoIT3.exe ended.rc:1 +>10:10:23 AutoIt3Wrapper Finished What AutoIt version are you using? Please Try this. Go to line 1363 on the Services.au3 and replace that line with this one: $vActions[$i][1] = DllStructGetData($tActions, 1, 2 * $i + 2) / (6E + 4) 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...
Manko Posted December 15, 2008 Share Posted December 15, 2008 Many thanks for this GREAT udf!!! I only needed _services_enum this time. But this udf is a keeper and a must have! I will use it again and again! /Manko Yes i rush things! (I sorta do small bursts inbetween doing nothing.) Things I have rushed and reRushed:* ProDLLer - Process manager - Unload viri modules (dll) and moore...* _WinAPI_ProcessListOWNER_WTS() - Get Processes owner list...* _WinAPI_GetCommandLineFromPID() - Get commandline of target process...* _WinAPI_ThreadsnProcesses() Much info if expanded - optional Indented "Parent/Child"-style Processlist. Moore to come... eventually... 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