2 * Copyright 1995, 2000 Perforce Software. All rights reserved.
4 * This file is part of Perforce - the FAST SCM System.
8 * NtService - Class allows Perforce server to run as a service on NT.
12 * NtService::NtService()
13 * Constructor requires a name, and a pointer to the entry point for
14 * the program which can not be main because main calls
15 * StartServiceControlDispatcher() and never returns.
18 * This calls StartServiceControlDispatcher to connect the service to
19 * the SCM. This should be called as soon as possible after the
20 * program starts because the SCM will only wait 30 seconds for this
23 * NtService::SetStatus()
24 * Informx SCM of changes in the services status. Required to tell
25 * SCM when service has successfully started.
50 // Our caller's interface
52 virtual void Start( int (*entryPt
)( DWORD
, char ** ), char *svc
);
54 virtual void SetStatus(
55 states state
= no_change
,
56 DWORD win32_exitcode
= 0,
57 DWORD specific_code
= 0,
58 DWORD wait_hint
= 0 );
62 // SCM callbacks with Win32 interfaces.
63 // Do not call them directly.
64 // Because they are static, we have to remember
65 // the (one) NtService in use.
67 static NtService
*global_this
;
68 static void WINAPI
ControlHandler( DWORD opcode
);
69 static void StaticRun( DWORD argc
, char **argv
);
71 // Called by ControlHanlder
73 virtual void Run( DWORD argc
, char **argv
);
76 SERVICE_STATUS status
;
77 SERVICE_STATUS_HANDLE statusHandle
;
79 int ( *entry_point
)( DWORD
, char ** );
84 #endif // NTSERVICE_H__