Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

OpenService WINAPI function

 [1/8] from: ptretter:charter at: 24-May-2003 12:32


Clear DayIn working with the Service Control Manager on XP. I used CreateProcess to successful create a service called "Unreal One" However, I dont have an actual service program called "Unreal One" therefore I wanted to delete the service. However, my methods have failed. Here is what I tried: ------------------------------------ DEL: to-integer #{010000} SC_MANAGER_ALL_ACCESS: to-integer first reduce [ #{0000} or #{0001} or #{0002} or #{0004} or #{0008} or #{0010} or #{0020} ] winlib: load/library %advapi32.dll openscmanager: make routine! [ lpMachineName [integer!] lpDatabaseName [integer!] dwDesiredAccess [long] return: [integer!] ] winlib "OpenSCManagerA" openscmanager-ret: openscmanager 0 0 SC_MANAGER_ALL_ACCESS openservice: make routine! [ hSCManager [integer!] lpServiceName [string!] dwDesiredAccess [integer!] ] winlib "OpenServiceA" openservice-ret: openservice openscmanager-ret "Unreal one^@" DEL ------------------------------------------------------------------------------------- Here is the error I get: ** Script Error: openservice-ret needs a value ** Near: openservice-ret: openservice openscmanager-ret "Unreal one^@" DEL I have read over the winapi details repeatedly and not sure what the problem is. I successfully get the returned handle to the Service Control Manager Database. Any ideas? Paul Tretter

 [2/8] from: greggirwin::mindspring::com at: 24-May-2003 15:36


Hi Paul, PT> openservice: make routine! [ PT> hSCManager [integer!] PT> lpServiceName [string!] PT> dwDesiredAccess [integer!] PT> ] winlib "OpenServiceA" PT> openservice-ret: openservice openscmanager-ret "Unreal one^@" DEL PT> ------------------------------------------------------------------------------------- PT> Here is the error I get: PT> ** Script Error: openservice-ret needs a value PT> ** Near: openservice-ret: openservice openscmanager-ret "Unreal one^@" DEL Looks like you didn't define a return value for the routine. openservice: make routine! [ hSCManager [integer!] lpServiceName [string!] dwDesiredAccess [integer!] return: [integer!] ] winlib "OpenServiceA" -- Gregg

 [3/8] from: ptretter:charter at: 24-May-2003 18:41


LOL! OMG, your right.. I should have looked at it longer. Thats twice I did that now. Each time I was stumped. This time taking notes. Thanks Gregg. Paul

 [4/8] from: maarten:koopmans:surfnet:nl at: 25-May-2003 12:22


Do I understand correctly that somebody knows how to install a REBOL script as a service under Windows? If so, where is it published? --Maarten Paul Tretter wrote:

 [5/8] from: tserpa:earthlink at: 25-May-2003 12:27


You can always use something like FireDaemon: http://www.firedaemon.com/ Ted

 [6/8] from: ptretter:charter at: 25-May-2003 12:40


Actually, I'm working on a script that I hope to setup as a service under Windows. However, by the looks of it so far, your rebol program would have to be able to talk to the Service Manager of windows in order to cooperate as a service on the system. Therefore, the REBOL service would have to have an installer routine to install it as a service (can be a separate program). Then your service will have to have service functions to initialize it with the Service Control Manager. I'll post some functions and information when I get it complete. Paul Tretter

 [7/8] from: greggirwin:mindspring at: 25-May-2003 11:58


Hi Paul, PT> I should have looked at it longer. Nah, the longer you look, the harder it is to see. That's why I could see it. :) -- Gregg

 [8/8] from: ptretter:charter at: 26-May-2003 16:24


Yeah I actually have FireDaemon and it works pretty good. I was digging a bit deaper into the WINAPI for creating a service and it doesnt look like REBOL can do windows service because REBOL doesn't support callback functions. Therefore, I will most likely have to use Firedaemon for my little project. Paul Tretter