ADVAPI32.DLL / SERVICES.EXE:
Implement ControlService()
RPCRT4.DLL:
Disable a bogus buffer overflow check in NdrSimpleStructMarshall.
Modified: trunk/reactos/include/idl/svcctl.idl
Modified: trunk/reactos/lib/advapi32/service/scm.c
Modified: trunk/reactos/lib/rpcrt4/ndr_marshall.c
Modified: trunk/reactos/subsys/system/services/rpcserver.c
_____
Modified: trunk/reactos/include/idl/svcctl.idl
--- trunk/reactos/include/idl/svcctl.idl 2005-04-17 19:47:44 UTC
(rev 14657)
+++ trunk/reactos/include/idl/svcctl.idl 2005-04-17 19:56:50 UTC
(rev 14658)
@@ -39,10 +39,10 @@
[in] SC_HANDLE hSCObject);
/* Function 1 */
-// BOOL ScmrControlService([in] handle_t BindingHandle,
-// [in] SC_HANDLE hService,
-// [in] DWORD dwControl,
-// [out] LPSERVICE_STATUS lpServiceStatus);
+ BOOL ScmrControlService([in] handle_t BindingHandle,
+ [in] SC_HANDLE hService,
+ [in] DWORD dwControl,
+ [out] LPSERVICE_STATUS lpServiceStatus);
/* Function 2 */
DWORD ScmrDeleteService([in] handle_t BindingHandle,
_____
Modified: trunk/reactos/lib/advapi32/service/scm.c
--- trunk/reactos/lib/advapi32/service/scm.c 2005-04-17 19:47:44 UTC
(rev 14657)
+++ trunk/reactos/lib/advapi32/service/scm.c 2005-04-17 19:56:50 UTC
(rev 14658)
@@ -139,21 +139,22 @@
{
DWORD dwError;
- DPRINT1("CloseServiceHandle() called\n");
+ DPRINT("CloseServiceHandle() called\n");
HandleBind();
/* Call to services.exe using RPC */
dwError = ScmrCloseServiceHandle(BindingHandle,
(unsigned int)hSCObject);
- DPRINT1("dwError %lu\n", dwError);
-
if (dwError)
{
+ DPRINT1("ScmrCloseServiceHandle() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
+ DPRINT("CloseServiceHandle() done\n");
+
return TRUE;
}
@@ -168,11 +169,10 @@
DWORD dwControl,
LPSERVICE_STATUS lpServiceStatus)
{
-#if 0
DWORD dwError;
- DPRINT1("ControlService(%x, %x, %p)\n",
- hService, dwControl, lpServiceStatus);
+ DPRINT("ControlService(%x, %x, %p)\n",
+ hService, dwControl, lpServiceStatus);
HandleBind();
@@ -183,18 +183,14 @@
lpServiceStatus);
if (dwError != ERROR_SUCCESS)
{
+ DPRINT1("ScmrControlService() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
- DPRINT1("ControlService() done\n");
+ DPRINT("ControlService() done\n");
return TRUE;
-#endif
-
- DPRINT1("ControlService is unimplemented\n");
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return FALSE;
}
@@ -262,7 +258,7 @@
{
DWORD dwError;
- DPRINT1("DeleteService(%x)\n", hService);
+ DPRINT("DeleteService(%x)\n", hService);
HandleBind();
@@ -271,6 +267,7 @@
(unsigned int)hService);
if (dwError != ERROR_SUCCESS)
{
+ DPRINT1("ScmrDeleteService() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return FALSE;
}
@@ -536,7 +533,7 @@
(unsigned int *)&hLock);
if (dwError != ERROR_SUCCESS)
{
- DPRINT("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError);
+ DPRINT1("ScmrLockServiceDatabase() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return NULL;
}
@@ -613,9 +610,9 @@
(LPSTR)lpDatabaseName,
dwDesiredAccess,
(unsigned int*)&hScm);
- if (dwError)
+ if (dwError != ERROR_SUCCESS)
{
- DPRINT("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError);
+ DPRINT1("ScmrOpenSCManagerA() failed (Error %lu)\n", dwError);
SetLastError(dwError);
return NULL;
}
@@ -928,7 +925,7 @@
(unsigned int)ScLock);
if (dwError != ERROR_SUCCESS)
{
- DPRINT("ScmrUnlockServiceDatabase() failed (Error %lu)\n",
dwError);
+ DPRINT1("ScmrUnlockServiceDatabase() failed (Error %lu)\n",
dwError);
SetLastError(dwError);
return FALSE;
}
_____
Modified: trunk/reactos/lib/rpcrt4/ndr_marshall.c
--- trunk/reactos/lib/rpcrt4/ndr_marshall.c 2005-04-17 19:47:44 UTC
(rev 14657)
+++ trunk/reactos/lib/rpcrt4/ndr_marshall.c 2005-04-17 19:56:50 UTC
(rev 14658)
@@ -1161,7 +1161,15 @@
if (pFormat[0] != RPC_FC_STRUCT)
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat+4);
+ /*
+ * This test does not work when NdrSimpleStructMarshall is called
+ * by an rpc-server to marshall data to return to the client because
+ * BufferStart and BufferEnd are bogus. MIDL does not update them
+ * when a new buffer is allocated in order to return data to the
caller.
+ */
+#if 0
STD_OVERFLOW_CHECK(pStubMsg);
+#endif
return NULL;
}
@@ -1201,20 +1209,22 @@
/***********************************************************************
- * NdrSimpleStructUnmarshall [RPCRT4.@]
+ * NdrSimpleTypeUnmarshall [RPCRT4.@]
*/
-void WINAPI NdrSimpleTypeMarshall( PMIDL_STUB_MESSAGE pStubMsg,
unsigned char* pMemory,
- unsigned char FormatChar )
+void WINAPI NdrSimpleTypeMarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ unsigned char FormatChar)
{
FIXME("stub\n");
}
/***********************************************************************
- * NdrSimpleStructUnmarshall [RPCRT4.@]
+ * NdrSimpleTypeUnmarshall [RPCRT4.@]
*/
-void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg,
unsigned char* pMemory,
- unsigned char FormatChar )
+void WINAPI NdrSimpleTypeUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
+ unsigned char *pMemory,
+ unsigned char FormatChar)
{
FIXME("stub\n");
}
_____
Modified: trunk/reactos/subsys/system/services/rpcserver.c
--- trunk/reactos/subsys/system/services/rpcserver.c 2005-04-17
19:47:44 UTC (rev 14657)
+++ trunk/reactos/subsys/system/services/rpcserver.c 2005-04-17
19:56:50 UTC (rev 14658)
@@ -272,7 +272,6 @@
/* Function 1 */
-#if 0
unsigned long
ScmrControlService(handle_t BindingHandle,
unsigned int hService,
@@ -281,7 +280,10 @@
{
DPRINT1("ScmrControlService() called\n");
-#if 0
+ /* FIXME: return proper service information */
+
+ /* test data */
+// #if 0
lpServiceStatus->dwServiceType = 0x12345678;
lpServiceStatus->dwCurrentState = 0x98765432;
lpServiceStatus->dwControlsAccepted = 0xdeadbabe;
@@ -289,11 +291,10 @@
lpServiceStatus->dwServiceSpecificExitCode = 0xdeadf00d;
lpServiceStatus->dwCheckPoint = 0xbaadbabe;
lpServiceStatus->dwWaitHint = 0x2468ACE1;
-#endif
+// #endif
- return TRUE;
+ return ERROR_SUCCESS;
}
-#endif
/* Function 2 */