Skip the optional leading backslashes in server names for the ncacn_np protocol.
This will fix at least one failure in the advapi32 registry winetest.

svn path=/trunk/; revision=63523
This commit is contained in:
Eric Kohl 2014-05-31 22:03:41 +00:00
parent b6cc5b5b59
commit dad73c35fe
2 changed files with 26 additions and 16 deletions

View file

@ -313,6 +313,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]); DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]);
RPC_STATUS r; RPC_STATUS r;
LPSTR pname; LPSTR pname;
LPSTR NetworkAddr;
INT size; INT size;
/* already connected? */ /* already connected? */
@ -329,9 +330,13 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
} }
else else
{ {
NetworkAddr = Connection->NetworkAddr;
if (NetworkAddr[0] == '\\' && NetworkAddr[1] == '\\')
NetworkAddr += 2;
if (GetComputerNameA(ComputerName, &bufLen)) if (GetComputerNameA(ComputerName, &bufLen))
{ {
if (stricmp(ComputerName, Connection->NetworkAddr) == 0) if (stricmp(ComputerName, NetworkAddr) == 0)
{ {
bUseLocalName = TRUE; bUseLocalName = TRUE;
size += strlen(local); size += strlen(local);
@ -339,13 +344,13 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
else else
{ {
bUseLocalName = FALSE; bUseLocalName = FALSE;
size += strlen(Connection->NetworkAddr); size += strlen(NetworkAddr);
} }
} }
else else
{ {
bUseLocalName = FALSE; bUseLocalName = FALSE;
size += strlen(Connection->NetworkAddr); size += strlen(NetworkAddr);
} }
} }
@ -356,7 +361,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
if (bUseLocalName) if (bUseLocalName)
strcat(pname, local); strcat(pname, local);
else else
strcat(pname, Connection->NetworkAddr); strcat(pname, NetworkAddr);
strcat(pname, Connection->Endpoint); strcat(pname, Connection->Endpoint);
r = rpcrt4_conn_open_pipe(Connection, pname, TRUE); r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
I_RpcFree(pname); I_RpcFree(pname);

View file

@ -141,7 +141,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
npc->pipe = pipe; npc->pipe = pipe;
return RPC_S_OK; return RPC_S_OK;
@@ -308,18 +306,59 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc @@ -308,18 +306,64 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection) static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
{ {
RpcConnection_np *npc = (RpcConnection_np *) Connection; RpcConnection_np *npc = (RpcConnection_np *) Connection;
@ -153,6 +153,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
+ DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]); + DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]);
RPC_STATUS r; RPC_STATUS r;
LPSTR pname; LPSTR pname;
+ LPSTR NetworkAddr;
+ INT size; + INT size;
/* already connected? */ /* already connected? */
@ -172,9 +173,13 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
+ } + }
+ else + else
+ { + {
+ NetworkAddr = Connection->NetworkAddr;
+ if (NetworkAddr[0] == '\\' && NetworkAddr[1] == '\\')
+ NetworkAddr += 2;
+
+ if (GetComputerNameA(ComputerName, &bufLen)) + if (GetComputerNameA(ComputerName, &bufLen))
+ { + {
+ if (stricmp(ComputerName, Connection->NetworkAddr) == 0) + if (stricmp(ComputerName, NetworkAddr) == 0)
+ { + {
+ bUseLocalName = TRUE; + bUseLocalName = TRUE;
+ size += strlen(local); + size += strlen(local);
@ -182,13 +187,13 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
+ else + else
+ { + {
+ bUseLocalName = FALSE; + bUseLocalName = FALSE;
+ size += strlen(Connection->NetworkAddr); + size += strlen(NetworkAddr);
+ } + }
+ } + }
+ else + else
+ { + {
+ bUseLocalName = FALSE; + bUseLocalName = FALSE;
+ size += strlen(Connection->NetworkAddr); + size += strlen(NetworkAddr);
+ } + }
+ } + }
+ +
@ -199,13 +204,13 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
+ if (bUseLocalName) + if (bUseLocalName)
+ strcat(pname, local); + strcat(pname, local);
+ else + else
+ strcat(pname, Connection->NetworkAddr); + strcat(pname, NetworkAddr);
+ strcat(pname, Connection->Endpoint); + strcat(pname, Connection->Endpoint);
+ r = rpcrt4_conn_open_pipe(Connection, pname, TRUE); + r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
I_RpcFree(pname); I_RpcFree(pname);
return r; return r;
@@ -368,9 +407,9 @@ static void rpcrt4_conn_np_handoff(RpcCo @@ -368,9 +412,9 @@ static void rpcrt4_conn_np_handoff(RpcCo
* to the child, then reopen the server binding to continue listening */ * to the child, then reopen the server binding to continue listening */
new_npc->pipe = old_npc->pipe; new_npc->pipe = old_npc->pipe;
@ -217,7 +222,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
old_npc->listening = FALSE; old_npc->listening = FALSE;
} }
@@ -415,11 +454,17 @@ static int rpcrt4_conn_np_read(RpcConnec @@ -415,11 +459,17 @@ static int rpcrt4_conn_np_read(RpcConnec
char *buf = buffer; char *buf = buffer;
BOOL ret = TRUE; BOOL ret = TRUE;
unsigned int bytes_left = count; unsigned int bytes_left = count;
@ -244,7 +249,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
return ret ? count : -1; return ret ? count : -1;
} }
@@ -437,16 +483,23 @@ static int rpcrt4_conn_np_write(RpcConne @@ -437,16 +488,23 @@ static int rpcrt4_conn_np_write(RpcConne
const char *buf = buffer; const char *buf = buffer;
BOOL ret = TRUE; BOOL ret = TRUE;
unsigned int bytes_left = count; unsigned int bytes_left = count;
@ -269,7 +274,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
return ret ? count : -1; return ret ? count : -1;
} }
@@ -458,9 +511,9 @@ static int rpcrt4_conn_np_close(RpcConne @@ -458,9 +516,9 @@ static int rpcrt4_conn_np_close(RpcConne
CloseHandle(npc->pipe); CloseHandle(npc->pipe);
npc->pipe = 0; npc->pipe = 0;
} }
@ -282,7 +287,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
} }
return 0; return 0;
} }
@@ -664,7 +717,7 @@ static void *rpcrt4_protseq_np_get_wait_ @@ -664,7 +722,7 @@ static void *rpcrt4_protseq_np_get_wait_
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
while (conn) { while (conn) {
rpcrt4_conn_listen_pipe(conn); rpcrt4_conn_listen_pipe(conn);
@ -291,7 +296,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
(*count)++; (*count)++;
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
} }
@@ -685,7 +738,7 @@ static void *rpcrt4_protseq_np_get_wait_ @@ -685,7 +743,7 @@ static void *rpcrt4_protseq_np_get_wait_
*count = 1; *count = 1;
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
while (conn) { while (conn) {
@ -300,7 +305,7 @@ diff -prudN .\wine\dlls\rpcrt4/rpc_transport.c .\reactos\dll\win32\rpcrt4/rpc_tr
(*count)++; (*count)++;
conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
} }
@@ -732,18 +785,12 @@ static int rpcrt4_protseq_np_wait_for_ne @@ -732,18 +790,12 @@ static int rpcrt4_protseq_np_wait_for_ne
EnterCriticalSection(&protseq->cs); EnterCriticalSection(&protseq->cs);
conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
while (conn) { while (conn) {