mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / sql / nt_servc.h
blob2f0d07df543295f3eddb38eb680faa11ef369265
1 /**
2 @file
4 @brief
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
9 */
11 // main application thread
12 typedef void (*THREAD_FC)(void *);
14 class NTService
16 public:
17 NTService();
18 ~NTService();
20 BOOL bOsNT; ///< true if OS is NT, false for Win95
21 //install optinos
22 DWORD dwDesiredAccess;
23 DWORD dwServiceType;
24 DWORD dwStartType;
25 DWORD dwErrorControl;
27 LPSTR szLoadOrderGroup;
28 LPDWORD lpdwTagID;
29 LPSTR szDependencies;
30 OSVERSIONINFO osVer;
32 // time-out (in milisec)
33 int nStartTimeOut;
34 int nStopTimeOut;
35 int nPauseTimeOut;
36 int nResumeTimeOut;
39 DWORD my_argc;
40 LPTSTR *my_argv;
41 HANDLE hShutdownEvent;
42 int nError;
43 DWORD dwState;
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);
62 BOOL is_super_user();
64 /*
65 SetRunning() is to be called by the application
66 when initialization completes and it can accept
67 stop request
69 void SetRunning(void);
72 Stop() is to be called by the application to stop
73 the service
75 void Stop(void);
77 protected:
78 LPSTR ServiceName;
79 HANDLE hExitEvent;
80 SERVICE_STATUS_HANDLE hServiceStatusHandle;
81 BOOL bPause;
82 BOOL bRunning;
83 HANDLE hThreadHandle;
84 THREAD_FC fpServiceThread;
86 void PauseService();
87 void ResumeService();
88 void StopService();
89 BOOL StartService();
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 -------------------------------------- */