5 Windows NT Service class library
7 Copyright Abandoned 1998 Irena Pancirov - Irnet Snc
8 This file is public domain and comes with NO WARRANTY of any kind
11 // main application thread
12 typedef void (*THREAD_FC
)(void *);
20 BOOL bOsNT
; ///< true if OS is NT, false for Win95
22 DWORD dwDesiredAccess
;
27 LPSTR szLoadOrderGroup
;
32 // time-out (in milisec)
41 HANDLE hShutdownEvent
;
45 BOOL
GetOS(); // returns TRUE if WinNT
46 BOOL
IsNT() { return bOsNT
;}
47 //init service entry point
48 long Init(LPCSTR szInternName
,void *ServiceThread
);
50 //application shutdown event
51 void SetShutdownEvent(HANDLE hEvent
){ hShutdownEvent
=hEvent
; }
54 //service install / un-install
55 BOOL
Install(int startType
,LPCSTR szInternName
,LPCSTR szDisplayName
,
56 LPCSTR szFullPath
, LPCSTR szAccountName
=NULL
,
57 LPCSTR szPassword
=NULL
);
58 BOOL
SeekStatus(LPCSTR szInternName
, int OperationType
);
59 BOOL
Remove(LPCSTR szInternName
);
60 BOOL
IsService(LPCSTR ServiceName
);
61 BOOL
got_service_option(char **argv
, char *service_option
);
65 SetRunning() is to be called by the application
66 when initialization completes and it can accept
69 void SetRunning(void);
72 Stop() is to be called by the application to stop
80 SERVICE_STATUS_HANDLE hServiceStatusHandle
;
84 THREAD_FC fpServiceThread
;
91 static void ServiceMain(DWORD argc
, LPTSTR
*argv
);
92 static void ServiceCtrlHandler (DWORD ctrlCode
);
94 void Exit(DWORD error
);
95 BOOL
SetStatus (DWORD dwCurrentState
,DWORD dwWin32ExitCode
,
96 DWORD dwServiceSpecificExitCode
,
97 DWORD dwCheckPoint
,DWORD dwWaitHint
);
100 /* ------------------------- the end -------------------------------------- */