Author: ekohl
Date: Sun Nov 23 16:39:43 2008
New Revision: 37599
URL:
http://svn.reactos.org/svn/reactos?rev=37599&view=rev
Log:
- Start the RPC-Server from a separate thread so the initial call to the DLL doesn't
get blocked.
- Ensure the server accepts more than a single call from clients.
Modified:
trunk/reactos/dll/win32/lsasrv/lsarpc.c
Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Sun Nov 23 16:39:43 2008
@@ -57,6 +57,7 @@
return Status;
}
+
/*static*/ VOID
DereferencePolicyHandle(IN OUT PLSAR_POLICY_HANDLE Policy,
IN BOOLEAN Delete)
@@ -81,17 +82,13 @@
RtlLeaveCriticalSection(&PolicyHandleTableLock);
}
-VOID
-LsarStartRpcServer(VOID)
+
+DWORD STDCALL
+LsapRpcThreadRoutine(LPVOID lpParameter)
{
RPC_STATUS Status;
- RtlInitializeCriticalSection(&PolicyHandleTableLock);
- RtlInitializeHandleTable(0x1000,
- sizeof(LSAR_POLICY_HANDLE),
- &PolicyHandleTable);
-
- TRACE("LsarStartRpcServer() called");
+ TRACE("LsapRpcThreadRoutine() called");
Status = RpcServerUseProtseqEpW(L"ncacn_np",
10,
@@ -100,7 +97,7 @@
if (Status != RPC_S_OK)
{
WARN("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
- return;
+ return 0;
}
Status = RpcServerRegisterIf(lsarpc_v0_0_s_ifspec,
@@ -109,17 +106,51 @@
if (Status != RPC_S_OK)
{
WARN("RpcServerRegisterIf() failed (Status %lx)\n", Status);
- return;
+ return 0;
}
- Status = RpcServerListen(1, 20, TRUE);
+ Status = RpcServerListen(1, 20, FALSE);
if (Status != RPC_S_OK)
{
WARN("RpcServerListen() failed (Status %lx)\n", Status);
- return;
+ return 0;
}
- TRACE("LsarStartRpcServer() done\n");
+ TRACE("LsapRpcThreadRoutine() done\n");
+
+ return 0;
+}
+
+
+VOID
+LsarStartRpcServer(VOID)
+{
+ HANDLE hThread;
+
+ TRACE("LsarStartRpcServer() called");
+
+ RtlInitializeCriticalSection(&PolicyHandleTableLock);
+ RtlInitializeHandleTable(0x1000,
+ sizeof(LSAR_POLICY_HANDLE),
+ &PolicyHandleTable);
+
+ hThread = CreateThread(NULL,
+ 0,
+ (LPTHREAD_START_ROUTINE)
+ LsapRpcThreadRoutine,
+ NULL,
+ 0,
+ NULL);
+ if (!hThread)
+ {
+ WARN("Starting LsapRpcThreadRoutine-Thread failed!\n");
+ }
+ else
+ {
+ CloseHandle(hThread);
+ }
+
+ TRACE("LsarStartRpcServer() done");
}
@@ -220,8 +251,16 @@
ACCESS_MASK DesiredAccess,
LSAPR_HANDLE *PolicyHandle)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ ERR("LsarOpenPolicy called!\n");
+
+ *PolicyHandle = (LSAPR_HANDLE)0xcafe;
+
+ ERR("LsarOpenPolicy done!\n");
+
+ return STATUS_SUCCESS;
+
+// UNIMPLEMENTED;
+// return STATUS_NOT_IMPLEMENTED;
}