[RPCRT4] Sync with Wine Staging 4.18. CORE-16441

This commit is contained in:
Amine Khaldi 2019-11-23 12:12:31 +01:00
parent 392821caea
commit 6feb8748d3
16 changed files with 1176 additions and 451 deletions

View File

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#define COBJMACROS
@ -36,6 +33,7 @@
#include "cpsf.h"
#include "ndr_misc.h"
#include "ndr_stubless.h"
#include "wine/asm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@ -106,19 +104,21 @@ static inline void init_thunk( struct thunk *thunk, unsigned int index )
extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC(call_stubless_func,
"movq %rcx,0x8(%rsp)\n\t"
"movq %rdx,0x10(%rsp)\n\t"
"movq %r8,0x18(%rsp)\n\t"
"movq %r9,0x20(%rsp)\n\t"
"leaq 0x8(%rsp),%r8\n\t" /* &This */
"subq $0x38,%rsp\n\t"
__ASM_SEH(".seh_stackalloc 0x38\n\t")
__ASM_SEH(".seh_endprologue\n\t")
__ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t")
"movq %rcx,0x40(%rsp)\n\t"
"movq %rdx,0x48(%rsp)\n\t"
"movq %r8,0x50(%rsp)\n\t"
"movq %r9,0x58(%rsp)\n\t"
"leaq 0x40(%rsp),%r8\n\t" /* &This */
"movq (%rcx),%rcx\n\t" /* This->lpVtbl */
"movq -0x10(%rcx),%rcx\n\t" /* MIDL_STUBLESS_PROXY_INFO */
"movq 0x10(%rcx),%rdx\n\t" /* info->FormatStringOffset */
"movzwq (%rdx,%r10,2),%rdx\n\t" /* FormatStringOffset[index] */
"addq 8(%rcx),%rdx\n\t" /* info->ProcFormatString + offset */
"movq (%rcx),%rcx\n\t" /* info->pStubDesc */
"subq $0x38,%rsp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t")
"movq %xmm1,0x20(%rsp)\n\t"
"movq %xmm2,0x28(%rsp)\n\t"
"movq %xmm3,0x30(%rsp)\n\t"
@ -196,6 +196,50 @@ static inline void init_thunk( struct thunk *thunk, unsigned int index )
thunk->func = call_stubless_func;
}
#elif defined(__aarch64__)
extern void call_stubless_func(void);
__ASM_GLOBAL_FUNC( call_stubless_func,
"stp x29, x30, [sp, #-0x90]!\n\t"
"mov x29, sp\n\t"
"stp d0, d1, [sp, #0x10]\n\t"
"stp d2, d3, [sp, #0x20]\n\t"
"stp d4, d5, [sp, #0x30]\n\t"
"stp d6, d7, [sp, #0x40]\n\t"
"stp x0, x1, [sp, #0x50]\n\t"
"stp x2, x3, [sp, #0x60]\n\t"
"stp x4, x5, [sp, #0x70]\n\t"
"stp x6, x7, [sp, #0x80]\n\t"
"ldr x0, [x0]\n\t" /* This->lpVtbl */
"ldr x0, [x0, #-16]\n\t" /* MIDL_STUBLESS_PROXY_INFO */
"ldp x1, x4, [x0, #8]\n\t" /* info->ProcFormatString, FormatStringOffset */
"ldrh w4, [x4, x16, lsl #1]\n\t" /* info->FormatStringOffset[index] */
"add x1, x1, x4\n\t" /* info->ProcFormatString + offset */
"ldr x0, [x0]\n\t" /* info->pStubDesc */
"add x2, sp, #0x50\n\t" /* stack */
"add x3, sp, #0x10\n\t" /* fpu_stack */
"bl " __ASM_NAME("ndr_client_call") "\n\t"
"ldp x29, x30, [sp], #0x90\n\t"
"ret" )
struct thunk
{
DWORD ldr_index; /* ldr w16, index */
DWORD ldr_func; /* ldr x17, func */
DWORD br; /* br x17 */
DWORD index;
void *func;
};
static inline void init_thunk( struct thunk *thunk, unsigned int index )
{
thunk->ldr_index = 0x18000070; /* ldr w16,index */
thunk->ldr_func = 0x58000071; /* ldr x17,func */
thunk->br = 0xd61f0220; /* br x17 */
thunk->index = index;
thunk->func = call_stubless_func;
}
#else /* __i386__ */
#warning You must implement stubless proxies for your CPU
@ -457,6 +501,8 @@ void WINAPI NdrProxyInitialize(void *This,
TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
if (!pStubMsg->pRpcChannelBuffer)
RpcRaiseException(CO_E_OBJNOTCONNECTED);
IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
&pStubMsg->dwDestContext,
&pStubMsg->pvDestContext);

View File

