Author: akhaldi
Date: Fri Dec 6 23:26:11 2013
New Revision: 61237
URL:
http://svn.reactos.org/svn/reactos?rev=61237&view=rev
Log:
[RPCRT4]
* Sync with Wine 1.7.1.
[PSDK]
* Update rpcdce.h, rpcdcep.h and rpcndr.h.
CORE-7469
Modified:
trunk/reactos/dll/win32/rpcrt4/cstub.c
trunk/reactos/dll/win32/rpcrt4/ndr_es.c
trunk/reactos/dll/win32/rpcrt4/ndr_marshall.c
trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c
trunk/reactos/dll/win32/rpcrt4/rpc_assoc.c
trunk/reactos/dll/win32/rpcrt4/rpc_assoc.h
trunk/reactos/dll/win32/rpcrt4/rpc_binding.c
trunk/reactos/dll/win32/rpcrt4/rpc_binding.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_transport.c
trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec
trunk/reactos/dll/win32/rpcrt4/rpcrt4_main.c
trunk/reactos/dll/win32/rpcrt4/rpcrt4_ros.diff
trunk/reactos/include/psdk/rpcdce.h
trunk/reactos/include/psdk/rpcdcep.h
trunk/reactos/include/psdk/rpcndr.h
trunk/reactos/media/doc/README.WINE
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] Fri Dec 6 23:26:11 2013
@@ -375,7 +375,7 @@
if (IsEqualIID(&IID_IUnknown, riid) ||
IsEqualIID(&IID_IRpcStubBuffer, riid))
{
- IUnknown_AddRef(iface);
+ IRpcStubBuffer_AddRef(iface);
*obj = iface;
return S_OK;
}
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] Fri Dec 6 23:26:11 2013
@@ -351,9 +351,9 @@
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
{
- const NDR_PROC_HEADER_RPC *pProcHeader = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
- stack_size = pProcHeader->stack_size;
- pEsMsg->ProcNumber = pProcHeader->proc_num;
+ const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
+ stack_size = header_rpc->stack_size;
+ pEsMsg->ProcNumber = header_rpc->proc_num;
pFormat += sizeof(NDR_PROC_HEADER_RPC);
}
else
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] Fri Dec 6 23:26:11 2013
@@ -1179,7 +1179,8 @@
while (pFormat[0] != RPC_FC_END) {
switch (pFormat[0]) {
default:
- FIXME("unknown repeat type %d\n", pFormat[0]);
+ FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
+ /* fallthrough */
case RPC_FC_NO_REPEAT:
rep = 1;
stride = 0;
@@ -1259,7 +1260,8 @@
TRACE("pFormat[0] = 0x%x\n", pFormat[0]);
switch (pFormat[0]) {
default:
- FIXME("unknown repeat type %d\n", pFormat[0]);
+ FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
+ /* fallthrough */
case RPC_FC_NO_REPEAT:
rep = 1;
stride = 0;
@@ -1333,7 +1335,8 @@
while (pFormat[0] != RPC_FC_END) {
switch (pFormat[0]) {
default:
- FIXME("unknown repeat type %d\n", pFormat[0]);
+ FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
+ /* fallthrough */
case RPC_FC_NO_REPEAT:
rep = 1;
stride = 0;
@@ -1405,7 +1408,8 @@
while (pFormat[0] != RPC_FC_END) {
switch (pFormat[0]) {
default:
- FIXME("unknown repeat type %d\n", pFormat[0]);
+ FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
+ /* fallthrough */
case RPC_FC_NO_REPEAT:
rep = 1;
stride = 0;
@@ -1463,7 +1467,8 @@
while (pFormat[0] != RPC_FC_END) {
switch (pFormat[0]) {
default:
- FIXME("unknown repeat type %d\n", pFormat[0]);
+ FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
+ /* fallthrough */
case RPC_FC_NO_REPEAT:
rep = 1;
stride = 0;
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] Fri Dec 6 23:26:11 2013
@@ -152,6 +152,15 @@
DWORD size;
switch(*pFormat)
{
+ case RPC_FC_RP:
+ if (pFormat[1] & RPC_FC_P_SIMPLEPOINTER)
+ {
+ FIXME("Simple reference pointer (type %#x).\n", pFormat[2]);
+ size = sizeof(void *);
+ break;
+ }
+ size = calc_arg_size(pStubMsg, &pFormat[2] + *(const
SHORT*)&pFormat[2]);
+ break;
case RPC_FC_STRUCT:
case RPC_FC_PSTRUCT:
size = *(const WORD*)(pFormat + 2);
@@ -206,7 +215,7 @@
default:
FIXME("Unhandled type %02x\n", *pFormat);
/* fallthrough */
- case RPC_FC_RP:
+ case RPC_FC_IP:
size = sizeof(void *);
break;
}
@@ -620,9 +629,9 @@
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
{
- const NDR_PROC_HEADER_RPC *pProcHeader = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
- stack_size = pProcHeader->stack_size;
- procedure_number = pProcHeader->proc_num;
+ const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
+ stack_size = header_rpc->stack_size;
+ procedure_number = header_rpc->proc_num;
pFormat += sizeof(NDR_PROC_HEADER_RPC);
}
else
@@ -809,7 +818,7 @@
}
}
- /* convert strings, floating point values and endianess into our
+ /* convert strings, floating point values and endianness into our
* preferred format */
if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) !=
NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(&stubMsg, pFormat);
@@ -847,7 +856,7 @@
if (comm_fault_offsets->FaultOffset == -1)
fault_status = (ULONG *)&RetVal;
else if (comm_fault_offsets->FaultOffset >= 0)
- fault_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop,
comm_fault_offsets->CommOffset);
+ fault_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop,
comm_fault_offsets->FaultOffset);
else
fault_status = NULL;
@@ -1226,8 +1235,8 @@
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
{
- const NDR_PROC_HEADER_RPC *pProcHeader = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
- stack_size = pProcHeader->stack_size;
+ const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
+ stack_size = header_rpc->stack_size;
pFormat += sizeof(NDR_PROC_HEADER_RPC);
}
@@ -1341,7 +1350,7 @@
NdrCorrCache, sizeof(NdrCorrCache),
&number_of_params );
}
- /* convert strings, floating point values and endianess into our
+ /* convert strings, floating point values and endianness into our
* preferred format */
if ((pRpcMsg->DataRepresentation & 0x0000FFFFUL) !=
NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(&stubMsg, pFormat);
@@ -1514,9 +1523,9 @@
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
{
- const NDR_PROC_HEADER_RPC *pProcHeader = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
- async_call_data->stack_size = pProcHeader->stack_size;
- procedure_number = pProcHeader->proc_num;
+ const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC
*)&pFormat[0];
+ async_call_data->stack_size = header_rpc->stack_size;
+ procedure_number = header_rpc->proc_num;
pFormat += sizeof(NDR_PROC_HEADER_RPC);
}
else
Modified: trunk/reactos/dll/win32/rpcrt4/rpc_assoc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_assoc…
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/rpc_assoc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rpcrt4/rpc_assoc.c [iso-8859-1] Fri Dec 6 23:26:11 2013
@@ -79,6 +79,7 @@
list_init(&assoc->free_connection_pool);
list_init(&assoc->context_handle_list);
InitializeCriticalSection(&assoc->cs);
+ assoc->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ":
RpcAssoc.cs");
assoc->Protseq = RPCRT4_strdupA(Protseq);
assoc->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
assoc->Endpoint = RPCRT4_strdupA(Endpoint);
@@ -207,7 +208,7 @@
LIST_FOR_EACH_ENTRY_SAFE(Connection, cursor2,
&assoc->free_connection_pool, RpcConnection, conn_pool_entry)
{
list_remove(&Connection->conn_pool_entry);
- RPCRT4_DestroyConnection(Connection);
+ RPCRT4_ReleaseConnection(Connection);
}
LIST_FOR_EACH_ENTRY_SAFE(context_handle, context_handle_cursor,
&assoc->context_handle_list, RpcContextHandle, entry)
@@ -218,6 +219,7 @@
HeapFree(GetProcessHeap(), 0, assoc->NetworkAddr);
HeapFree(GetProcessHeap(), 0, assoc->Protseq);
+ assoc->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&assoc->cs);
HeapFree(GetProcessHeap(), 0, assoc);
@@ -392,7 +394,7 @@
RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc,
const RPC_SYNTAX_IDENTIFIER *InterfaceId,
const RPC_SYNTAX_IDENTIFIER *TransferSyntax,
RpcAuthInfo *AuthInfo,
- RpcQualityOfService *QOS, RpcConnection
**Connection)
+ RpcQualityOfService *QOS, LPCWSTR CookieAuth,
RpcConnection **Connection)
{
RpcConnection *NewConnection;
RPC_STATUS status;
@@ -405,7 +407,7 @@
status = RPCRT4_CreateConnection(&NewConnection, FALSE /* is this a server
connection? */,
assoc->Protseq, assoc->NetworkAddr,
assoc->Endpoint, assoc->NetworkOptions,
- AuthInfo, QOS);
+ AuthInfo, QOS, CookieAuth);
if (status != RPC_S_OK)
return status;
@@ -413,14 +415,14 @@
status = RPCRT4_OpenClientConnection(NewConnection);
if (status != RPC_S_OK)
{
- RPCRT4_DestroyConnection(NewConnection);
+ RPCRT4_ReleaseConnection(NewConnection);
return status;
}
status = RpcAssoc_BindConnection(assoc, NewConnection, InterfaceId, TransferSyntax);
if (status != RPC_S_OK)
{
- RPCRT4_DestroyConnection(NewConnection);
+ RPCRT4_ReleaseConnection(NewConnection);
return status;
}
Modified: trunk/reactos/dll/win32/rpcrt4/rpc_assoc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_assoc…
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/rpc_assoc.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rpcrt4/rpc_assoc.h [iso-8859-1] Fri Dec 6 23:26:11 2013
@@ -47,7 +47,9 @@
} RpcAssoc;
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint,
LPCWSTR NetworkOptions, RpcAssoc **assoc) DECLSPEC_HIDDEN;
-RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER
*InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo,
RpcQualityOfService *QOS, RpcConnection **Connection) DECLSPEC_HIDDEN;
+RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER
*InterfaceId,
+ const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo,
RpcQualityOfService *QOS,
+ LPCWSTR CookieAuth, RpcConnection **Connection) DECLSPEC_HIDDEN;
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
DECLSPEC_HIDDEN;
ULONG RpcAssoc_Release(RpcAssoc *assoc) DECLSPEC_HIDDEN;
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR
Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out) DECLSPEC_HIDDEN;
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] Fri Dec 6 23:26:11 2013
@@ -266,6 +266,7 @@
RPCRT4_strfree(Binding->NetworkAddr);
RPCRT4_strfree(Binding->Protseq);
HeapFree(GetProcessHeap(), 0, Binding->NetworkOptions);
+ HeapFree(GetProcessHeap(), 0, Binding->CookieAuth);
if (Binding->AuthInfo) RpcAuthInfo_Release(Binding->AuthInfo);
if (Binding->QOS) RpcQualityOfService_Release(Binding->QOS);
HeapFree(GetProcessHeap(), 0, Binding);
@@ -280,7 +281,7 @@
if (!Binding->server) {
return RpcAssoc_GetClientConnection(Binding->Assoc, InterfaceId,
- TransferSyntax, Binding->AuthInfo, Binding->QOS, Connection);
+ TransferSyntax, Binding->AuthInfo, Binding->QOS, Binding->CookieAuth,
Connection);
} else {
/* we already have a connection with acceptable binding, so use it */
if (Binding->FromConn) {
@@ -301,7 +302,7 @@
/* don't destroy a connection that is cached in the binding */
if (Binding->FromConn == Connection)
return RPC_S_OK;
- return RPCRT4_DestroyConnection(Connection);
+ return RPCRT4_ReleaseConnection(Connection);
}
else {
RpcAssoc_ReleaseIdleConnection(Binding->Assoc, Connection);
@@ -854,10 +855,16 @@
if (ret == RPC_S_OK)
ret = RPCRT4_CreateBindingA(&bind, FALSE, (char*)Protseq);
- if (ret != RPC_S_OK) return ret;
- ret = RPCRT4_SetBindingObject(bind, &Uuid);
- if (ret == RPC_S_OK)
- ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint,
(char*)Options);
+ if (ret == RPC_S_OK) {
+ ret = RPCRT4_SetBindingObject(bind, &Uuid);
+ if (ret == RPC_S_OK)
+ ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint,
(char*)Options);
+
+ if (ret == RPC_S_OK)
+ *Binding = (RPC_BINDING_HANDLE)bind;
+ else
+ RPCRT4_ReleaseBinding(bind);
+ }
RpcStringFreeA(&Options);
RpcStringFreeA(&Endpoint);
@@ -865,11 +872,6 @@
RpcStringFreeA(&Protseq);
RpcStringFreeA(&ObjectUuid);
- if (ret == RPC_S_OK)
- *Binding = (RPC_BINDING_HANDLE)bind;
- else
- RPCRT4_ReleaseBinding(bind);
-
return ret;
}
@@ -893,21 +895,22 @@
if (ret == RPC_S_OK)
ret = RPCRT4_CreateBindingW(&bind, FALSE, Protseq);
- if (ret != RPC_S_OK) return ret;
- ret = RPCRT4_SetBindingObject(bind, &Uuid);
- if (ret == RPC_S_OK)
- ret = RPCRT4_CompleteBindingW(bind, NetworkAddr, Endpoint, Options);
+ if (ret == RPC_S_OK) {
+ ret = RPCRT4_SetBindingObject(bind, &Uuid);
+ if (ret == RPC_S_OK)
+ ret = RPCRT4_CompleteBindingW(bind, NetworkAddr, Endpoint, Options);
+
+ if (ret == RPC_S_OK)
+ *Binding = (RPC_BINDING_HANDLE)bind;
+ else
+ RPCRT4_ReleaseBinding(bind);
+ }
RpcStringFreeW(&Options);
RpcStringFreeW(&Endpoint);
RpcStringFreeW(&NetworkAddr);
RpcStringFreeW(&Protseq);
RpcStringFreeW(&ObjectUuid);
-
- if (ret == RPC_S_OK)
- *Binding = (RPC_BINDING_HANDLE)bind;
- else
- RPCRT4_ReleaseBinding(bind);
return ret;
}
@@ -1003,6 +1006,7 @@
DestBinding->NetworkAddr = RPCRT4_strndupA(SrcBinding->NetworkAddr, -1);
DestBinding->Endpoint = RPCRT4_strndupA(SrcBinding->Endpoint, -1);
DestBinding->NetworkOptions = RPCRT4_strdupW(SrcBinding->NetworkOptions);
+ DestBinding->CookieAuth = RPCRT4_strdupW(SrcBinding->CookieAuth);
if (SrcBinding->Assoc) SrcBinding->Assoc->refs++;
DestBinding->Assoc = SrcBinding->Assoc;
@@ -1415,7 +1419,18 @@
if (http_credentials1->AuthenticationTarget !=
http_credentials2->AuthenticationTarget)
return FALSE;
- /* authentication schemes and server certificate subject not currently used */
+ if (http_credentials1->NumberOfAuthnSchemes !=
http_credentials2->NumberOfAuthnSchemes)
+ return FALSE;
+
+ if ((!http_credentials1->AuthnSchemes &&
http_credentials2->AuthnSchemes) ||
+ (http_credentials1->AuthnSchemes &&
!http_credentials2->AuthnSchemes))
+ return FALSE;
+
+ if (memcmp(http_credentials1->AuthnSchemes,
http_credentials2->AuthnSchemes,
+ http_credentials1->NumberOfAuthnSchemes *
sizeof(http_credentials1->AuthnSchemes[0])))
+ return FALSE;
+
+ /* server certificate subject not currently used */
if (http_credentials1->TransportCredentials !=
http_credentials2->TransportCredentials)
{
@@ -1653,12 +1668,13 @@
const RPC_SECURITY_QOS_V2_A *SecurityQos2 = (const RPC_SECURITY_QOS_V2_A
*)SecurityQos;
TRACE(", AdditionalSecurityInfoType=%d",
SecurityQos2->AdditionalSecurityInfoType);
if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
- TRACE(", { %p, 0x%x, %d, %d, %p, %s }",
+ TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
SecurityQos2->u.HttpCredentials->TransportCredentials,
SecurityQos2->u.HttpCredentials->Flags,
SecurityQos2->u.HttpCredentials->AuthenticationTarget,
SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
SecurityQos2->u.HttpCredentials->AuthnSchemes,
+ SecurityQos2->u.HttpCredentials->AuthnSchemes ?
*SecurityQos2->u.HttpCredentials->AuthnSchemes : 0,
SecurityQos2->u.HttpCredentials->ServerCertificateSubject);
}
TRACE("}\n");
@@ -1730,7 +1746,7 @@
if (r == RPC_S_OK)
{
new_auth_info->server_principal_name = RPCRT4_strdupAtoW((char
*)ServerPrincName);
- if (new_auth_info->server_principal_name)
+ if (!ServerPrincName || new_auth_info->server_principal_name)
{
if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
bind->AuthInfo = new_auth_info;
@@ -1783,12 +1799,13 @@
const RPC_SECURITY_QOS_V2_W *SecurityQos2 = (const RPC_SECURITY_QOS_V2_W
*)SecurityQos;
TRACE(", AdditionalSecurityInfoType=%d",
SecurityQos2->AdditionalSecurityInfoType);
if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
- TRACE(", { %p, 0x%x, %d, %d, %p, %s }",
+ TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
SecurityQos2->u.HttpCredentials->TransportCredentials,
SecurityQos2->u.HttpCredentials->Flags,
SecurityQos2->u.HttpCredentials->AuthenticationTarget,
SecurityQos2->u.HttpCredentials->NumberOfAuthnSchemes,
SecurityQos2->u.HttpCredentials->AuthnSchemes,
+ SecurityQos2->u.HttpCredentials->AuthnSchemes ?
*SecurityQos2->u.HttpCredentials->AuthnSchemes : 0,
debugstr_w(SecurityQos2->u.HttpCredentials->ServerCertificateSubject));
}
TRACE("}\n");
@@ -1911,6 +1928,27 @@
*/
RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Option,
ULONG_PTR OptionValue)
{
- FIXME("(%p, %d, %ld): stub\n", BindingHandle, Option, OptionValue);
+ TRACE("(%p, %d, %ld)\n", BindingHandle, Option, OptionValue);
+
+ switch (Option)
+ {
+ case RPC_C_OPT_COOKIE_AUTH:
+ {
+ RPC_C_OPT_COOKIE_AUTH_DESCRIPTOR *cookie = (RPC_C_OPT_COOKIE_AUTH_DESCRIPTOR
*)OptionValue;
+ RpcBinding *binding = BindingHandle;
+ int len = MultiByteToWideChar(CP_ACP, 0, cookie->Buffer,
cookie->BufferSize, NULL, 0);
+ WCHAR *str;
+
+ if (!(str = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)))) return
ERROR_OUTOFMEMORY;
+ MultiByteToWideChar(CP_ACP, 0, cookie->Buffer, cookie->BufferSize, str,
len);
+ str[len] = 0;
+ HeapFree(GetProcessHeap(), 0, binding->CookieAuth);
+ binding->CookieAuth = str;
+ break;
+ }
+ default:
+ FIXME("option %u not supported\n", Option);
+ break;
+ }
return RPC_S_OK;
}
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] Fri Dec 6 23:26:11 2013
@@ -61,6 +61,7 @@
typedef struct _RpcConnection
{
+ LONG ref;
BOOL server;
LPSTR NetworkAddr;
LPSTR Endpoint;
@@ -77,6 +78,7 @@
ULONG encryption_auth_len;
ULONG signature_auth_len;
RpcQualityOfService *QOS;
+ LPWSTR CookieAuth;
/* client-only */
struct list conn_pool_entry;
@@ -133,6 +135,7 @@
/* authentication */
RpcAuthInfo *AuthInfo;
RpcQualityOfService *QOS;
+ LPWSTR CookieAuth;
} RpcBinding;
LPSTR RPCRT4_strndupA(LPCSTR src, INT len) DECLSPEC_HIDDEN;
@@ -152,8 +155,11 @@
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos) DECLSPEC_HIDDEN;
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const
RpcQualityOfService *qos2) DECLSPEC_HIDDEN;
-RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR
Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo*
AuthInfo, RpcQualityOfService *QOS) DECLSPEC_HIDDEN;
-RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
+RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR
Protseq,
+ LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo,
+ RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN;
+RpcConnection *RPCRT4_GrabConnection( RpcConnection *conn ) DECLSPEC_HIDDEN;
+RPC_STATUS RPCRT4_ReleaseConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
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] Fri Dec 6 23:26:11 2013
@@ -179,11 +179,8 @@
}
}
-/***********************************************************************
- * RpcEpRegisterA (RPCRT4.@)
- */
-RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR
*BindingVector,
- UUID_VECTOR *UuidVector, RPC_CSTR Annotation )
+static RPC_STATUS epm_register( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector,
+ UUID_VECTOR *UuidVector, RPC_CSTR Annotation, BOOL
replace )
{
PRPC_SERVER_INTERFACE If = IfSpec;
ULONG i;
@@ -192,7 +189,7 @@
ept_entry_t *entries;
handle_t handle;
- TRACE("(%p,%p,%p,%s)\n", IfSpec, BindingVector, UuidVector,
debugstr_a((char*)Annotation));
+ TRACE("(%p,%p,%p,%s) replace=%d\n", IfSpec, BindingVector, UuidVector,
debugstr_a((char*)Annotation), replace);
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
for (i=0; i<BindingVector->Count; i++) {
RpcBinding* bind = BindingVector->BindingH[i];
@@ -246,7 +243,7 @@
__TRY
{
ept_insert(handle, BindingVector->Count * (UuidVector ?
UuidVector->Count : 1),
- entries, TRUE, &status2);
+ entries, replace, &status2);
}
__EXCEPT(rpc_filter)
{
@@ -280,6 +277,24 @@
}
/***********************************************************************
+ * RpcEpRegisterA (RPCRT4.@)
+ */
+RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR
*BindingVector,
+ UUID_VECTOR *UuidVector, RPC_CSTR Annotation )
+{
+ return epm_register(IfSpec, BindingVector, UuidVector, Annotation, TRUE);
+}
+
+/***********************************************************************
+ * RpcEpRegisterNoReplaceA (RPCRT4.@)
+ */
+RPC_STATUS WINAPI RpcEpRegisterNoReplaceA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR
*BindingVector,
+ UUID_VECTOR *UuidVector, RPC_CSTR Annotation
)
+{
+ return epm_register(IfSpec, BindingVector, UuidVector, Annotation, FALSE);
+}
+
+/***********************************************************************
* RpcEpRegisterW (RPCRT4.@)
*/
RPC_STATUS WINAPI RpcEpRegisterW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR
*BindingVector,
@@ -288,7 +303,22 @@
LPSTR annA = RPCRT4_strdupWtoA(Annotation);
RPC_STATUS status;
- status = RpcEpRegisterA(IfSpec, BindingVector, UuidVector, (RPC_CSTR)annA);
+ status = epm_register(IfSpec, BindingVector, UuidVector, (RPC_CSTR)annA, TRUE);
+
+ HeapFree(GetProcessHeap(), 0, annA);
+ return status;
+}
+
+/***********************************************************************
+ * RpcEpRegisterNoReplaceW (RPCRT4.@)
+ */
+RPC_STATUS WINAPI RpcEpRegisterNoReplaceW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR
*BindingVector,
+ UUID_VECTOR *UuidVector, RPC_WSTR Annotation
)
+{
+ LPSTR annA = RPCRT4_strdupWtoA(Annotation);
+ RPC_STATUS status;
+
+ status = epm_register(IfSpec, BindingVector, UuidVector, (RPC_CSTR)annA, FALSE);
HeapFree(GetProcessHeap(), 0, annA);
return status;
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] Fri Dec 6 23:26:11 2013
@@ -342,7 +342,7 @@
(payload) += sizeof(UUID); \
} while (0)
-RpcPktHdr *RPCRT4_BuildHttpConnectHeader(unsigned short flags, int out_pipe,
+RpcPktHdr *RPCRT4_BuildHttpConnectHeader(int out_pipe,
const UUID *connection_uuid,
const UUID *pipe_uuid,
const UUID *association_uuid)
@@ -355,7 +355,7 @@
if (!out_pipe)
size += 8 + 4 + sizeof(UUID);
- header = RPCRT4_BuildHttpHeader(NDR_LOCAL_DATA_REPRESENTATION, flags,
+ header = RPCRT4_BuildHttpHeader(NDR_LOCAL_DATA_REPRESENTATION, 0,
out_pipe ? 4 : 6, size);
if (!header) return NULL;
payload = (char *)(&header->http+1);
@@ -1877,7 +1877,7 @@
fail:
RPCRT4_FreeHeader(hdr);
- RPCRT4_DestroyConnection(conn);
+ RPCRT4_ReleaseConnection(conn);
pMsg->ReservedForRuntime = NULL;
return status;
}
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] Fri Dec 6 23:26:11 2013
@@ -31,7 +31,7 @@
RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion,
unsigned char RpcVersionMinor, unsigned short RejectReason) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation, unsigned short
MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, LPCSTR
ServerAddress, unsigned char ResultCount, const RpcResult *Results) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation, unsigned short flags,
unsigned short num_data_items, unsigned int payload_size) DECLSPEC_HIDDEN;
-RpcPktHdr *RPCRT4_BuildHttpConnectHeader(unsigned short flags, int out_pipe, const UUID
*connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid) DECLSPEC_HIDDEN;
+RpcPktHdr *RPCRT4_BuildHttpConnectHeader(int out_pipe, const UUID *connection_uuid, const
UUID *pipe_uuid, const UUID *association_uuid) DECLSPEC_HIDDEN;
RpcPktHdr *RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitted, ULONG
flow_control_increment, const UUID *pipe_uuid) DECLSPEC_HIDDEN;
VOID RPCRT4_FreeHeader(RpcPktHdr *Header) DECLSPEC_HIDDEN;
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer,
unsigned int BufferLength) DECLSPEC_HIDDEN;
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] Fri Dec 6 23:26:11 2013
@@ -46,6 +46,7 @@
#include "rpc_message.h"
//#include "rpc_defs.h"
#include "ncastatus.h"
+#include <secext.h>
WINE_DEFAULT_DEBUG_CHANNEL(rpc);
@@ -541,6 +542,7 @@
RpcPacket *pkt = the_arg;
RPCRT4_process_packet(pkt->conn, pkt->hdr, pkt->msg, pkt->auth_data,
pkt->auth_length);
+ RPCRT4_ReleaseConnection(pkt->conn);
HeapFree(GetProcessHeap(), 0, pkt);
return 0;
}
@@ -587,7 +589,7 @@
HeapFree(GetProcessHeap(), 0, auth_data);
goto exit;
}
- packet->conn = conn;
+ packet->conn = RPCRT4_GrabConnection( conn );
packet->hdr = hdr;
packet->msg = msg;
packet->auth_data = auth_data;
@@ -623,7 +625,7 @@
}
}
exit:
- RPCRT4_DestroyConnection(conn);
+ RPCRT4_ReleaseConnection(conn);
return 0;
}
@@ -633,7 +635,7 @@
if (!thread) {
DWORD err = GetLastError();
ERR("failed to create thread, error=%08x\n", err);
- RPCRT4_DestroyConnection(conn);
+ RPCRT4_ReleaseConnection(conn);
}
/* we could set conn->thread, but then we'd have to make the io_thread wait
* for that, otherwise the thread might finish, destroy the connection, and
@@ -933,6 +935,7 @@
(*ps)->MaxCalls = 0;
(*ps)->conn = NULL;
InitializeCriticalSection(&(*ps)->cs);
+ (*ps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ":
RpcServerProtseq.cs");
(*ps)->is_listening = FALSE;
(*ps)->mgr_mutex = NULL;
(*ps)->server_ready_event = NULL;
@@ -948,6 +951,7 @@
static void destroy_serverprotoseq(RpcServerProtseq *ps)
{
RPCRT4_strfree(ps->Protseq);
+ ps->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&ps->cs);
CloseHandle(ps->mgr_mutex);
CloseHandle(ps->server_ready_event);
@@ -1073,9 +1077,15 @@
EnterCriticalSection(&server_cs);
LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry)
{
+#ifndef __REACTOS__
+ if (listen_count != 0)
+ RPCRT4_sync_with_server_thread(cps);
+#endif
destroy_serverprotoseq(cps);
}
LeaveCriticalSection(&server_cs);
+ DeleteCriticalSection(&server_cs);
+ DeleteCriticalSection(&listen_cs);
}
/***********************************************************************
@@ -1319,6 +1329,7 @@
HeapFree(GetProcessHeap(), 0, auth_info);
}
LeaveCriticalSection(&server_auth_info_cs);
+ DeleteCriticalSection(&server_auth_info_cs);
}
/***********************************************************************
@@ -1451,6 +1462,45 @@
return RPC_S_OK;
}
+/******************************************************************************
+ * RpcServerInqDefaultPrincNameA (rpcrt4.@)
+ */
+RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameA(ULONG AuthnSvc, RPC_CSTR *PrincName)
+{
+ RPC_STATUS ret;
+ RPC_WSTR principalW;
+
+ TRACE("%u, %p\n", AuthnSvc, PrincName);
+
+ if ((ret = RpcServerInqDefaultPrincNameW( AuthnSvc, &principalW )) == RPC_S_OK)
+ {
+ if (!(*PrincName = (RPC_CSTR)RPCRT4_strdupWtoA( principalW ))) return
RPC_S_OUT_OF_MEMORY;
+ RpcStringFreeW( &principalW );
+ }
+ return ret;
+}
+
+/******************************************************************************
+ * RpcServerInqDefaultPrincNameW (rpcrt4.@)
+ */
+RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW(ULONG AuthnSvc, RPC_WSTR *PrincName)
+{
+ ULONG len = 0;
+
+ FIXME("%u, %p\n", AuthnSvc, PrincName);
+
+ if (AuthnSvc != RPC_C_AUTHN_WINNT) return RPC_S_UNKNOWN_AUTHN_SERVICE;
+
+ GetUserNameExW( NameSamCompatible, NULL, &len );
+ if (GetLastError() != ERROR_MORE_DATA) return RPC_S_INTERNAL_ERROR;
+
+ if (!(*PrincName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
+ return RPC_S_OUT_OF_MEMORY;
+
+ GetUserNameExW( NameSamCompatible, *PrincName, &len );
+ return RPC_S_OK;
+}
+
/***********************************************************************
* RpcServerListen (RPCRT4.@)
*/
@@ -1617,8 +1667,14 @@
*/
RPC_STATUS WINAPI RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding)
{
- FIXME("(%p): stub\n", Binding);
- return RPC_S_INVALID_BINDING;
+ RPC_STATUS status = RPC_S_NOT_LISTENING;
+
+ TRACE("(%p)\n", Binding);
+
+ EnterCriticalSection(&listen_cs);
+ if (manual_listen_count > 0) status = RPC_S_OK;
+ LeaveCriticalSection(&listen_cs);
+ return status;
}
/***********************************************************************
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] Fri Dec 6 23:26:11 2013
@@ -121,7 +121,7 @@
static RpcConnection *rpcrt4_conn_np_alloc(void)
{
- RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcConnection_np));
+ RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(RpcConnection_np));
if (npc)
{
npc->pipe = NULL;
@@ -290,7 +290,7 @@
}
r = RPCRT4_CreateConnection(&Connection, TRUE, protseq->Protseq, NULL,
- endpoint, NULL, NULL, NULL);
+ endpoint, NULL, NULL, NULL, NULL);
if (r != RPC_S_OK)
return r;
@@ -362,7 +362,7 @@
}
r = RPCRT4_CreateConnection(&Connection, TRUE, protseq->Protseq, NULL,
- endpoint, NULL, NULL, NULL);
+ endpoint, NULL, NULL, NULL, NULL);
if (r != RPC_S_OK)
return r;
@@ -1373,6 +1373,7 @@
if (getsockname(sock, (struct sockaddr *)&sa, &sa_len))
{
WARN("getsockname() failed: %s\n", strerror(errno));
+ closesocket(sock);
status = RPC_S_CANT_CREATE_ENDPOINT;
continue;
}
@@ -1383,13 +1384,14 @@
if (ret)
{
WARN("getnameinfo failed: %s\n", gai_strerror(ret));
+ closesocket(sock);
status = RPC_S_CANT_CREATE_ENDPOINT;
continue;
}
create_status = RPCRT4_CreateConnection((RpcConnection **)&tcpc, TRUE,
protseq->Protseq, NULL,
- service, NULL, NULL, NULL);
+ service, NULL, NULL, NULL, NULL);
if (create_status != RPC_S_OK)
{
closesocket(sock);
@@ -1402,7 +1404,7 @@
if (ret < 0)
{
WARN("listen failed: %s\n", strerror(errno));
- RPCRT4_DestroyConnection(&tcpc->common);
+ RPCRT4_ReleaseConnection(&tcpc->common);
status = RPC_S_OUT_OF_RESOURCES;
continue;
}
@@ -1415,7 +1417,7 @@
if (ret < 0)
{
WARN("couldn't make socket non-blocking, error %d\n", ret);
- RPCRT4_DestroyConnection(&tcpc->common);
+ RPCRT4_ReleaseConnection(&tcpc->common);
status = RPC_S_OUT_OF_RESOURCES;
continue;
}
@@ -1872,9 +1874,8 @@
{
LONG refs;
HANDLE completion_event;
+ WORD async_result;
INTERNET_BUFFERSA inet_buffers;
- void *destination_buffer; /* the address that inet_buffers.lpvBuffer will be
- * copied into when the call completes */
CRITICAL_SECTION cs;
} RpcHttpAsyncData;
@@ -1891,10 +1892,47 @@
TRACE("destroying async data %p\n", data);
CloseHandle(data->completion_event);
HeapFree(GetProcessHeap(), 0, data->inet_buffers.lpvBuffer);
+ data->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&data->cs);
HeapFree(GetProcessHeap(), 0, data);
}
return refs;
+}
+
+static void prepare_async_request(RpcHttpAsyncData *async_data)
+{
+ ResetEvent(async_data->completion_event);
+ RpcHttpAsyncData_AddRef(async_data);
+}
+
+static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret, HANDLE
cancel_event)
+{
+ HANDLE handles[2] = { async_data->completion_event, cancel_event };
+ DWORD res;
+
+ if(call_ret) {
+ RpcHttpAsyncData_Release(async_data);
+ return RPC_S_OK;
+ }
+
+ if(GetLastError() != ERROR_IO_PENDING) {
+ RpcHttpAsyncData_Release(async_data);
+ ERR("Request failed with error %d\n", GetLastError());
+ return RPC_S_SERVER_UNAVAILABLE;
+ }
+
+ res = WaitForMultipleObjects(2, handles, FALSE, DEFAULT_NCACN_HTTP_TIMEOUT);
+ if(res != WAIT_OBJECT_0) {
+ TRACE("Cancelled\n");
+ return RPC_S_CALL_CANCELLED;
+ }
+
+ if(async_data->async_result) {
+ ERR("Async request failed with error %d\n",
async_data->async_result);
+ return RPC_S_SERVER_UNAVAILABLE;
+ }
+
+ return RPC_S_OK;
}
typedef struct _RpcConnection_http
@@ -1932,8 +1970,8 @@
httpc->async_data->refs = 1;
httpc->async_data->inet_buffers.dwStructSize = sizeof(INTERNET_BUFFERSA);
httpc->async_data->inet_buffers.lpvBuffer = NULL;
- httpc->async_data->destination_buffer = NULL;
InitializeCriticalSection(&httpc->async_data->cs);
+ httpc->async_data->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ":
RpcHttpAsyncData.cs");
return &httpc->common;
}
@@ -1980,7 +2018,7 @@
timeout = rpcrt4_http_timer_calc_timeout(data.last_sent_time))
{
/* are we too soon after last send? */
- if (GetTickCount() - HTTP_IDLE_TIME < *data.last_sent_time)
+ if (GetTickCount() - *data.last_sent_time < HTTP_IDLE_TIME)
continue;
rpcrt4_http_keep_connection_active_timer_proc(data.timer_param, TRUE);
}
@@ -2004,20 +2042,9 @@
TRACE("INTERNET_STATUS_REQUEST_COMPLETED\n");
if (async_data)
{
- if (async_data->inet_buffers.lpvBuffer)
- {
- EnterCriticalSection(&async_data->cs);
- if (async_data->destination_buffer)
- {
- memcpy(async_data->destination_buffer,
- async_data->inet_buffers.lpvBuffer,
- async_data->inet_buffers.dwBufferLength);
- async_data->destination_buffer = NULL;
- }
- LeaveCriticalSection(&async_data->cs);
- }
- HeapFree(GetProcessHeap(), 0, async_data->inet_buffers.lpvBuffer);
- async_data->inet_buffers.lpvBuffer = NULL;
+ INTERNET_ASYNC_RESULT *async_result = lpvStatusInformation;
+
+ async_data->async_result = async_result->dwResult ? ERROR_SUCCESS :
async_result->dwError;
SetEvent(async_data->completion_event);
RpcHttpAsyncData_Release(async_data);
}
@@ -2040,7 +2067,7 @@
ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER,
&status_code, &size, &index);
if (!ret)
return GetLastError();
- if (status_code < 400)
+ if (status_code == HTTP_STATUS_OK)
return RPC_S_OK;
index = 0;
size = sizeof(buf);
@@ -2067,7 +2094,7 @@
LPWSTR password = NULL;
LPWSTR servername = NULL;
const WCHAR *option;
- INTERNET_PORT port = INTERNET_INVALID_PORT_NUMBER; /* use default port */
+ INTERNET_PORT port;
if (httpc->common.QOS &&
(httpc->common.QOS->qos->AdditionalSecurityInfoType ==
RPC_C_AUTHN_INFO_TYPE_HTTP))
@@ -2142,6 +2169,8 @@
{
HeapFree(GetProcessHeap(), 0, password);
HeapFree(GetProcessHeap(), 0, user);
+ HeapFree(GetProcessHeap(), 0, proxy);
+ HeapFree(GetProcessHeap(), 0, servername);
ERR("InternetOpenW failed with error %d\n", GetLastError());
return RPC_S_SERVER_UNAVAILABLE;
}
@@ -2156,16 +2185,23 @@
{
HeapFree(GetProcessHeap(), 0, password);
HeapFree(GetProcessHeap(), 0, user);
+ HeapFree(GetProcessHeap(), 0, proxy);
return RPC_S_OUT_OF_RESOURCES;
}
MultiByteToWideChar(CP_ACP, 0, httpc->common.NetworkAddr, -1, servername,
strlen(httpc->common.NetworkAddr) + 1);
}
+
+ port = (httpc->common.QOS &&
+ (httpc->common.QOS->qos->AdditionalSecurityInfoType ==
RPC_C_AUTHN_INFO_TYPE_HTTP) &&
+ (httpc->common.QOS->qos->u.HttpCredentials->Flags &
RPC_C_HTTP_FLAG_USE_SSL)) ?
+ INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
httpc->session = InternetConnectW(httpc->app_info, servername, port, user,
password,
INTERNET_SERVICE_HTTP, 0, 0);
HeapFree(GetProcessHeap(), 0, password);
HeapFree(GetProcessHeap(), 0, user);
+ HeapFree(GetProcessHeap(), 0, proxy);
HeapFree(GetProcessHeap(), 0, servername);
if (!httpc->session)
@@ -2177,61 +2213,54 @@
return RPC_S_OK;
}
+static RPC_STATUS send_echo_request(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE
cancel_event)
+{
+ DWORD bytes_read;
+ BYTE buf[20];
+ BOOL ret;
+ RPC_STATUS status;
+
+ prepare_async_request(async_data);
+ ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
+ status = wait_async_request(async_data, ret, cancel_event);
+ if (status != RPC_S_OK) return status;
+
+ status = rpcrt4_http_check_response(req);
+ if (status != RPC_S_OK) return status;
+
+ InternetReadFile(req, buf, sizeof(buf), &bytes_read);
+ /* FIXME: do something with retrieved data */
+
+ return RPC_S_OK;
+}
+
/* prepare the in pipe for use by RPC packets */
-static RPC_STATUS rpcrt4_http_prepare_in_pipe(HINTERNET in_request, RpcHttpAsyncData
*async_data,
+static RPC_STATUS rpcrt4_http_prepare_in_pipe(HINTERNET in_request, RpcHttpAsyncData
*async_data, HANDLE cancel_event,
const UUID *connection_uuid,
const UUID *in_pipe_uuid,
const UUID *association_uuid)
{
- BYTE packet[44];
BOOL ret;
RPC_STATUS status;
RpcPktHdr *hdr;
INTERNET_BUFFERSW buffers_in;
- DWORD bytes_read, bytes_written;
+ DWORD bytes_written;
/* prepare in pipe */
- ResetEvent(async_data->completion_event);
- RpcHttpAsyncData_AddRef(async_data);
- ret = HttpSendRequestW(in_request, NULL, 0, NULL, 0);
- if (!ret)
- {
- if (GetLastError() == ERROR_IO_PENDING)
- WaitForSingleObject(async_data->completion_event, INFINITE);
- else
- {
- RpcHttpAsyncData_Release(async_data);
- ERR("HttpSendRequestW failed with error %d\n", GetLastError());
- return RPC_S_SERVER_UNAVAILABLE;
- }
- }
- status = rpcrt4_http_check_response(in_request);
+ status = send_echo_request(in_request, async_data, cancel_event);
if (status != RPC_S_OK) return status;
-
- InternetReadFile(in_request, packet, 20, &bytes_read);
- /* FIXME: do something with retrieved data */
memset(&buffers_in, 0, sizeof(buffers_in));
buffers_in.dwStructSize = sizeof(buffers_in);
/* FIXME: get this from the registry */
buffers_in.dwBufferTotal = 1024 * 1024 * 1024; /* 1Gb */
- ResetEvent(async_data->completion_event);
- RpcHttpAsyncData_AddRef(async_data);
+ prepare_async_request(async_data);
ret = HttpSendRequestExW(in_request, &buffers_in, NULL, 0, 0);
- if (!ret)
- {
- if (GetLastError() == ERROR_IO_PENDING)
- WaitForSingleObject(async_data->completion_event, INFINITE);
- else
- {
- RpcHttpAsyncData_Release(async_data);
- ERR("HttpSendRequestExW failed with error %d\n", GetLastError());
- return RPC_S_SERVER_UNAVAILABLE;
- }
- }
+ status = wait_async_request(async_data, ret, cancel_event);
+ if (status != RPC_S_OK) return status;
TRACE("sending HTTP connect header to server\n");
- hdr = RPCRT4_BuildHttpConnectHeader(0, FALSE, connection_uuid, in_pipe_uuid,
association_uuid);
+ hdr = RPCRT4_BuildHttpConnectHeader(FALSE, connection_uuid, in_pipe_uuid,
association_uuid);
if (!hdr) return RPC_S_OUT_OF_RESOURCES;
ret = InternetWriteFile(in_request, hdr, hdr->common.frag_len,
&bytes_written);
RPCRT4_FreeHeader(hdr);
@@ -2292,57 +2321,30 @@
/* prepare the out pipe for use by RPC packets */
static RPC_STATUS rpcrt4_http_prepare_out_pipe(HINTERNET out_request,
RpcHttpAsyncData *async_data,
+ HANDLE cancel_event,
const UUID *connection_uuid,
const UUID *out_pipe_uuid,
ULONG *flow_control_increment)
{
- BYTE packet[20];
BOOL ret;
RPC_STATUS status;
RpcPktHdr *hdr;
- DWORD bytes_read;
BYTE *data_from_server;
RpcPktHdr pkt_from_server;
ULONG field1, field3;
- ResetEvent(async_data->completion_event);
- RpcHttpAsyncData_AddRef(async_data);
- ret = HttpSendRequestW(out_request, NULL, 0, NULL, 0);
- if (!ret)
- {
- if (GetLastError() == ERROR_IO_PENDING)
- WaitForSingleObject(async_data->completion_event, INFINITE);
- else
- {
- RpcHttpAsyncData_Release(async_data);
- ERR("HttpSendRequestW failed with error %d\n", GetLastError());
- return RPC_S_SERVER_UNAVAILABLE;
- }
- }
- status = rpcrt4_http_check_response(out_request);
+ status = send_echo_request(out_request, async_data, cancel_event);
if (status != RPC_S_OK) return status;
- InternetReadFile(out_request, packet, 20, &bytes_read);
- /* FIXME: do something with retrieved data */
-
- hdr = RPCRT4_BuildHttpConnectHeader(0, TRUE, connection_uuid, out_pipe_uuid, NULL);
+ hdr = RPCRT4_BuildHttpConnectHeader(TRUE, connection_uuid, out_pipe_uuid, NULL);
if (!hdr) return RPC_S_OUT_OF_RESOURCES;
- ResetEvent(async_data->completion_event);
- RpcHttpAsyncData_AddRef(async_data);
+
+ prepare_async_request(async_data);
ret = HttpSendRequestW(out_request, NULL, 0, hdr, hdr->common.frag_len);
- if (!ret)
- {
- if (GetLastError() == ERROR_IO_PENDING)
- WaitForSingleObject(async_data->completion_event, INFINITE);
- else
- {
- RpcHttpAsyncData_Release(async_data);
- ERR("HttpSendRequestW failed with error %d\n", GetLastError());
- RPCRT4_FreeHeader(hdr);
- return RPC_S_SERVER_UNAVAILABLE;
- }
- }
+ status = wait_async_request(async_data, ret, cancel_event);
RPCRT4_FreeHeader(hdr);
+ if (status != RPC_S_OK) return status;
+
status = rpcrt4_http_check_response(out_request);
if (status != RPC_S_OK) return status;
@@ -2355,9 +2357,22 @@
if (status != RPC_S_OK) return status;
TRACE("received (%d) from first prepare header\n", field1);
- status = rpcrt4_http_read_http_packet(out_request, &pkt_from_server,
- &data_from_server);
- if (status != RPC_S_OK) return status;
+ for (;;)
+ {
+ status = rpcrt4_http_read_http_packet(out_request, &pkt_from_server,
+ &data_from_server);
+ if (status != RPC_S_OK) return status;
+ if (pkt_from_server.http.flags != 0x0001) break;
+
+ TRACE("http idle packet, waiting for real packet\n");
+ HeapFree(GetProcessHeap(), 0, data_from_server);
+ if (pkt_from_server.http.num_data_items != 0)
+ {
+ ERR("HTTP idle packet should have no data items instead of %d\n",
+ pkt_from_server.http.num_data_items);
+ return RPC_S_PROTOCOL_ERROR;
+ }
+ }
status = RPCRT4_ParseHttpPrepareHeader2(&pkt_from_server, data_from_server,
&field1, flow_control_increment,
&field3);
@@ -2366,6 +2381,122 @@
TRACE("received (0x%08x 0x%08x %d) from second prepare header\n", field1,
*flow_control_increment, field3);
return RPC_S_OK;
+}
+
+static UINT encode_base64(const char *bin, unsigned int len, WCHAR *base64)
+{
+ static char enc[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ UINT i = 0, x;
+
+ while (len > 0)
+ {
+ /* first 6 bits, all from bin[0] */
+ base64[i++] = enc[(bin[0] & 0xfc) >> 2];
+ x = (bin[0] & 3) << 4;
+
+ /* next 6 bits, 2 from bin[0] and 4 from bin[1] */
+ if (len == 1)
+ {
+ base64[i++] = enc[x];
+ base64[i++] = '=';
+ base64[i++] = '=';
+ break;
+ }
+ base64[i++] = enc[x | ((bin[1] & 0xf0) >> 4)];
+ x = (bin[1] & 0x0f) << 2;
+
+ /* next 6 bits 4 from bin[1] and 2 from bin[2] */
+ if (len == 2)
+ {
+ base64[i++] = enc[x];
+ base64[i++] = '=';
+ break;
+ }
+ base64[i++] = enc[x | ((bin[2] & 0xc0) >> 6)];
+
+ /* last 6 bits, all from bin [2] */
+ base64[i++] = enc[bin[2] & 0x3f];
+ bin += 3;
+ len -= 3;
+ }
+ base64[i] = 0;
+ return i;
+}
+
+static RPC_STATUS insert_authorization_header(HINTERNET request, RpcQualityOfService
*qos)
+{
+ static const WCHAR basicW[] =
+
{'A','u','t','h','o','r','i','z','a','t','i','o','n',':','
','B','a','s','i','c',' '};
+ RPC_HTTP_TRANSPORT_CREDENTIALS_W *creds;
+ SEC_WINNT_AUTH_IDENTITY_W *id;
+ int len, datalen, userlen, passlen;
+ WCHAR *header, *ptr;
+ char *data;
+ RPC_STATUS status = RPC_S_SERVER_UNAVAILABLE;
+
+ if (!qos || qos->qos->AdditionalSecurityInfoType !=
RPC_C_AUTHN_INFO_TYPE_HTTP)
+ return RPC_S_OK;
+
+ creds = qos->qos->u.HttpCredentials;
+ if (creds->AuthenticationTarget != RPC_C_HTTP_AUTHN_TARGET_SERVER ||
!creds->NumberOfAuthnSchemes)
+ return RPC_S_OK;
+
+ if (creds->AuthnSchemes[0] != RPC_C_HTTP_AUTHN_SCHEME_BASIC)
+ {
+ FIXME("scheme %u not supported\n", creds->AuthnSchemes[0]);
+ return RPC_S_OK;
+ }
+ id = creds->TransportCredentials;
+ if (!id->User || !id->Password) return RPC_S_OK;
+
+ userlen = WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, NULL, 0,
NULL, NULL);
+ passlen = WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength,
NULL, 0, NULL, NULL);
+
+ datalen = userlen + passlen + 1;
+ if (!(data = HeapAlloc(GetProcessHeap(), 0, datalen))) return RPC_S_OUT_OF_MEMORY;
+
+ WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, data, userlen, NULL,
NULL);
+ data[userlen] = ':';
+ WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength, data +
userlen + 1, passlen, NULL, NULL);
+
+ len = ((datalen + 2) * 4) / 3;
+ if ((header = HeapAlloc(GetProcessHeap(), 0, sizeof(basicW) + (len + 2) *
sizeof(WCHAR))))
+ {
+ memcpy(header, basicW, sizeof(basicW));
+ ptr = header + sizeof(basicW) / sizeof(basicW[0]);
+ len = encode_base64(data, datalen, ptr);
+ ptr[len++] = '\r';
+ ptr[len++] = '\n';
+ ptr[len] = 0;
+ if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_ADD_IF_NEW)))
status = RPC_S_OK;
+ HeapFree(GetProcessHeap(), 0, header);
+ }
+ HeapFree(GetProcessHeap(), 0, data);
+ return status;
+}
+
+static RPC_STATUS insert_cookie_header(HINTERNET request, const WCHAR *value)
+{
+ static const WCHAR cookieW[] =
{'C','o','o','k','i','e',':','
'};
+ WCHAR *header, *ptr;
+ int len;
+ RPC_STATUS status = RPC_S_SERVER_UNAVAILABLE;
+
+ if (!value) return RPC_S_OK;
+
+ len = strlenW(value);
+ if ((header = HeapAlloc(GetProcessHeap(), 0, sizeof(cookieW) + (len + 3) *
sizeof(WCHAR))))
+ {
+ memcpy(header, cookieW, sizeof(cookieW));
+ ptr = header + sizeof(cookieW) / sizeof(cookieW[0]);
+ memcpy(ptr, value, len * sizeof(WCHAR));
+ ptr[len++] = '\r';
+ ptr[len++] = '\n';
+ ptr[len] = 0;
+ if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_ADD_IF_NEW)))
status = RPC_S_OK;
+ HeapFree(GetProcessHeap(), 0, header);
+ }
+ return status;
}
static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
@@ -2377,6 +2508,7 @@
static const WCHAR wszColon[] = {':',0};
static const WCHAR wszAcceptType[] =
{'a','p','p','l','i','c','a','t','i','o','n','/','r','p','c',0};
LPCWSTR wszAcceptTypes[] = { wszAcceptType, NULL };
+ DWORD flags;
WCHAR *url;
RPC_STATUS status;
BOOL secure;
@@ -2416,27 +2548,45 @@
(httpc->common.QOS->qos->AdditionalSecurityInfoType ==
RPC_C_AUTHN_INFO_TYPE_HTTP) &&
(httpc->common.QOS->qos->u.HttpCredentials->Flags &
RPC_C_HTTP_FLAG_USE_SSL);
- httpc->in_request = HttpOpenRequestW(httpc->session, wszVerbIn, url, NULL,
NULL,
- wszAcceptTypes,
- (secure ? INTERNET_FLAG_SECURE :
0)|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_PRAGMA_NOCACHE,
- (DWORD_PTR)httpc->async_data);
+ flags = INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_PRAGMA_NOCACHE |
INTERNET_FLAG_NO_CACHE_WRITE |
+ INTERNET_FLAG_NO_AUTO_REDIRECT;
+ if (secure) flags |= INTERNET_FLAG_SECURE;
+
+ httpc->in_request = HttpOpenRequestW(httpc->session, wszVerbIn, url, NULL,
NULL, wszAcceptTypes,
+ flags, (DWORD_PTR)httpc->async_data);
if (!httpc->in_request)
+ {
+ ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
+ HeapFree(GetProcessHeap(), 0, url);
+ return RPC_S_SERVER_UNAVAILABLE;
+ }
+ status = insert_authorization_header(httpc->in_request, httpc->common.QOS);
+ if (status != RPC_S_OK)
+ return status;
+
+ status = insert_cookie_header(httpc->in_request, Connection->CookieAuth);
+ if (status != RPC_S_OK)
+ return status;
+
+ httpc->out_request = HttpOpenRequestW(httpc->session, wszVerbOut, url, NULL,
NULL, wszAcceptTypes,
+ flags, (DWORD_PTR)httpc->async_data);
+ HeapFree(GetProcessHeap(), 0, url);
+ if (!httpc->out_request)
{
ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
return RPC_S_SERVER_UNAVAILABLE;
}
- httpc->out_request = HttpOpenRequestW(httpc->session, wszVerbOut, url, NULL,
NULL,
- wszAcceptTypes,
- (secure ? INTERNET_FLAG_SECURE :
0)|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_PRAGMA_NOCACHE,
- (DWORD_PTR)httpc->async_data);
- if (!httpc->out_request)
- {
- ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
- return RPC_S_SERVER_UNAVAILABLE;
- }
+ status = insert_authorization_header(httpc->out_request, httpc->common.QOS);
+ if (status != RPC_S_OK)
+ return status;
+
+ status = insert_cookie_header(httpc->out_request, Connection->CookieAuth);
+ if (status != RPC_S_OK)
+ return status;
status = rpcrt4_http_prepare_in_pipe(httpc->in_request,
httpc->async_data,
+ httpc->cancel_event,
&httpc->connection_uuid,
&httpc->in_pipe_uuid,
&Connection->assoc->http_uuid);
@@ -2445,6 +2595,7 @@
status = rpcrt4_http_prepare_out_pipe(httpc->out_request,
httpc->async_data,
+ httpc->cancel_event,
&httpc->connection_uuid,
&httpc->out_pipe_uuid,
&httpc->flow_control_increment);
@@ -2484,61 +2635,38 @@
{
RpcConnection_http *httpc = (RpcConnection_http *) Connection;
char *buf = buffer;
- BOOL ret = TRUE;
+ BOOL ret;
unsigned int bytes_left = count;
-
- ResetEvent(httpc->async_data->completion_event);
+ RPC_STATUS status = RPC_S_OK;
+
+ httpc->async_data->inet_buffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0,
count);
+
while (bytes_left)
{
- RpcHttpAsyncData_AddRef(httpc->async_data);
httpc->async_data->inet_buffers.dwBufferLength = bytes_left;
- httpc->async_data->inet_buffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0,
bytes_left);
- httpc->async_data->destination_buffer = buf;
+ prepare_async_request(httpc->async_data);
ret = InternetReadFileExA(httpc->out_request,
&httpc->async_data->inet_buffers, IRF_ASYNC, 0);
- if (ret)
- {
- /* INTERNET_STATUS_REQUEST_COMPLETED won't be sent, so release our
- * async ref now */
- RpcHttpAsyncData_Release(httpc->async_data);
- memcpy(buf, httpc->async_data->inet_buffers.lpvBuffer,
- httpc->async_data->inet_buffers.dwBufferLength);
- HeapFree(GetProcessHeap(), 0, httpc->async_data->inet_buffers.lpvBuffer);
- httpc->async_data->inet_buffers.lpvBuffer = NULL;
- httpc->async_data->destination_buffer = NULL;
- }
- else
- {
- if (GetLastError() == ERROR_IO_PENDING)
- {
- HANDLE handles[2] = { httpc->async_data->completion_event,
httpc->cancel_event };
- DWORD result = WaitForMultipleObjects(2, handles, FALSE,
DEFAULT_NCACN_HTTP_TIMEOUT);
- if (result == WAIT_OBJECT_0)
- ret = TRUE;
- else
- {
- TRACE("call cancelled\n");
- EnterCriticalSection(&httpc->async_data->cs);
- httpc->async_data->destination_buffer = NULL;
- LeaveCriticalSection(&httpc->async_data->cs);
- break;
- }
- }
- else
- {
- HeapFree(GetProcessHeap(), 0,
httpc->async_data->inet_buffers.lpvBuffer);
- httpc->async_data->inet_buffers.lpvBuffer = NULL;
- httpc->async_data->destination_buffer = NULL;
- RpcHttpAsyncData_Release(httpc->async_data);
- break;
- }
- }
- if (!httpc->async_data->inet_buffers.dwBufferLength)
+ status = wait_async_request(httpc->async_data, ret, httpc->cancel_event);
+ if(status != RPC_S_OK) {
+ if(status == RPC_S_CALL_CANCELLED)
+ TRACE("call cancelled\n");
break;
+ }
+
+ if(!httpc->async_data->inet_buffers.dwBufferLength)
+ break;
+ memcpy(buf, httpc->async_data->inet_buffers.lpvBuffer,
+ httpc->async_data->inet_buffers.dwBufferLength);
+
bytes_left -= httpc->async_data->inet_buffers.dwBufferLength;
buf += httpc->async_data->inet_buffers.dwBufferLength;
}
- TRACE("%p %p %u -> %s\n", httpc->out_request, buffer, count, ret ?
"TRUE" : "FALSE");
- return ret ? count : -1;
+
+ HeapFree(GetProcessHeap(), 0, httpc->async_data->inet_buffers.lpvBuffer);
+ httpc->async_data->inet_buffers.lpvBuffer = NULL;
+
+ TRACE("%p %p %u -> %u\n", httpc->out_request, buffer, count, status);
+ return status == RPC_S_OK ? count : -1;
}
static RPC_STATUS rpcrt4_ncacn_http_receive_fragment(RpcConnection *Connection, RpcPktHdr
**Header, void **Payload)
@@ -2746,39 +2874,15 @@
static int rpcrt4_ncacn_http_wait_for_incoming_data(RpcConnection *Connection)
{
+ RpcConnection_http *httpc = (RpcConnection_http *) Connection;
BOOL ret;
- RpcConnection_http *httpc = (RpcConnection_http *) Connection;
-
- RpcHttpAsyncData_AddRef(httpc->async_data);
+ RPC_STATUS status;
+
+ prepare_async_request(httpc->async_data);
ret = InternetQueryDataAvailable(httpc->out_request,
&httpc->async_data->inet_buffers.dwBufferLength, IRF_ASYNC, 0);
- if (ret)
- {
- /* INTERNET_STATUS_REQUEST_COMPLETED won't be sent, so release our
- * async ref now */
- RpcHttpAsyncData_Release(httpc->async_data);
- }
- else
- {
- if (GetLastError() == ERROR_IO_PENDING)
- {
- HANDLE handles[2] = { httpc->async_data->completion_event,
httpc->cancel_event };
- DWORD result = WaitForMultipleObjects(2, handles, FALSE,
DEFAULT_NCACN_HTTP_TIMEOUT);
- if (result != WAIT_OBJECT_0)
- {
- TRACE("call cancelled\n");
- return -1;
- }
- }
- else
- {
- RpcHttpAsyncData_Release(httpc->async_data);
- return -1;
- }
- }
-
- /* success */
- return 0;
+ status = wait_async_request(httpc->async_data, ret, httpc->cancel_event);
+ return status == RPC_S_OK ? 0 : -1;
}
static size_t rpcrt4_ncacn_http_get_top_of_tower(unsigned char *tower_data,
@@ -2958,7 +3062,7 @@
RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server,
LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint,
- LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS)
+ LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS, LPCWSTR
CookieAuth)
{
static LONG next_id;
const struct connection_ops *ops;
@@ -2972,6 +3076,7 @@
}
NewConnection = ops->alloc();
+ NewConnection->ref = 1;
NewConnection->Next = NULL;
NewConnection->server_binding = NULL;
NewConnection->server = server;
@@ -2979,6 +3084,7 @@
NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
+ NewConnection->CookieAuth = RPCRT4_strdupW(CookieAuth);
NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
memset(&NewConnection->ActiveInterface, 0,
sizeof(NewConnection->ActiveInterface));
NewConnection->NextCallId = 1;
@@ -3007,24 +3113,31 @@
{
RPC_STATUS err;
- err = RPCRT4_CreateConnection(Connection, OldConnection->server,
- rpcrt4_conn_get_name(OldConnection),
- OldConnection->NetworkAddr,
- OldConnection->Endpoint, NULL,
- OldConnection->AuthInfo, OldConnection->QOS);
+ err = RPCRT4_CreateConnection(Connection, OldConnection->server,
rpcrt4_conn_get_name(OldConnection),
+ OldConnection->NetworkAddr,
OldConnection->Endpoint, NULL,
+ OldConnection->AuthInfo, OldConnection->QOS,
OldConnection->CookieAuth);
if (err == RPC_S_OK)
rpcrt4_conn_handoff(OldConnection, *Connection);
return err;
}
-RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection)
-{
- TRACE("connection: %p\n", Connection);
+RpcConnection *RPCRT4_GrabConnection( RpcConnection *conn )
+{
+ InterlockedIncrement( &conn->ref );
+ return conn;
+}
+
+RPC_STATUS RPCRT4_ReleaseConnection(RpcConnection* Connection)
+{
+ if (InterlockedDecrement( &Connection->ref ) > 0) return RPC_S_OK;
+
+ TRACE("destroying connection %p\n", Connection);
RPCRT4_CloseConnection(Connection);
RPCRT4_strfree(Connection->Endpoint);
RPCRT4_strfree(Connection->NetworkAddr);
HeapFree(GetProcessHeap(), 0, Connection->NetworkOptions);
+ HeapFree(GetProcessHeap(), 0, Connection->CookieAuth);
if (Connection->AuthInfo) RpcAuthInfo_Release(Connection->AuthInfo);
if (Connection->QOS) RpcQualityOfService_Release(Connection->QOS);
@@ -3169,7 +3282,7 @@
if (*protseqs)
{
- int i;
+ unsigned int i;
for (i = 0; i < (*protseqs)->Count; i++)
HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
HeapFree(GetProcessHeap(), 0, *protseqs);
@@ -3187,7 +3300,7 @@
if (*protseqs)
{
- int i;
+ unsigned int i;
for (i = 0; i < (*protseqs)->Count; i++)
HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
HeapFree(GetProcessHeap(), 0, *protseqs);
@@ -3202,7 +3315,7 @@
RPC_STATUS WINAPI RpcNetworkInqProtseqsW( RPC_PROTSEQ_VECTORW** protseqs )
{
RPC_PROTSEQ_VECTORW *pvector;
- int i = 0;
+ unsigned int i;
RPC_STATUS status = RPC_S_OUT_OF_MEMORY;
TRACE("(%p)\n", protseqs);
@@ -3235,7 +3348,7 @@
RPC_STATUS WINAPI RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA** protseqs)
{
RPC_PROTSEQ_VECTORA *pvector;
- int i = 0;
+ unsigned int i;
RPC_STATUS status = RPC_S_OUT_OF_MEMORY;
TRACE("(%p)\n", protseqs);
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] Fri Dec 6 23:26:11 2013
@@ -369,19 +369,19 @@
@ stub RpcCertGeneratePrincipalNameW
@ stdcall RpcCompleteAsyncCall(ptr ptr) RpcAsyncCompleteCall
@ stdcall RpcEpRegisterA(ptr ptr ptr str)
-@ stub RpcEpRegisterNoReplaceA
-@ stub RpcEpRegisterNoReplaceW
+@ stdcall RpcEpRegisterNoReplaceA(ptr ptr ptr str)
+@ stdcall RpcEpRegisterNoReplaceW(ptr ptr ptr wstr)
@ stdcall RpcEpRegisterW(ptr ptr ptr wstr)
@ stdcall RpcEpResolveBinding(ptr ptr)
@ stdcall RpcEpUnregister(ptr ptr ptr)
@ stub RpcErrorAddRecord # wxp
@ stub RpcErrorClearInformation # wxp
-@ stub RpcErrorEndEnumeration # wxp
-@ stub RpcErrorGetNextRecord # wxp
-@ stub RpcErrorLoadErrorInfo # wxp
+@ stdcall RpcErrorEndEnumeration(ptr)
+@ stdcall RpcErrorGetNextRecord(ptr long ptr)
+@ stdcall RpcErrorLoadErrorInfo(ptr long ptr)
@ stub RpcErrorNumberOfRecords # wxp
@ stub RpcErrorResetEnumeration # wxp
-@ stub RpcErrorSaveErrorInfo # wxp
+@ stdcall RpcErrorSaveErrorInfo(ptr ptr ptr)
@ stdcall RpcErrorStartEnumeration(ptr)
@ stub RpcFreeAuthorizationContext # wxp
@ stdcall RpcGetAsyncCallStatus(ptr) RpcAsyncGetCallStatus
@@ -427,8 +427,8 @@
@ stdcall RpcServerInqBindings(ptr)
@ stub RpcServerInqCallAttributesA # wxp
@ stub RpcServerInqCallAttributesW # wxp
-@ stub RpcServerInqDefaultPrincNameA
-@ stub RpcServerInqDefaultPrincNameW
+@ stdcall RpcServerInqDefaultPrincNameA(long ptr)
+@ stdcall RpcServerInqDefaultPrincNameW(long ptr)
@ stub RpcServerInqIf
@ stdcall RpcServerListen(long long long)
@ stdcall RpcServerRegisterAuthInfoA(str long ptr ptr)
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] Fri Dec 6 23:26:11 2013
@@ -128,6 +128,7 @@
list_remove(&tdata->entry);
LeaveCriticalSection(&threaddata_cs);
+ tdata->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&tdata->cs);
if (tdata->connection)
ERR("tdata->connection should be NULL but is still set to
%p\n", tdata->connection);
@@ -138,8 +139,11 @@
break;
case DLL_PROCESS_DETACH:
+ if (lpvReserved) break; /* do nothing if process is shutting down */
RPCRT4_destroy_all_protseqs();
RPCRT4_ServerFreeAllRegisteredAuthInfo();
+ DeleteCriticalSection(&uuid_cs);
+ DeleteCriticalSection(&threaddata_cs);
break;
}
@@ -872,6 +876,42 @@
}
/******************************************************************************
+ * RpcErrorEndEnumeration (rpcrt4.@)
+ */
+RPC_STATUS RPC_ENTRY RpcErrorEndEnumeration(RPC_ERROR_ENUM_HANDLE* EnumHandle)
+{
+ FIXME("(%p): stub\n", EnumHandle);
+ return RPC_S_OK;
+}
+
+/******************************************************************************
+ * RpcErrorSaveErrorInfo (rpcrt4.@)
+ */
+RPC_STATUS RPC_ENTRY RpcErrorSaveErrorInfo(RPC_ERROR_ENUM_HANDLE *EnumHandle, void
**ErrorBlob, SIZE_T *BlobSize)
+{
+ FIXME("(%p %p %p): stub\n", EnumHandle, ErrorBlob, BlobSize);
+ return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+/******************************************************************************
+ * RpcErrorLoadErrorInfo (rpcrt4.@)
+ */
+RPC_STATUS RPC_ENTRY RpcErrorLoadErrorInfo(void *ErrorBlob, SIZE_T BlobSize,
RPC_ERROR_ENUM_HANDLE *EnumHandle)
+{
+ FIXME("(%p %lu %p): stub\n", ErrorBlob, BlobSize, EnumHandle);
+ return ERROR_CALL_NOT_IMPLEMENTED;
+}
+
+/******************************************************************************
+ * RpcErrorGetNextRecord (rpcrt4.@)
+ */
+RPC_STATUS RPC_ENTRY RpcErrorGetNextRecord(RPC_ERROR_ENUM_HANDLE *EnumHandle, BOOL
CopyStrings, RPC_EXTENDED_ERROR_INFO *ErrorInfo)
+{
+ FIXME("(%p %x %p): stub\n", EnumHandle, CopyStrings, ErrorInfo);
+ return RPC_S_ENTRY_NOT_FOUND;
+}
+
+/******************************************************************************
* RpcMgmtSetCancelTimeout (rpcrt4.@)
*/
RPC_STATUS RPC_ENTRY RpcMgmtSetCancelTimeout(LONG Timeout)
@@ -889,6 +929,7 @@
if (!tdata) return NULL;
InitializeCriticalSection(&tdata->cs);
+ tdata->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ":
threaddata.cs");
tdata->thread_id = GetCurrentThreadId();
EnterCriticalSection(&threaddata_cs);
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] Fri Dec 6 23:26:11 2013
@@ -1,21 +1,19 @@
-Index: epm_towers.h
-===================================================================
---- epm_towers.h (working copy)
-+++ epm_towers.h (working copy)
+diff -prudN e:\Wine\dlls\rpcrt4/epm_towers.h e:\reactos\dll\win32\rpcrt4/epm_towers.h
+--- e:\Wine\dlls\rpcrt4/epm_towers.h 2011-09-16 23:22:37.031828000 +0100
++++ e:\reactos\dll\win32\rpcrt4/epm_towers.h 2013-01-25 14:13:03.257632500 +0100
@@ -19,7 +19,7 @@
*
*/
-#include "epm.h"
-+#include "epm_c.h"
++#include <epm_c.h>
#define EPM_PROTOCOL_DNET_NSP 0x04
#define EPM_PROTOCOL_OSI_TP4 0x05
-Index: ndr_marshall.c
-===================================================================
---- ndr_marshall.c (working copy)
-+++ ndr_marshall.c (working copy)
-@@ -1210,7 +1210,7 @@
+diff -prudN e:\Wine\dlls\rpcrt4/ndr_marshall.c
e:\reactos\dll\win32\rpcrt4/ndr_marshall.c
+--- e:\Wine\dlls\rpcrt4/ndr_marshall.c 2012-04-02 20:39:58.270363100 +0100
++++ e:\reactos\dll\win32\rpcrt4/ndr_marshall.c 2013-12-06 20:04:02.897835300 +0100
+@@ -1211,7 +1211,7 @@ static unsigned char * EmbeddedPointerMa
unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
unsigned char *saved_memory = pStubMsg->Memory;
@@ -24,7 +22,7 @@
PointerMarshall(pStubMsg, bufptr, *(unsigned char**)memptr, info+4);
pStubMsg->Memory = saved_memory;
}
-@@ -1362,7 +1362,7 @@
+@@ -1365,7 +1365,7 @@ static void EmbeddedPointerBufferSize(PM
unsigned char *memptr = membase + *(const SHORT*)&info[0];
unsigned char *saved_memory = pStubMsg->Memory;
@@ -33,46 +31,10 @@
PointerBufferSize(pStubMsg, *(unsigned char**)memptr, info+4);
pStubMsg->Memory = saved_memory;
}
-@@ -6159,6 +6159,7 @@ static LONG unmarshall_discriminant(PMID
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
-+ case RPC_FC_ENUM16:
- {
- USHORT d;
- align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
-Index: ndr_stubless.c
-===================================================================
---- ndr_stubless.c (working copy)
-+++ ndr_stubless.c (working copy)
-@@ -981,11 +981,12 @@ __declspec(naked) LONG_PTR __cdecl call_
- __asm
- {
- push ebp
-+ mov ebp, esp
- push edi ; Save registers
- push esi
-- mov ebp, esp
- mov eax, [ebp+16] ; Get stack size
- sub esp, eax ; Make room in stack for arguments
-+ and esp, 0xFFFFFFF0
- mov edi, esp
- mov ecx, eax
- mov esi, [ebp+12]
-Index: rpc_epmap.c
-===================================================================
---- rpc_epmap.c (working copy)
-+++ rpc_epmap.c (working copy)
-@@ -32,7 +32,7 @@
- #include "wine/exception.h"
-
- #include "rpc_binding.h"
--#include "epm.h"
-+#include "epm_c.h"
- #include "epm_towers.h"
-
- WINE_DEFAULT_DEBUG_CHANNEL(ole);
-@@ -162,7 +162,7 @@ static RPC_STATUS get_epm_handle_server(
+diff -prudN e:\Wine\dlls\rpcrt4/rpc_epmap.c e:\reactos\dll\win32\rpcrt4/rpc_epmap.c
+--- e:\Wine\dlls\rpcrt4/rpc_epmap.c 2013-03-02 14:18:00.736492500 +0100
++++ e:\reactos\dll\win32\rpcrt4/rpc_epmap.c 2013-12-06 20:28:21.361553600 +0100
+@@ -162,7 +169,7 @@ static RPC_STATUS get_epm_handle_server(
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr)
{
@@ -81,24 +43,113 @@
{
case EXCEPTION_ACCESS_VIOLATION:
case EXCEPTION_ILLEGAL_INSTRUCTION:
-Index: rpc_server.c
-===================================================================
---- rpc_server.c (working copy)
-+++ rpc_server.c (working copy)
-@@ -1071,8 +1071,6 @@ void RPCRT4_destroy_all_protseqs(void)
+diff -prudN e:\Wine\dlls\rpcrt4/rpc_server.c e:\reactos\dll\win32\rpcrt4/rpc_server.c
+--- e:\Wine\dlls\rpcrt4/rpc_server.c 2012-12-09 09:57:02.680308600 +0100
++++ e:\reactos\dll\win32\rpcrt4/rpc_server.c 2013-12-06 23:50:04.564226300 +0100
+@@ -1075,8 +1077,10 @@ void RPCRT4_destroy_all_protseqs(void)
EnterCriticalSection(&server_cs);
LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry)
{
-- if (listen_count != 0)
-- RPCRT4_sync_with_server_thread(cps);
++#ifndef __REACTOS__
+ if (listen_count != 0)
+ RPCRT4_sync_with_server_thread(cps);
++#endif
destroy_serverprotoseq(cps);
}
LeaveCriticalSection(&server_cs);
-Index: rpc_transport.c
-===================================================================
---- rpc_transport.c (working copy)
-+++ rpc_transport.c (working copy)
-@@ -224,6 +224,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
+diff -prudN e:\Wine\dlls\rpcrt4/rpc_transport.c
e:\reactos\dll\win32\rpcrt4/rpc_transport.c
+--- e:\Wine\dlls\rpcrt4/rpc_transport.c 2013-12-06 20:10:59.302378700 +0100
++++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2013-12-06 23:39:38.664465200 +0100
+@@ -111,31 +115,41 @@ typedef struct _RpcConnection_np
+ {
+ RpcConnection common;
+ HANDLE pipe;
+- HANDLE listen_thread;
++ OVERLAPPED ovl;
+ BOOL listening;
+ } RpcConnection_np;
+
+ static RpcConnection *rpcrt4_conn_np_alloc(void)
+ {
+ RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(RpcConnection_np));
++ if (npc)
++ {
++ npc->pipe = NULL;
++ memset(&npc->ovl, 0, sizeof(npc->ovl));
++ npc->listening = FALSE;
++ }
+ return &npc->common;
+ }
+
+-static DWORD CALLBACK listen_thread(void *arg)
++static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
+ {
+- RpcConnection_np *npc = arg;
++ if (npc->listening)
++ return RPC_S_OK;
++
++ npc->listening = TRUE;
+ for (;;)
+ {
+- if (ConnectNamedPipe(npc->pipe, NULL))
++ if (ConnectNamedPipe(npc->pipe, &npc->ovl))
+ return RPC_S_OK;
+
+ switch(GetLastError())
+ {
+ case ERROR_PIPE_CONNECTED:
++ SetEvent(npc->ovl.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_HANDLES_CLOSED:
+- /* connection closed during listen */
+- return RPC_S_NO_CONTEXT_AVAILABLE;
+ case ERROR_NO_DATA_DETECTED:
+ /* client has disconnected, retry */
+ DisconnectNamedPipe( npc->pipe );
+@@ -148,28 +162,12 @@ static DWORD CALLBACK listen_thread(void
+ }
+ }
+
+-static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc)
+-{
+- if (npc->listening)
+- return RPC_S_OK;
+-
+- npc->listening = TRUE;
+- npc->listen_thread = CreateThread(NULL, 0, listen_thread, npc, 0, NULL);
+- if (!npc->listen_thread)
+- {
+- npc->listening = FALSE;
+- ERR("Couldn't create listen thread (error was %d)\n",
GetLastError());
+- return RPC_S_OUT_OF_RESOURCES;
+- }
+- return RPC_S_OK;
+-}
+-
+ static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname)
+ {
+ RpcConnection_np *npc = (RpcConnection_np *) Connection;
+ TRACE("listening on %s\n", pname);
+
+- npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX,
++ npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
+ PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
+ PIPE_UNLIMITED_INSTANCES,
+ RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
+@@ -181,6 +179,9 @@ static RPC_STATUS rpcrt4_conn_create_pip
+ return RPC_S_CANT_CREATE_ENDPOINT;
+ }
+
++ memset(&npc->ovl, 0, sizeof(npc->ovl));
++ npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
++
+ /* Note: we don't call ConnectNamedPipe here because it must be done in the
+ * server thread as the thread must be alertable */
+ return RPC_S_OK;
+@@ -227,6 +228,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
if (err == ERROR_PIPE_BUSY) {
TRACE("connection failed, error=%x\n", err);
return RPC_S_SERVER_TOO_BUSY;
@@ -108,7 +159,19 @@
}
if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
err = GetLastError();
-@@ -305,18 +308,32 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
+@@ -236,9 +240,11 @@ static RPC_STATUS rpcrt4_conn_open_pipe(
+ }
+
+ /* success */
++ memset(&npc->ovl, 0, sizeof(npc->ovl));
+ /* pipe is connected; change to message-read mode. */
+ dwMode = PIPE_READMODE_MESSAGE;
+ SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
++ npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
+ npc->pipe = pipe;
+
+ return RPC_S_OK;
+@@ -306,18 +312,32 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc
static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
{
RpcConnection_np *npc = (RpcConnection_np *) Connection;
@@ -145,7 +208,19 @@
I_RpcFree(pname);
return r;
-@@ -412,11 +429,17 @@ static int rpcrt4_conn_np_read(RpcConnec
+@@ -366,9 +386,9 @@ static void rpcrt4_conn_np_handoff(RpcCo
+ * to the child, then reopen the server binding to continue listening */
+
+ new_npc->pipe = old_npc->pipe;
+- new_npc->listen_thread = old_npc->listen_thread;
++ new_npc->ovl = old_npc->ovl;
+ old_npc->pipe = 0;
+- old_npc->listen_thread = 0;
++ memset(&old_npc->ovl, 0, sizeof(old_npc->ovl));
+ old_npc->listening = FALSE;
+ }
+
+@@ -413,11 +433,17 @@ static int rpcrt4_conn_np_read(RpcConnec
char *buf = buffer;
BOOL ret = TRUE;
unsigned int bytes_left = count;
@@ -164,7 +239,7 @@
if (!ret && GetLastError() == ERROR_MORE_DATA)
ret = TRUE;
if (!ret || !bytes_read)
-@@ -424,6 +447,7 @@ static int rpcrt4_conn_np_read(RpcConnec
+@@ -425,6 +451,7 @@ static int rpcrt4_conn_np_read(RpcConnec
bytes_left -= bytes_read;
buf += bytes_read;
}
@@ -172,7 +247,7 @@
return ret ? count : -1;
}
-@@ -434,16 +458,23 @@ static int rpcrt4_conn_np_write(RpcConne
+@@ -435,16 +462,23 @@ static int rpcrt4_conn_np_write(RpcConne
const char *buf = buffer;
BOOL ret = TRUE;
unsigned int bytes_left = count;
@@ -197,19 +272,61 @@
return ret ? count : -1;
}
-Index: rpcrt4.spec
-===================================================================
---- rpcrt4.spec (working copy)
-+++ rpcrt4.spec (working copy)
-@@ -53,7 +53,7 @@
- @ stub I_RpcIfInqTransferSyntaxes
- @ stub I_RpcLogEvent
- @ stdcall I_RpcMapWin32Status(long)
--@ stub I_RpcNegotiateTransferSyntax # wxp
-+@ stdcall I_RpcNegotiateTransferSyntax(ptr)
- @ stub I_RpcNsBindingSetEntryName
- @ stub I_RpcNsBindingSetEntryNameA
- @ stub I_RpcNsBindingSetEntryNameW
+@@ -456,9 +490,9 @@ static int rpcrt4_conn_np_close(RpcConne
+ CloseHandle(npc->pipe);
+ npc->pipe = 0;
+ }
+- if (npc->listen_thread) {
+- CloseHandle(npc->listen_thread);
+- npc->listen_thread = 0;
++ if (npc->ovl.hEvent) {
++ CloseHandle(npc->ovl.hEvent);
++ npc->ovl.hEvent = 0;
+ }
+ return 0;
+ }
+@@ -662,7 +696,7 @@ static void *rpcrt4_protseq_np_get_wait_
+ conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
+ while (conn) {
+ rpcrt4_conn_listen_pipe(conn);
+- if (conn->listen_thread)
++ if (conn->ovl.hEvent)
+ (*count)++;
+ conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
+ }
+@@ -683,7 +717,7 @@ static void *rpcrt4_protseq_np_get_wait_
+ *count = 1;
+ conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
+ while (conn) {
+- if ((objs[*count] = conn->listen_thread))
++ if ((objs[*count] = conn->ovl.hEvent))
+ (*count)++;
+ conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
+ }
+@@ -730,18 +764,12 @@ static int rpcrt4_protseq_np_wait_for_ne
+ EnterCriticalSection(&protseq->cs);
+ conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common);
+ while (conn) {
+- if (b_handle == conn->listen_thread) break;
++ if (b_handle == conn->ovl.hEvent) break;
+ conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common);
+ }
+ cconn = NULL;
+ if (conn)
+- {
+- DWORD exit_code;
+- if (GetExitCodeThread(conn->listen_thread, &exit_code) &&
exit_code == RPC_S_OK)
+- RPCRT4_SpawnConnection(&cconn, &conn->common);
+- CloseHandle(conn->listen_thread);
+- conn->listen_thread = 0;
+- }
++ RPCRT4_SpawnConnection(&cconn, &conn->common);
+ else
+ ERR("failed to locate connection for handle %p\n", b_handle);
+ LeaveCriticalSection(&protseq->cs);
+diff -prudN e:\Wine\dlls\rpcrt4/rpcrt4.spec e:\reactos\dll\win32\rpcrt4/rpcrt4.spec
+--- e:\Wine\dlls\rpcrt4/rpcrt4.spec 2012-09-09 19:47:53.677232900 +0100
++++ e:\reactos\dll\win32\rpcrt4/rpcrt4.spec 2013-12-06 20:29:09.804227500 +0100
@@ -266,7 +266,7 @@
@ stdcall NdrRangeUnmarshall(ptr ptr ptr long)
@ stub NdrRpcSmClientAllocate
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] Fri Dec 6 23:26:11 2013
@@ -85,6 +85,20 @@
ULONG Stats[1];
} RPC_STATS_VECTOR;
+typedef struct _RPC_PROTSEQ_VECTORA
+{
+ unsigned int Count;
+ unsigned char *Protseq[1];
+} RPC_PROTSEQ_VECTORA;
+
+typedef struct _RPC_PROTSEQ_VECTORW
+{
+ unsigned int Count;
+ unsigned short *Protseq[1];
+} RPC_PROTSEQ_VECTORW;
+
+DECL_WINELIB_TYPE_AW(RPC_PROTSEQ_VECTOR)
+
typedef I_RPC_HANDLE *RPC_EP_INQ_HANDLE;
#define RPC_C_EP_ALL_ELTS 0
@@ -279,18 +293,6 @@
} u;
} RPC_SECURITY_QOS_V2_A, *PRPC_SECURITY_QOS_V2_A;
-typedef struct _RPC_PROTSEQ_VECTORA
-{
- unsigned int Count;
- unsigned char __RPC_FAR * Protseq[1];
-} RPC_PROTSEQ_VECTORA;
-
-typedef struct _RPC_PROTSEQ_VECTORW
-{
- unsigned int Count;
- unsigned short __RPC_FAR * Protseq[1];
-} RPC_PROTSEQ_VECTORW;
-
#define _SEC_WINNT_AUTH_IDENTITY WINELIB_NAME_AW(_SEC_WINNT_AUTH_IDENTITY_)
#define SEC_WINNT_AUTH_IDENTITY WINELIB_NAME_AW(SEC_WINNT_AUTH_IDENTITY_)
#define PSEC_WINNT_AUTH_IDENTITY WINELIB_NAME_AW(PSEC_WINNT_AUTH_IDENTITY_)
@@ -302,16 +304,6 @@
#define RPC_SECURITY_QOS_V2 WINELIB_NAME_AW(RPC_SECURITY_QOS_V2_)
#define PRPC_SECURITY_QOS_V2 WINELIB_NAME_AW(PRPC_SECURITY_QOS_V2_)
#define _RPC_SECURITY_QOS_V2 WINELIB_NAME_AW(_RPC_SECURITY_QOS_V2_)
-
-#define RPC_PROTSEQ_VECTOR WINELIB_NAME_AW(RPC_PROTSEQ_VECTOR)
-#define _RPC_PROTSEQ_VECTOR WINELIB_NAME_AW(_RPC_PROTSEQ_VECTOR)
-
-typedef int
-(__RPC_API * RPC_MGMT_AUTHORIZATION_FN) (
- IN RPC_BINDING_HANDLE ClientBinding,
- IN unsigned long RequestedMgmtOperation,
- OUT RPC_STATUS __RPC_FAR * Status
- );
/* SEC_WINNT_AUTH Flags */
#define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1
@@ -332,7 +324,7 @@
RPCRTAPI DECLSPEC_NORETURN void RPC_ENTRY
RpcRaiseException( RPC_STATUS exception );
-
+
RPCRTAPI RPC_STATUS RPC_ENTRY
RpcBindingCopy( RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE*
DestinationBinding );
@@ -414,6 +406,10 @@
RPCRTAPI RPC_STATUS RPC_ENTRY
RpcMgmtEnableIdleCleanup( void );
+
+typedef int (__RPC_API *RPC_MGMT_AUTHORIZATION_FN)( RPC_BINDING_HANDLE, ULONG, RPC_STATUS
* );
+
+RPCRTAPI RPC_STATUS RPC_ENTRY RpcMgmtSetAuthorizationFn( RPC_MGMT_AUTHORIZATION_FN );
RPCRTAPI RPC_STATUS RPC_ENTRY RpcMgmtSetCancelTimeout(LONG);
@@ -564,6 +560,18 @@
RPCRTAPI RPC_STATUS RPC_ENTRY
RpcNetworkIsProtseqValidW( RPC_WSTR protseq );
#define RpcNetworkIsProtseqValid WINELIB_NAME_AW(RpcNetworkIsProtseqValid)
+
+RPCRTAPI RPC_STATUS RPC_ENTRY
+ RpcNetworkInqProtseqsA( RPC_PROTSEQ_VECTORA** protseqs );
+RPCRTAPI RPC_STATUS RPC_ENTRY
+ RpcNetworkInqProtseqsW( RPC_PROTSEQ_VECTORW** protseqs );
+#define RpcNetworkInqProtseqs WINELIB_NAME_AW(RpcNetworkInqProtseqs)
+
+RPCRTAPI RPC_STATUS RPC_ENTRY
+ RpcProtseqVectorFreeA( RPC_PROTSEQ_VECTORA** protseqs );
+RPCRTAPI RPC_STATUS RPC_ENTRY
+ RpcProtseqVectorFreeW( RPC_PROTSEQ_VECTORW** protseqs );
+#define RpcProtseqVectorFree WINELIB_NAME_AW(RpcProtseqVectorFree)
RPCRTAPI RPC_STATUS RPC_ENTRY
RpcRevertToSelf( void );
@@ -603,6 +611,12 @@
RPCRTAPI int RPC_ENTRY
UuidIsNil( UUID* Uuid, RPC_STATUS* Status_ );
+RPCRTAPI RPC_STATUS RPC_ENTRY
+ RpcServerInqDefaultPrincNameA( ULONG AuthnSvc, RPC_CSTR *PrincName );
+RPCRTAPI RPC_STATUS RPC_ENTRY
+ RpcServerInqDefaultPrincNameW( ULONG AuthnSvc, RPC_WSTR *PrincName );
+#define RpcServerInqDefaultPrincName WINELIB_NAME_AW(RpcServerInqDefaultPrincName)
+
#ifdef __cplusplus
}
#endif
Modified: trunk/reactos/include/psdk/rpcdcep.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/rpcdcep.h?rev…
==============================================================================
--- trunk/reactos/include/psdk/rpcdcep.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/rpcdcep.h [iso-8859-1] Fri Dec 6 23:26:11 2013
@@ -124,6 +124,14 @@
unsigned int Flags;
} RPC_CLIENT_INTERFACE, *PRPC_CLIENT_INTERFACE;
+#define RPC_C_OPT_COOKIE_AUTH 7
+
+typedef struct _RPC_C_OPT_COOKIE_AUTH_DESCRIPTOR
+{
+ ULONG BufferSize;
+ char *Buffer;
+} RPC_C_OPT_COOKIE_AUTH_DESCRIPTOR;
+
#define TRANSPORT_TYPE_CN 0x01
#define TRANSPORT_TYPE_DG 0x02
#define TRANSPORT_TYPE_LPC 0x04
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] Fri Dec 6 23:26:11 2013
@@ -45,19 +45,19 @@
/* stupid #if can't handle casts... this __stupidity
is just a workaround for that limitation */
-#define __NDR_CHAR_REP_MASK 0x000fL
-#define __NDR_INT_REP_MASK 0x00f0L
-#define __NDR_FLOAT_REP_MASK 0xff00L
-
-#define __NDR_IEEE_FLOAT 0x0000L
-#define __NDR_VAX_FLOAT 0x0100L
-#define __NDR_IBM_FLOAT 0x0300L
-
-#define __NDR_ASCII_CHAR 0x0000L
-#define __NDR_EBCDIC_CHAR 0x0001L
-
-#define __NDR_LITTLE_ENDIAN 0x0010L
-#define __NDR_BIG_ENDIAN 0x0000L
+#define __NDR_CHAR_REP_MASK 0x000f
+#define __NDR_INT_REP_MASK 0x00f0
+#define __NDR_FLOAT_REP_MASK 0xff00
+
+#define __NDR_IEEE_FLOAT 0x0000
+#define __NDR_VAX_FLOAT 0x0100
+#define __NDR_IBM_FLOAT 0x0300
+
+#define __NDR_ASCII_CHAR 0x0000
+#define __NDR_EBCDIC_CHAR 0x0001
+
+#define __NDR_LITTLE_ENDIAN 0x0010
+#define __NDR_BIG_ENDIAN 0x0000
/* Mac's are special */
#if defined(__RPC_MAC__)
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Dec 6 23:26:11 2013
@@ -165,7 +165,7 @@
reactos/dll/win32/resutils # Synced to Wine-1.7.1
reactos/dll/win32/riched20 # Synced to Wine-1.7.1
reactos/dll/win32/riched32 # Synced to Wine-1.7.1
-reactos/dll/win32/rpcrt4 # Synced to Wine-1.3.26
+reactos/dll/win32/rpcrt4 # Synced to Wine-1.7.1
reactos/dll/win32/rsabase # Synced to Wine-1.7.1
reactos/dll/win32/rsaenh # Synced to Wine-1.7.1
reactos/dll/win32/sccbase # Synced to Wine-1.7.1