ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
28 participants
657 discussions
Start a n
N
ew thread
[fireball] 37231: - Sync rpcrt4_winetest too.
by fireball@svn.reactos.org
Author: fireball Date: Thu Nov 6 14:12:22 2008 New Revision: 37231 URL:
http://svn.reactos.org/svn/reactos?rev=37231&view=rev
Log: - Sync rpcrt4_winetest too. Modified: trunk/rostests/winetests/rpcrt4/cstub.c trunk/rostests/winetests/rpcrt4/ndr_marshall.c trunk/rostests/winetests/rpcrt4/rpc.c trunk/rostests/winetests/rpcrt4/server.c trunk/rostests/winetests/rpcrt4/server.idl Modified: trunk/rostests/winetests/rpcrt4/cstub.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/cstub.c?…
============================================================================== --- trunk/rostests/winetests/rpcrt4/cstub.c [iso-8859-1] (original) +++ trunk/rostests/winetests/rpcrt4/cstub.c [iso-8859-1] Thu Nov 6 14:12:22 2008 @@ -432,6 +432,7 @@ { IPSFactoryBuffer *ppsf = NULL; const CLSID PSDispatch = {0x20420, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; + const CLSID CLSID_Unknown = {0x45678, 0x1234, 0x6666, {0xff, 0x67, 0x45, 0x98, 0x76, 0x12, 0x34, 0x56}}; HRESULT r; HMODULE hmod = LoadLibraryA("rpcrt4.dll"); void *CStd_QueryInterface = GetProcAddress(hmod, "CStdStubBuffer_QueryInterface"); @@ -444,6 +445,11 @@ void *CStd_CountRefs = GetProcAddress(hmod, "CStdStubBuffer_CountRefs"); void *CStd_DebugServerQueryInterface = GetProcAddress(hmod, "CStdStubBuffer_DebugServerQueryInterface"); void *CStd_DebugServerRelease = GetProcAddress(hmod, "CStdStubBuffer_DebugServerRelease"); + + r = NdrDllGetClassObject(&PSDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list, + &CLSID_Unknown, &PSFactoryBuffer); + ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%x\n", r); + ok(ppsf == NULL, "NdrDllGetClassObject should have set ppsf to NULL on failure\n"); r = NdrDllGetClassObject(&PSDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list, &PSDispatch, &PSFactoryBuffer); @@ -518,6 +524,13 @@ #undef VTBL_TEST_ZERO ok(PSFactoryBuffer.RefCount == 1, "ref count %d\n", PSFactoryBuffer.RefCount); + IPSFactoryBuffer_Release(ppsf); + + r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list, + NULL, &PSFactoryBuffer); + ok(r == S_OK, "ret %08x\n", r); + ok(ppsf != NULL, "ppsf == NULL\n"); + return ppsf; } Modified: trunk/rostests/winetests/rpcrt4/ndr_marshall.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/ndr_mars…
============================================================================== --- trunk/rostests/winetests/rpcrt4/ndr_marshall.c [iso-8859-1] (original) +++ trunk/rostests/winetests/rpcrt4/ndr_marshall.c [iso-8859-1] Thu Nov 6 14:12:22 2008 @@ -1191,11 +1191,17 @@ TEST_ZERO(fHasExtensions, "%d"); TEST_ZERO(fHasNewCorrDesc, "%d"); TEST_ZERO(fIsIn, "%d"); - TEST_ZERO(fIsOut, "%d"); + ok(stubMsg.fIsOut == 0 || + stubMsg.fIsOut == -1, /* XP-SP3 */ + "fIsOut should have been set to 0 or -1 instead of %d\n", stubMsg.fIsOut); TEST_ZERO(fIsOicf, "%d"); TEST_ZERO(fBufferValid, "%d"); - TEST_ZERO(fHasMemoryValidateCallback, "%d"); - TEST_ZERO(fInFree, "%d"); + ok(stubMsg.fHasMemoryValidateCallback == 0 || + stubMsg.fHasMemoryValidateCallback == -1, /* XP-SP3 */ + "fHasMemoryValidateCallback should have been set to 0 or -1 instead of %d\n", stubMsg.fHasMemoryValidateCallback); + ok(stubMsg.fInFree == 0 || + stubMsg.fInFree == -1, /* XP-SP3 */ + "fInFree should have been set to 0 or -1 instead of %d\n", stubMsg.fInFree); TEST_ZERO(fNeedMCCP, "%d"); ok(stubMsg.fUnused == 0 || stubMsg.fUnused == -2, /* Vista */ @@ -1302,11 +1308,17 @@ TEST_ZERO(fHasExtensions, "%d"); TEST_ZERO(fHasNewCorrDesc, "%d"); TEST_ZERO(fIsIn, "%d"); - TEST_ZERO(fIsOut, "%d"); + ok(stubMsg.fIsOut == 0 || + stubMsg.fIsOut == -1, /* XP-SP3 */ + "fIsOut should have been set to 0 or -1 instead of %d\n", stubMsg.fIsOut); TEST_ZERO(fIsOicf, "%d"); trace("fBufferValid = %d\n", stubMsg.fBufferValid); - TEST_ZERO(fHasMemoryValidateCallback, "%d"); - TEST_ZERO(fInFree, "%d"); + ok(stubMsg.fHasMemoryValidateCallback == 0 || + stubMsg.fHasMemoryValidateCallback == -1, /* XP-SP3 */ + "fHasMemoryValidateCallback should have been set to 0 or -1 instead of %d\n", stubMsg.fHasMemoryValidateCallback); + ok(stubMsg.fInFree == 0 || + stubMsg.fInFree == -1, /* XP-SP3 */ + "fInFree should have been set to 0 or -1 instead of %d\n", stubMsg.fInFree); TEST_ZERO(fNeedMCCP, "%d"); ok(stubMsg.fUnused == 0 || stubMsg.fUnused == -2, /* Vista */ Modified: trunk/rostests/winetests/rpcrt4/rpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/rpc.c?re…
============================================================================== --- trunk/rostests/winetests/rpcrt4/rpc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/rpcrt4/rpc.c [iso-8859-1] Thu Nov 6 14:12:22 2008 @@ -385,7 +385,9 @@ ok(ret == RPC_S_OK, "TowerConstruct failed with error %ld\n", ret); ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address); ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret); - ok(!strcmp(address, "0.0.0.0"), "address was \"%s\" instead of \"0.0.0.0\"\n", address); + ok(!strcmp(address, "0.0.0.0") || + broken(!strcmp(address, "255.255.255.255")), + "address was \"%s\" instead of \"0.0.0.0\"\n", address); I_RpcFree(address); I_RpcFree(tower); @@ -666,6 +668,7 @@ ok(retval == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n", exception, EXCEPTION_CONTINUE_SEARCH, retval); break; + case STATUS_GUARD_PAGE_VIOLATION: case STATUS_IN_PAGE_ERROR: case STATUS_HANDLE_NOT_CLOSABLE: trace("I_RpcExceptionFilter(0x%x) returned %d\n", exception, retval); @@ -757,6 +760,74 @@ status = RpcBindingFree(&handle); ok(status == RPC_S_OK, "RpcBindingFree failed with error %lu\n", status); +} + +static char *printGuid(char *buf, const UUID *guid) +{ + sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", + guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], + guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], + guid->Data4[6], guid->Data4[7]); + return buf; +} + +static void test_UuidCreate(void) +{ + UUID guid; + BYTE version; + + UuidCreate(&guid); + version = (guid.Data3 & 0xf000) >> 12; + todo_wine + ok(version == 4 || broken(version == 1), "unexpected version %d\n", + version); + if (version == 4) + { + static UUID v4and = { 0, 0, 0x4000, { 0x80,0,0,0,0,0,0,0 } }; + static UUID v4or = { 0xffffffff, 0xffff, 0x4fff, + { 0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff } }; + UUID and, or; + RPC_STATUS rslt; + int i; + char buf[39]; + + memcpy(&and, &guid, sizeof(guid)); + memcpy(&or, &guid, sizeof(guid)); + /* Generate a bunch of UUIDs and mask them. By the end, we expect + * every randomly generated bit to have been zero at least once, + * resulting in no bits set in the and mask except those which are not + * randomly generated: the version number and the topmost bits of the + * Data4 field (treated as big-endian.) Similarly, we expect only + * the bits which are not randomly set to be cleared in the or mask. + */ + for (i = 0; i < 1000; i++) + { + LPBYTE src, dst; + + UuidCreate(&guid); + for (src = (LPBYTE)&guid, dst = (LPBYTE)∧ + src - (LPBYTE)&guid < sizeof(guid); src++, dst++) + *dst &= *src; + for (src = (LPBYTE)&guid, dst = (LPBYTE)∨ + src - (LPBYTE)&guid < sizeof(guid); src++, dst++) + *dst |= *src; + } + ok(UuidEqual(&and, &v4and, &rslt), + "unexpected bits set in V4 UUID: %s\n", printGuid(buf, &and)); + ok(UuidEqual(&or, &v4or, &rslt), + "unexpected bits set in V4 UUID: %s\n", printGuid(buf, &or)); + } + else + { + /* Older versions of Windows generate V1 UUIDs. For these, there are + * many stable bits, including at least the MAC address if one is + * present. Just check that Data4[0]'s most significant bits are + * set as expected. + */ + todo_wine + ok((guid.Data4[0] & 0xc0) == 0x80, + "unexpected value in Data4[0]: %02x\n", guid.Data4[0] & 0xc0); + } } START_TEST( rpc ) @@ -777,4 +848,5 @@ test_endpoint_mapper(ncacn_np, np_address, np_endpoint); test_endpoint_mapper(ncalrpc, NULL, lrpc_endpoint); test_RpcStringBindingFromBinding(); -} + test_UuidCreate(); +} Modified: trunk/rostests/winetests/rpcrt4/server.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/server.c…
============================================================================== --- trunk/rostests/winetests/rpcrt4/server.c [iso-8859-1] (original) +++ trunk/rostests/winetests/rpcrt4/server.c [iso-8859-1] Thu Nov 6 14:12:22 2008 @@ -990,27 +990,27 @@ ULONG __RPC_USER bstr_t_UserSize(ULONG *flags, ULONG start, bstr_t *b) { - return start + FIELD_OFFSET(wire_bstr_t, data[(*b)[-1]]); + return start + FIELD_OFFSET(user_bstr_t, data[(*b)[-1]]); } unsigned char * __RPC_USER bstr_t_UserMarshal(ULONG *flags, unsigned char *buffer, bstr_t *b) { - wire_bstr_t *wb = (wire_bstr_t *) buffer; + wire_bstr_t wb = (wire_bstr_t) buffer; wb->n = (*b)[-1]; memcpy(&wb->data, *b, wb->n * sizeof wb->data[0]); - return buffer + FIELD_OFFSET(wire_bstr_t, data[wb->n]); + return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]); } unsigned char * __RPC_USER bstr_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, bstr_t *b) { - wire_bstr_t *wb = (wire_bstr_t *) buffer; + wire_bstr_t wb = (wire_bstr_t) buffer; short *data = HeapAlloc(GetProcessHeap(), 0, (wb->n + 1) * sizeof *data); data[0] = wb->n; memcpy(&data[1], wb->data, wb->n * sizeof data[1]); *b = &data[1]; - return buffer + FIELD_OFFSET(wire_bstr_t, data[wb->n]); + return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]); } void __RPC_USER Modified: trunk/rostests/winetests/rpcrt4/server.idl URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/server.i…
============================================================================== --- trunk/rostests/winetests/rpcrt4/server.idl [iso-8859-1] (original) +++ trunk/rostests/winetests/rpcrt4/server.idl [iso-8859-1] Thu Nov 6 14:12:22 2008 @@ -299,8 +299,9 @@ { short n; [size_is(n)] short data[]; - } wire_bstr_t; - + } user_bstr_t; + + typedef [unique] user_bstr_t *wire_bstr_t; typedef [wire_marshal(wire_bstr_t)] short *bstr_t; unsigned hash_bstr(bstr_t s);
16 years, 1 month
1
0
0
0
[sginsberg] 37230: - ASSERTify a hacky workaround -- this shouldn't happen anymore in ros
by sginsberg@svn.reactos.org
Author: sginsberg Date: Thu Nov 6 13:21:46 2008 New Revision: 37230 URL:
http://svn.reactos.org/svn/reactos?rev=37230&view=rev
Log: - ASSERTify a hacky workaround -- this shouldn't happen anymore in ros Modified: trunk/reactos/ntoskrnl/ob/obref.c Modified: trunk/reactos/ntoskrnl/ob/obref.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obref.c?rev=37…
============================================================================== --- trunk/reactos/ntoskrnl/ob/obref.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ob/obref.c [iso-8859-1] Thu Nov 6 13:21:46 2008 @@ -299,11 +299,7 @@ if (!OldCount) { /* Sanity check */ - if (Header->HandleCount) - { - DPRINT1("Misbehaving object: %wZ\n", &Header->Type->Name); - return Header->PointerCount; - } + ASSERT(Header->HandleCount == 0); /* Check if APCs are still active */ if (!KeAreAllApcsDisabled())
16 years, 1 month
1
0
0
0
[fireball] 37229: - Update the _ros.diff. Usual changes are there (unfortunately incompatibilites in Wine still exist, RpcMgmtWaitForServerListen is still not implemented there, and their dependency on unix sockets is totally out of place). On the good side I could get rid of disabling unix-sockets stuff in source code by slightly improving unix_func.
by fireball@svn.reactos.org
Author: fireball Date: Thu Nov 6 13:10:03 2008 New Revision: 37229 URL:
http://svn.reactos.org/svn/reactos?rev=37229&view=rev
Log: - Update the _ros.diff. Usual changes are there (unfortunately incompatibilites in Wine still exist, RpcMgmtWaitForServerListen is still not implemented there, and their dependency on unix sockets is totally out of place). On the good side I could get rid of disabling unix-sockets stuff in source code by slightly improving unix_func. Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4_ros.diff Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4_ros.diff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcrt4_ro…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcrt4_ros.diff [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcrt4_ros.diff [iso-8859-1] Thu Nov 6 13:10:03 2008 @@ -1,8 +1,42 @@ +Index: epm_towers.h +=================================================================== +--- epm_towers.h (working copy) ++++ epm_towers.h (working copy) +@@ -17,11 +17,11 @@ + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +-#include "epm.h" ++#include "epm_c.h" + + #define EPM_PROTOCOL_DNET_NSP 0x04 + #define EPM_PROTOCOL_OSI_TP4 0x05 + #define EPM_PROTOCOL_OSI_CLNS 0x06 + #define EPM_PROTOCOL_TCP 0x07 +Index: rpc_epmap.c +=================================================================== +--- rpc_epmap.c (working copy) ++++ rpc_epmap.c (working copy) +@@ -30,11 +30,11 @@ + + #include "wine/debug.h" + #include "wine/exception.h" + + #include "rpc_binding.h" +-#include "epm.h" ++#include "epm_c.h" + #include "epm_towers.h" + + WINE_DEFAULT_DEBUG_CHANNEL(ole); + + /* The "real" RPC portmapper endpoints that I know of are: Index: rpc_server.c =================================================================== --- rpc_server.c (working copy) +++ rpc_server.c (working copy) -@@ -1017,22 +1017,30 @@ +@@ -1040,22 +1040,28 @@ /*********************************************************************** * RpcMgmtServerWaitListen (RPCRT4.@) */ @@ -18,14 +52,12 @@ return RPC_S_NOT_LISTENING; } -+ do -+ { ++ do { LeaveCriticalSection(&listen_cs); ++ LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry) ++ WaitForSingleObject(cps->server_ready_event, INFINITE); - FIXME("not waiting for server calls to finish\n"); -+ LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry) -+ WaitForSingleObject(cps->server_ready_event, INFINITE); -+ + EnterCriticalSection(&listen_cs); + } while (!std_listen); + @@ -39,11 +71,11 @@ =================================================================== --- rpc_transport.c (working copy) +++ rpc_transport.c (working copy) -@@ -54,10 +54,13 @@ - #endif - #ifdef HAVE_SYS_POLL_H - #include <sys/poll.h> - #endif +@@ -65,10 +65,13 @@ + # include <sys/poll.h> + # endif + # define closesocket close + #endif /* defined(__MINGW32__) || defined (_MSC_VER) */ +#include <winsock2.h> +#include <ws2tcpip.h> @@ -53,7 +85,7 @@ #include "winnls.h" #include "winerror.h" #include "winternl.h" -@@ -71,10 +74,12 @@ +@@ -82,10 +85,12 @@ #include "rpc_binding.h" #include "rpc_message.h" #include "rpc_server.h" @@ -66,7 +98,7 @@ #endif WINE_DEFAULT_DEBUG_CHANNEL(rpc); -@@ -83,11 +88,11 @@ +@@ -94,11 +99,11 @@ typedef struct _RpcConnection_np { @@ -79,25 +111,27 @@ static RpcConnection *rpcrt4_conn_np_alloc(void) { -@@ -105,15 +110,15 @@ - { - if (npc->listening) +@@ -118,17 +123,17 @@ return RPC_S_OK; npc->listening = TRUE; -- if (ConnectNamedPipe(npc->pipe, &npc->ovl)) -+ if (ConnectNamedPipe(npc->pipe, &npc->ovl[0])) - return RPC_S_OK; - - if (GetLastError() == ERROR_PIPE_CONNECTED) { -- SetEvent(npc->ovl.hEvent); -+ SetEvent(npc->ovl[0].hEvent); - return RPC_S_OK; - } - if (GetLastError() == ERROR_IO_PENDING) { - /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */ - return RPC_S_OK; -@@ -126,11 +131,11 @@ + for (;;) + { +- if (ConnectNamedPipe(npc->pipe, &npc->ovl)) ++ if (ConnectNamedPipe(npc->pipe, &npc->ovl[0])) + return RPC_S_OK; + + switch(GetLastError()) + { + case ERROR_PIPE_CONNECTED: +- SetEvent(npc->ovl.hEvent); ++ SetEvent(npc->ovl[0].hEvent); + return RPC_S_OK; + case ERROR_IO_PENDING: + /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */ + return RPC_S_OK; + case ERROR_NO_DATA_DETECTED: +@@ -146,11 +151,11 @@ static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname) { RpcConnection_np *npc = (RpcConnection_np *) Connection; @@ -110,7 +144,7 @@ RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL); if (npc->pipe == INVALID_HANDLE_VALUE) { WARN("CreateNamedPipe failed with error %d\n", GetLastError()); -@@ -139,11 +144,12 @@ +@@ -159,11 +164,12 @@ else return RPC_S_CANT_CREATE_ENDPOINT; } @@ -124,7 +158,7 @@ * server thread as the thread must be alertable */ return RPC_S_OK; } -@@ -202,11 +208,13 @@ +@@ -220,11 +226,12 @@ /* success */ memset(&npc->ovl, 0, sizeof(npc->ovl)); /* pipe is connected; change to message-read mode. */ @@ -133,13 +167,12 @@ - npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); -+ npc->pipe = pipe; return RPC_S_OK; } -@@ -308,11 +316,12 @@ +@@ -326,11 +333,12 @@ { /* because of the way named pipes work, we'll transfer the connected pipe * to the child, then reopen the server binding to continue listening */ @@ -153,7 +186,7 @@ old_npc->listening = FALSE; } -@@ -359,13 +368,18 @@ +@@ -377,13 +385,18 @@ unsigned int bytes_left = count; while (bytes_left) @@ -163,39 +196,39 @@ - if (!ret || !bytes_read) + ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &npc->ovl[0]); + if ((!ret || !bytes_read) && (GetLastError() != ERROR_IO_PENDING)) ++ break; ++ ++ ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE); ++ if (!ret && (GetLastError() != ERROR_MORE_DATA)) break; -+ -+ ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE); -+ if (!ret && GetLastError() != ERROR_MORE_DATA) -+ break; + bytes_left -= bytes_read; buf += bytes_read; } return ret ? count : -1; } -@@ -379,13 +393,18 @@ +@@ -397,13 +410,18 @@ unsigned int bytes_left = count; while (bytes_left) { DWORD bytes_written; -- ret = WriteFile(npc->pipe, buf, count, &bytes_written, NULL); +- ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL); - if (!ret || !bytes_written) -+ ret = WriteFile(npc->pipe, buf, count, &bytes_written, &npc->ovl[1]); ++ ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &npc->ovl[1]); + if ((!ret || !bytes_written) && (GetLastError() != ERROR_IO_PENDING)) ++ break; ++ ++ ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE); ++ if (!ret && (GetLastError() != ERROR_MORE_DATA)) break; -+ -+ ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE); -+ if (!ret && GetLastError() != ERROR_MORE_DATA) -+ break; + bytes_left -= bytes_written; buf += bytes_written; } return ret ? count : -1; } -@@ -396,14 +415,19 @@ +@@ -414,13 +432,17 @@ if (npc->pipe) { FlushFileBuffers(npc->pipe); CloseHandle(npc->pipe); @@ -212,13 +245,11 @@ + CloseHandle(npc->ovl[1].hEvent); + npc->ovl[1].hEvent = 0; } -+ return 0; } static void rpcrt4_conn_np_cancel_call(RpcConnection *Connection) - { -@@ -547,11 +571,11 @@ +@@ -579,11 +601,11 @@ /* open and count connections */ *count = 1; conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); @@ -231,7 +262,7 @@ } /* make array of connections */ -@@ -568,11 +592,11 @@ +@@ -600,11 +622,11 @@ objs[0] = npps->mgr_event; *count = 1; @@ -244,7 +275,7 @@ } LeaveCriticalSection(&protseq->cs); return objs; -@@ -615,11 +639,11 @@ +@@ -647,11 +669,11 @@ b_handle = objs[res - WAIT_OBJECT_0]; /* find which connection got a RPC */ EnterCriticalSection(&protseq->cs); @@ -257,120 +288,3 @@ cconn = NULL; if (conn) RPCRT4_SpawnConnection(&cconn, &conn->common); -@@ -713,16 +737,18 @@ - RpcConnection_tcp *tcpc; - tcpc = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcConnection_tcp)); - if (tcpc == NULL) - return NULL; - tcpc->sock = -1; -+#ifndef __REACTOS__ - if (socketpair(PF_UNIX, SOCK_STREAM, 0, tcpc->cancel_fds) < 0) - { - ERR("socketpair() failed: %s\n", strerror(errno)); - HeapFree(GetProcessHeap(), 0, tcpc); - return NULL; - } -+#endif - return &tcpc->common; - } - - static RPC_STATUS rpcrt4_ncacn_ip_tcp_open(RpcConnection* Connection) - { -@@ -783,12 +809,11 @@ - continue; - } - - /* RPC depends on having minimal latency so disable the Nagle algorithm */ - val = 1; -- setsockopt(sock, SOL_TCP, TCP_NODELAY, &val, sizeof(val)); -- fcntl(sock, F_SETFL, O_NONBLOCK); /* make socket nonblocking */ -+ setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); - - tcpc->sock = sock; - - freeaddrinfo(ai); - TRACE("connected\n"); -@@ -806,10 +831,11 @@ - int sock; - int ret; - struct addrinfo *ai; - struct addrinfo *ai_cur; - struct addrinfo hints; -+ u_long blocking; - RpcConnection *first_connection = NULL; - - TRACE("(%p, %s)\n", protseq, endpoint); - - hints.ai_flags = AI_PASSIVE /* for non-localhost addresses */; -@@ -857,11 +883,11 @@ - ret = bind(sock, ai_cur->ai_addr, ai_cur->ai_addrlen); - if (ret < 0) - { - WARN("bind failed: %s\n", strerror(errno)); - close(sock); -- if (errno == EADDRINUSE) -+ if (errno == WSAEADDRINUSE) - status = RPC_S_DUPLICATE_ENDPOINT; - else - status = RPC_S_CANT_CREATE_ENDPOINT; - continue; - } -@@ -886,11 +912,12 @@ - } - /* need a non-blocking socket, otherwise accept() has a potential - * race-condition (poll() says it is readable, connection drops, - * and accept() blocks until the next connection comes...) - */ -- ret = fcntl(sock, F_SETFL, O_NONBLOCK); -+ blocking = 1; -+ ret = ioctlsocket(sock, FIONBIO, &blocking); - if (ret < 0) - { - WARN("couldn't make socket non-blocking, error %d\n", ret); - RPCRT4_DestroyConnection(&tcpc->common); - status = RPC_S_OUT_OF_RESOURCES; -@@ -929,10 +956,11 @@ - static RPC_STATUS rpcrt4_conn_tcp_handoff(RpcConnection *old_conn, RpcConnection *new_conn) - { - int ret; - struct sockaddr_in address; - socklen_t addrsize; -+ u_long blocking; - RpcConnection_tcp *server = (RpcConnection_tcp*) old_conn; - RpcConnection_tcp *client = (RpcConnection_tcp*) new_conn; - - addrsize = sizeof(address); - ret = accept(server->sock, (struct sockaddr*) &address, &addrsize); -@@ -940,11 +968,12 @@ - { - ERR("Failed to accept a TCP connection: error %d\n", ret); - return RPC_S_OUT_OF_RESOURCES; - } - /* reset to blocking behaviour */ -- fcntl(ret, F_SETFL, 0); -+ blocking = 0; -+ ret = ioctlsocket(ret, FIONBIO, &blocking); - client->sock = ret; - TRACE("Accepted a new TCP connection\n"); - return RPC_S_OK; - } - -@@ -1187,14 +1216,16 @@ - { - RpcServerProtseq_sock *ps = HeapAlloc(GetProcessHeap(), 0, sizeof(*ps)); - if (ps) - { - int fds[2]; -+ u_long blocking; - if (!socketpair(PF_UNIX, SOCK_DGRAM, 0, fds)) - { -- fcntl(fds[0], F_SETFL, O_NONBLOCK); -- fcntl(fds[1], F_SETFL, O_NONBLOCK); -+ blocking = 1; -+ ioctlsocket(fds[0], FIONBIO, &blocking); -+ ioctlsocket(fds[1], FIONBIO, &blocking); - ps->mgr_event_rcv = fds[0]; - ps->mgr_event_snd = fds[1]; - } - else - {
16 years, 1 month
1
0
0
0
[sginsberg] 37228: - Comment out unused, static PaintUnderLappers
by sginsberg@svn.reactos.org
Author: sginsberg Date: Thu Nov 6 12:38:21 2008 New Revision: 37228 URL:
http://svn.reactos.org/svn/reactos?rev=37228&view=rev
Log: - Comment out unused, static PaintUnderLappers Modified: trunk/rosapps/dflat32/normal.c Modified: trunk/rosapps/dflat32/normal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/dflat32/normal.c?rev=37228…
============================================================================== --- trunk/rosapps/dflat32/normal.c [iso-8859-1] (original) +++ trunk/rosapps/dflat32/normal.c [iso-8859-1] Thu Nov 6 12:38:21 2008 @@ -4,7 +4,7 @@ #ifdef INCLUDE_MULTI_WINDOWS static void PaintOverLappers(DFWINDOW wnd); -static void PaintUnderLappers(DFWINDOW wnd); +//static void PaintUnderLappers(DFWINDOW wnd); #endif static BOOL InsideWindow(DFWINDOW, int, int); @@ -915,6 +915,8 @@ HiddenWindow = wnd; PaintOverParents(wnd); } + +#if 0 /* --- paint those parts of a window that are overlapped --- */ static void PaintUnderLappers(DFWINDOW wnd) { @@ -960,6 +962,7 @@ hwnd = DfNextWindow(hwnd); } } +#endif #endif /* #ifdef INCLUDE_MULTI_WINDOWS */ /* --- save video area to be used by dummy window border --- */
16 years, 1 month
1
0
0
0
[sginsberg] 37227: - Make Kdbg "bugcheck" command work -- Kdbg isn't re-entrant, so defer the bugcheck and exit the input loop
by sginsberg@svn.reactos.org
Author: sginsberg Date: Thu Nov 6 12:33:56 2008 New Revision: 37227 URL:
http://svn.reactos.org/svn/reactos?rev=37227&view=rev
Log: - Make Kdbg "bugcheck" command work -- Kdbg isn't re-entrant, so defer the bugcheck and exit the input loop Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c trunk/reactos/ntoskrnl/kdbg/kdb_cli.c Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb.c?rev=37…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb.c [iso-8859-1] Thu Nov 6 12:33:56 2008 @@ -51,6 +51,7 @@ STATIC KDB_KTRAP_FRAME KdbTrapFrame = { { 0 } }; /* The trapframe which was passed to KdbEnterDebuggerException */ STATIC KDB_KTRAP_FRAME KdbThreadTrapFrame = { { 0 } }; /* The trapframe of the current thread (KdbCurrentThread) */ STATIC KAPC_STATE KdbApcState; +extern BOOLEAN KdbpBugCheckRequested; /* Array of conditions when to enter KDB */ STATIC KDB_ENTER_CONDITION KdbEnterConditions[][2] = @@ -1601,6 +1602,13 @@ /* Leave critical section */ Ke386RestoreFlags(OldEflags); + /* Check if user requested a bugcheck */ + if (KdbpBugCheckRequested) + { + /* Bugcheck the system */ + KeBugCheck(MANUALLY_INITIATED_CRASH); + } + continue_execution: /* Clear debug status */ if (ExceptionCode == STATUS_BREAKPOINT) /* FIXME: Why clear DR6 on INT3? */ Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_cli.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] Thu Nov 6 12:33:56 2008 @@ -99,6 +99,7 @@ STATIC LONG KdbNumberOfColsTerminal = -1; PCHAR KdbInitFileBuffer = NULL; /* Buffer where KDBinit file is loaded into during initialization */ +BOOLEAN KdbpBugCheckRequested = FALSE; STATIC CONST struct { @@ -1689,9 +1690,9 @@ STATIC BOOLEAN KdbpCmdBugCheck(ULONG Argc, PCHAR Argv[]) { - /* Bugcheck the system */ - KeBugCheck(MANUALLY_INITIATED_CRASH); - return TRUE; + /* Set the flag and quit looping */ + KdbpBugCheckRequested = TRUE; + return FALSE; } /*!\brief Sets or displays a config variables value.
16 years, 1 month
1
0
0
0
[sginsberg] 37226: - KdbpCmdBugCheck: Use correct bugcheck code
by sginsberg@svn.reactos.org
Author: sginsberg Date: Thu Nov 6 12:03:57 2008 New Revision: 37226 URL:
http://svn.reactos.org/svn/reactos?rev=37226&view=rev
Log: - KdbpCmdBugCheck: Use correct bugcheck code Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_cli.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c [iso-8859-1] Thu Nov 6 12:03:57 2008 @@ -1689,7 +1689,8 @@ STATIC BOOLEAN KdbpCmdBugCheck(ULONG Argc, PCHAR Argv[]) { - KeBugCheck(0xDEADDEAD); + /* Bugcheck the system */ + KeBugCheck(MANUALLY_INITIATED_CRASH); return TRUE; }
16 years, 1 month
1
0
0
0
[fireball] 37225: - Sync rpcrt4.dll to Wine-20081106. ros.diff and regtests aren't updated yet.
by fireball@svn.reactos.org
Author: fireball Date: Thu Nov 6 11:35:54 2008 New Revision: 37225 URL:
http://svn.reactos.org/svn/reactos?rev=37225&view=rev
Log: - Sync rpcrt4.dll to Wine-20081106. ros.diff and regtests aren't updated yet. Added: trunk/reactos/dll/win32/rpcrt4/epm.idl Removed: trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.c trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.h Modified: trunk/reactos/dll/win32/rpcrt4/cproxy.c trunk/reactos/dll/win32/rpcrt4/cpsf.c trunk/reactos/dll/win32/rpcrt4/cpsf.h trunk/reactos/dll/win32/rpcrt4/cstub.c trunk/reactos/dll/win32/rpcrt4/epm_towers.h trunk/reactos/dll/win32/rpcrt4/ndr_clientserver.c trunk/reactos/dll/win32/rpcrt4/ndr_es.c trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c trunk/reactos/dll/win32/rpcrt4/ndr_misc.h trunk/reactos/dll/win32/rpcrt4/ndr_ole.c trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c trunk/reactos/dll/win32/rpcrt4/rpc_async.c trunk/reactos/dll/win32/rpcrt4/rpc_binding.c trunk/reactos/dll/win32/rpcrt4/rpc_binding.h trunk/reactos/dll/win32/rpcrt4/rpc_defs.h trunk/reactos/dll/win32/rpcrt4/rpc_epmap.c trunk/reactos/dll/win32/rpcrt4/rpc_message.c trunk/reactos/dll/win32/rpcrt4/rpc_message.h trunk/reactos/dll/win32/rpcrt4/rpc_server.c trunk/reactos/dll/win32/rpcrt4/rpc_server.h trunk/reactos/dll/win32/rpcrt4/rpc_transport.c trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec trunk/reactos/dll/win32/rpcrt4/rpcrt4_main.c trunk/reactos/dll/win32/rpcrt4/unix_func.c trunk/reactos/dll/win32/rpcrt4/unix_func.h trunk/reactos/include/psdk/rpcdce.h trunk/reactos/include/psdk/rpcndr.h trunk/reactos/include/psdk/winnt.h Modified: trunk/reactos/dll/win32/rpcrt4/cproxy.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/cproxy.c?…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/cproxy.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/cproxy.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * COM proxy implementation * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -57,10 +57,6 @@ static const IRpcProxyBufferVtbl StdProxy_Vtbl; #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) - -/* How the Windows stubless proxy thunks work is explained at - *
http://msdn.microsoft.com/library/en-us/dnmsj99/html/com0199.asp
, - * but I'll use a slightly different method, to make life easier */ #if defined(__i386__) @@ -389,6 +385,8 @@ } pStubMsg->dwStubPhase = PROXY_SENDRECEIVE; + /* avoid sending uninitialised parts of the buffer on the wire */ + pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer; hr = IRpcChannelBuffer_SendReceive(pStubMsg->pRpcChannelBuffer, (RPCOLEMESSAGE*)pStubMsg->RpcMsg, &Status); Modified: trunk/reactos/dll/win32/rpcrt4/cpsf.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/cpsf.c?re…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/cpsf.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/cpsf.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * COM proxy/stub factory (CStdPSFactory) implementation * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -174,7 +174,7 @@ if(max_delegating_vtbl_size > 0) create_delegating_vtbl(max_delegating_vtbl_size); } - if (IsEqualGUID(rclsid, pclsid)) + if (pclsid && IsEqualGUID(rclsid, pclsid)) return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv); else { const ProxyFileInfo *info; Modified: trunk/reactos/dll/win32/rpcrt4/cpsf.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/cpsf.h?re…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/cpsf.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/cpsf.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * COM proxy definitions * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/reactos/dll/win32/rpcrt4/cstub.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/cstub.c?r…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/cstub.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/cstub.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * COM stub (CStdStubBuffer) implementation * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,6 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + #include <stdarg.h> #define COBJMACROS @@ -39,9 +42,9 @@ #define STUB_HEADER(This) (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1]) -static WINE_EXCEPTION_FILTER(stub_filter) -{ - if (GetExceptionInformation()->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) +static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr) +{ + if (eptr->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_EXECUTE_HANDLER; } @@ -194,7 +197,7 @@ #else /* __i386__ */ typedef struct {int dummy;} vtbl_method_t; -static void fill_table(IUnknownVtbl *vtbl, DWORD num) +static void fill_table(IUnknownVtbl *vtbl, void **methods, DWORD num) { ERR("delegated stubs are not supported on this architecture\n"); } @@ -218,9 +221,7 @@ if(current_vtbl.table && current_vtbl.table->ref == 0) { TRACE("freeing old table\n"); - VirtualFree(current_vtbl.table->methods, - (current_vtbl.table->size - 3) * sizeof(vtbl_method_t), - MEM_RELEASE); + VirtualFree(current_vtbl.table->methods, 0, MEM_RELEASE); HeapFree(GetProcessHeap(), 0, current_vtbl.table); } size = (num_methods - 3) * sizeof(vtbl_method_t); @@ -255,9 +256,7 @@ if(table->ref == 0 && table != current_vtbl.table) { TRACE("... and we're not current so free'ing\n"); - VirtualFree(current_vtbl.table->methods, - (current_vtbl.table->size - 3) * sizeof(vtbl_method_t), - MEM_RELEASE); + VirtualFree(current_vtbl.table->methods, 0, MEM_RELEASE); HeapFree(GetProcessHeap(), 0, table); } LeaveCriticalSection(&delegating_vtbl_section); Added: trunk/reactos/dll/win32/rpcrt4/epm.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/epm.idl?r…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/epm.idl (added) +++ trunk/reactos/dll/win32/rpcrt4/epm.idl [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,0 +1,19 @@ +/* + * Copyright 2008 Robert Shearman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/epm.idl" Modified: trunk/reactos/dll/win32/rpcrt4/epm_towers.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/epm_tower…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/epm_towers.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/epm_towers.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ + +#include "epm_c.h" #define EPM_PROTOCOL_DNET_NSP 0x04 #define EPM_PROTOCOL_OSI_TP4 0x05 @@ -47,10 +49,6 @@ #define EPM_PROTOCOL_NULL 0x21 #include <pshpack1.h> - -typedef unsigned char u_int8; -typedef unsigned short u_int16; -typedef unsigned int u_int32; typedef struct { Modified: trunk/reactos/dll/win32/rpcrt4/ndr_clientserver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_clien…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_clientserver.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_clientserver.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * MIDL proxy/stub stuff * - * Copyright 2002 Ove Kåven, TransGaming Technologies + * Copyright 2002 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/reactos/dll/win32/rpcrt4/ndr_es.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_es.c?…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_es.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_es.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -156,7 +156,18 @@ *pHandle = (handle_t)pEsMsg; - return RPC_S_OK;} + return RPC_S_OK; +} + +/*********************************************************************** + * MesEncodeDynBufferHandleCreate [RPCRT4.@] + */ +RPC_STATUS RPC_ENTRY MesEncodeDynBufferHandleCreate(char **ppBuffer, + ULONG *pEncodedSize, handle_t *pHandle) +{ + FIXME("%p %p %p stub\n", ppBuffer, pEncodedSize, pHandle); + return RPC_S_OK; +} /*********************************************************************** * MesDecodeBufferHandleCreate [RPCRT4.@] Modified: trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_marsh…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -361,10 +361,10 @@ * If the function is unable to allocate memory an ERROR_OUTOFMEMORY * exception is raised. */ -void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, size_t len) -{ - size_t aligned_len; - size_t adjusted_len; +void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len) +{ + SIZE_T aligned_len; + SIZE_T adjusted_len; void *p; NDR_MEMORY_LIST *mem_list; @@ -373,7 +373,7 @@ /* check for overflow */ if (adjusted_len < len) { - ERR("overflow of adjusted_len %d, len %d\n", adjusted_len, len); + ERR("overflow of adjusted_len %ld, len %ld\n", adjusted_len, len); RpcRaiseException(RPC_X_BAD_STUB_DATA); } @@ -861,7 +861,10 @@ if (pointer_id) pointer_needs_unmarshaling = 1; else + { + *pPointer = NULL; pointer_needs_unmarshaling = 0; + } break; case RPC_FC_FP: pointer_id = NDR_LOCAL_UINT32_READ(Buffer); Modified: trunk/reactos/dll/win32/rpcrt4/ndr_misc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_misc.…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_misc.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_misc.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * NDR definitions * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/reactos/dll/win32/rpcrt4/ndr_ole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_ole.c…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_ole.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_ole.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * OLE32 callouts, COM interface marshalling * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_stubl…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * NDR -Oi,-Oif,-Oicf Interpreter * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * Copyright 2003-5 Robert Shearman (for CodeWeavers) * * This library is free software; you can redistribute it and/or Modified: trunk/reactos/dll/win32/rpcrt4/rpc_async.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_async…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_async.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_async.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -64,7 +64,7 @@ pAsync->Flags = 0; pAsync->StubInfo = NULL; pAsync->RuntimeInfo = NULL; - memset(&pAsync->Reserved, 0, sizeof(*pAsync) - FIELD_OFFSET(RPC_ASYNC_STATE, Reserved)); + memset(pAsync->Reserved, 0, sizeof(*pAsync) - FIELD_OFFSET(RPC_ASYNC_STATE, Reserved)); return RPC_S_OK; } Modified: trunk/reactos/dll/win32/rpcrt4/rpc_binding.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_bindi…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_binding.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_binding.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * RPC binding API * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * Copyright 2003 Mike Hearn * Copyright 2004 Filip Navara * Copyright 2006 CodeWeavers @@ -435,7 +435,7 @@ { RPC_WSTR component, p; - if (len == -1) len = strlen((const char *)string_binding); + if (len == -1) len = strlenW(string_binding); component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component)); if (!component) return NULL; Modified: trunk/reactos/dll/win32/rpcrt4/rpc_binding.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_bindi…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_binding.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_binding.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * RPC binding API * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,7 +21,6 @@ #ifndef __WINE_RPC_BINDING_H #define __WINE_RPC_BINDING_H -#include "wine/rpcss_shared.h" #include "rpcndr.h" #include "security.h" #include "wine/list.h" @@ -150,9 +149,6 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId); RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection); -BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply); -HANDLE RPCRT4_GetMasterMutex(void); -HANDLE RPCRT4_RpcssNPConnect(void); static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection) { Modified: trunk/reactos/dll/win32/rpcrt4/rpc_defs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_defs.…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_defs.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_defs.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * RPC definitions * - * Copyright 2001-2002 Ove Kåven, TransGaming Technologies + * Copyright 2001-2002 Ove KÃ¥ven, TransGaming Technologies * Copyright 2004 Filip Navara * * This library is free software; you can redistribute it and/or Modified: trunk/reactos/dll/win32/rpcrt4/rpc_epmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_epmap…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_epmap.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_epmap.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -2,7 +2,8 @@ * RPC endpoint mapper * * Copyright 2002 Greg Turner - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies + * Copyright 2008 Robert Shearman (for CodeWeavers) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,14 +18,9 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - * TODO: - * - actually do things right */ #include <stdarg.h> -#include <stdio.h> -#include <string.h> #include "windef.h" #include "winbase.h" @@ -33,8 +29,10 @@ #include "rpc.h" #include "wine/debug.h" +#include "wine/exception.h" #include "rpc_binding.h" +#include "epm_c.h" #include "epm_towers.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -43,8 +41,9 @@ * * ncadg_ip_udp: 135 * ncacn_ip_tcp: 135 - * ncacn_np: \\pipe\epmapper (?) + * ncacn_np: \\pipe\epmapper * ncalrpc: epmapper + * ncacn_http: 593 * * If the user's machine ran a DCE RPC daemon, it would * probably be possible to connect to it, but there are many @@ -63,77 +62,222 @@ * of running a fully functional DCOM server using Wine... */ +static const struct epm_endpoints +{ + const char *protseq; + const char *endpoint; +} epm_endpoints[] = +{ + { "ncacn_np", "\\pipe\\epmapper" }, + { "ncacn_ip_tcp", "135" }, + { "ncacn_ip_udp", "135" }, + { "ncalrpc", "epmapper" }, + { "ncacn_http", "593" }, +}; + +static BOOL start_rpcss(void) +{ + PROCESS_INFORMATION pi; + STARTUPINFOW si; + static WCHAR cmd[6]; + static const WCHAR rpcss[] = {'r','p','c','s','s',0}; + BOOL rslt; + + TRACE("\n"); + + ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); + ZeroMemory(&si, sizeof(STARTUPINFOA)); + si.cb = sizeof(STARTUPINFOA); + + memcpy(cmd, rpcss, sizeof(rpcss)); + + rslt = CreateProcessW( + NULL, /* executable */ + cmd, /* command line */ + NULL, /* process security attributes */ + NULL, /* primary thread security attributes */ + FALSE, /* inherit handles */ + 0, /* creation flags */ + NULL, /* use parent's environment */ + NULL, /* use parent's current directory */ + &si, /* STARTUPINFO pointer */ + &pi /* PROCESS_INFORMATION */ + ); + + if (rslt) + { + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + Sleep(100); + } + + return rslt; +} + +static inline BOOL is_epm_destination_local(RPC_BINDING_HANDLE handle) +{ + RpcBinding *bind = (RpcBinding *)handle; + const char *protseq = bind->Protseq; + const char *network_addr = bind->NetworkAddr; + + return ((!strcmp(protseq, "ncalrpc") && !network_addr) || + (!strcmp(protseq, "ncacn_np") && + (!network_addr || !strcmp(network_addr, ".")))); +} + +static RPC_STATUS get_epm_handle_client(RPC_BINDING_HANDLE handle, RPC_BINDING_HANDLE *epm_handle) +{ + RpcBinding *bind = (RpcBinding *)handle; + const char * pszEndpoint = NULL; + RPC_STATUS status; + RpcBinding* epm_bind; + unsigned int i; + + if (bind->server) + return RPC_S_INVALID_BINDING; + + for (i = 0; i < sizeof(epm_endpoints)/sizeof(epm_endpoints[0]); i++) + if (!strcmp(bind->Protseq, epm_endpoints[i].protseq)) + pszEndpoint = epm_endpoints[i].endpoint; + + if (!pszEndpoint) + { + FIXME("no endpoint for the endpoint-mapper found for protseq %s\n", debugstr_a(bind->Protseq)); + return RPC_S_PROTSEQ_NOT_SUPPORTED; + } + + status = RpcBindingCopy(handle, epm_handle); + if (status != RPC_S_OK) return status; + + epm_bind = (RpcBinding*)*epm_handle; + if (epm_bind->AuthInfo) + { + /* don't bother with authenticating against the EPM by default + * (see EnableAuthEpResolution registry value) */ + RpcAuthInfo_Release(epm_bind->AuthInfo); + epm_bind->AuthInfo = NULL; + } + RPCRT4_ResolveBinding(epm_bind, pszEndpoint); + TRACE("RPC_S_OK\n"); + return RPC_S_OK; +} + +static RPC_STATUS get_epm_handle_server(RPC_BINDING_HANDLE *epm_handle) +{ + unsigned char string_binding[] = "ncacn_np:.[\\\\pipe\\\\epmapper]"; + + return RpcBindingFromStringBindingA(string_binding, epm_handle); +} + +static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr) +{ + switch (GetExceptionCode()) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + return EXCEPTION_CONTINUE_SEARCH; + default: + return EXCEPTION_EXECUTE_HANDLER; + } +} + /*********************************************************************** * RpcEpRegisterA (RPCRT4.@) */ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_CSTR Annotation ) { - RPCSS_NP_MESSAGE msg; - RPCSS_NP_REPLY reply; - char *vardata_payload, *vp; PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec; - unsigned long c; - RPC_STATUS rslt = RPC_S_OK; + unsigned long i; + RPC_STATUS status = RPC_S_OK; + error_status_t status2; + ept_entry_t *entries; + handle_t handle; TRACE("(%p,%p,%p,%s)\n", IfSpec, BindingVector, UuidVector, debugstr_a((char*)Annotation)); TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID)); - for (c=0; c<BindingVector->Count; c++) { - RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[c]); - TRACE(" protseq[%ld]=%s\n", c, debugstr_a(bind->Protseq)); - TRACE(" endpoint[%ld]=%s\n", c, debugstr_a(bind->Endpoint)); + for (i=0; i<BindingVector->Count; i++) { + RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); + TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq)); + TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint)); } if (UuidVector) { - for (c=0; c<UuidVector->Count; c++) - TRACE(" obj[%ld]=%s\n", c, debugstr_guid(UuidVector->Uuid[c])); - } - - /* FIXME: Do something with annotation. */ - - /* construct the message to rpcss */ - msg.message_type = RPCSS_NP_MESSAGE_TYPEID_REGISTEREPMSG; - msg.message.registerepmsg.iface = If->InterfaceId; - msg.message.registerepmsg.no_replace = 0; - - msg.message.registerepmsg.object_count = (UuidVector) ? UuidVector->Count : 0; - msg.message.registerepmsg.binding_count = BindingVector->Count; - - /* calculate vardata payload size */ - msg.vardata_payload_size = msg.message.registerepmsg.object_count * sizeof(UUID); - for (c=0; c < msg.message.registerepmsg.binding_count; c++) { - RpcBinding *bind = (RpcBinding *)(BindingVector->BindingH[c]); - msg.vardata_payload_size += strlen(bind->Protseq) + 1; - msg.vardata_payload_size += strlen(bind->Endpoint) + 1; - } - - /* allocate the payload buffer */ - vp = vardata_payload = LocalAlloc(LPTR, msg.vardata_payload_size); - if (!vardata_payload) - return RPC_S_OUT_OF_MEMORY; - - /* populate the payload data */ - for (c=0; c < msg.message.registerepmsg.object_count; c++) { - CopyMemory(vp, UuidVector->Uuid[c], sizeof(UUID)); - vp += sizeof(UUID); - } - - for (c=0; c < msg.message.registerepmsg.binding_count; c++) { - RpcBinding *bind = (RpcBinding*)(BindingVector->BindingH[c]); - unsigned long pslen = strlen(bind->Protseq) + 1, eplen = strlen(bind->Endpoint) + 1; - CopyMemory(vp, bind->Protseq, pslen); - vp += pslen; - CopyMemory(vp, bind->Endpoint, eplen); - vp += eplen; - } - - /* send our request */ - if (!RPCRT4_RPCSSOnDemandCall(&msg, vardata_payload, &reply)) - rslt = RPC_S_OUT_OF_MEMORY; - - /* free the payload buffer */ - LocalFree(vardata_payload); - - return rslt; + for (i=0; i<UuidVector->Count; i++) + TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i])); + } + + if (!BindingVector->Count) return RPC_S_OK; + + entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entries) * BindingVector->Count * (UuidVector ? UuidVector->Count : 1)); + if (!entries) + return RPC_S_OUT_OF_MEMORY; + + status = get_epm_handle_server(&handle); + if (status != RPC_S_OK) + { + HeapFree(GetProcessHeap(), 0, entries); + return status; + } + + for (i = 0; i < BindingVector->Count; i++) + { + unsigned j; + RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); + for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++) + { + int len = strlen((char *)Annotation); + status = TowerConstruct(&If->InterfaceId, &If->TransferSyntax, + bind->Protseq, bind->Endpoint, + bind->NetworkAddr, + &entries[i*(UuidVector ? UuidVector->Count : 1) + j].tower); + if (status != RPC_S_OK) break; + + if (UuidVector) + memcpy(&entries[i * UuidVector->Count].object, &UuidVector->Uuid[j], sizeof(GUID)); + else + memset(&entries[i].object, 0, sizeof(entries[i].object)); + memcpy(entries[i].annotation, Annotation, min(len + 1, ept_max_annotation_size)); + } + } + + if (status == RPC_S_OK) + { + while (TRUE) + { + __TRY + { + ept_insert(handle, BindingVector->Count * (UuidVector ? UuidVector->Count : 1), + entries, TRUE, &status2); + } + __EXCEPT(rpc_filter) + { + status2 = GetExceptionCode(); + } + __ENDTRY + if (status2 == RPC_S_SERVER_UNAVAILABLE && + is_epm_destination_local(handle)) + { + if (start_rpcss()) + continue; + } + if (status2 != RPC_S_OK) + ERR("ept_insert failed with error %d\n", status2); + status = status2; /* FIXME: convert status? */ + break; + } + } + RpcBindingFree(&handle); + + for (i = 0; i < BindingVector->Count; i++) + { + unsigned j; + for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++) + I_RpcFree(entries[i*(UuidVector ? UuidVector->Count : 1) + j].tower); + } + + HeapFree(GetProcessHeap(), 0, entries); + + return status; } /*********************************************************************** @@ -142,68 +286,85 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector ) { - RPCSS_NP_MESSAGE msg; - RPCSS_NP_REPLY reply; - char *vardata_payload, *vp; PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec; - unsigned long c; - RPC_STATUS rslt = RPC_S_OK; + unsigned long i; + RPC_STATUS status = RPC_S_OK; + error_status_t status2; + ept_entry_t *entries; + handle_t handle; TRACE("(%p,%p,%p)\n", IfSpec, BindingVector, UuidVector); TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID)); - for (c=0; c<BindingVector->Count; c++) { - RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[c]); - TRACE(" protseq[%ld]=%s\n", c, debugstr_a(bind->Protseq)); - TRACE(" endpoint[%ld]=%s\n", c, debugstr_a(bind->Endpoint)); + for (i=0; i<BindingVector->Count; i++) { + RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); + TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq)); + TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint)); } if (UuidVector) { - for (c=0; c<UuidVector->Count; c++) - TRACE(" obj[%ld]=%s\n", c, debugstr_guid(UuidVector->Uuid[c])); - } - - /* construct the message to rpcss */ - msg.message_type = RPCSS_NP_MESSAGE_TYPEID_UNREGISTEREPMSG; - msg.message.unregisterepmsg.iface = If->InterfaceId; - - msg.message.unregisterepmsg.object_count = (UuidVector) ? UuidVector->Count : 0; - msg.message.unregisterepmsg.binding_count = BindingVector->Count; - - /* calculate vardata payload size */ - msg.vardata_payload_size = msg.message.unregisterepmsg.object_count * sizeof(UUID); - for (c=0; c < msg.message.unregisterepmsg.binding_count; c++) { - RpcBinding *bind = (RpcBinding *)(BindingVector->BindingH[c]); - msg.vardata_payload_size += strlen(bind->Protseq) + 1; - msg.vardata_payload_size += strlen(bind->Endpoint) + 1; - } - - /* allocate the payload buffer */ - vp = vardata_payload = LocalAlloc(LPTR, msg.vardata_payload_size); - if (!vardata_payload) - return RPC_S_OUT_OF_MEMORY; - - /* populate the payload data */ - for (c=0; c < msg.message.unregisterepmsg.object_count; c++) { - CopyMemory(vp, UuidVector->Uuid[c], sizeof(UUID)); - vp += sizeof(UUID); - } - - for (c=0; c < msg.message.unregisterepmsg.binding_count; c++) { - RpcBinding *bind = (RpcBinding*)(BindingVector->BindingH[c]); - unsigned long pslen = strlen(bind->Protseq) + 1, eplen = strlen(bind->Endpoint) + 1; - CopyMemory(vp, bind->Protseq, pslen); - vp += pslen; - CopyMemory(vp, bind->Endpoint, eplen); - vp += eplen; - } - - /* send our request */ - if (!RPCRT4_RPCSSOnDemandCall(&msg, vardata_payload, &reply)) - rslt = RPC_S_OUT_OF_MEMORY; - - /* free the payload buffer */ - LocalFree(vardata_payload); - - return rslt; + for (i=0; i<UuidVector->Count; i++) + TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i])); + } + + entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entries) * BindingVector->Count * (UuidVector ? UuidVector->Count : 1)); + if (!entries) + return RPC_S_OUT_OF_MEMORY; + + status = get_epm_handle_server(&handle); + if (status != RPC_S_OK) + { + HeapFree(GetProcessHeap(), 0, entries); + return status; + } + + for (i = 0; i < BindingVector->Count; i++) + { + unsigned j; + RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); + for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++) + { + status = TowerConstruct(&If->InterfaceId, &If->TransferSyntax, + bind->Protseq, bind->Endpoint, + bind->NetworkAddr, + &entries[i*(UuidVector ? UuidVector->Count : 1) + j].tower); + if (status != RPC_S_OK) break; + + if (UuidVector) + memcpy(&entries[i * UuidVector->Count + j].object, &UuidVector->Uuid[j], sizeof(GUID)); + else + memset(&entries[i].object, 0, sizeof(entries[i].object)); + } + } + + if (status == RPC_S_OK) + { + __TRY + { + ept_insert(handle, BindingVector->Count * (UuidVector ? UuidVector->Count : 1), + entries, TRUE, &status2); + } + __EXCEPT(rpc_filter) + { + status2 = GetExceptionCode(); + } + __ENDTRY + if (status2 == RPC_S_SERVER_UNAVAILABLE) + status2 = EPT_S_NOT_REGISTERED; + if (status2 != RPC_S_OK) + ERR("ept_insert failed with error %d\n", status2); + status = status2; /* FIXME: convert status? */ + } + RpcBindingFree(&handle); + + for (i = 0; i < BindingVector->Count; i++) + { + unsigned j; + for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++) + I_RpcFree(entries[i*(UuidVector ? UuidVector->Count : 1) + j].tower); + } + + HeapFree(GetProcessHeap(), 0, entries); + + return status; } /*********************************************************************** @@ -211,50 +372,96 @@ */ RPC_STATUS WINAPI RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec ) { - RPCSS_NP_MESSAGE msg; - RPCSS_NP_REPLY reply; PRPC_CLIENT_INTERFACE If = (PRPC_CLIENT_INTERFACE)IfSpec; RpcBinding* bind = (RpcBinding*)Binding; + RPC_STATUS status; + error_status_t status2; + handle_t handle; + ept_lookup_handle_t entry_handle = NULL; + twr_t *tower; + twr_t *towers[4] = { NULL }; + unsigned32 num_towers, i; + GUID uuid = GUID_NULL; + char *resolved_endpoint = NULL; TRACE("(%p,%p)\n", Binding, IfSpec); TRACE(" protseq=%s\n", debugstr_a(bind->Protseq)); TRACE(" obj=%s\n", debugstr_guid(&bind->ObjectUuid)); + TRACE(" networkaddr=%s\n", debugstr_a(bind->NetworkAddr)); TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID)); - - /* FIXME: totally untested */ /* just return for fully bound handles */ if (bind->Endpoint && (bind->Endpoint[0] != '\0')) return RPC_S_OK; - /* construct the message to rpcss */ - msg.message_type = RPCSS_NP_MESSAGE_TYPEID_RESOLVEEPMSG; - msg.message.resolveepmsg.iface = If->InterfaceId; - msg.message.resolveepmsg.object = bind->ObjectUuid; - - msg.vardata_payload_size = strlen(bind->Protseq) + 1; - - /* send the message */ - if (!RPCRT4_RPCSSOnDemandCall(&msg, bind->Protseq, &reply)) - return RPC_S_OUT_OF_MEMORY; - - /* empty-string result means not registered */ - if (reply.as_string[0] == '\0') - return EPT_S_NOT_REGISTERED; + status = get_epm_handle_client(Binding, &handle); + if (status != RPC_S_OK) return status; - /* otherwise we fully bind the handle & return RPC_S_OK */ - return RPCRT4_ResolveBinding(Binding, reply.as_string); -} - -typedef unsigned int unsigned32; -typedef struct twr_t - { - unsigned32 tower_length; - /* [size_is] */ BYTE tower_octet_string[ 1 ]; - } twr_t; - -/*********************************************************************** - * TowerExplode (RPCRT4.@) + status = TowerConstruct(&If->InterfaceId, &If->TransferSyntax, bind->Protseq, + ((RpcBinding *)handle)->Endpoint, + bind->NetworkAddr, &tower); + if (status != RPC_S_OK) + { + WARN("couldn't get tower\n"); + RpcBindingFree(&handle); + return status; + } + + while (TRUE) + { + __TRY + { + ept_map(handle, &uuid, tower, &entry_handle, sizeof(towers)/sizeof(towers[0]), &num_towers, towers, &status2); + /* FIXME: translate status2? */ + } + __EXCEPT(rpc_filter) + { + status2 = GetExceptionCode(); + } + __ENDTRY + if (status2 == RPC_S_SERVER_UNAVAILABLE && + is_epm_destination_local(handle)) + { + if (start_rpcss()) + continue; + } + break; + }; + + RpcBindingFree(&handle); + I_RpcFree(tower); + + if (status2 != RPC_S_OK) + { + ERR("ept_map failed for ifid %s, protseq %s, networkaddr %s\n", debugstr_guid(&If->TransferSyntax.SyntaxGUID), bind->Protseq, bind->NetworkAddr); + return status2; + } + + for (i = 0; i < num_towers; i++) + { + /* only parse the tower if we haven't already found a suitable + * endpoint, otherwise just free the tower */ + if (!resolved_endpoint) + { + status = TowerExplode(towers[i], NULL, NULL, NULL, &resolved_endpoint, NULL); + TRACE("status = %ld\n", status); + } + I_RpcFree(towers[i]); + } + + if (resolved_endpoint) + { + RPCRT4_ResolveBinding(Binding, resolved_endpoint); + I_RpcFree(resolved_endpoint); + return RPC_S_OK; + } + + WARN("couldn't find an endpoint\n"); + return EPT_S_NOT_REGISTERED; +} + +/***************************************************************************** + * TowerExplode (RPCRT4.@) */ RPC_STATUS WINAPI TowerExplode( const twr_t *tower, PRPC_SYNTAX_IDENTIFIER object, PRPC_SYNTAX_IDENTIFIER syntax, @@ -388,3 +595,13 @@ } return RPC_S_OK; } + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t len) +{ + return HeapAlloc(GetProcessHeap(), 0, len); +} + +void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr) +{ + HeapFree(GetProcessHeap(), 0, ptr); +} Modified: trunk/reactos/dll/win32/rpcrt4/rpc_message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_messa…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_message.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_message.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * RPC messages * - * Copyright 2001-2002 Ove Kåven, TransGaming Technologies + * Copyright 2001-2002 Ove KÃ¥ven, TransGaming Technologies * Copyright 2004 Filip Navara * Copyright 2006 CodeWeavers * @@ -1005,7 +1005,10 @@ TRACE("(%p)\n", pMsg); if (!bind || bind->server) + { + ERR("no binding\n"); return RPC_S_INVALID_BINDING; + } /* if we already have a connection, we don't need to negotiate again */ if (!pMsg->ReservedForRuntime) @@ -1065,7 +1068,10 @@ TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength); if (!bind) + { + ERR("no binding\n"); return RPC_S_INVALID_BINDING; + } pMsg->Buffer = I_RpcAllocate(pMsg->BufferLength); TRACE("Buffer=%p\n", pMsg->Buffer); @@ -1118,7 +1124,11 @@ TRACE("(%p) Buffer=%p\n", pMsg, pMsg->Buffer); - if (!bind) return RPC_S_INVALID_BINDING; + if (!bind) + { + ERR("no binding\n"); + return RPC_S_INVALID_BINDING; + } if (pMsg->ReservedForRuntime) { Modified: trunk/reactos/dll/win32/rpcrt4/rpc_message.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_messa…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_message.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_message.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -21,7 +21,6 @@ #ifndef __WINE_RPC_MESSAGE_H #define __WINE_RPC_MESSAGE_H -#include "wine/rpcss_shared.h" #include "rpc_defs.h" typedef unsigned int NCA_STATUS; Modified: trunk/reactos/dll/win32/rpcrt4/rpc_server.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_serve…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_server.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_server.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * RPC server API * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * Copyright 2004 Filip Navara * Copyright 2006-2008 Robert Shearman (for CodeWeavers) * @@ -138,27 +138,22 @@ } LeaveCriticalSection(&server_cs); if (&cif->entry == &server_interfaces) cif = NULL; - TRACE("returning %p for %s\n", cif, debugstr_guid(object)); + TRACE("returning %p for object %s, if_id { %d.%d %s }\n", cif, + debugstr_guid(object), if_id->SyntaxVersion.MajorVersion, + if_id->SyntaxVersion.MinorVersion, debugstr_guid(&if_id->SyntaxGUID)); return cif; } static void RPCRT4_release_server_interface(RpcServerInterface *sif) { if (!InterlockedDecrement(&sif->CurrentCalls) && - sif->CallsCompletedEvent) { + sif->Delete) { /* sif must have been removed from server_interfaces before * CallsCompletedEvent is set */ - SetEvent(sif->CallsCompletedEvent); + if (sif->CallsCompletedEvent) + SetEvent(sif->CallsCompletedEvent); HeapFree(GetProcessHeap(), 0, sif); } -} - -static WINE_EXCEPTION_FILTER(rpc_filter) -{ - WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode()); - TRACE("returning failure packet\n"); - /* catch every exception */ - return EXCEPTION_EXECUTE_HANDLER; } static RPC_STATUS process_bind_packet(RpcConnection *conn, RpcPktBindHdr *hdr, RPC_MESSAGE *msg) @@ -294,7 +289,8 @@ RPCRT4_SetThreadCurrentCallHandle(msg->Handle); __TRY { if (func) func(msg); - } __EXCEPT(rpc_filter) { + } __EXCEPT_ALL { + WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode()); exception = TRUE; if (GetExceptionCode() == STATUS_ACCESS_VIOLATION) status = ERROR_NOACCESS; @@ -356,7 +352,7 @@ } /* clean up */ - I_RpcFreeBuffer(msg); + I_RpcFree(msg->Buffer); RPCRT4_FreeHeader(hdr); HeapFree(GetProcessHeap(), 0, msg); } @@ -392,6 +388,7 @@ packet = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcPacket)); if (!packet) { I_RpcFree(msg->Buffer); + RPCRT4_FreeHeader(hdr); HeapFree(GetProcessHeap(), 0, msg); break; } @@ -401,6 +398,7 @@ if (!QueueUserWorkItem(RPCRT4_worker_thread, packet, WT_EXECUTELONGFUNCTION)) { ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError()); I_RpcFree(msg->Buffer); + RPCRT4_FreeHeader(hdr); HeapFree(GetProcessHeap(), 0, msg); HeapFree(GetProcessHeap(), 0, packet); break; @@ -852,7 +850,7 @@ sif = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcServerInterface)); sif->If = If; if (MgrTypeUuid) { - memcpy(&sif->MgrTypeUuid, MgrTypeUuid, sizeof(UUID)); + sif->MgrTypeUuid = *MgrTypeUuid; sif->MgrEpv = MgrEpv; } else { memset(&sif->MgrTypeUuid, 0, sizeof(UUID)); @@ -893,8 +891,10 @@ if ((!IfSpec || !memcmp(&If->InterfaceId, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER))) && UuidEqual(MgrTypeUuid, &cif->MgrTypeUuid, &status)) { list_remove(&cif->entry); + TRACE("unregistering cif %p\n", cif); if (cif->CurrentCalls) { completed = FALSE; + cif->Delete = TRUE; if (WaitForCallsToComplete) cif->CallsCompletedEvent = event = CreateEventW(NULL, FALSE, FALSE, NULL); } @@ -984,8 +984,8 @@ return RPC_S_ALREADY_REGISTERED; /* ... otherwise create a new one and add it in. */ map = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcObjTypeMap)); - memcpy(&map->Object, ObjUuid, sizeof(UUID)); - memcpy(&map->Type, TypeUuid, sizeof(UUID)); + map->Object = *ObjUuid; + map->Type = *TypeUuid; map->next = NULL; if (prev) prev->next = map; /* prev is the last map in the linklist */ @@ -1050,13 +1050,11 @@ LeaveCriticalSection(&listen_cs); return RPC_S_NOT_LISTENING; } - - do - { - LeaveCriticalSection(&listen_cs); - + + do { + LeaveCriticalSection(&listen_cs); LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry) - WaitForSingleObject(cps->server_ready_event, INFINITE); + WaitForSingleObject(cps->server_ready_event, INFINITE); EnterCriticalSection(&listen_cs); } while (!std_listen); @@ -1132,6 +1130,40 @@ } /*********************************************************************** + * RpcMgmtInqStats (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics) +{ + RPC_STATS_VECTOR *stats; + + FIXME("(%p,%p)\n", Binding, Statistics); + + if ((stats = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_STATS_VECTOR)))) + { + stats->Count = 1; + stats->Stats[0] = 0; + *Statistics = stats; + return RPC_S_OK; + } + return RPC_S_OUT_OF_RESOURCES; +} + +/*********************************************************************** + * RpcMgmtStatsVectorFree (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector) +{ + FIXME("(%p)\n", StatsVector); + + if (StatsVector) + { + HeapFree(GetProcessHeap(), 0, *StatsVector); + *StatsVector = NULL; + } + return RPC_S_OK; +} + +/*********************************************************************** * RpcMgmtEpEltInqBegin (RPCRT4.@) */ RPC_STATUS WINAPI RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE Binding, ULONG InquiryType, Modified: trunk/reactos/dll/win32/rpcrt4/rpc_server.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_serve…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_server.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_server.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * RPC server API * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -73,6 +73,7 @@ /* set when unregistering interface to let the caller of * RpcServerUnregisterIf* know that all calls have finished */ HANDLE CallsCompletedEvent; + BOOL Delete; /* delete when the last call finishes */ } RpcServerInterface; void RPCRT4_new_client(RpcConnection* conn); Modified: trunk/reactos/dll/win32/rpcrt4/rpc_transport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_trans…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_transport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_transport.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -1,7 +1,7 @@ /* * RPC transport layer * - * Copyright 2001 Ove Kåven, TransGaming Technologies + * Copyright 2001 Ove KÃ¥ven, TransGaming Technologies * Copyright 2003 Mike Hearn * Copyright 2004 Filip Navara * Copyright 2006 Mike McCormack @@ -29,32 +29,43 @@ #include <stdio.h> #include <string.h> #include <assert.h> -#include <errno.h> - -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#include <fcntl.h> #include <stdlib.h> #include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -# include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H -# include <netinet/in.h> -#endif -#ifdef HAVE_NETINET_TCP_H -# include <netinet/tcp.h> -#endif -#ifdef HAVE_ARPA_INET_H -# include <arpa/inet.h> -#endif -#ifdef HAVE_NETDB_H -#include <netdb.h> -#endif -#ifdef HAVE_SYS_POLL_H -#include <sys/poll.h> -#endif + +#if defined(__MINGW32__) || defined (_MSC_VER) +# include <ws2tcpip.h> +# ifndef EADDRINUSE +# define EADDRINUSE WSAEADDRINUSE +# endif +# ifndef EAGAIN +# define EAGAIN WSAEWOULDBLOCK +# endif +#else +# include <errno.h> +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif +# include <fcntl.h> +# ifdef HAVE_SYS_SOCKET_H +# include <sys/socket.h> +# endif +# ifdef HAVE_NETINET_IN_H +# include <netinet/in.h> +# endif +# ifdef HAVE_NETINET_TCP_H +# include <netinet/tcp.h> +# endif +# ifdef HAVE_ARPA_INET_H +# include <arpa/inet.h> +# endif +# ifdef HAVE_NETDB_H +# include <netdb.h> +# endif +# ifdef HAVE_SYS_POLL_H +# include <sys/poll.h> +# endif +# define closesocket close +#endif /* defined(__MINGW32__) || defined (_MSC_VER) */ #include <winsock2.h> #include <ws2tcpip.h> @@ -112,20 +123,29 @@ return RPC_S_OK; npc->listening = TRUE; - if (ConnectNamedPipe(npc->pipe, &npc->ovl[0])) - return RPC_S_OK; - - if (GetLastError() == ERROR_PIPE_CONNECTED) { - SetEvent(npc->ovl[0].hEvent); - return RPC_S_OK; + for (;;) + { + if (ConnectNamedPipe(npc->pipe, &npc->ovl[0])) + return RPC_S_OK; + + switch(GetLastError()) + { + case ERROR_PIPE_CONNECTED: + SetEvent(npc->ovl[0].hEvent); + return RPC_S_OK; + case ERROR_IO_PENDING: + /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */ + return RPC_S_OK; + case ERROR_NO_DATA_DETECTED: + /* client has disconnected, retry */ + DisconnectNamedPipe( npc->pipe ); + break; + default: + npc->listening = FALSE; + WARN("Couldn't ConnectNamedPipe (error was %d)\n", GetLastError()); + return RPC_S_OUT_OF_RESOURCES; + } } - if (GetLastError() == ERROR_IO_PENDING) { - /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */ - return RPC_S_OK; - } - npc->listening = FALSE; - WARN("Couldn't ConnectNamedPipe (error was %d)\n", GetLastError()); - return RPC_S_OUT_OF_RESOURCES; } static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname) @@ -196,9 +216,7 @@ TRACE("connection failed, error=%x\n", err); return RPC_S_SERVER_TOO_BUSY; } - if (!wait) - return RPC_S_SERVER_UNAVAILABLE; - if (!WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { + if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { err = GetLastError(); WARN("connection failed, error=%x\n", err); return RPC_S_SERVER_UNAVAILABLE; @@ -212,7 +230,6 @@ SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL); npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - npc->pipe = pipe; return RPC_S_OK; @@ -375,7 +392,7 @@ break; ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE); - if (!ret && GetLastError() != ERROR_MORE_DATA) + if (!ret && (GetLastError() != ERROR_MORE_DATA)) break; bytes_left -= bytes_read; @@ -395,12 +412,12 @@ while (bytes_left) { DWORD bytes_written; - ret = WriteFile(npc->pipe, buf, count, &bytes_written, &npc->ovl[1]); + ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &npc->ovl[1]); if ((!ret || !bytes_written) && (GetLastError() != ERROR_IO_PENDING)) break; ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE); - if (!ret && GetLastError() != ERROR_MORE_DATA) + if (!ret && (GetLastError() != ERROR_MORE_DATA)) break; bytes_left -= bytes_written; @@ -425,7 +442,6 @@ CloseHandle(npc->ovl[1].hEvent); npc->ovl[1].hEvent = 0; } - return 0; } @@ -508,7 +524,8 @@ if ((smb_floor->count_lhs != sizeof(smb_floor->protid)) || (smb_floor->protid != EPM_PROTOCOL_SMB) || - (smb_floor->count_rhs > tower_size)) + (smb_floor->count_rhs > tower_size) || + (tower_data[smb_floor->count_rhs - 1] != '\0')) return EPT_S_NOT_REGISTERED; if (endpoint) @@ -531,7 +548,8 @@ if ((nb_floor->count_lhs != sizeof(nb_floor->protid)) || (nb_floor->protid != EPM_PROTOCOL_NETBIOS) || - (nb_floor->count_rhs > tower_size)) + (nb_floor->count_rhs > tower_size) || + (tower_data[nb_floor->count_rhs - 1] != '\0')) return EPT_S_NOT_REGISTERED; if (networkaddr) @@ -681,7 +699,7 @@ TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint); - endpoint_size = strlen(networkaddr) + 1; + endpoint_size = strlen(endpoint) + 1; size = sizeof(*pipe_floor) + endpoint_size; if (!tower_data) @@ -692,7 +710,7 @@ tower_data += sizeof(*pipe_floor); pipe_floor->count_lhs = sizeof(pipe_floor->protid); - pipe_floor->protid = EPM_PROTOCOL_SMB; + pipe_floor->protid = EPM_PROTOCOL_PIPE; pipe_floor->count_rhs = endpoint_size; memcpy(tower_data, endpoint, endpoint_size); @@ -710,9 +728,6 @@ TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint); - *networkaddr = NULL; - *endpoint = NULL; - if (tower_size < sizeof(*pipe_floor)) return EPT_S_NOT_REGISTERED; @@ -720,9 +735,13 @@ tower_size -= sizeof(*pipe_floor); if ((pipe_floor->count_lhs != sizeof(pipe_floor->protid)) || - (pipe_floor->protid != EPM_PROTOCOL_SMB) || - (pipe_floor->count_rhs > tower_size)) + (pipe_floor->protid != EPM_PROTOCOL_PIPE) || + (pipe_floor->count_rhs > tower_size) || + (tower_data[pipe_floor->count_rhs - 1] != '\0')) return EPT_S_NOT_REGISTERED; + + if (networkaddr) + *networkaddr = NULL; if (endpoint) { @@ -751,14 +770,12 @@ if (tcpc == NULL) return NULL; tcpc->sock = -1; -#ifndef __REACTOS__ if (socketpair(PF_UNIX, SOCK_STREAM, 0, tcpc->cancel_fds) < 0) { ERR("socketpair() failed: %s\n", strerror(errno)); HeapFree(GetProcessHeap(), 0, tcpc); return NULL; } -#endif return &tcpc->common; } @@ -817,13 +834,14 @@ if (0>connect(sock, ai_cur->ai_addr, ai_cur->ai_addrlen)) { WARN("connect() failed: %s\n", strerror(errno)); - close(sock); + closesocket(sock); continue; } /* RPC depends on having minimal latency so disable the Nagle algorithm */ val = 1; - setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); + setsockopt(sock, SOL_TCP, TCP_NODELAY, &val, sizeof(val)); + fcntl(sock, F_SETFL, O_NONBLOCK); /* make socket nonblocking */ tcpc->sock = sock; @@ -845,7 +863,6 @@ struct addrinfo *ai; struct addrinfo *ai_cur; struct addrinfo hints; - u_long blocking; RpcConnection *first_connection = NULL; TRACE("(%p, %s)\n", protseq, endpoint); @@ -896,8 +913,8 @@ if (ret < 0) { WARN("bind failed: %s\n", strerror(errno)); - close(sock); - if (errno == WSAEADDRINUSE) + closesocket(sock); + if (errno == EADDRINUSE) status = RPC_S_DUPLICATE_ENDPOINT; else status = RPC_S_CANT_CREATE_ENDPOINT; @@ -908,7 +925,7 @@ endpoint, NULL, NULL, NULL); if (create_status != RPC_S_OK) { - close(sock); + closesocket(sock); status = create_status; continue; } @@ -926,8 +943,7 @@ * race-condition (poll() says it is readable, connection drops, * and accept() blocks until the next connection comes...) */ - blocking = 1; - ret = ioctlsocket(sock, FIONBIO, &blocking); + ret = fcntl(sock, F_SETFL, O_NONBLOCK); if (ret < 0) { WARN("couldn't make socket non-blocking, error %d\n", ret); @@ -970,7 +986,6 @@ int ret; struct sockaddr_in address; socklen_t addrsize; - u_long blocking; RpcConnection_tcp *server = (RpcConnection_tcp*) old_conn; RpcConnection_tcp *client = (RpcConnection_tcp*) new_conn; @@ -982,8 +997,7 @@ return RPC_S_OUT_OF_RESOURCES; } /* reset to blocking behaviour */ - blocking = 0; - ret = ioctlsocket(ret, FIONBIO, &blocking); + fcntl(ret, F_SETFL, 0); client->sock = ret; TRACE("Accepted a new TCP connection\n"); return RPC_S_OK; @@ -1065,7 +1079,7 @@ TRACE("%d\n", tcpc->sock); if (tcpc->sock != -1) - close(tcpc->sock); + closesocket(tcpc->sock); tcpc->sock = -1; close(tcpc->cancel_fds[0]); close(tcpc->cancel_fds[1]); @@ -1256,12 +1270,10 @@ if (ps) { int fds[2]; - u_long blocking; if (!socketpair(PF_UNIX, SOCK_DGRAM, 0, fds)) { - blocking = 1; - ioctlsocket(fds[0], FIONBIO, &blocking); - ioctlsocket(fds[1], FIONBIO, &blocking); + fcntl(fds[0], F_SETFL, O_NONBLOCK); + fcntl(fds[1], F_SETFL, O_NONBLOCK); ps->mgr_event_rcv = fds[0]; ps->mgr_event_snd = fds[1]; } Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcrt4.rb…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcrt4.rbuild [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -9,6 +9,7 @@ <define name="MSWMSG" /> <library>wine</library> <library>uuid</library> + <library>rpcrt4_epm_client</library> <library>kernel32</library> <library>user32</library> <library>advapi32</library> @@ -33,9 +34,16 @@ <file>rpc_server.c</file> <file>rpc_transport.c</file> <file>rpcrt4_main.c</file> - <file>rpcss_np_client.c</file> <file>unix_func.c</file> <file>ndr_es.c</file> <file>rpcrt4.rc</file> + <file>epm.idl</file> + <include base="rpcrt4" root="intermediate">.</include> <file>rpcrt4.spec</file> </module> +<module name="rpcrt4_epm_server" type="rpcserver"> + <file>epm.idl</file> +</module> +<module name="rpcrt4_epm_client" type="rpcclient"> + <file>epm.idl</file> +</module> Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcrt4.sp…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -99,7 +99,7 @@ @ stub MesBufferHandleReset @ stdcall MesDecodeBufferHandleCreate(ptr long ptr) @ stdcall MesDecodeIncrementalHandleCreate(ptr ptr ptr) -@ stub MesEncodeDynBufferHandleCreate +@ stdcall MesEncodeDynBufferHandleCreate(ptr ptr ptr) @ stdcall MesEncodeFixedBufferHandleCreate(ptr long ptr ptr) @ stdcall MesEncodeIncrementalHandleCreate(ptr ptr ptr ptr) @ stdcall MesHandleFree(ptr) @@ -363,7 +363,7 @@ @ stdcall RpcBindingVectorFree(ptr) @ stdcall RpcCancelAsyncCall(ptr long) RpcAsyncCancelCall @ stdcall RpcCancelThread(ptr) -@ stub RpcCancelThreadEx +@ stdcall RpcCancelThreadEx(ptr long) @ stub RpcCertGeneratePrincipalNameA @ stub RpcCertGeneratePrincipalNameW @ stdcall RpcCompleteAsyncCall(ptr ptr) RpcAsyncCompleteCall @@ -399,13 +399,13 @@ @ stdcall RpcMgmtInqIfIds(ptr ptr) @ stub RpcMgmtInqServerPrincNameA @ stub RpcMgmtInqServerPrincNameW -@ stub RpcMgmtInqStats +@ stdcall RpcMgmtInqStats(ptr ptr) @ stdcall RpcMgmtIsServerListening(ptr) @ stub RpcMgmtSetAuthorizationFn @ stdcall RpcMgmtSetCancelTimeout(long) @ stdcall RpcMgmtSetComTimeout(ptr long) @ stdcall RpcMgmtSetServerStackSize(long) -@ stub RpcMgmtStatsVectorFree +@ stdcall RpcMgmtStatsVectorFree(ptr) @ stdcall RpcMgmtStopServerListening(ptr) @ stdcall RpcMgmtWaitServerListen() @ stub RpcNetworkInqProtseqsA Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcrt4_ma…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcrt4_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcrt4_main.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -53,19 +53,12 @@ #include "rpcproxy.h" #include "rpc_binding.h" -#include "rpcss_np_client.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(rpc); static UUID uuid_nil; -static HANDLE master_mutex; - -HANDLE RPCRT4_GetMasterMutex(void) -{ - return master_mutex; -} static CRITICAL_SECTION uuid_cs; static CRITICAL_SECTION_DEBUG critsect_debug = @@ -122,9 +115,6 @@ switch (fdwReason) { case DLL_PROCESS_ATTACH: - master_mutex = CreateMutexA( NULL, FALSE, RPCSS_MASTER_MUTEX_NAME); - if (!master_mutex) - ERR("Failed to create master mutex\n"); break; case DLL_THREAD_DETACH: @@ -145,8 +135,6 @@ break; case DLL_PROCESS_DETACH: - CloseHandle(master_mutex); - master_mutex = NULL; break; } @@ -265,7 +253,7 @@ * * PARAMS * UUID *Uuid [I] Uuid to compare - * RPC_STATUS *Status [O] retuns RPC_S_OK + * RPC_STATUS *Status [O] returns RPC_S_OK * * RETURNS * TRUE/FALSE @@ -643,102 +631,6 @@ { FIXME( "(): stub\n" ); return S_OK; -} - -static BOOL RPCRT4_StartRPCSS(void) -{ - PROCESS_INFORMATION pi; - STARTUPINFOA si; - static char cmd[6]; - BOOL rslt; - - ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); - ZeroMemory(&si, sizeof(STARTUPINFOA)); - si.cb = sizeof(STARTUPINFOA); - - /* apparently it's not OK to use a constant string below */ - CopyMemory(cmd, "rpcss", 6); - - /* FIXME: will this do the right thing when run as a test? */ - rslt = CreateProcessA( - NULL, /* executable */ - cmd, /* command line */ - NULL, /* process security attributes */ - NULL, /* primary thread security attributes */ - FALSE, /* inherit handles */ - 0, /* creation flags */ - NULL, /* use parent's environment */ - NULL, /* use parent's current directory */ - &si, /* STARTUPINFO pointer */ - &pi /* PROCESS_INFORMATION */ - ); - - if (rslt) { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - - return rslt; -} - -/*********************************************************************** - * RPCRT4_RPCSSOnDemandCall (internal) - * - * Attempts to send a message to the RPCSS process - * on the local machine, invoking it if necessary. - * For remote RPCSS calls, use.... your imagination. - * - * PARAMS - * msg [I] pointer to the RPCSS message - * vardata_payload [I] pointer vardata portion of the RPCSS message - * reply [O] pointer to reply structure - * - * RETURNS - * TRUE if successful - * FALSE otherwise - */ -BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply) -{ - HANDLE client_handle; - BOOL ret; - int i, j = 0; - - TRACE("(msg == %p, vardata_payload == %p, reply == %p)\n", msg, vardata_payload, reply); - - client_handle = RPCRT4_RpcssNPConnect(); - - while (INVALID_HANDLE_VALUE == client_handle) { - /* start the RPCSS process */ - if (!RPCRT4_StartRPCSS()) { - ERR("Unable to start RPCSS process.\n"); - return FALSE; - } - /* wait for a connection (w/ periodic polling) */ - for (i = 0; i < 60; i++) { - Sleep(200); - client_handle = RPCRT4_RpcssNPConnect(); - if (INVALID_HANDLE_VALUE != client_handle) break; - } - /* we are only willing to try twice */ - if (j++ >= 1) break; - } - - if (INVALID_HANDLE_VALUE == client_handle) { - /* no dice! */ - ERR("Unable to connect to RPCSS process!\n"); - SetLastError(RPC_E_SERVER_DIED_DNE); - return FALSE; - } - - /* great, we're connected. now send the message */ - ret = TRUE; - if (!RPCRT4_SendReceiveNPMsg(client_handle, msg, vardata_payload, reply)) { - ERR("Something is amiss: RPC_SendReceive failed.\n"); - ret = FALSE; - } - CloseHandle(client_handle); - - return ret; } #define MAX_RPC_ERROR_TEXT 256 @@ -1076,19 +968,9 @@ return context_handle; } -/****************************************************************************** - * RpcCancelThread (rpcrt4.@) - */ -RPC_STATUS RPC_ENTRY RpcCancelThread(void* ThreadHandle) -{ - DWORD target_tid; +static RPC_STATUS rpc_cancel_thread(DWORD target_tid) +{ struct threaddata *tdata; - - TRACE("(%p)\n", ThreadHandle); - - target_tid = GetThreadId(ThreadHandle); - if (!target_tid) - return RPC_S_INVALID_ARG; EnterCriticalSection(&threaddata_cs); LIST_FOR_EACH_ENTRY(tdata, &threaddata_list, struct threaddata, entry) @@ -1103,3 +985,34 @@ return RPC_S_OK; } + +/****************************************************************************** + * RpcCancelThread (rpcrt4.@) + */ +RPC_STATUS RPC_ENTRY RpcCancelThread(void* ThreadHandle) +{ + TRACE("(%p)\n", ThreadHandle); + return RpcCancelThreadEx(ThreadHandle, 0); +} + +/****************************************************************************** + * RpcCancelThreadEx (rpcrt4.@) + */ +RPC_STATUS RPC_ENTRY RpcCancelThreadEx(void* ThreadHandle, LONG Timeout) +{ + DWORD target_tid; + + FIXME("(%p, %d)\n", ThreadHandle, Timeout); + + target_tid = GetThreadId(ThreadHandle); + if (!target_tid) + return RPC_S_INVALID_ARG; + + if (Timeout) + { + FIXME("(%p, %d)\n", ThreadHandle, Timeout); + return RPC_S_OK; + } + else + return rpc_cancel_thread(target_tid); +} Removed: trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcss_np_…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.c (removed) @@ -1,152 +1,0 @@ -/* - * RPCSS named pipe client implementation - * - * Copyright (C) 2002 Greg Turner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <assert.h> -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wine/rpcss_shared.h" -#include "wine/debug.h" - -#include "rpc_binding.h" - -WINE_DEFAULT_DEBUG_CHANNEL(ole); - -HANDLE RPCRT4_RpcssNPConnect(void) -{ - HANDLE the_pipe; - DWORD dwmode, wait_result; - HANDLE master_mutex = RPCRT4_GetMasterMutex(); - - TRACE("\n"); - - while (TRUE) { - - wait_result = WaitForSingleObject(master_mutex, MASTER_MUTEX_TIMEOUT); - switch (wait_result) { - case WAIT_ABANDONED: - case WAIT_OBJECT_0: - break; - case WAIT_FAILED: - case WAIT_TIMEOUT: - default: - ERR("This should never happen: couldn't enter mutex.\n"); - return NULL; - } - - /* try to open the client side of the named pipe. */ - the_pipe = CreateFileA( - NAME_RPCSS_NAMED_PIPE, /* pipe name */ - GENERIC_READ | GENERIC_WRITE, /* r/w access */ - 0, /* no sharing */ - NULL, /* no security attributes */ - OPEN_EXISTING, /* open an existing pipe */ - 0, /* default attributes */ - NULL /* no template file */ - ); - - if (the_pipe != INVALID_HANDLE_VALUE) - break; - - if (GetLastError() != ERROR_PIPE_BUSY) { - WARN("Unable to open named pipe %s (assuming unavailable).\n", - debugstr_a(NAME_RPCSS_NAMED_PIPE)); - break; - } - - WARN("Named pipe busy (will wait)\n"); - - if (!ReleaseMutex(master_mutex)) - ERR("Failed to release master mutex. Expect deadlock.\n"); - - /* wait for the named pipe. We are only willing to wait for 5 seconds. - It should be available /very/ soon. */ - if (! WaitNamedPipeA(NAME_RPCSS_NAMED_PIPE, MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT)) - { - ERR("Named pipe unavailable after waiting. Something is probably wrong.\n"); - break; - } - - } - - if (the_pipe != INVALID_HANDLE_VALUE) { - dwmode = PIPE_READMODE_MESSAGE; - /* SetNamedPipeHandleState not implemented ATM, but still seems to work somehow. */ - if (! SetNamedPipeHandleState(the_pipe, &dwmode, NULL, NULL)) - WARN("Failed to set pipe handle state\n"); - } - - if (!ReleaseMutex(master_mutex)) - ERR("Uh oh, failed to leave the RPC Master Mutex!\n"); - - return the_pipe; -} - -BOOL RPCRT4_SendReceiveNPMsg(HANDLE np, PRPCSS_NP_MESSAGE msg, char *vardata, PRPCSS_NP_REPLY reply) -{ - DWORD count; - UINT32 payload_offset; - RPCSS_NP_MESSAGE vardata_payload_msg; - - TRACE("(np == %p, msg == %p, vardata == %p, reply == %p)\n", - np, msg, vardata, reply); - - if (! WriteFile(np, msg, sizeof(RPCSS_NP_MESSAGE), &count, NULL)) { - ERR("write failed.\n"); - return FALSE; - } - - if (count != sizeof(RPCSS_NP_MESSAGE)) { - ERR("write count mismatch.\n"); - return FALSE; - } - - /* process the vardata payload if necessary */ - vardata_payload_msg.message_type = RPCSS_NP_MESSAGE_TYPEID_VARDATAPAYLOADMSG; - vardata_payload_msg.vardata_payload_size = 0; /* meaningless */ - for ( payload_offset = 0; payload_offset < msg->vardata_payload_size; - payload_offset += VARDATA_PAYLOAD_BYTES ) { - TRACE("sending vardata payload. vd=%p, po=%d, ps=%d\n", vardata, - payload_offset, msg->vardata_payload_size); - ZeroMemory(vardata_payload_msg.message.vardatapayloadmsg.payload, VARDATA_PAYLOAD_BYTES); - CopyMemory(vardata_payload_msg.message.vardatapayloadmsg.payload, - vardata, - min( VARDATA_PAYLOAD_BYTES, msg->vardata_payload_size - payload_offset )); - vardata += VARDATA_PAYLOAD_BYTES; - if (! WriteFile(np, &vardata_payload_msg, sizeof(RPCSS_NP_MESSAGE), &count, NULL)) { - ERR("vardata write failed at %u bytes.\n", payload_offset); - return FALSE; - } - } - - if (! ReadFile(np, reply, sizeof(RPCSS_NP_REPLY), &count, NULL)) { - ERR("read failed.\n"); - return FALSE; - } - - if (count != sizeof(RPCSS_NP_REPLY)) { - ERR("read count mismatch. got %d.\n", count); - return FALSE; - } - - /* message execution was successful */ - return TRUE; -} Removed: trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcss_np_…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcss_np_client.h (removed) @@ -1,26 +1,0 @@ -/* - * Copyright (C) 2002 Greg Turner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef __WINE_RPCSS_NP_CLIENT_H -#define __WINE_RPCSS_NP_CLIENT_H - -/* rpcss_np_client.c */ -HANDLE RPC_RpcssNPConnect(void); -BOOL RPCRT4_SendReceiveNPMsg(HANDLE, PRPCSS_NP_MESSAGE, char *, PRPCSS_NP_REPLY); - -#endif /* __RPCSS_NP_CLINET_H */ Modified: trunk/reactos/dll/win32/rpcrt4/unix_func.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/unix_func…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/unix_func.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/unix_func.c [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -167,3 +167,11 @@ return 0; } + +int fcntl(int fd, + int cmd, + long arg) +{ + // Stub + return 0; +} Modified: trunk/reactos/dll/win32/rpcrt4/unix_func.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/unix_func…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/unix_func.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/unix_func.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -14,6 +14,15 @@ short revents; /* returned events */ }; +#define F_SETFL 4 /* set file->f_flags */ + +#ifndef O_NONBLOCK +#define O_NONBLOCK 00004000 +#endif + +#define EINTR 4 /* Interrupted system call */ + int poll(struct pollfd *fds, unsigned long nfds, int timo); int socketpair (int af, int type, int protocol, SOCKET socket[2]); const char * inet_ntop (int af, const void *src, char *dst, size_t cnt); +int fcntl(int fd, int cmd, long arg); Modified: trunk/reactos/include/psdk/rpcdce.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/rpcdce.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/rpcdce.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/rpcdce.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -79,6 +79,12 @@ RPC_IF_ID *IfId[1]; } RPC_IF_ID_VECTOR; +typedef struct +{ + unsigned int Count; + unsigned long Stats[1]; +} RPC_STATS_VECTOR; + typedef I_RPC_HANDLE *RPC_EP_INQ_HANDLE; #define RPC_C_EP_ALL_ELTS 0 Modified: trunk/reactos/include/psdk/rpcndr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/rpcndr.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/rpcndr.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/rpcndr.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -114,6 +114,12 @@ #define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8) #define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), \ (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24) + +#define RPC_BAD_STUB_DATA_EXCEPTION_FILTER \ + ((RpcExceptionCode() == STATUS_ACCESS_VIOLATION) || \ + (RpcExceptionCode() == STATUS_DATATYPE_MISALIGNMENT) || \ + (RpcExceptionCode() == RPC_X_BAD_STUB_DATA) || \ + (RpcExceptionCode() == RPC_S_INVALID_BOUND)) typedef struct { @@ -189,7 +195,7 @@ ULONG_PTR MaxCount; ULONG Offset; ULONG ActualCount; - void * (__RPC_API *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(size_t); void (__RPC_API *pfnFree)(void *); unsigned char *StackTop; unsigned char *pPresentedType; @@ -316,7 +322,7 @@ typedef struct _MALLOC_FREE_STRUCT { - void * (__RPC_USER *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_USER *pfnAllocate)(size_t); void (__RPC_USER *pfnFree)(void *); } MALLOC_FREE_STRUCT; @@ -329,7 +335,7 @@ typedef struct _MIDL_STUB_DESC { void *RpcInterfaceInformation; - void * (__RPC_API *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(size_t); void (__RPC_API *pfnFree)(void *); union { handle_t *pAutoHandle; @@ -468,7 +474,7 @@ { void *Buffer; ULONG BufferSize; - void * (__RPC_API *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(size_t); void (__RPC_API *pfnFree)(void *); struct IRpcChannelBuffer *pRpcChannelBuffer; ULONG_PTR Reserved[5]; @@ -652,7 +658,7 @@ NdrDcomAsyncStubCall( struct IRpcStubBuffer* pThis, struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, DWORD * pdwStubPhase ); RPCRTAPI void* RPC_ENTRY - NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, size_t Len ); + NdrAllocate( PMIDL_STUB_MESSAGE pStubMsg, SIZE_T Len ) __WINE_ALLOC_SIZE(2); RPCRTAPI void RPC_ENTRY NdrClearOutParameters( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, void *ArgAddr ); @@ -662,7 +668,7 @@ ULONG *pFaultStatus, RPC_STATUS Status_ ); RPCRTAPI void* RPC_ENTRY - NdrOleAllocate( size_t Size ); + NdrOleAllocate( size_t Size ) __WINE_ALLOC_SIZE(1); RPCRTAPI void RPC_ENTRY NdrOleFree( void* NodeToFree ); @@ -723,11 +729,11 @@ RPCRTAPI void RPC_ENTRY NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage ); RPCRTAPI void * RPC_ENTRY - NdrRpcSmClientAllocate( size_t Size ); + NdrRpcSmClientAllocate( size_t Size ) __WINE_ALLOC_SIZE(1); RPCRTAPI void RPC_ENTRY NdrRpcSmClientFree( void *NodeToFree ); RPCRTAPI void * RPC_ENTRY - NdrRpcSsDefaultAllocate( size_t Size ); + NdrRpcSsDefaultAllocate( size_t Size ) __WINE_ALLOC_SIZE(1); RPCRTAPI void RPC_ENTRY NdrRpcSsDefaultFree( void *NodeToFree ); Modified: trunk/reactos/include/psdk/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=3…
============================================================================== --- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Thu Nov 6 11:35:54 2008 @@ -68,6 +68,12 @@ #else #define DECLSPEC_ADDRSAFE #endif +#endif + +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) +#define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#else +#define __WINE_ALLOC_SIZE(x) #endif #ifndef FORCEINLINE
16 years, 1 month
1
0
0
0
[fireball] 37224: - Add endpoint mapping and DCE types IDL from Wine.
by fireball@svn.reactos.org
Author: fireball Date: Thu Nov 6 06:23:44 2008 New Revision: 37224 URL:
http://svn.reactos.org/svn/reactos?rev=37224&view=rev
Log: - Add endpoint mapping and DCE types IDL from Wine. Added: trunk/reactos/include/reactos/wine/dcetypes.idl trunk/reactos/include/reactos/wine/epm.idl Added: trunk/reactos/include/reactos/wine/dcetypes.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/dcety…
============================================================================== --- trunk/reactos/include/reactos/wine/dcetypes.idl (added) +++ trunk/reactos/include/reactos/wine/dcetypes.idl [iso-8859-1] Thu Nov 6 06:23:44 2008 @@ -1,0 +1,88 @@ +/* + * Common DCE Types + * + * Copyright 2006 Robert Shearman (for CodeWeavers) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* pull in GUID type */ +import "wtypes.idl"; + +typedef unsigned small unsigned8; +typedef unsigned short unsigned16; +typedef unsigned long unsigned32; +typedef small signed8; +typedef short signed16; +typedef long signed32; +typedef unsigned32 boolean32; +typedef unsigned hyper u_int64; +typedef unsigned long u_int32; +typedef unsigned short u_int16; +typedef unsigned small u_int8; + +typedef [ptr] GUID *uuid_p_t; + +typedef struct twr_t +{ + unsigned32 tower_length; + [size_is(tower_length)] byte tower_octet_string[]; +} twr_t; +typedef [ptr] twr_t *twr_p_t; + +typedef struct ndr_context_handle +{ + unsigned32 context_handle_attributes; + GUID context_handle_uuid; +} ndr_context_handle; + +const long ndr_c_int_big_endian = 0; +const long ndr_c_int_little_endian = 1; +const long ndr_c_float_ieee = 0; +const long ndr_c_float_vax = 1; +const long ndr_c_float_cray = 2; +const long ndr_c_float_ibm = 3; +const long ndr_c_char_ascii = 0; +const long ndr_c_char_ebcdic = 1; + +typedef struct +{ + unsigned8 int_rep; + unsigned8 char_rep; + unsigned8 float_rep; + byte reserved; +} ndr_format_t, *ndr_format_p_t; + +typedef struct +{ + GUID uuid; + unsigned16 vers_major; + unsigned16 vers_minor; +} rpc_if_id_t; +typedef [unique] rpc_if_id_t *rpc_if_id_p_t; + +typedef struct +{ + unsigned32 count; + [size_is(count)] + rpc_if_id_p_t if_id[*]; +} rpc_if_id_vector_t; +typedef [unique] rpc_if_id_vector_t *rpc_if_id_vector_p_t; + +typedef struct +{ + unsigned32 count; + unsigned32 stats[1]; /* length_is (count) */ +} rpc_stats_vector_t, *rpc_stats_vector_p_t; Added: trunk/reactos/include/reactos/wine/epm.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/epm.i…
============================================================================== --- trunk/reactos/include/reactos/wine/epm.idl (added) +++ trunk/reactos/include/reactos/wine/epm.idl [iso-8859-1] Thu Nov 6 06:23:44 2008 @@ -1,0 +1,122 @@ +/* + * Endpoint Mapper + * + * Copyright 2006 Robert Shearman (for CodeWeavers) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* FIXME: should be import */ +#include "dcetypes.idl" + +cpp_quote("RPC_STATUS WINAPI TowerExplode(") +cpp_quote(" const twr_t *tower, PRPC_SYNTAX_IDENTIFIER object, PRPC_SYNTAX_IDENTIFIER syntax,") +cpp_quote(" char **protseq, char **endpoint, char **address);") +cpp_quote("RPC_STATUS WINAPI TowerConstruct(") +cpp_quote(" const RPC_SYNTAX_IDENTIFIER *object, const RPC_SYNTAX_IDENTIFIER *syntax,") +cpp_quote(" const char *protseq, const char *endpoint, const char *address,") +cpp_quote(" twr_t **tower);") + +[ + uuid(e1af8308-5d1f-11c9-91a4-08002b14a0fa), + version(3.0), + pointer_default(ref) +] +interface epm +{ + const long ept_max_annotation_size = 64; + + typedef struct + { + GUID object; + twr_t *tower; + [string] char annotation[ept_max_annotation_size]; + } ept_entry_t, *ept_entry_p_t; + + typedef [context_handle] void *ept_lookup_handle_t; + + /* Adds entries to an endpoint map */ + void ept_insert( + [in] handle_t h, + [in] unsigned32 num_ents, + [in, size_is(num_ents)] + ept_entry_t entries[], + [in] boolean32 replace, + [out] error_status_t *status + ); + + /* Removes entries from an endpoint map */ + void ept_delete( + [in] handle_t h, + [in] unsigned32 num_ents, + [in, size_is(num_ents)] + ept_entry_t entries[], + [out] error_status_t *status + ); + + /* Lookup entries in an endpoint map */ + [idempotent] + void ept_lookup( + [in] handle_t h, + [in] unsigned32 inquiry_type, + [in] uuid_p_t object, + [in] rpc_if_id_p_t interface_id, + [in] unsigned32 vers_option, + [in, out] ept_lookup_handle_t *entry_handle, + [in] unsigned32 max_ents, + [out] unsigned32 *num_ents, + [out, length_is(*num_ents), size_is(max_ents)] + ept_entry_t entries[], + [out] error_status_t *status + ); + + /* Lookup entries in an endpoint map using the given input pattern */ + [idempotent] + void ept_map( + [in] handle_t h, + [in] uuid_p_t object, + [in] twr_p_t map_tower, + [in, out] ept_lookup_handle_t *entry_handle, + [in] unsigned32 max_towers, + [out] unsigned32 *num_towers, + [out, length_is(*num_towers), size_is(max_towers)] + twr_p_t *towers, + [out] error_status_t *status + ); + + /* Free the context handle returned by ept_lookup or ept_map */ + void ept_lookup_handle_free( + [in] handle_t h, + [in, out] ept_lookup_handle_t *entry_handle, + [out] error_status_t *status + ); + + /* Inquires as to the endpoint map's object identifier */ + [idempotent] + void ept_inq_object( + [in] handle_t h, + [out] GUID *ept_object, + [out] error_status_t *status + ); + + /* Deletes matching entries in the endpoint map */ + void ept_mgmt_delete( + [in] handle_t h, + [in] boolean32 object_speced, + [in] uuid_p_t object, + [in] twr_p_t tower, + [out] error_status_t *status + ); +}
16 years, 1 month
1
0
0
0
[jimtabor] 37223: - Fix WidenPath. Now Area.exe runs and crashes when using real hardware. That is a good thing. We now know our Xorg based region code has problems. It allocates all the memory building PolyPolygon region data.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Nov 6 05:55:08 2008 New Revision: 37223 URL:
http://svn.reactos.org/svn/reactos?rev=37223&view=rev
Log: - Fix WidenPath. Now Area.exe runs and crashes when using real hardware. That is a good thing. We now know our Xorg based region code has problems. It allocates all the memory building PolyPolygon region data. Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Thu Nov 6 05:55:08 2008 @@ -1490,9 +1490,9 @@ FASTCALL PATH_WidenPath(DC *dc) { - INT i, j, numStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; + INT i, j, numStrokes, numOldStrokes, penWidth, penWidthIn, penWidthOut, size, penStyle; BOOL ret = FALSE; - PPATH pPath, pNewPath, *pStrokes, pUpPath, pDownPath; + PPATH pPath, pNewPath, *pStrokes, *pOldStrokes, pUpPath, pDownPath; EXTLOGPEN *elp; DWORD obj_type, joint, endcap, penType; PDC_ATTR Dc_Attr = dc->pDc_Attr; @@ -1560,6 +1560,7 @@ penWidthOut++; numStrokes = 0; + numOldStrokes = 1; pStrokes = ExAllocatePoolWithTag(PagedPool, sizeof(PPATH), TAG_PATH); pStrokes[0] = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH); @@ -1588,8 +1589,11 @@ } numStrokes++; j = 0; - ExFreePoolWithTag(pStrokes, TAG_PATH); + pOldStrokes = pStrokes; // Save old pointer. pStrokes = ExAllocatePoolWithTag(PagedPool, numStrokes * sizeof(PPATH), TAG_PATH); + RtlCopyMemory(pStrokes, pOldStrokes, numOldStrokes * sizeof(PPATH)); + numOldStrokes = numStrokes; // Save orig count. + ExFreePoolWithTag(pOldStrokes, TAG_PATH); // Free old pointer. pStrokes[numStrokes - 1] = ExAllocatePoolWithTag(PagedPool, sizeof(PATH), TAG_PATH); PATH_InitGdiPath(pStrokes[numStrokes - 1]);
16 years, 1 month
1
0
0
0
[jimtabor] 37222: - Fix Path drawing.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Thu Nov 6 05:48:51 2008 New Revision: 37222 URL:
http://svn.reactos.org/svn/reactos?rev=37222&view=rev
Log: - Fix Path drawing. Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Thu Nov 6 05:48:51 2008 @@ -2648,6 +2648,7 @@ Dc_Attr->iMapMode = MM_TEXT; Dc_Attr->iGraphicsMode = GM_COMPATIBLE; + Dc_Attr->jFillMode = ALTERNATE; Dc_Attr->szlWindowExt.cx = 1; // Float to Int,,, WRONG! Dc_Attr->szlWindowExt.cy = 1;
16 years, 1 month
1
0
0
0
← Newer
1
...
54
55
56
57
58
59
60
...
66
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Results per page:
10
25
50
100
200