home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / s / servic.zip / README.TXT < prev    next >
Text File  |  1993-02-04  |  2KB  |  56 lines

  1. Sample: Simple Service
  2.  
  3. Summary:
  4.  
  5. The Simple Service sample demonstrates how to create and
  6. install a service.
  7.  
  8. In this particular case, the service merely opens a named
  9. pipe of the name \\.\pipe\simple, and waits for traffic.
  10. If it receives anything, it surrounds the input with:
  11.  
  12.         Foo! [<input goes here>]
  13.  
  14. and sends it back down the pipe to the client.
  15.  
  16. The service can be Started, Stopped, Paused, and Continued.
  17.  
  18. To install the service, first compile everything, and then
  19. user INSTSRV to install SimpleService as follows:
  20.  
  21.         instsrv SimpleService <location of simple.exe>
  22.  
  23. Now all you have to do is start it, either using the
  24. "net start" method or via the control panel Services applet.
  25.  
  26. Once the service has been started, you can use the CLIENT
  27. program to verify that it really is working, using the syntax:
  28.  
  29.         client \\.\pipe\simple foo
  30.  
  31. which should return the response:
  32.  
  33.         Foo! [foo]
  34.  
  35. If, after playing with the sample you wish to remove the service,
  36. simple say:
  37.  
  38.         instsrv SimpleService remove
  39.  
  40. Note that INSTSRV can be a little dangerous -- it'll install
  41. and remove any service you tell it to, so be careful.
  42.  
  43.  
  44. The following is a list of the Win32 API functions used in
  45. this sample:
  46.  
  47. CallNamedPipe         DisconnectNamedPipe          ReportEvent
  48. CloseHandle           GetLastError                 ResumeThread
  49. CloseServiceHandle    InitializeSecurityDescriptor SetEvent
  50. ConnectNamedPipe      LocalAlloc                   SetSecurityDescriptorDacl
  51. CreateEvent           LocalFree                    SetServiceStatus
  52. CreateNamedPipe       OpenSCManager                StartServiceCtrlDispatcher
  53. CreateService         ReadFile                     SuspendThread
  54. CreateThread          RegisterEventSource          WaitForSingleObject
  55. DeregisterEventSource RegisterServiceCtrlHandler   WriteFile
  56.