Whitespace cleanup.
This commit is contained in:
parent
641f7fa3de
commit
c029f8c006
@ -241,7 +241,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding)
|
|||||||
LPSTR pname;
|
LPSTR pname;
|
||||||
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
||||||
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
||||||
TRACE("listening on %s\n", pname);
|
TRACE("listening on %s\n", pname);
|
||||||
Binding->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
Binding->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
||||||
0, PIPE_UNLIMITED_INSTANCES, 0, 0, 5000, NULL);
|
0, PIPE_UNLIMITED_INSTANCES, 0, 0, 5000, NULL);
|
||||||
HeapFree(GetProcessHeap(), 0, pname);
|
HeapFree(GetProcessHeap(), 0, pname);
|
||||||
@ -262,7 +262,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding)
|
|||||||
LPSTR pname;
|
LPSTR pname;
|
||||||
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
||||||
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
||||||
TRACE("listening on %s\n", pname);
|
TRACE("listening on %s\n", pname);
|
||||||
Binding->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
Binding->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
|
||||||
0, PIPE_UNLIMITED_INSTANCES, 0, 0, 5000, NULL);
|
0, PIPE_UNLIMITED_INSTANCES, 0, 0, 5000, NULL);
|
||||||
HeapFree(GetProcessHeap(), 0, pname);
|
HeapFree(GetProcessHeap(), 0, pname);
|
||||||
@ -278,8 +278,8 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ERR("protseq %s not supported\n", Binding->Protseq);
|
ERR("protseq %s not supported\n", Binding->Protseq);
|
||||||
return RPC_S_PROTSEQ_NOT_SUPPORTED;
|
return RPC_S_PROTSEQ_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* client */
|
else { /* client */
|
||||||
@ -288,67 +288,65 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding)
|
|||||||
if (strcmp(Binding->Protseq, "ncalrpc") == 0) {
|
if (strcmp(Binding->Protseq, "ncalrpc") == 0) {
|
||||||
static LPSTR prefix = "\\\\.\\pipe\\lrpc\\";
|
static LPSTR prefix = "\\\\.\\pipe\\lrpc\\";
|
||||||
LPSTR pname;
|
LPSTR pname;
|
||||||
HANDLE conn;
|
HANDLE conn;
|
||||||
DWORD err;
|
DWORD err;
|
||||||
|
|
||||||
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
||||||
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
||||||
TRACE("connecting to %s\n", pname);
|
TRACE("connecting to %s\n", pname);
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
|
if (WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
|
||||||
conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
|
conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
|
||||||
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
|
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
|
||||||
if (conn != INVALID_HANDLE_VALUE) break;
|
if (conn != INVALID_HANDLE_VALUE) break;
|
||||||
err = GetLastError();
|
err = GetLastError();
|
||||||
if (err == ERROR_PIPE_BUSY) continue;
|
if (err == ERROR_PIPE_BUSY) continue;
|
||||||
TRACE("connection failed, error=%lx\n", err);
|
TRACE("connection failed, error=%lx\n", err);
|
||||||
HeapFree(GetProcessHeap(), 0, pname);
|
HeapFree(GetProcessHeap(), 0, pname);
|
||||||
return err;
|
return err;
|
||||||
}
|
} else {
|
||||||
else {
|
err = GetLastError();
|
||||||
err = GetLastError();
|
TRACE("connection failed, error=%lx\n", err);
|
||||||
TRACE("connection failed, error=%lx\n", err);
|
HeapFree(GetProcessHeap(), 0, pname);
|
||||||
HeapFree(GetProcessHeap(), 0, pname);
|
return err;
|
||||||
return err;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
HeapFree(GetProcessHeap(), 0, pname);
|
HeapFree(GetProcessHeap(), 0, pname);
|
||||||
memset(&Binding->ovl, 0, sizeof(Binding->ovl));
|
memset(&Binding->ovl, 0, sizeof(Binding->ovl));
|
||||||
Binding->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
|
Binding->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
|
||||||
Binding->conn = conn;
|
Binding->conn = conn;
|
||||||
}
|
}
|
||||||
/* protseq=ncacn_np: named pipes */
|
/* protseq=ncacn_np: named pipes */
|
||||||
else if (strcmp(Binding->Protseq, "ncacn_np") == 0) {
|
else if (strcmp(Binding->Protseq, "ncacn_np") == 0) {
|
||||||
static LPSTR prefix = "\\\\.";
|
static LPSTR prefix = "\\\\.";
|
||||||
LPSTR pname;
|
LPSTR pname;
|
||||||
HANDLE conn;
|
HANDLE conn;
|
||||||
DWORD err;
|
DWORD err;
|
||||||
|
|
||||||
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Binding->Endpoint) + 1);
|
||||||
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
strcat(strcpy(pname, prefix), Binding->Endpoint);
|
||||||
TRACE("connecting to %s\n", pname);
|
TRACE("connecting to %s\n", pname);
|
||||||
conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
|
conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
|
||||||
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
|
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
|
||||||
if (conn == INVALID_HANDLE_VALUE) {
|
if (conn == INVALID_HANDLE_VALUE) {
|
||||||
err = GetLastError();
|
err = GetLastError();
|
||||||
/* we don't need to handle ERROR_PIPE_BUSY here,
|
/* we don't need to handle ERROR_PIPE_BUSY here,
|
||||||
* the doc says that it is returned to the app */
|
* the doc says that it is returned to the app */
|
||||||
TRACE("connection failed, error=%lx\n", err);
|
TRACE("connection failed, error=%lx\n", err);
|
||||||
HeapFree(GetProcessHeap(), 0, pname);
|
HeapFree(GetProcessHeap(), 0, pname);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
HeapFree(GetProcessHeap(), 0, pname);
|
HeapFree(GetProcessHeap(), 0, pname);
|
||||||
memset(&Binding->ovl, 0, sizeof(Binding->ovl));
|
memset(&Binding->ovl, 0, sizeof(Binding->ovl));
|
||||||
Binding->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
|
Binding->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
|
||||||
Binding->conn = conn;
|
Binding->conn = conn;
|
||||||
}
|
} else {
|
||||||
else {
|
ERR("protseq %s not supported\n", Binding->Protseq);
|
||||||
ERR("protseq %s not supported\n", Binding->Protseq);
|
return RPC_S_PROTSEQ_NOT_SUPPORTED;
|
||||||
return RPC_S_PROTSEQ_NOT_SUPPORTED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,9 +438,9 @@ RPC_STATUS WINAPI RpcStringBindingComposeA( LPSTR ObjUuid, LPSTR Protseq,
|
|||||||
data += RPCRT4_strcopyA(data, Protseq);
|
data += RPCRT4_strcopyA(data, Protseq);
|
||||||
*data++ = ':';
|
*data++ = ':';
|
||||||
}
|
}
|
||||||
if (NetworkAddr && *NetworkAddr) {
|
if (NetworkAddr && *NetworkAddr)
|
||||||
data += RPCRT4_strcopyA(data, NetworkAddr);
|
data += RPCRT4_strcopyA(data, NetworkAddr);
|
||||||
}
|
|
||||||
if ((Endpoint && *Endpoint) ||
|
if ((Endpoint && *Endpoint) ||
|
||||||
(Options && *Options)) {
|
(Options && *Options)) {
|
||||||
*data++ = '[';
|
*data++ = '[';
|
||||||
@ -566,33 +564,33 @@ RPC_STATUS WINAPI RpcStringBindingParseA( LPSTR StringBinding, LPSTR *ObjUuid,
|
|||||||
/* parse option */
|
/* parse option */
|
||||||
next = strchr(opt, '=');
|
next = strchr(opt, '=');
|
||||||
if (!next) {
|
if (!next) {
|
||||||
/* not an option, must be an endpoint */
|
/* not an option, must be an endpoint */
|
||||||
if (*Endpoint) goto fail;
|
if (*Endpoint) goto fail;
|
||||||
*Endpoint = opt;
|
*Endpoint = opt;
|
||||||
}
|
} else {
|
||||||
else {
|
if (strncmp(opt, ep_opt, strlen(ep_opt)) == 0) {
|
||||||
if (strncmp(opt, ep_opt, strlen(ep_opt)) == 0) {
|
/* endpoint option */
|
||||||
/* endpoint option */
|
if (*Endpoint) goto fail;
|
||||||
if (*Endpoint) goto fail;
|
*Endpoint = RPCRT4_strdupA(next+1);
|
||||||
*Endpoint = RPCRT4_strdupA(next+1);
|
HeapFree(GetProcessHeap(), 0, opt);
|
||||||
HeapFree(GetProcessHeap(), 0, opt);
|
} else {
|
||||||
}
|
/* network option */
|
||||||
else {
|
if (*Options) {
|
||||||
/* network option */
|
|
||||||
if (*Options) {
|
|
||||||
/* FIXME: this is kind of inefficient */
|
/* FIXME: this is kind of inefficient */
|
||||||
*Options = RPCRT4_strconcatA(*Options, opt);
|
*Options = RPCRT4_strconcatA(*Options, opt);
|
||||||
HeapFree(GetProcessHeap(), 0, opt);
|
HeapFree(GetProcessHeap(), 0, opt);
|
||||||
}
|
} else
|
||||||
else *Options = opt;
|
*Options = opt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data = close+1;
|
data = close+1;
|
||||||
if (*data) goto fail;
|
if (*data) goto fail;
|
||||||
}
|
}
|
||||||
else if (NetworkAddr) *NetworkAddr = RPCRT4_strdupA(data);
|
else if (NetworkAddr)
|
||||||
|
*NetworkAddr = RPCRT4_strdupA(data);
|
||||||
|
|
||||||
return RPC_S_OK;
|
return RPC_S_OK;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
@ -657,35 +655,34 @@ RPC_STATUS WINAPI RpcStringBindingParseW( LPWSTR StringBinding, LPWSTR *ObjUuid,
|
|||||||
/* parse option */
|
/* parse option */
|
||||||
next = strchrW(opt, '=');
|
next = strchrW(opt, '=');
|
||||||
if (!next) {
|
if (!next) {
|
||||||
/* not an option, must be an endpoint */
|
/* not an option, must be an endpoint */
|
||||||
if (*Endpoint) goto fail;
|
if (*Endpoint) goto fail;
|
||||||
*Endpoint = opt;
|
*Endpoint = opt;
|
||||||
}
|
} else {
|
||||||
else {
|
if (strncmpW(opt, ep_opt, strlenW(ep_opt)) == 0) {
|
||||||
if (strncmpW(opt, ep_opt, strlenW(ep_opt)) == 0) {
|
/* endpoint option */
|
||||||
/* endpoint option */
|
if (*Endpoint) goto fail;
|
||||||
if (*Endpoint) goto fail;
|
*Endpoint = RPCRT4_strdupW(next+1);
|
||||||
*Endpoint = RPCRT4_strdupW(next+1);
|
HeapFree(GetProcessHeap(), 0, opt);
|
||||||
HeapFree(GetProcessHeap(), 0, opt);
|
} else {
|
||||||
}
|
/* network option */
|
||||||
else {
|
if (*Options) {
|
||||||
/* network option */
|
|
||||||
if (*Options) {
|
|
||||||
/* FIXME: this is kind of inefficient */
|
/* FIXME: this is kind of inefficient */
|
||||||
*Options = RPCRT4_strconcatW(*Options, opt);
|
*Options = RPCRT4_strconcatW(*Options, opt);
|
||||||
HeapFree(GetProcessHeap(), 0, opt);
|
HeapFree(GetProcessHeap(), 0, opt);
|
||||||
}
|
} else
|
||||||
else *Options = opt;
|
*Options = opt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data = close+1;
|
data = close+1;
|
||||||
if (*data) goto fail;
|
if (*data) goto fail;
|
||||||
}
|
} else if (NetworkAddr)
|
||||||
else if (NetworkAddr) *NetworkAddr = RPCRT4_strdupW(data);
|
*NetworkAddr = RPCRT4_strdupW(data);
|
||||||
|
|
||||||
return RPC_S_OK;
|
return RPC_S_OK;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (ObjUuid) RpcStringFreeW(ObjUuid);
|
if (ObjUuid) RpcStringFreeW(ObjUuid);
|
||||||
if (Protseq) RpcStringFreeW(Protseq);
|
if (Protseq) RpcStringFreeW(Protseq);
|
||||||
@ -779,8 +776,10 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( LPSTR StringBinding, RPC_BINDING
|
|||||||
RpcStringFreeA(&Protseq);
|
RpcStringFreeA(&Protseq);
|
||||||
RpcStringFreeA(&ObjectUuid);
|
RpcStringFreeA(&ObjectUuid);
|
||||||
|
|
||||||
if (ret == RPC_S_OK) *Binding = (RPC_BINDING_HANDLE)bind;
|
if (ret == RPC_S_OK)
|
||||||
else RPCRT4_DestroyBinding(bind);
|
*Binding = (RPC_BINDING_HANDLE)bind;
|
||||||
|
else
|
||||||
|
RPCRT4_DestroyBinding(bind);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -816,8 +815,10 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingW( LPWSTR StringBinding, RPC_BINDIN
|
|||||||
RpcStringFreeW(&Protseq);
|
RpcStringFreeW(&Protseq);
|
||||||
RpcStringFreeW(&ObjectUuid);
|
RpcStringFreeW(&ObjectUuid);
|
||||||
|
|
||||||
if (ret == RPC_S_OK) *Binding = (RPC_BINDING_HANDLE)bind;
|
if (ret == RPC_S_OK)
|
||||||
else RPCRT4_DestroyBinding(bind);
|
*Binding = (RPC_BINDING_HANDLE)bind;
|
||||||
|
else
|
||||||
|
RPCRT4_DestroyBinding(bind);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user