#ifndef INSPIRCD_WIN32WRAPPER_H
#define INSPIRCD_WIN32WRAPPER_H
+#ifndef CONFIGURE_BUILD
#include "win32service.h"
+#endif
/* Define the WINDOWS macro. This means we're building on windows to the rest of the server.
I think this is more reasonable than using WIN32, especially if we're gonna be doing 64-bit compiles */
*/
typedef BOOL (CALLBACK* SETSERVDESC)(SC_HANDLE,DWORD,LPVOID);
+BOOL UpdateSCMStatus (DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwServiceSpecificExitCode, DWORD dwCheckPoint, DWORD dwWaitHint);
+void terminateService (int code, int wincode);
+
/* A commandline parameter handler for service specific commandline parameters */
typedef void (*CommandlineParameterHandler)(void);
/* A function pointer for dynamic linking tricks */
SETSERVDESC ChangeServiceConf;
-bool IsAService();
+bool IsAService()
{
USEROBJECTFLAGS uoflags;
HWINSTA winstation = GetProcessWindowStation();
return;
serviceCurrentStatus = SERVICE_RUNNING;
- success = UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0, 0, 0);
+ BOOL success = UpdateSCMStatus(SERVICE_RUNNING, NO_ERROR, 0, 0, 0);
if (!success)
{
terminateService(6, GetLastError());
}
/* In windows we hook this to exit() */
-void newexit(int status)
+void SetServiceStopped(int status)
{
if (!IsAService())
exit(status);
* as a service so if this is true, we just run the non-service inspircd.
*/
if (!IsAService())
- return smain(argv, argc);
+ return smain(argc, argv);
/* If we get here, we know the service is installed so we can start it */
#define _WIN32SERVICE_H_\r
/* Hook for win32service.cpp to exit properly with the service specific error code */
-#define exit(a) newexit(a)
-void newexit(int status);
+void SetServiceStopped(int status);
\r
/* Marks the service as running, not called until the config is parsed */\r
void SetServiceRunning();\r