Jump to content

kschwarz

Active Members
  • Posts

    24
  • Joined

  • Last visited

About kschwarz

  • Birthday February 7

Profile Information

  • Location
    Sao Jose dos Campos, SP, Brazil

kschwarz's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I found that the logprint() is a function in the include file Log.Au3 that is part of the SessionChange Service.zip (See the first page of this _Service_UDF v4 topic page). So, you should adapt it to your own context.
  2. @spudw2k I have removed the "If Not IsHWnd($hService) Then Return SetError(1,0,0) ;Check if $hService is a real Handle" line and compiled my program again and it worked correctly. See: "SC qc" before running my program: [SC] QueryServiceConfig SUCCESS SERVICE_NAME: MyService TYPE : 10 WIN32_OWN_PROCESS START_TYPE : 4 DISABLED ERROR_CONTROL : 1 NORMAL BINARY_PATH_NAME : C:\temp\MyService.exe LOAD_ORDER_GROUP : Default TAG : 0 DISPLAY_NAME : MyService DEPENDENCIES : NETMAN SERVICE_START_NAME : LocalSystem "SC qc" after my program execution: [SC] QueryServiceConfig SUCCESS SERVICE_NAME: MyService TYPE : 10 WIN32_OWN_PROCESS START_TYPE : 2 AUTO_START (DELAYED) ERROR_CONTROL : 1 NORMAL BINARY_PATH_NAME : C:\temp\MyService.exe LOAD_ORDER_GROUP : Default TAG : 0 DISPLAY_NAME : MyService DEPENDENCIES : NETMAN SERVICE_START_NAME : LocalSystem When you find a replacement for that line, please let me know. Thanks!
  3. @spudw2k I was testing your function but I am getting an Error return from IsHWnd($hService) in the following line: If Not IsHWnd($hService) Then Return SetError(1,0,0) ;Check if $hService is a real Handle My main procedure (a CUI executable is created) is something like: #include <Services.au3> #include <ServicesConstants.au3> Const $SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3 Const $tagSERVICE_DELAYED_AUTO_START_INFO = "struct;bool fDelayedAutostart;endstruct" Local $hSC, $hService $hSC = OpenSCManager("", $SC_MANAGER_CONNECT) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hSC = ' & $hSC & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $hService = OpenService($hSC, "Servicename", $SERVICE_INTERROGATE) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hService = ' & $hService & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $iRC = _SERVICE_CONFIG_DELAYED_AUTO_START($hService, True) The Debug ConsoleWrite shows that both $hSC and $hService are set to pointers (hexadecinal number returns). The pointer $hService is passed ok to the Function (I have put another Debug write inside). What am I missing?
  4. Will it be included in V5, as it is being prepared?
  5. Does Service UDF support setting DelayedAutoStart?
  6. I´ve made the modification but am still getting the same error 1061! Klaus.
  7. Hi Arcker, As requested, I have the error message box on screen waiting for the OK, and submitted the following command: C:\temp>sc query autoit_service SERVICE_NAME: autoit_service TYPE : 10 WIN32_OWN_PROCESS STATE : 1 STOPPED WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 C:\temp>
  8. I have tryed dimmmmmm´s solution with ServiceExample.au3, but it still gives error 1061 when I try to stop the service. Klaus
  9. Trying to play with ServiceExample.au3: Install works, uninstall works, service start works, but when I try to stop the service, it takes too long to stop and gives a 1061 error message and after clicking OK it stops the service. Running Windows 7 and AutoIt beta. How to fix this behavior? Thanks, Klaus
  10. Arcker, I am trying to use the new version of this UDF with a service where I already used the old version. I am getting an execution error message box: Error: Subscript used with non-Array variable. Debugging the Services.au3 I found that SetPrivs($avPrivilege) function is giving the error in two positions: $avOPT = DllCall($hAdvapi32, "int", "OpenProcessToken", _ "hwnd", $ahGCP[0], _ "dword", BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY), _ "hwnd*", 0) and DllCall($hAdvapi32, "int", "AdjustTokenPrivileges", _ "hwnd", $avOPT[3], _ "int", False, _ "ptr", DllStructGetPtr($tCurrState), _ "dword", DllStructGetSize($tCurrState), _ "ptr", $pPrevState, _ "dword*", 0) $ahGCP and $avOPT[3] are declared as non-Array variables. What is the correct coding for this function?
  11. I am trying to setup dependencies for a service but depending on the dependency name size the _Service_Create function and even the _Service_SetDependencies function set the DependOnSevice Registry entry with a trash dependency appended. For example: let say the Dependency name is "ABC". It ends with a DependOnService Registry entry of: "DependOnService"=hex(7):41,00,42,00,43,00,00,00,c3,c6,a1,7d,fc,00,00,80,ee,01,\ 00,00,00,00 Another problem is with the _Service_QueryDependencies that retrieves the dependencies as: Dependencies[0]=A Dependencies[1]=B Dependencies[2]=C instead of: Dependencies[0]=ABC Printing the result of _StringToHex($sFull) in the _Service_QueryDependencies it shows: $sFull = 4100420043000000C3C6A17DFC000080EE01000000000000 Both problems seems to be mapping problems that for the create functions I could not determine if they are a problem in this functions or in the DllStruct type functions. Could someone help to fix this? Thanks!
  12. Arcker, Are you considering to implement the support of the new Delayed-auto Start Type to your Services UDF?
  13. Hi Adam and rover, I will be giving a try to the new _CurrentUserLoggedIn and the _CreateProcessAsUser functions, but it will take some time because of priority changes. I will let you know if it worked for me or not. Thanks, Klaus
  14. I have tryed the Task Scheduler hint on Windows 7 and it worked perfectly. But when I have tryed it on a Windows XP x64 machine it is always asking for the "run as password". See whole message bellow: Please enter the run as password for domain\username: WARNING: When the run as password is empty, the scheduled task may not run because of the security policy. WARNING: The scheduled task "TaskName" has been created, but may not run because the account information could not be set. And the Eventlog shows "Unknown user name or bad password". The user exists and as I am not giving the password it is failing. Seems this procedure does not work on versions prior to Windows 7 (or Vista perhaps). Any remindings, hints, etc? Klaus
×
×
  • Create New...