-1      !"#$%&'()*+,-./0  Safe-Inferred123412341234NoneEWin32 defines many types of services, but this binding only supports  WIN32_OWN_PROCESS. DDo no write your own services of this type. Windows Vista and above C prevent service processes from directly interacting with users. A  is either a  or a  + running in the context of the LocalSystem = account which is allowed to directly interact with users. 2The service shares a process with other services. %The service runs in its own process.  The service is a device driver. %The service is a file system driver. 5678785678None9:;<=>9:;<=9:;<=>None The current state of a service.  ?@ABC  ?BC ?@ABCNoneFA SERVICE_CONTROL is used in Handler functions. All control codes are 2 defined here, but some can only be used with a  HandlerEx callback.  Use convertSuccess to translate from a  to a D.  Use convertAttempt to translate from a D to a . EFGHIEFH EFGHINoneCThe control codes the service accepts and processes in its handler  function (See HandlerFunction'). By default, all services accept the   INTERROGATE value. To accept the  DEVICEEVENT value, the service must 2 register to receive device events by using the  registerDeviceNotification function. DThe service can be stopped. This control code allows the service to  receive STOP notifications. BThe service is notified when system shutdown occurs. This control & code allows the service to receive SHUTDOWN notifications. Note % that only the system can send it. ?MSDN documentation says that this function is not supported on $ Windows Server 2003 or Windows XP/"2000. The support status on other  versions is unknown to me. EThe service can perform preshutdown tasks. This control code enables  the service to receive  PRESHUTDOWN notifications. * Note that only the system can send it. FThe service can be paused and continued. This control code allows the  service to receive PAUSE and CONTINUE notifications. !DThe service can reread its startup parameters without being stopped B and restarted. This control code allows the service to receive   PARAMCHANGE notifications. "BThe service is a network component that can accept changes in its I binding without being stopped and restarted. This control code allows  the service to receive  NETBINDADD,  NETBINDREMOVE,  NETBINDENABLE  , and NETBINDDISABLE notifications. JThis function takes a D) and assumes it is a flagfield. Each bit G is masked off and converted into a value. Any failures are silently  discarded.  !"KLMNOJP  !"KL"! KLMNOJPNone#+Contains status information for a service. %FThe type of service. This binding only supports the WIN32_OWN_PROCESS  type. &"The current state of the service. 'See  for details on this field. (DThe error code the service uses to report an error that occurs when G it is starting or stopping. To return an error code specific to the / service, the service must set this value to   to indicate that the  )- member contains the error code. The service  should set this value to " when it is running and on normal  termination. )EA service-specific error code that the service returns when an error A occurs while the service is starting or stopping. This value is  ignored unless the ( member is set to  . <This binding does not support service-specific error codes. *DThe check-point value the service increments periodically to report A its progress during a lengthy start, stop, pause, or continue I operation. For example, the service should increment this value as it I completes each step of its initialization when it is starting up. The I user interface program that invoked the operation on the service uses D this value to track the progress of the service during a lengthy B operation. This value is not valid and should be zero when the E service does not have a start, stop, pause, or continue operation  pending. +AThe estimated time required for a pending start, stop, pause, or G continue operation, in milliseconds. Before the specified amount of B time has elapsed, the service should make its next call to the E SetServiceStatus function with either an incremented dwCheckPoint  value or a change in &". If the amount of time specified  by + passes, and * has not been incremented or  &1 has not changed, the service control manager or I service control program can assume that an error has occurred and the G service should be stopped. However, if the service shares a process I with other services, the service control manager cannot terminate the D service application because it would have to terminate the other ) services sharing the process as well. #$%&'()*+Q #$%&'()*+#$%&'()*+Q NoneRSTUVWRSTUVWRSTUVWNone,HThe service dispatcher thread will call each function of this type that H you provide. The first argument will be the name of the service. Any J additional command-line parameters will appear in the second argument. $Each of these functions should call registerServiceCtrlHandler to G register a function to handle incoming commands. It should then set  the service' s status to  , and specify that no controls F will be accepted. At this point the function may perform any other 2 initialization steps before setting the service' s status to   .. All of this should take no more than 100ms. -DA handler function is registered with the service dispatcher thread  from a ,. The first argument is a X returned  from calling registerServiceCtrlHandler!. The second argument represents : the command this service has been directed to perform. .7Retrieves the current status of the specified service. YHRegister an handler function to be called whenever the operating system $ receives service control messages. /#Updates the service control manager'%s status information for the calling  service. 0FRegister a callback function to initialize the service, which will be H called by the operating system immediately. startServiceCtrlDispatcher : will block until the provided callback function returns. IMSDN documentation: Connects the main thread of a service process to the L service control manager, which causes the thread to be the service control , dispatcher thread for the calling process. ,-.EMSDN documentation: A handle to the service. This handle is returned H by the OpenService or the CreateService function, and it must have the F SERVICE_QUERY_STATUS access right. For more information, see Service  Security and Access Rights. DThis function will raise an exception if the Win32 call returned an  error condition. Y>The name of the service. According to MSDN documentation this E argument is unused in WIN32_OWN_PROCESS type services, which is the A only type supported by this binding. Even so, it is recommended ' that the name of the service be used. EMSDN description: The name of the service run by the calling thread. H This is the service name that the service control program specified in 7 the CreateService function when creating the service. ?A Handler function to be called in response to service control 7 messages. Behind the scenes this is translated into a  HandlerEx type  handler. BThe returned handle may be used in calls to SetServiceStatus. For F convenience Handler functions also receive a handle for the service. /EMSDN documentation: A handle to the status information structure for 5 the current service. This handle is returned by the ( RegisterServiceCtrlHandlerEx function. BMSDN documentation: A pointer to the SERVICE_STATUS structure the A contains the latest status information for the calling service. DThis function will raise an exception if the Win32 call returned an  error condition. 0>The name of the service. According to MSDN documentation this E argument is unused in WIN32_OWN_PROCESS type services, which is the A only type supported by this binding. Even so, it is recommended ' that the name of the service be used. EMSDN description: The name of the service run by the calling thread. H This is the service name that the service control program specified in 7 the CreateService function when creating the service. AThis is a callback function that will be called by the operating C system whenever the service is started. It should perform service B initialization including the registration of a handler function. I MSDN documentation gives conflicting advice as to whether this function A should return before the service has entered the stopped state. D In the official example the service main function blocks until the  service is ready to stop. DAn exception will be raised if the underlying Win32 call returns an  error condition. Z[1  !"#$%&'()*+,-./01-,"!  #$%&'()*+./0,-.Y/0Z[\     !"#$%&'()*+,--./0123456789:;<=>?@ABBCDEFG?>HIJKLMN>?OPQR>?OST U V W X Y ZJK[\]^_Win32-services-0.2.3.1$System.Win32.SystemServices.Services*System.Win32.SystemServices.Services.Types1System.Win32.SystemServices.Services.SERVICE_TYPE8System.Win32.SystemServices.Services.SERVICE_TABLE_ENTRY2System.Win32.SystemServices.Services.SERVICE_STATE4System.Win32.SystemServices.Services.SERVICE_CONTROL3System.Win32.SystemServices.Services.SERVICE_ACCEPT3System.Win32.SystemServices.Services.SERVICE_STATUS(System.Win32.SystemServices.Services.Raw SERVICE_TYPESERVICE_INTERACTIVE_PROCESSWIN32_SHARE_PROCESSWIN32_OWN_PROCESS KERNEL_DRIVERFILE_SYSTEM_DRIVER SERVICE_STATESTOPPED STOP_PENDING START_PENDINGRUNNINGPAUSED PAUSE_PENDINGCONTINUE_PENDINGnO_ERROReRROR_SERVICE_SPECIFIC_ERRORSERVICE_CONTROLSTOPSHUTDOWN PRESHUTDOWNPAUSE PARAMCHANGE NETBINDREMOVE NETBINDENABLENETBINDDISABLE NETBINDADD INTERROGATECONTINUESERVICE_ACCEPT ACCEPT_STOPACCEPT_SHUTDOWNACCEPT_PRESHUTDOWNACCEPT_PAUSE_CONTINUEACCEPT_PARAMCHANGEACCEPT_NETBINDCHANGESERVICE_STATUS serviceType currentStatecontrolsAccepted win32ExitCodeserviceSpecificExitCode checkPointwaitHintServiceMainFunctionHandlerFunctionqueryServiceStatussetServiceStatusstartServiceCtrlDispatcherLPSERVICE_MAIN_FUNCTIONSERVICE_MAIN_FUNCTIONLPHANDLER_FUNCTION_EXHANDLER_FUNCTION_EXtoDWORD fromDWORDpeekServiceTypepokeServiceTypeSERVICE_TABLE_ENTRY serviceName serviceProcnullSTE$fStorableSERVICE_TABLE_ENTRYeRROR_CALL_NOT_IMPLEMENTEDpeekServiceStatepokeServiceState Win32-2.3.0.0System.Win32.TypesDWORDpeekServiceControlpokeServiceControl unsupportedunflagpeekServiceAcceptpokeServiceAcceptflag$fStorableSERVICE_STATUSc_StartServiceCtrlDispatcherc_SetServiceStatusc_RegisterServiceCtrlHandlerExc_QueryServiceStatushandlerToFunPtr smfToFunPtrHANDLEregisterServiceCtrlHandlerExtoSMF toHandlerEx