--- trunk/reactos/lib/rpcrt4/ndr_stubless.c 2005-05-28 14:56:02 UTC (rev 15580)
+++ trunk/reactos/lib/rpcrt4/ndr_stubless.c 2005-05-28 15:04:47 UTC (rev 15581)
@@ -41,7 +41,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole);
-LONG_PTR /* CLIENT_CALL_RETURN */ RPCRT4_NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, va_list args)
+/***********************************************************************
+ * Note: this should return a CLIENT_CALL_RETURN, but calling convention for
+ * returning structures/unions is different between Windows and gcc on i386.
+ */
+LONG_PTR RPCRT4_NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, va_list args)
{
RPC_CLIENT_INTERFACE *rpc_cli_if = (RPC_CLIENT_INTERFACE *)(pStubDesc->RpcInterfaceInformation);
@@ -83,8 +87,11 @@
/***********************************************************************
* NdrClientCall2 [RPCRT4.@]
+ *
+ * Note: this should return a CLIENT_CALL_RETURN, but calling convention for
+ * returning structures/unions is different between Windows and gcc on i386.
*/
-LONG_PTR /* CLIENT_CALL_RETURN */ WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc,
+LONG_PTR WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc,
PFORMAT_STRING pFormat, ...)
{
LONG_PTR ret;
--- trunk/reactos/lib/rpcrt4/rpc_server.c 2005-05-28 14:56:02 UTC (rev 15580)
+++ trunk/reactos/lib/rpcrt4/rpc_server.c 2005-05-28 15:04:47 UTC (rev 15581)
@@ -103,8 +103,6 @@
static HANDLE mgr_mutex;
/* set when server thread has finished opening connections */
static HANDLE server_ready_event;
-/* thread that waits for connections */
-static HANDLE server_thread;
static CRITICAL_SECTION spacket_cs;
static CRITICAL_SECTION_DEBUG spacket_cs_debug =
@@ -587,14 +585,18 @@
ReleaseMutex(mgr_mutex);
}
-static void RPCRT4_start_listen(BOOL auto_listen)
+static RPC_STATUS RPCRT4_start_listen(BOOL auto_listen)
{
+ RPC_STATUS status = RPC_S_ALREADY_LISTENING;
+
TRACE("\n");
EnterCriticalSection(&listen_cs);
if (auto_listen || (manual_listen_count++ == 0))
{
+ status = RPC_S_OK;
if (++listen_count == 1) {
+ HANDLE server_thread;
/* first listener creates server thread */
if (!mgr_mutex) mgr_mutex = CreateMutexW(NULL, FALSE, NULL);
if (!mgr_event) mgr_event = CreateEventW(NULL, FALSE, FALSE, NULL);
@@ -603,13 +605,12 @@
if (!worker_tls) worker_tls = TlsAlloc();
std_listen = TRUE;
server_thread = CreateThread(NULL, 0, RPCRT4_server_thread, NULL, 0, NULL);
- } else {
- LeaveCriticalSection(&listen_cs);
- RPCRT4_sync_with_server_thread();
- return;
+ CloseHandle(server_thread);
}
}
LeaveCriticalSection(&listen_cs);
+
+ return status;
}
static void RPCRT4_stop_listen(BOOL auto_listen)
@@ -977,24 +978,17 @@
*/
RPC_STATUS WINAPI RpcServerListen( UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait )
{
+ RPC_STATUS status;
+
TRACE("(%u,%u,%u)\n", MinimumCallThreads, MaxCalls, DontWait);
if (!protseqs)
return RPC_S_NO_PROTSEQS_REGISTERED;
- EnterCriticalSection(&listen_cs);
+ status = RPCRT4_start_listen(FALSE);
- if (std_listen) {
- LeaveCriticalSection(&listen_cs);
- return RPC_S_ALREADY_LISTENING;
- }
+ if (DontWait || (status != RPC_S_OK)) return status;
- RPCRT4_start_listen(FALSE);
-
- LeaveCriticalSection(&listen_cs);
-
- if (DontWait) return RPC_S_OK;
-
return RpcMgmtWaitServerListen();
}
@@ -1003,29 +997,20 @@
*/
RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
{
- RPC_STATUS rslt = RPC_S_OK;
+ TRACE("()\n");
- TRACE("\n");
-
EnterCriticalSection(&listen_cs);
- if (!std_listen)
- if ( (rslt = RpcServerListen(1, 0, TRUE)) != RPC_S_OK ) {
- LeaveCriticalSection(&listen_cs);
- return rslt;
- }
+ if (!std_listen) {
+ LeaveCriticalSection(&listen_cs);
+ return RPC_S_NOT_LISTENING;
+ }
LeaveCriticalSection(&listen_cs);
- while (std_listen) {
- WaitForSingleObject(mgr_event, INFINITE);
- if (!std_listen) {
- Sleep(100); /* don't spin violently */
- TRACE("spinning.\n");
- }
- }
+ RPCRT4_sync_with_server_thread();
- return rslt;
+ return RPC_S_OK;
}
/***********************************************************************
--- trunk/reactos/lib/rpcrt4/rpcrt4_main.c 2005-05-28 14:56:02 UTC (rev 15580)
+++ trunk/reactos/lib/rpcrt4/rpcrt4_main.c 2005-05-28 15:04:47 UTC (rev 15581)
@@ -767,7 +767,10 @@
return TRUE;
}
-/* DceErrorInqText
+#define MAX_RPC_ERROR_TEXT 256
+
+/******************************************************************************
+ * DceErrorInqTextW (rpcrt4.@)
*
* Notes
* 1. On passing a NULL pointer the code does bomb out.
@@ -778,9 +781,6 @@
* 4. The MSDN documentation currently declares that the second argument is
* unsigned char *, even for the W version. I don't believe it.
*/
-
-#define MAX_RPC_ERROR_TEXT 256
-
RPC_STATUS RPC_ENTRY DceErrorInqTextW (RPC_STATUS e, unsigned short *buffer)
{
DWORD count;
@@ -801,6 +801,9 @@
return RPC_S_OK;
}
+/******************************************************************************
+ * DceErrorInqTextA (rpcrt4.@)
+ */
RPC_STATUS RPC_ENTRY DceErrorInqTextA (RPC_STATUS e, unsigned char *buffer)
{
RPC_STATUS status;