@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@ -36,7 +33,6 @@
#include "rpcproxy.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "cpsf.h"
@ -49,7 +45,7 @@ static void format_clsid( WCHAR *buffer, const CLSID *clsid )
'%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X',
'%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','}',0};
sprintfW( buffer, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
swprintf( buffer, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
@ -261,14 +257,14 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
TRACE("registering %s %s => %s\n",
debugstr_a(name), debugstr_guid(proxy->header.piid), debugstr_w(clsid));
strcpyW( keyname, interfaceW );
format_clsid( keyname + strlenW(keyname), proxy->header.piid );
lstrcpyW( keyname, interfaceW );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
WCHAR num[10];
if (name)
RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE *)name, strlen(name)+1);
RegSetValueW( key, clsid32W, REG_SZ, clsid, 0 );
sprintfW(num, numformatW, proxy->header.DispatchTableCount);
swprintf(num, numformatW, proxy->header.DispatchTableCount);
RegSetValueW( key, nummethodsW, REG_SZ, num, 0 );
RegCloseKey(key);
}
@ -277,15 +273,15 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
}
/* register clsid to point to module */
strcpyW( keyname, clsidW );
strcatW( keyname, clsid );
lstrcpyW( keyname, clsidW );
lstrcatW( keyname, clsid );
len = GetModuleFileNameW(hDll, module, ARRAY_SIZE(module));
if (len && len < sizeof(module)) {
TRACE("registering CLSID %s => %s\n", debugstr_w(clsid), debugstr_w(module));
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)psfactoryW, sizeof(psfactoryW));
if (RegCreateKeyW(key, inprocserverW, &subkey) == ERROR_SUCCESS) {
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (strlenW(module)+1)*sizeof(WCHAR));
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (lstrlenW(module)+1)*sizeof(WCHAR));
RegSetValueExW(subkey, threadingmodelW, 0, REG_SZ, (const BYTE *)bothW, sizeof(bothW));
RegCloseKey(subkey);
}
@ -325,16 +321,16 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
TRACE("unregistering %s %s\n", debugstr_a(name), debugstr_guid(proxy->header.piid));
strcpyW( keyname, interfaceW );
format_clsid( keyname + strlenW(keyname), proxy->header.piid );
lstrcpyW( keyname, interfaceW );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
}
pProxyFileList++;
}
/* unregister clsid */
strcpyW( keyname, clsidW );
strcatW( keyname, clsid );
lstrcpyW( keyname, clsidW );
lstrcatW( keyname, clsid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
return S_OK;

View File

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#define COBJMACROS
@ -186,6 +183,23 @@ typedef struct
DWORD offset;
} vtbl_method_t;
#elif defined(__aarch64__)
static const DWORD opcodes[] =
{
0xf9401000, /* ldr x0, [x0,#32] */
0xf9400010, /* ldr x16, [x0] */
0x18000071, /* ldr w17, offset */
0xf8716a10, /* ldr x16, [x16,x17] */
0xd61f0200 /* br x16 */
};
typedef struct
{
DWORD opcodes[ARRAY_SIZE(opcodes)];
DWORD offset;
} vtbl_method_t;
#else
#warning You must implement delegated proxies/stubs for your CPU

View File

@ -263,9 +263,6 @@ void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
if (!binding->server || !binding->Assoc)
RpcRaiseException(RPC_S_INVALID_BINDING);
if (Flags & RPC_CONTEXT_HANDLE_FLAGS)
FIXME("unimplemented flags: 0x%x\n", Flags & RPC_CONTEXT_HANDLE_FLAGS);
if (SContext->userContext)
{
status = RpcServerAssoc_UpdateContextHandle(binding->Assoc, SContext, CtxGuard, userRunDownIn);
@ -337,9 +334,6 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
if (!binding->server || !binding->Assoc)
RpcRaiseException(RPC_S_INVALID_BINDING);
if (Flags & RPC_CONTEXT_HANDLE_FLAGS)
FIXME("unimplemented flags: 0x%x\n", Flags & RPC_CONTEXT_HANDLE_FLAGS);
if (!pBuff || (!context_ndr->attributes &&
UuidIsNil((UUID *)&context_ndr->uuid, &status)))
status = RpcServerAssoc_AllocateContextHandle(binding->Assoc, CtxGuard,

View File

@ -42,7 +42,6 @@
#include "rpcndr.h"
#include "ndrtypes.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@ -132,8 +131,6 @@ static inline void align_pointer_offset_clear( unsigned char **ptr, unsigned cha
#define NDR_TABLE_SIZE 128
#define NDR_TABLE_MASK 127
#define NDRSContextFromValue(user_context) (NDR_SCONTEXT)((char *)(user_context) - (char *)NDRSContextValue((NDR_SCONTEXT)NULL))
static unsigned char *WINAPI NdrBaseTypeMarshall(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
static unsigned char *WINAPI NdrBaseTypeUnmarshall(PMIDL_STUB_MESSAGE, unsigned char **, PFORMAT_STRING, unsigned char);
static void WINAPI NdrBaseTypeBufferSize(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STRING);
@ -1873,7 +1870,7 @@ static inline void array_compute_and_size_conformance(
else
{
TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory));
pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
pStubMsg->ActualCount = lstrlenW((LPCWSTR)pMemory)+1;
}
if (pFormat[1] == FC_STRING_SIZED)
@ -1996,7 +1993,7 @@ static inline void array_compute_and_write_conformance(
else
{
TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory));
pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
pStubMsg->ActualCount = lstrlenW((LPCWSTR)pMemory)+1;
}
if (pFormat[1] == FC_STRING_SIZED)
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0);
@ -7002,7 +6999,7 @@ static unsigned char *WINAPI NdrContextHandleMarshall(
}
else
{
NDR_SCONTEXT ctxt = NDRSContextFromValue(pMemory);
NDR_SCONTEXT ctxt = CONTAINING_RECORD(pMemory, struct _NDR_SCONTEXT, userContext);
NDR_RUNDOWN rundown = pStubMsg->StubDesc->apfnNdrRundownRoutines[pFormat[2]];
NdrServerContextNewMarshall(pStubMsg, ctxt, rundown, pFormat);
}
@ -7031,10 +7028,15 @@ static unsigned char *WINAPI NdrContextHandleUnmarshall(
if (pStubMsg->IsClient)
{
NDR_CCONTEXT *ccontext;
if (pFormat[1] & HANDLE_PARAM_IS_VIA_PTR)
ccontext = *(NDR_CCONTEXT **)ppMemory;
else
ccontext = (NDR_CCONTEXT *)ppMemory;
/* [out]-only or [ret] param */
if ((pFormat[1] & (HANDLE_PARAM_IS_IN|HANDLE_PARAM_IS_OUT)) == HANDLE_PARAM_IS_OUT)
**(NDR_CCONTEXT **)ppMemory = NULL;
NdrClientContextUnmarshall(pStubMsg, *(NDR_CCONTEXT **)ppMemory, pStubMsg->RpcMsg->Handle);
*ccontext = NULL;
NdrClientContextUnmarshall(pStubMsg, ccontext, pStubMsg->RpcMsg->Handle);
}
else
{
@ -7258,7 +7260,10 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
*/
void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory, ULONG CacheSize, ULONG Flags)
{
FIXME("(%p, %p, %d, 0x%x): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
static int once;
if (!once++)
FIXME("(%p, %p, %d, 0x%x): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
if (pStubMsg->CorrDespIncrement == 0)
pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */
@ -7296,5 +7301,8 @@ void WINAPI NdrCorrelationPass(PMIDL_STUB_MESSAGE pStubMsg)
*/
void WINAPI NdrCorrelationFree(PMIDL_STUB_MESSAGE pStubMsg)
{
FIXME("(%p): stub\n", pStubMsg);
static int once;
if (!once++)
FIXME("(%p): stub\n", pStubMsg);
}

File diff suppressed because it is too large Load Diff

View File

@ -204,8 +204,8 @@ typedef struct _NDR_EHD_CONTEXT
* NDR_CONTEXT_HANDLE_SERIALIZE = 0x02
* NDR_CONTEXT_HANDLE_NO_SERIALIZE = 0x04
* NDR_STRICT_CONTEXT_HANDLE = 0x08
* HANDLE_PARAM_IS_RETURN = 0x10
* HANDLE_PARAM_IS_OUT = 0x20
* HANDLE_PARAM_IS_RETURN = 0x21
* HANDLE_PARAM_IS_IN = 0x40
* HANDLE_PARAM_IS_VIA_PTR = 0x80
*/
@ -226,6 +226,23 @@ typedef struct _NDR_EHD_CONTEXT
#include "poppack.h"
struct async_call_data
{
MIDL_STUB_MESSAGE *pStubMsg;
const NDR_PROC_HEADER *pProcHeader;
PFORMAT_STRING pHandleFormat;
PFORMAT_STRING pParamFormat;
RPC_BINDING_HANDLE hBinding;
/* size of stack */
unsigned short stack_size;
/* number of parameters. optional for client to give it to us */
unsigned int number_of_params;
/* location to put retval into */
LONG_PTR *retval_ptr;
/* correlation cache */
ULONG_PTR NdrCorrCache[256];
};
enum stubless_phase
{
STUBLESS_UNMARSHAL,
@ -248,3 +265,4 @@ PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
unsigned int stack_size, BOOL object_proc,
void *buffer, unsigned int size, unsigned int *count ) DECLSPEC_HIDDEN;
RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply) DECLSPEC_HIDDEN;
RPC_STATUS NdrpCompleteAsyncServerCall(RPC_ASYNC_STATE *pAsync, void *Reply) DECLSPEC_HIDDEN;

View File

@ -109,9 +109,13 @@ static unsigned short write_oleaut_tfs(VARTYPE vt)
return 0;
}
static unsigned char get_base_type(VARTYPE vt)
static unsigned char get_basetype(ITypeInfo *typeinfo, TYPEDESC *desc)
{
switch (vt)
ITypeInfo *refinfo;
unsigned char ret;
TYPEATTR *attr;
switch (desc->vt)
{
case VT_I1: return FC_SMALL;
case VT_BOOL:
@ -129,6 +133,18 @@ static unsigned char get_base_type(VARTYPE vt)
case VT_R4: return FC_FLOAT;
case VT_DATE:
case VT_R8: return FC_DOUBLE;
case VT_USERDEFINED:
ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
if (attr->typekind == TKIND_ENUM)
ret = FC_ENUM32;
else if (attr->typekind == TKIND_ALIAS)
ret = get_basetype(refinfo, &attr->tdescAlias);
else
ret = 0;
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
return ret;
default: return 0;
}
}
@ -192,34 +208,118 @@ static unsigned int type_memsize(ITypeInfo *typeinfo, TYPEDESC *desc)
}
}
static BOOL type_pointer_is_iface(ITypeInfo *typeinfo, TYPEDESC *tdesc)
{
ITypeInfo *refinfo;
BOOL ret = FALSE;
TYPEATTR *attr;
if (tdesc->vt == VT_USERDEFINED)
{
ITypeInfo_GetRefTypeInfo(typeinfo, tdesc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
if (attr->typekind == TKIND_INTERFACE
|| attr->typekind == TKIND_DISPATCH
|| attr->typekind == TKIND_COCLASS)
ret = TRUE;
else if (attr->typekind == TKIND_ALIAS)
ret = type_pointer_is_iface(refinfo, &attr->tdescAlias);
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
}
return ret;
}
static unsigned char get_array_fc(ITypeInfo *typeinfo, TYPEDESC *desc);
static unsigned char get_struct_fc(ITypeInfo *typeinfo, TYPEATTR *attr);
static unsigned char get_struct_member_fc(ITypeInfo *typeinfo, TYPEDESC *tdesc)
{
unsigned char fc;
ITypeInfo *refinfo;
TYPEATTR *attr;
switch (tdesc->vt)
{
case VT_BSTR:
case VT_SAFEARRAY:
return (sizeof(void *) == 4) ? FC_PSTRUCT : FC_BOGUS_STRUCT;
case VT_CY:
return FC_STRUCT;
case VT_VARIANT:
case VT_UNKNOWN:
case VT_DISPATCH:
return FC_BOGUS_STRUCT;
case VT_CARRAY:
if (get_array_fc(typeinfo, &tdesc->lpadesc->tdescElem) == FC_BOGUS_ARRAY)
return FC_BOGUS_STRUCT;
return FC_STRUCT;
case VT_PTR:
if (type_pointer_is_iface(typeinfo, tdesc))
fc = FC_BOGUS_STRUCT;
else
fc = (sizeof(void *) == 4) ? FC_PSTRUCT : FC_BOGUS_STRUCT;
break;
case VT_USERDEFINED:
ITypeInfo_GetRefTypeInfo(typeinfo, tdesc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
switch (attr->typekind)
{
case TKIND_ENUM:
fc = FC_STRUCT;
break;
case TKIND_RECORD:
fc = get_struct_fc(refinfo, attr);
break;
case TKIND_INTERFACE:
case TKIND_DISPATCH:
case TKIND_COCLASS:
fc = FC_BOGUS_STRUCT;
break;
case TKIND_ALIAS:
fc = get_struct_member_fc(refinfo, &attr->tdescAlias);
break;
default:
FIXME("Unhandled kind %#x.\n", attr->typekind);
fc = FC_BOGUS_STRUCT;
break;
}
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
break;
default:
if (get_basetype(typeinfo, tdesc))
return FC_STRUCT;
else
{
FIXME("Unhandled type %u.\n", tdesc->vt);
return FC_BOGUS_STRUCT;
}
}
return fc;
}
static unsigned char get_struct_fc(ITypeInfo *typeinfo, TYPEATTR *attr)
{
unsigned char fc = FC_STRUCT;
unsigned char fc = FC_STRUCT, member_fc;
VARDESC *desc;
VARTYPE vt;
WORD i;
for (i = 0; i < attr->cVars; i++)
{
ITypeInfo_GetVarDesc(typeinfo, i, &desc);
vt = desc->elemdescVar.tdesc.vt;
switch (vt)
{
case VT_CARRAY:
if (get_array_fc(typeinfo, &desc->elemdescVar.tdesc.lpadesc->tdescElem) == FC_BOGUS_ARRAY)
fc = FC_BOGUS_STRUCT;
break;
default:
if (!get_base_type(vt))
{
FIXME("unhandled type %u\n", vt);
fc = FC_BOGUS_STRUCT;
}
break;
}
member_fc = get_struct_member_fc(typeinfo, &desc->elemdescVar.tdesc);
if (member_fc == FC_BOGUS_STRUCT)
fc = FC_BOGUS_STRUCT;
else if (member_fc == FC_PSTRUCT && fc != FC_BOGUS_STRUCT)
fc = FC_PSTRUCT;
ITypeInfo_ReleaseVarDesc(typeinfo, desc);
}
@ -229,9 +329,13 @@ static unsigned char get_struct_fc(ITypeInfo *typeinfo, TYPEATTR *attr)
static unsigned char get_array_fc(ITypeInfo *typeinfo, TYPEDESC *desc)
{
if (get_base_type(desc->vt))
switch (desc->vt)
{
case VT_CY:
return FC_LGFARRAY;
else if (desc->vt == VT_USERDEFINED)
case VT_CARRAY:
return get_array_fc(typeinfo, &desc->lpadesc->tdescElem);
case VT_USERDEFINED:
{
ITypeInfo *refinfo;
TYPEATTR *attr;
@ -244,6 +348,8 @@ static unsigned char get_array_fc(ITypeInfo *typeinfo, TYPEDESC *desc)
fc = FC_LGFARRAY;
else if (attr->typekind == TKIND_RECORD && get_struct_fc(refinfo, attr) == FC_STRUCT)
fc = FC_LGFARRAY;
else if (attr->typekind == TKIND_ALIAS)
fc = get_array_fc(refinfo, &attr->tdescAlias);
else
fc = FC_BOGUS_ARRAY;
@ -252,8 +358,244 @@ static unsigned char get_array_fc(ITypeInfo *typeinfo, TYPEDESC *desc)
return fc;
}
default:
return get_basetype(typeinfo, desc) ? FC_LGFARRAY : FC_BOGUS_ARRAY;
}
}
static BOOL type_is_non_iface_pointer(ITypeInfo *typeinfo, TYPEDESC *desc)
{
if (desc->vt == VT_PTR)
return !type_pointer_is_iface(typeinfo, desc->lptdesc);
else if (desc->vt == VT_USERDEFINED)
{
ITypeInfo *refinfo;
TYPEATTR *attr;
BOOL ret;
ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
if (attr->typekind == TKIND_ALIAS)
ret = type_is_non_iface_pointer(refinfo, &attr->tdescAlias);
else
ret = FALSE;
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
return ret;
}
else
return FC_BOGUS_ARRAY;
return FALSE;
}
static void write_struct_members(ITypeInfo *typeinfo, unsigned char *str,
size_t *len, TYPEATTR *attr)
{
unsigned int struct_offset = 0;
unsigned char basetype;
TYPEDESC *tdesc;
VARDESC *desc;
WORD i;
for (i = 0; i < attr->cVars; i++)
{
ITypeInfo_GetVarDesc(typeinfo, i, &desc);
tdesc = &desc->elemdescVar.tdesc;
/* This may not match the intended alignment, but we don't have enough
* information to determine that. This should always give the correct
* layout. */
if ((struct_offset & 7) && !(desc->oInst & 7))
WRITE_CHAR(str, *len, FC_ALIGNM8);
else if ((struct_offset & 3) && !(desc->oInst & 3))
WRITE_CHAR(str, *len, FC_ALIGNM4);
else if ((struct_offset & 1) && !(desc->oInst & 1))
WRITE_CHAR(str, *len, FC_ALIGNM2);
struct_offset = desc->oInst + type_memsize(typeinfo, tdesc);
if ((basetype = get_basetype(typeinfo, tdesc)))
WRITE_CHAR(str, *len, basetype);
else if (type_is_non_iface_pointer(typeinfo, tdesc))
WRITE_CHAR(str, *len, FC_POINTER);
else
{
WRITE_CHAR(str, *len, FC_EMBEDDED_COMPLEX);
WRITE_CHAR(str, *len, 0);
WRITE_SHORT(str, *len, 0);
}
ITypeInfo_ReleaseVarDesc(typeinfo, desc);
}
if (!(*len & 1))
WRITE_CHAR (str, *len, FC_PAD);
WRITE_CHAR (str, *len, FC_END);
}
static void write_simple_struct_tfs(ITypeInfo *typeinfo, unsigned char *str,
size_t *len, TYPEATTR *attr)
{
write_struct_members(typeinfo, str, len, attr);
}
static BOOL type_needs_pointer_deref(ITypeInfo *typeinfo, TYPEDESC *desc)
{
if (desc->vt == VT_PTR || desc->vt == VT_UNKNOWN || desc->vt == VT_DISPATCH)
return TRUE;
else if (desc->vt == VT_USERDEFINED)
{
ITypeInfo *refinfo;
BOOL ret = FALSE;
TYPEATTR *attr;
ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
if (attr->typekind == TKIND_ALIAS)
ret = type_needs_pointer_deref(refinfo, &attr->tdescAlias);
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
return ret;
}
else
return FALSE;
}
static void write_complex_struct_pointer_layout(ITypeInfo *typeinfo,
TYPEDESC *desc, unsigned char *str, size_t *len)
{
unsigned char basetype;
if (desc->vt == VT_PTR && !type_pointer_is_iface(typeinfo, desc->lptdesc))
{
WRITE_CHAR(str, *len, FC_UP);
if ((basetype = get_basetype(typeinfo, desc->lptdesc)))
{
WRITE_CHAR(str, *len, FC_SIMPLE_POINTER);
WRITE_CHAR(str, *len, basetype);
WRITE_CHAR(str, *len, FC_PAD);
}
else
{
if (type_needs_pointer_deref(typeinfo, desc->lptdesc))
WRITE_CHAR(str, *len, FC_POINTER_DEREF);
else
WRITE_CHAR(str, *len, 0);
WRITE_SHORT(str, *len, 0);
}
}
else if (desc->vt == VT_USERDEFINED)
{
ITypeInfo *refinfo;
TYPEATTR *attr;
ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
if (attr->typekind == TKIND_ALIAS)
write_complex_struct_pointer_layout(refinfo, &attr->tdescAlias, str, len);
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
}
}
static size_t write_complex_struct_pointer_ref(ITypeInfo *typeinfo,
TYPEDESC *desc, unsigned char *str, size_t *len)
{
if (desc->vt == VT_PTR && !type_pointer_is_iface(typeinfo, desc->lptdesc)
&& !get_basetype(typeinfo, desc->lptdesc))
{
return write_type_tfs(typeinfo, str, len, desc->lptdesc, FALSE, FALSE);
}
else if (desc->vt == VT_USERDEFINED)
{
ITypeInfo *refinfo;
TYPEATTR *attr;
size_t ret = 0;
ITypeInfo_GetRefTypeInfo(typeinfo, desc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
if (attr->typekind == TKIND_ALIAS)
ret = write_complex_struct_pointer_ref(refinfo, &attr->tdescAlias, str, len);
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
return ret;
}
return 0;
}
static void write_complex_struct_tfs(ITypeInfo *typeinfo, unsigned char *str,
size_t *len, TYPEATTR *attr)
{
size_t pointer_layout_offset, pointer_layout, member_layout, ref;
unsigned int struct_offset = 0;
TYPEDESC *tdesc;
VARDESC *desc;
WORD i;
WRITE_SHORT(str, *len, 0); /* conformant array description */
pointer_layout_offset = *len;
WRITE_SHORT(str, *len, 0); /* pointer layout; will be filled in later */
member_layout = *len;
/* First pass: write the struct members and pointer layout, but do not yet
* write the offsets for embedded complexes and pointer refs. These must be
* handled after we write the whole struct description, since it must be
* contiguous. */
write_struct_members(typeinfo, str, len, attr);
pointer_layout = *len;
if (str) *((short *)(str + pointer_layout_offset)) = pointer_layout - pointer_layout_offset;
for (i = 0; i < attr->cVars; i++)
{
ITypeInfo_GetVarDesc(typeinfo, i, &desc);
write_complex_struct_pointer_layout(typeinfo, &desc->elemdescVar.tdesc, str, len);
ITypeInfo_ReleaseVarDesc(typeinfo, desc);
}
/* Second pass: write types for embedded complexes and non-simple pointers. */
struct_offset = 0;
for (i = 0; i < attr->cVars; i++)
{
ITypeInfo_GetVarDesc(typeinfo, i, &desc);
tdesc = &desc->elemdescVar.tdesc;
if (struct_offset != desc->oInst)
member_layout++; /* alignment directive */
struct_offset = desc->oInst + type_memsize(typeinfo, tdesc);
if (get_basetype(typeinfo, tdesc))
member_layout++;
else if (type_is_non_iface_pointer(typeinfo, tdesc))
{
member_layout++;
if ((ref = write_complex_struct_pointer_ref(typeinfo, tdesc, str, len)))
{
if (str) *((short *)(str + pointer_layout + 2)) = ref - (pointer_layout + 2);
}
pointer_layout += 4;
}
else
{
ref = write_type_tfs(typeinfo, str, len, tdesc, FALSE, FALSE);
if (str) *((short *)(str + member_layout + 2)) = ref - (member_layout + 2);
member_layout += 4;
}
ITypeInfo_ReleaseVarDesc(typeinfo, desc);
}
}
static size_t write_struct_tfs(ITypeInfo *typeinfo, unsigned char *str,
@ -262,14 +604,18 @@ static size_t write_struct_tfs(ITypeInfo *typeinfo, unsigned char *str,
unsigned char fc = get_struct_fc(typeinfo, attr);
size_t off = *len;
if (fc != FC_STRUCT)
FIXME("fc %02x not implemented\n", fc);
/* For the sake of simplicity, write pointer structs as complex structs. */
if (fc == FC_PSTRUCT)
fc = FC_BOGUS_STRUCT;
WRITE_CHAR (str, *len, FC_STRUCT);
WRITE_CHAR (str, *len, fc);
WRITE_CHAR (str, *len, attr->cbAlignment - 1);
WRITE_SHORT(str, *len, attr->cbSizeInstance);
WRITE_CHAR (str, *len, FC_PAD);
WRITE_CHAR (str, *len, FC_END);
if (fc == FC_STRUCT)
write_simple_struct_tfs(typeinfo, str, len, attr);
else if (fc == FC_BOGUS_STRUCT)
write_complex_struct_tfs(typeinfo, str, len, attr);
return off;
}
@ -278,15 +624,12 @@ static size_t write_array_tfs(ITypeInfo *typeinfo, unsigned char *str,
size_t *len, ARRAYDESC *desc)
{
unsigned char fc = get_array_fc(typeinfo, &desc->tdescElem);
ULONG size = type_memsize(typeinfo, &desc->tdescElem);
unsigned char basetype;
size_t ref = 0, off;
ULONG size = 1;
USHORT i;
if (fc != FC_LGFARRAY)
FIXME("complex arrays not implemented\n");
if (!(basetype = get_base_type(desc->tdescElem.vt)))
if (!(basetype = get_basetype(typeinfo, &desc->tdescElem)))
ref = write_type_tfs(typeinfo, str, len, &desc->tdescElem, FALSE, FALSE);
/* In theory arrays should be nested, but there's no reason not to marshal
@ -295,9 +638,20 @@ static size_t write_array_tfs(ITypeInfo *typeinfo, unsigned char *str,
off = *len;
WRITE_CHAR(str, *len, FC_LGFARRAY);
WRITE_CHAR(str, *len, fc);
WRITE_CHAR(str, *len, 0);
WRITE_INT (str, *len, size);
if (fc == FC_BOGUS_ARRAY)
{
WRITE_SHORT(str, *len, size);
WRITE_INT(str, *len, 0xffffffff); /* conformance */
WRITE_INT(str, *len, 0xffffffff); /* variance */
}
else
{
size *= type_memsize(typeinfo, &desc->tdescElem);
WRITE_INT(str, *len, size);
}
if (basetype)
WRITE_CHAR(str, *len, basetype);
else
@ -404,7 +758,7 @@ static size_t write_pointer_tfs(ITypeInfo *typeinfo, unsigned char *str,
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
}
else if ((basetype = get_base_type(desc->vt)))
else if ((basetype = get_basetype(typeinfo, desc)))
{
assert(!toplevel); /* toplevel base-type pointers should use IsSimpleRef */
WRITE_CHAR(str, *len, FC_UP);
@ -457,6 +811,14 @@ static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str,
case TKIND_RECORD:
off = write_struct_tfs(refinfo, str, len, attr);
break;
case TKIND_INTERFACE:
case TKIND_DISPATCH:
case TKIND_COCLASS:
assert(0);
break;
case TKIND_ALIAS:
off = write_type_tfs(refinfo, str, len, &attr->tdescAlias, toplevel, onstack);
break;
default:
FIXME("unhandled kind %u\n", attr->typekind);
off = *len;
@ -469,7 +831,7 @@ static size_t write_type_tfs(ITypeInfo *typeinfo, unsigned char *str,
break;
default:
/* base types are always embedded directly */
assert(!get_base_type(desc->vt));
assert(!get_basetype(typeinfo, desc));
FIXME("unhandled type %u\n", desc->vt);
off = *len;
WRITE_SHORT(str, *len, 0);
@ -517,26 +879,10 @@ static HRESULT get_param_pointer_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int
break;
case VT_PTR:
*flags |= MustFree;
if (tdesc->lptdesc->vt == VT_USERDEFINED)
if (type_pointer_is_iface(typeinfo, tdesc->lptdesc))
{
ITypeInfo_GetRefTypeInfo(typeinfo, tdesc->lptdesc->hreftype, &refinfo);
ITypeInfo_GetTypeAttr(refinfo, &attr);
switch (attr->typekind)
{
case TKIND_INTERFACE:
case TKIND_DISPATCH:
case TKIND_COCLASS:
if (is_in && is_out)
*server_size = sizeof(void *);
break;
default:
if (is_in && is_out)
*server_size = sizeof(void *);
}
ITypeInfo_ReleaseTypeAttr(refinfo, attr);
ITypeInfo_Release(refinfo);
}
else
*server_size = sizeof(void *);
@ -587,7 +933,7 @@ static HRESULT get_param_pointer_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int
*tfs_tdesc = tdesc;
if (!is_in && is_out)
*server_size = type_memsize(typeinfo, tdesc);
if ((*basetype = get_base_type(tdesc->vt)))
if ((*basetype = get_basetype(typeinfo, tdesc)))
*flags |= IsBasetype;
break;
}
@ -665,7 +1011,7 @@ static HRESULT get_param_info(ITypeInfo *typeinfo, TYPEDESC *tdesc, int is_in,
ITypeInfo_Release(refinfo);
break;
default:
if ((*basetype = get_base_type(tdesc->vt)))
if ((*basetype = get_basetype(typeinfo, tdesc)))
*flags |= IsBasetype;
else
{
@ -752,7 +1098,7 @@ static void write_proc_func_header(ITypeInfo *typeinfo, FUNCDESC *desc,
WRITE_SHORT(proc, *proclen, 0); /* NotifyIndex */
for (param_idx = 0; param_idx < desc->cParams && param_idx < 3; param_idx++)
{
basetype = get_base_type(desc->lprgelemdescParam[param_idx].tdesc.vt);
basetype = get_basetype(typeinfo, &desc->lprgelemdescParam[param_idx].tdesc);
if (basetype == FC_FLOAT)
float_mask |= (1 << ((param_idx + 1) * 2));
else if (basetype == FC_DOUBLE)

View File

@ -2,8 +2,6 @@
#ifndef _RPCRT4_PCH_
#define _RPCRT4_PCH_
#include <config.h>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
@ -19,6 +17,7 @@
#include <windef.h>
#include <winbase.h>
#include <winternl.h>
#include <winnls.h>
#include <objbase.h>
#include <rpcproxy.h>
#include <security.h>
@ -27,7 +26,6 @@
#include <wine/exception.h>
#include <wine/list.h>
#include <wine/rpcfc.h>
#include <wine/unicode.h>
#include "cpsf.h"
#include "ncastatus.h"

View File

@ -26,7 +26,6 @@
#include "rpcndr.h"
#include "wine/winternl.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "rpc_binding.h"
@ -93,7 +92,7 @@ static BOOL compare_networkoptions(LPCWSTR opts1, LPCWSTR opts2)
return TRUE;
if ((opts1 == NULL) || (opts2 == NULL))
return FALSE;
return !strcmpW(opts1, opts2);
return !wcscmp(opts1, opts2);
}
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
@ -154,7 +153,7 @@ RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
(!NetworkAddr || !assoc->NetworkAddr || !strcmp(NetworkAddr, assoc->NetworkAddr)) &&
!strcmp(Endpoint, assoc->Endpoint) &&
((!assoc->NetworkOptions == !NetworkOptions) &&
(!NetworkOptions || !strcmpW(NetworkOptions, assoc->NetworkOptions))))
(!NetworkOptions || !wcscmp(NetworkOptions, assoc->NetworkOptions))))
{
assoc->refs++;
*assoc_out = assoc;

View File

@ -110,6 +110,8 @@ RPC_STATUS WINAPI RpcAsyncGetCallStatus(PRPC_ASYNC_STATE pAsync)
*/
RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply)
{
struct async_call_data *data;
TRACE("(%p, %p)\n", pAsync, Reply);
if (!valid_async_handle(pAsync))
@ -117,7 +119,13 @@ RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply)
/* FIXME: check completed */
return NdrpCompleteAsyncClientCall(pAsync, Reply);
TRACE("pAsync %p, pAsync->StubInfo %p\n", pAsync, pAsync->StubInfo);
data = pAsync->StubInfo;
if (data->pStubMsg->IsClient)
return NdrpCompleteAsyncClientCall(pAsync, Reply);
return NdrpCompleteAsyncServerCall(pAsync, Reply);
}
/***********************************************************************

View File

@ -31,7 +31,6 @@
#include "winnls.h"
#include "winerror.h"
#include "wine/winternl.h"
#include "wine/unicode.h"
#include "rpc.h"
#include "rpcndr.h"
@ -94,7 +93,7 @@ LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
DWORD len;
LPWSTR s;
if (!src) return NULL;
if (slen == -1) slen = strlenW(src);
if (slen == -1) slen = lstrlenW(src);
len = slen;
s = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
memcpy(s, src, len*sizeof(WCHAR));
@ -322,7 +321,7 @@ static LPSTR RPCRT4_strconcatA(LPSTR dst, LPCSTR src)
static LPWSTR RPCRT4_strconcatW(LPWSTR dst, LPCWSTR src)
{
DWORD len = strlenW(dst), slen = strlenW(src);
DWORD len = lstrlenW(dst), slen = lstrlenW(src);
LPWSTR ndst = HeapReAlloc(GetProcessHeap(), 0, dst, (len+slen+2)*sizeof(WCHAR));
if (!ndst)
{
@ -435,7 +434,7 @@ static RPC_WSTR unescape_string_binding_componentW(
{
RPC_WSTR component, p;
if (len == -1) len = strlenW(string_binding);
if (len == -1) len = lstrlenW(string_binding);
component = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*component));
if (!component) return NULL;
@ -521,11 +520,11 @@ RPC_STATUS WINAPI RpcStringBindingComposeW( RPC_WSTR ObjUuid, RPC_WSTR Protseq,
debugstr_w( Options ), StringBinding);
/* overestimate for each component for escaping of delimiters */
if (ObjUuid && *ObjUuid) len += strlenW(ObjUuid) * 2 + 1;
if (Protseq && *Protseq) len += strlenW(Protseq) * 2 + 1;
if (NetworkAddr && *NetworkAddr) len += strlenW(NetworkAddr) * 2;
if (Endpoint && *Endpoint) len += strlenW(Endpoint) * 2 + 2;
if (Options && *Options) len += strlenW(Options) * 2 + 2;
if (ObjUuid && *ObjUuid) len += lstrlenW(ObjUuid) * 2 + 1;
if (Protseq && *Protseq) len += lstrlenW(Protseq) * 2 + 1;
if (NetworkAddr && *NetworkAddr) len += lstrlenW(NetworkAddr) * 2;
if (Endpoint && *Endpoint) len += lstrlenW(Endpoint) * 2 + 2;
if (Options && *Options) len += lstrlenW(Options) * 2 + 2;
data = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
*StringBinding = data;
@ -741,7 +740,7 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
else HeapFree(GetProcessHeap(), 0, opt);
endpoint_already_found = TRUE;
} else {
if (strncmpW(opt, ep_opt, strlenW(ep_opt)) == 0) {
if (wcsncmp(opt, ep_opt, lstrlenW(ep_opt)) == 0) {
/* endpoint option */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
@ -1320,7 +1319,7 @@ static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BO
if (unicode)
http_credentials_dst->ServerCertificateSubject =
RPCRT4_strndupW(http_credentials_src->ServerCertificateSubject,
strlenW(http_credentials_src->ServerCertificateSubject));
lstrlenW(http_credentials_src->ServerCertificateSubject));
else
http_credentials_dst->ServerCertificateSubject =
RPCRT4_strdupAtoW((char *)http_credentials_src->ServerCertificateSubject);

View File

@ -20,9 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@ -702,10 +699,6 @@ static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg)
}
LeaveCriticalSection(&cps->cs);
EnterCriticalSection(&listen_cs);
CloseHandle(cps->server_thread);
cps->server_thread = NULL;
LeaveCriticalSection(&listen_cs);
TRACE("done\n");
return 0;
}
@ -1573,7 +1566,10 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
LIST_FOR_EACH_ENTRY(protseq, &protseqs, RpcServerProtseq, entry)
{
if ((wait_thread = protseq->server_thread))
{
protseq->server_thread = NULL;
break;
}
}
LeaveCriticalSection(&server_cs);
if (!wait_thread)
@ -1582,6 +1578,7 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
TRACE("waiting for thread %u\n", GetThreadId(wait_thread));
LeaveCriticalSection(&listen_cs);
WaitForSingleObject(wait_thread, INFINITE);
CloseHandle(wait_thread);
EnterCriticalSection(&listen_cs);
}
if (listen_done_event == event)

View File

@ -42,7 +42,6 @@
#include "wininet.h"
#include "wine/winternl.h"
#include "winioctl.h"
#include "wine/unicode.h"
#include "rpc.h"
#include "rpcndr.h"
@ -528,10 +527,9 @@ static void rpcrt4_conn_np_cancel_call(RpcConnection *conn)
CancelIoEx(connection->pipe, NULL);
}
static int rpcrt4_conn_np_wait_for_incoming_data(RpcConnection *Connection)
static int rpcrt4_conn_np_wait_for_incoming_data(RpcConnection *conn)
{
/* FIXME: implement when named pipe writes use overlapped I/O */
return -1;
return rpcrt4_conn_np_read(conn, NULL, 0);
}
static size_t rpcrt4_ncacn_np_get_top_of_tower(unsigned char *tower_data,
@ -1976,38 +1974,38 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
}
for (option = httpc->common.NetworkOptions; option;
option = (strchrW(option, ',') ? strchrW(option, ',')+1 : NULL))
option = (wcschr(option, ',') ? wcschr(option, ',')+1 : NULL))
{
static const WCHAR wszRpcProxy[] = {'R','p','c','P','r','o','x','y','=',0};
static const WCHAR wszHttpProxy[] = {'H','t','t','p','P','r','o','x','y','=',0};
if (!strncmpiW(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
if (!_wcsnicmp(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
{
const WCHAR *value_start = option + ARRAY_SIZE(wszRpcProxy)-1;
const WCHAR *value_end;
const WCHAR *p;
value_end = strchrW(option, ',');
value_end = wcschr(option, ',');
if (!value_end)
value_end = value_start + strlenW(value_start);
value_end = value_start + lstrlenW(value_start);
for (p = value_start; p < value_end; p++)
if (*p == ':')
{
port = atoiW(p+1);
port = wcstol(p+1, NULL, 10);
value_end = p;
break;
}
TRACE("RpcProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
servername = RPCRT4_strndupW(value_start, value_end-value_start);
}
else if (!strncmpiW(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
else if (!_wcsnicmp(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
{
const WCHAR *value_start = option + ARRAY_SIZE(wszHttpProxy)-1;
const WCHAR *value_end;
value_end = strchrW(option, ',');
value_end = wcschr(option, ',');
if (!value_end)
value_end = value_start + strlenW(value_start);
value_end = value_start + lstrlenW(value_start);
TRACE("HttpProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
proxy = RPCRT4_strndupW(value_start, value_end-value_start);
}
@ -2132,7 +2130,7 @@ static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
{'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
WCHAR header[ARRAY_SIZE(fmtW) + 10];
sprintfW(header, fmtW, len);
swprintf(header, fmtW, len);
if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD))) return RPC_S_OK;
return RPC_S_SERVER_UNAVAILABLE;
}
@ -2471,7 +2469,7 @@ static DWORD auth_scheme_from_header( const WCHAR *header )
unsigned int i;
for (i = 0; i < ARRAY_SIZE(auth_schemes); i++)
{
if (!strncmpiW( header, auth_schemes[i].str, auth_schemes[i].len ) &&
if (!_wcsnicmp( header, auth_schemes[i].str, auth_schemes[i].len ) &&
(header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
}
return 0;
@ -2538,7 +2536,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
if (creds->AuthnSchemes[0] == RPC_C_HTTP_AUTHN_SCHEME_NTLM) scheme = ntlmW;
else scheme = negotiateW;
scheme_len = strlenW( scheme );
scheme_len = lstrlenW( scheme );
if (!*auth_ptr)
{
@ -2575,7 +2573,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
p = auth_value + scheme_len;
if (!first && *p == ' ')
{
int len = strlenW(++p);
int len = lstrlenW(++p);
in.cbBuffer = decode_base64(p, len, NULL);
if (!(in.pvBuffer = HeapAlloc(GetProcessHeap(), 0, in.cbBuffer))) break;
decode_base64(p, len, in.pvBuffer);
@ -2843,8 +2841,8 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
memcpy(url, wszRpcProxyPrefix, sizeof(wszRpcProxyPrefix));
MultiByteToWideChar(CP_ACP, 0, Connection->NetworkAddr, -1, url+ARRAY_SIZE(wszRpcProxyPrefix)-1,
strlen(Connection->NetworkAddr)+1);
strcatW(url, wszColon);
MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+strlenW(url), strlen(Connection->Endpoint)+1);
lstrcatW(url, wszColon);
MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+lstrlenW(url), strlen(Connection->Endpoint)+1);
secure = is_secure(httpc);
credentials = has_credentials(httpc);

View File

@ -28,8 +28,6 @@
* NT-based native rpcrt4's. Commonly-used transport for self-to-self RPC's.
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@ -46,7 +44,6 @@
#include "ntsecapi.h"
#include "iptypes.h"
#include "iphlpapi.h"
#include "wine/unicode.h"
#include "rpc.h"
#include "ole2.h"
@ -618,7 +615,7 @@ RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
if (!s) return UuidCreateNil( uuid );
if (strlenW(s) != 36) return RPC_S_INVALID_STRING_UUID;
if (lstrlenW(s) != 36) return RPC_S_INVALID_STRING_UUID;
if ((s[8]!='-') || (s[13]!='-') || (s[18]!='-') || (s[23]!='-'))
return RPC_S_INVALID_STRING_UUID;

View File

@ -161,7 +161,7 @@ dll/win32/rasapi32 # Synced to WineStaging-3.3
dll/win32/resutils # Synced to WineStaging-3.3
dll/win32/riched20 # Synced to WineStaging-4.18
dll/win32/riched32 # Synced to WineStaging-3.3
dll/win32/rpcrt4 # Synced to WineStaging-4.0
dll/win32/rpcrt4 # Synced to WineStaging-4.18
dll/win32/rsabase # Synced to WineStaging-3.3
dll/win32/rsaenh # Synced to WineStaging-2.9
dll/win32/sccbase # Synced to WineStaging-3.3