mirror of
https://github.com/reactos/reactos.git
synced 2025-06-23 13:30:17 +00:00
[RPCRT4] Addendum to support for remote pipes names in ncacn_pipe_name() (24cd7bbe
).
CORE-6561 CORE-13442 - Call GetComputerNameA() only when a non-empty server name has been provided, thus slightly improving speed for the most common case when local calls (with an empty server name) are done. - When a server name is passed, trim any leading UNC server prefix since the latter will be restored when building the pipe name string.
This commit is contained in:
parent
bf0dc6adb2
commit
5274857da9
2 changed files with 34 additions and 7 deletions
|
@ -262,18 +262,31 @@ static char *ncacn_pipe_name(const char *endpoint)
|
||||||
static const char prefix[] = "\\\\";
|
static const char prefix[] = "\\\\";
|
||||||
static const char local[] = ".";
|
static const char local[] = ".";
|
||||||
char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
|
DWORD bufLen = ARRAY_SIZE(ComputerName);
|
||||||
#else
|
#else
|
||||||
static const char prefix[] = "\\\\.";
|
static const char prefix[] = "\\\\.";
|
||||||
#endif
|
#endif
|
||||||
char *pipe_name;
|
char *pipe_name;
|
||||||
|
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
DWORD bufLen = ARRAYSIZE(ComputerName);
|
if (server != NULL && *server != 0)
|
||||||
|
{
|
||||||
|
/* Trim any leading UNC server prefix. */
|
||||||
|
if (server[0] == '\\' && server[1] == '\\')
|
||||||
|
server += 2;
|
||||||
|
|
||||||
GetComputerNameA(ComputerName, &bufLen);
|
/* If the server represents the local computer, use instead
|
||||||
|
* the local prefix to avoid a round in UNC name resolution. */
|
||||||
if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0)
|
if (GetComputerNameA(ComputerName, &bufLen) &&
|
||||||
|
(stricmp(ComputerName, server) == 0))
|
||||||
|
{
|
||||||
server = local;
|
server = local;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
server = local;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* protseq=ncacn_np: named pipes */
|
/* protseq=ncacn_np: named pipes */
|
||||||
|
|
|
@ -129,13 +129,27 @@ diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_t
|
||||||
+ static const char prefix[] = "\\\\";
|
+ static const char prefix[] = "\\\\";
|
||||||
+ static const char local[] = ".";
|
+ static const char local[] = ".";
|
||||||
+ char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
+ char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
|
+ DWORD bufLen = ARRAY_SIZE(ComputerName);
|
||||||
char *pipe_name;
|
char *pipe_name;
|
||||||
+ DWORD bufLen = ARRAYSIZE(ComputerName);
|
|
||||||
+
|
+
|
||||||
+ GetComputerNameA(ComputerName, &bufLen);
|
+ if (server != NULL && *server != 0)
|
||||||
|
+ {
|
||||||
|
+ /* Trim any leading UNC server prefix. */
|
||||||
|
+ if (server[0] == '\\' && server[1] == '\\')
|
||||||
|
+ server += 2;
|
||||||
+
|
+
|
||||||
+ if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0)
|
+ /* If the server represents the local computer, use instead
|
||||||
|
+ * the local prefix to avoid a round in UNC name resolution. */
|
||||||
|
+ if (GetComputerNameA(ComputerName, &bufLen) &&
|
||||||
|
+ (stricmp(ComputerName, server) == 0))
|
||||||
|
+ {
|
||||||
+ server = local;
|
+ server = local;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ server = local;
|
||||||
|
+ }
|
||||||
|
|
||||||
/* protseq=ncacn_np: named pipes */
|
/* protseq=ncacn_np: named pipes */
|
||||||
- pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
|
- pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue