Author: gedmurphy
Date: Fri Nov 7 06:49:51 2008
New Revision: 37241
URL:
http://svn.reactos.org/svn/reactos?rev=37241&view=rev
Log:
Convert rpcss back to a service
Added:
trunk/reactos/base/services/rpcss/rpcss_ros.diff
trunk/reactos/base/services/rpcss/service_main.c (with props)
Modified:
trunk/reactos/base/services/rpcss/rpcss.rbuild
trunk/reactos/base/services/rpcss/rpcss_main.c
Modified: trunk/reactos/base/services/rpcss/rpcss.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/rpcss/rpcss.…
==============================================================================
--- trunk/reactos/base/services/rpcss/rpcss.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/services/rpcss/rpcss.rbuild [iso-8859-1] Fri Nov 7 06:49:51 2008
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
-<module name="rpcss" type="win32cui"
installbase="system32" installname="rpcss.exe">
+<module name="rpcss" type="win32cui"
installbase="system32" installname="rpcss.exe"
unicode="yes">
<include base="rpcss">.</include>
<include base="rpcss" root="intermediate">.</include>
<library>wine</library>
@@ -9,9 +9,10 @@
<library>rpcrt4</library>
<library>kernel32</library>
<library>advapi32</library>
- <file>rpcss_main.c</file>
<file>epmp.c</file>
<file>irotp.c</file>
+ <file>rpcss_main.c</file>
+ <file>service_main.c</file>
<file>epm.idl</file>
<file>irot.idl</file>
<file>rpcss.rc</file>
Modified: trunk/reactos/base/services/rpcss/rpcss_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/rpcss/rpcss_…
==============================================================================
--- trunk/reactos/base/services/rpcss/rpcss_main.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/rpcss/rpcss_main.c [iso-8859-1] Fri Nov 7 06:49:51 2008
@@ -62,7 +62,7 @@
//extern HANDLE __wine_make_process_system(void);
-static BOOL RPCSS_Initialize(void)
+BOOL RPCSS_Initialize(void)
{
static unsigned short irot_protseq[] = IROT_PROTSEQ;
static unsigned short irot_endpoint[] = IROT_ENDPOINT;
@@ -116,7 +116,7 @@
/* returns false if we discover at the last moment that we
aren't ready to terminate */
-static BOOL RPCSS_Shutdown(void)
+BOOL RPCSS_Shutdown(void)
{
RpcMgmtStopServerListening(NULL);
RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, TRUE);
@@ -127,6 +127,7 @@
return TRUE;
}
+#if 0
int main( int argc, char **argv )
{
/*
@@ -142,3 +143,4 @@
return 0;
}
+#endif
Added: trunk/reactos/base/services/rpcss/rpcss_ros.diff
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/rpcss/rpcss_…
==============================================================================
--- trunk/reactos/base/services/rpcss/rpcss_ros.diff (added)
+++ trunk/reactos/base/services/rpcss/rpcss_ros.diff [iso-8859-1] Fri Nov 7 06:49:51
2008
@@ -1,0 +1,35 @@
+Index: rpcss_main.c
+===================================================================
+--- rpcss_main.c (revision 37240)
++++ rpcss_main.c (working copy)
+@@ -62,7 +62,7 @@
+
+ //extern HANDLE __wine_make_process_system(void);
+
+-static BOOL RPCSS_Initialize(void)
++BOOL RPCSS_Initialize(void)
+ {
+ static unsigned short irot_protseq[] = IROT_PROTSEQ;
+ static unsigned short irot_endpoint[] = IROT_ENDPOINT;
+@@ -116,7 +116,7 @@
+
+ /* returns false if we discover at the last moment that we
+ aren't ready to terminate */
+-static BOOL RPCSS_Shutdown(void)
++BOOL RPCSS_Shutdown(void)
+ {
+ RpcMgmtStopServerListening(NULL);
+ RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, TRUE);
+@@ -127,6 +127,7 @@
+ return TRUE;
+ }
+
++#if 0
+ int main( int argc, char **argv )
+ {
+ /*
+@@ -142,3 +143,4 @@
+
+ return 0;
+ }
++#endif
Added: trunk/reactos/base/services/rpcss/service_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/rpcss/servic…
==============================================================================
--- trunk/reactos/base/services/rpcss/service_main.c (added)
+++ trunk/reactos/base/services/rpcss/service_main.c [iso-8859-1] Fri Nov 7 06:49:51
2008
@@ -1,0 +1,128 @@
+/*
+ * PROJECT: ReactOS Remote Procedure Call service
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: /base/services/rpcss/service_main.c
+ * PURPOSE: Service control code
+ * COPYRIGHT: Copyright 2008 Ged Murphy <gedmurphy(a)reactos.org>
+ *
+ */
+
+#include "rpcss.h"
+
+BOOL RPCSS_Initialize(void);
+BOOL RPCSS_Shutdown(void);
+
+static WCHAR ServiceName[] = L"RpcSs";
+
+typedef struct _ServiceInfo
+{
+ SERVICE_STATUS servStatus;
+ SERVICE_STATUS_HANDLE hStatus;
+} SERVICEINFO, *PSERVICEINFO;
+
+
+static VOID
+UpdateStatus(PSERVICEINFO pServInfo,
+ DWORD NewStatus,
+ DWORD Check)
+{
+ if (Check > 0)
+ {
+ pServInfo->servStatus.dwCheckPoint += Check;
+ }
+ else
+ {
+ pServInfo->servStatus.dwCheckPoint = Check;
+ }
+
+ if (NewStatus > 0)
+ {
+ pServInfo->servStatus.dwCurrentState = NewStatus;
+ }
+
+ SetServiceStatus(pServInfo->hStatus, &pServInfo->servStatus);
+}
+
+
+static BOOL
+RunService(PSERVICEINFO pServInfo)
+{
+ return RPCSS_Initialize();
+}
+
+VOID WINAPI
+ServerCtrlHandler(DWORD dwControl,
+ DWORD dwEventType,
+ LPVOID lpEventData,
+ LPVOID lpContext)
+{
+ PSERVICEINFO pServInfo = (PSERVICEINFO)lpContext;
+
+ switch (dwControl)
+ {
+ case SERVICE_CONTROL_SHUTDOWN:
+ case SERVICE_CONTROL_STOP:
+ RPCSS_Shutdown();
+ pServInfo->servStatus.dwWin32ExitCode = 0;
+ pServInfo->servStatus.dwWaitHint = 0;
+ UpdateStatus(pServInfo, SERVICE_STOP_PENDING, 1);
+ break;
+
+ default:
+ break;
+ }
+}
+
+VOID WINAPI
+ServiceMain(DWORD argc, LPWSTR argv[])
+{
+ SERVICEINFO servInfo;
+ HANDLE hThread;
+ DWORD dwThreadId;
+
+ servInfo.servStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
+ servInfo.servStatus.dwCurrentState = SERVICE_STOPPED;
+ servInfo.servStatus.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN;
+ servInfo.servStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
+ servInfo.servStatus.dwServiceSpecificExitCode = 0;
+ servInfo.servStatus.dwCheckPoint = 0;
+ servInfo.servStatus.dwWaitHint = 1000;
+
+ servInfo.hStatus = RegisterServiceCtrlHandlerExW(ServiceName,
+
(LPHANDLER_FUNCTION_EX)ServerCtrlHandler,
+ &servInfo);
+ if (!servInfo.hStatus) return;
+
+ UpdateStatus(&servInfo, SERVICE_START_PENDING, 1);
+
+ /* Create worker thread */
+ hThread = CreateThread(NULL,
+ 0,
+ (LPTHREAD_START_ROUTINE)RunService,
+ &servInfo,
+ 0,
+ &dwThreadId);
+ if (!hThread) return;
+
+ /* Set service status to running */
+ UpdateStatus(&servInfo, SERVICE_RUNNING, 0);
+
+ /* Wait until thread has terminated */
+ WaitForSingleObject(hThread, INFINITE);
+
+ CloseHandle(hThread);
+
+ UpdateStatus(&servInfo, SERVICE_STOPPED, 0);
+}
+
+
+int wmain(int argc, LPWSTR argv [])
+{
+ SERVICE_TABLE_ENTRYW ServiceTable[] =
+ {
+ {ServiceName, ServiceMain},
+ {NULL, NULL }
+ };
+
+ return (int)(StartServiceCtrlDispatcherW(ServiceTable) != 0);
+}
Propchange: trunk/reactos/base/services/rpcss/service_main.c
------------------------------------------------------------------------------
svn:eol-style = native