This fixes part of the deadlock problems with H_PL1. Another other part of the problem was in the server parts and will be submitted only to wine-devel as H_PL3. With both patches, RpcMgmtStopServerListen basically works, at least in the simple tests I've been performing. LICENSE: X11 CHANGELOG: * dlls/rpcrt4: ndr_marshall.c, rpc_server.c: Greg Turner <gmturner007@ameritech.net> - fix deadlock due to automatic-reset event - fix comment corresponding to bugfix in H_PL1 -- gmt "The purpose of government is to rein in the rights of the people" --President Bill Clinton, MTV interview, 1993
diff -ur -x CVS -x 'bigdif*' ../wine.test/dlls/rpcrt4/ndr_marshall.c ./dlls/rpcrt4/ndr_marshall.c --- ../wine.test/dlls/rpcrt4/ndr_marshall.c 2002-10-29 14:12:21.000000000 -0600 +++ ./dlls/rpcrt4/ndr_marshall.c 2002-10-29 15:29:31.000000000 -0600 @@ -67,10 +67,11 @@ * NdrConformantString: * * What MS calls a ConformantString is, in DCE terminology, - * a Varying Conformant String. + * a Varying-Conformant String. * [ * maxlen: DWORD (max # of CHARTYPE characters, inclusive of '\0') - * offset: DWORD (actual elements begin at (offset) CHARTYPE's into (data)) + * offset: DWORD (actual string data begins at (offset) CHARTYPE's + * into unmarshalled string) * length: DWORD (# of CHARTYPE characters, inclusive of '\0') * [ * data: CHARTYPE[maxlen] diff -ur -x CVS -x 'bigdif*' ../wine.test/dlls/rpcrt4/rpc_server.c ./dlls/rpcrt4/rpc_server.c --- ../wine.test/dlls/rpcrt4/rpc_server.c 2002-10-29 14:12:21.000000000 -0600 +++ ./dlls/rpcrt4/rpc_server.c 2002-10-29 16:12:16.000000000 -0600 @@ -233,6 +233,7 @@ /* start waiting */ res = WaitForMultipleObjects(count, objs, FALSE, INFINITE); if (res == WAIT_OBJECT_0) { + ResetEvent(m_event); if (!std_listen) break; } else if (res == WAIT_FAILED) { @@ -284,7 +285,7 @@ EnterCriticalSection(&listen_cs); if (! ++listen_count) { - if (!mgr_event) mgr_event = CreateEventA(NULL, FALSE, FALSE, NULL); + if (!mgr_event) mgr_event = CreateEventA(NULL, TRUE, FALSE, NULL); std_listen = TRUE; server_thread = CreateThread(NULL, 0, RPCRT4_server_thread, NULL, 0, NULL); LeaveCriticalSection(&listen_cs); @@ -636,6 +637,10 @@ while (std_listen) { WaitForSingleObject(mgr_event, INFINITE); + if (!std_listen) { + Sleep(100); /* don't spin violently */ + TRACE("spinning.\n"); + } } return rslt;