NightHawk Posted May 24, 2008 Share Posted May 24, 2008 How can an exe file compiled from Autoit code install and act itself as a Windows Service without any external program like srvany.exe ?Topic is old , still i get no answer about the Exe being independent to behave like a Service......Any idea..... ??? Link to comment Share on other sites More sharing options...
rasim Posted May 24, 2008 Share Posted May 24, 2008 Type in CMD sc create /? Link to comment Share on other sites More sharing options...
NightHawk Posted May 24, 2008 Author Share Posted May 24, 2008 Already tried the SC.exe in Windows XP SP2.... The exe file 'doesn't respond appropriately' (as the error is) when the service is started. I have used SC.exe to start the service and also the compmgmt.msc without success. There may be some property of the exe file such that it responds to the operating system like a service should do. I can't run any exe(written in any language) as a service, isn't it? It may require some coding inside the Autoit script , I suppose........ I can't figure out whether any User Defined Functions exists........ Link to comment Share on other sites More sharing options...
rasim Posted May 24, 2008 Share Posted May 24, 2008 (edited) NightHawk The exe file 'doesn't respond appropriately' (as the error is) when the service is started.Hmm...try this: Global Const $SERVICES_ACTIVE_DATABASE = "ServicesActive" Global Const $SC_MANAGER_CREATE_SERVICE = 0x0002 Global Const $SERVICE_ALL_ACCESS = 0xF01FF Global Const $SERVICE_WIN32_OWN_PROCESS = 0x00000010 Global Const $SERVICE_INTERACTIVE_PROCESS = 0x00000100 Global Const $SERVICE_AUTO_START = 0x00000002 Global Const $SERVICE_ERROR_NORMAL = 0x00000001 $hSCManager = DllCall("advapi32.dll", "hwnd", "OpenSCManager", "str", "", _ "str", $SERVICES_ACTIVE_DATABASE, "dword", $SC_MANAGER_CREATE_SERVICE) $hSCManager = $hSCManager[0] $aCreate = DllCall("advapi32.dll", "hwnd", "CreateService", "hwnd", $hSCManager, "str", "MyService", "str", "MyNewService", _ "dword", $SERVICE_ALL_ACCESS, "dword", BitOR($SERVICE_WIN32_OWN_PROCESS, $SERVICE_INTERACTIVE_PROCESS), _ "dword", $SERVICE_AUTO_START, "dword", $SERVICE_ERROR_NORMAL, "str", "c:\test.exe", "str", "", "ptr", 0, _ "ptr", 0, "str", "LocalSystem", "str", "") If $aCreate[0] Then MsgBox(64, "CreateService", "Service creating successful") MSDN Edited May 24, 2008 by rasim Link to comment Share on other sites More sharing options...
Andreik Posted May 24, 2008 Share Posted May 24, 2008 http://www.autoitscript.com/forum/index.php?showtopic=37289 When the words fail... music speaks. 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