mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
[OLEAUT32] Sync with Wine Staging 1.7.47. CORE-9924
svn path=/trunk/; revision=68486
This commit is contained in:
@@ -53,9 +53,6 @@ typedef struct ConnectionPointImpl {
|
||||
DWORD nSinks;
|
||||
} ConnectionPointImpl;
|
||||
|
||||
static const IConnectionPointVtbl ConnectionPointImpl_VTable;
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Implementation of IEnumConnections
|
||||
*/
|
||||
@@ -91,26 +88,6 @@ static inline EnumConnectionsImpl *impl_from_IEnumConnections(IEnumConnections *
|
||||
return CONTAINING_RECORD(iface, EnumConnectionsImpl, IEnumConnections_iface);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* ConnectionPointImpl_Construct
|
||||
*/
|
||||
static ConnectionPointImpl *ConnectionPointImpl_Construct(IUnknown *pUnk,
|
||||
REFIID riid)
|
||||
{
|
||||
ConnectionPointImpl *Obj;
|
||||
|
||||
Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
|
||||
Obj->IConnectionPoint_iface.lpVtbl = &ConnectionPointImpl_VTable;
|
||||
Obj->Obj = pUnk;
|
||||
Obj->ref = 1;
|
||||
Obj->iid = *riid;
|
||||
Obj->maxSinks = MAXSINKS;
|
||||
Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(IUnknown*) * MAXSINKS);
|
||||
Obj->nSinks = 0;
|
||||
return Obj;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* ConnectionPointImpl_Destroy
|
||||
*/
|
||||
@@ -128,7 +105,6 @@ static void ConnectionPointImpl_Destroy(ConnectionPointImpl *Obj)
|
||||
return;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ConnectionPointImpl_AddRef(IConnectionPoint* iface);
|
||||
/************************************************************************
|
||||
* ConnectionPointImpl_QueryInterface (IUnknown)
|
||||
*
|
||||
@@ -145,7 +121,7 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface(
|
||||
/*
|
||||
* Perform a sanity check on the parameters.
|
||||
*/
|
||||
if ( (This==0) || (ppvObject==0) )
|
||||
if (!ppvObject)
|
||||
return E_INVALIDARG;
|
||||
|
||||
/*
|
||||
@@ -153,28 +129,20 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface(
|
||||
*/
|
||||
*ppvObject = 0;
|
||||
|
||||
/*
|
||||
* Compare the riid with the interface IDs implemented by this object.
|
||||
*/
|
||||
if (IsEqualIID(&IID_IUnknown, riid))
|
||||
*ppvObject = This;
|
||||
else if (IsEqualIID(&IID_IConnectionPoint, riid))
|
||||
*ppvObject = This;
|
||||
|
||||
if (IsEqualIID(&IID_IConnectionPoint, riid) || IsEqualIID(&IID_IUnknown, riid))
|
||||
*ppvObject = iface;
|
||||
|
||||
/*
|
||||
* Check that we obtained an interface.
|
||||
*/
|
||||
if ((*ppvObject)==0)
|
||||
{
|
||||
FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid));
|
||||
FIXME("() : asking for unsupported interface %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Query Interface always increases the reference count by one when it is
|
||||
* successful
|
||||
*/
|
||||
ConnectionPointImpl_AddRef(&This->IConnectionPoint_iface);
|
||||
IUnknown_AddRef((IUnknown*)*ppvObject);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -330,9 +298,9 @@ static HRESULT WINAPI ConnectionPointImpl_EnumConnections(
|
||||
|
||||
/* Bump the ref count of this object up by one. It gets Released in
|
||||
IEnumConnections_Release */
|
||||
IUnknown_AddRef((IUnknown*)This);
|
||||
IConnectionPoint_AddRef(iface);
|
||||
|
||||
EnumObj = EnumConnectionsImpl_Construct((IUnknown*)This, This->nSinks, pCD);
|
||||
EnumObj = EnumConnectionsImpl_Construct((IUnknown*)iface, This->nSinks, pCD);
|
||||
hr = IEnumConnections_QueryInterface(&EnumObj->IEnumConnections_iface,
|
||||
&IID_IEnumConnections, (void**)ppEnum);
|
||||
IEnumConnections_Release(&EnumObj->IEnumConnections_iface);
|
||||
@@ -355,7 +323,6 @@ static const IConnectionPointVtbl ConnectionPointImpl_VTable =
|
||||
|
||||
|
||||
static const IEnumConnectionsVtbl EnumConnectionsImpl_VTable;
|
||||
static ULONG WINAPI EnumConnectionsImpl_AddRef(IEnumConnections* iface);
|
||||
|
||||
/************************************************************************
|
||||
* EnumConnectionsImpl_Construct
|
||||
@@ -412,7 +379,7 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface(
|
||||
/*
|
||||
* Perform a sanity check on the parameters.
|
||||
*/
|
||||
if ( (This==0) || (ppvObject==0) )
|
||||
if (!ppvObject)
|
||||
return E_INVALIDARG;
|
||||
|
||||
/*
|
||||
@@ -420,28 +387,19 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface(
|
||||
*/
|
||||
*ppvObject = 0;
|
||||
|
||||
/*
|
||||
* Compare the riid with the interface IDs implemented by this object.
|
||||
*/
|
||||
if (IsEqualIID(&IID_IUnknown, riid))
|
||||
*ppvObject = This;
|
||||
else if (IsEqualIID(&IID_IEnumConnections, riid))
|
||||
*ppvObject = This;
|
||||
if (IsEqualIID(&IID_IEnumConnections, riid) || IsEqualIID(&IID_IUnknown, riid))
|
||||
*ppvObject = iface;
|
||||
|
||||
/*
|
||||
* Check that we obtained an interface.
|
||||
*/
|
||||
if ((*ppvObject)==0)
|
||||
{
|
||||
FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid));
|
||||
FIXME("() : asking for unsupported interface %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Query Interface always increases the reference count by one when it is
|
||||
* successful
|
||||
*/
|
||||
EnumConnectionsImpl_AddRef((IEnumConnections*)This);
|
||||
IUnknown_AddRef((IUnknown*)*ppvObject);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -568,7 +526,7 @@ static HRESULT WINAPI EnumConnectionsImpl_Clone(IEnumConnections* iface,
|
||||
|
||||
newObj = EnumConnectionsImpl_Construct(This->pUnk, This->nConns, This->pCD);
|
||||
newObj->nCur = This->nCur;
|
||||
*ppEnum = (LPENUMCONNECTIONS)newObj;
|
||||
*ppEnum = &newObj->IEnumConnections_iface;
|
||||
IUnknown_AddRef(This->pUnk);
|
||||
return S_OK;
|
||||
}
|
||||
@@ -602,13 +560,22 @@ HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid,
|
||||
IConnectionPoint **pCP)
|
||||
{
|
||||
ConnectionPointImpl *Obj;
|
||||
HRESULT hr;
|
||||
|
||||
Obj = ConnectionPointImpl_Construct(pUnk, riid);
|
||||
if(!Obj) return E_OUTOFMEMORY;
|
||||
TRACE("(%p %s %p)\n", pUnk, debugstr_guid(riid), pCP);
|
||||
|
||||
hr = IConnectionPoint_QueryInterface(&Obj->IConnectionPoint_iface,
|
||||
&IID_IConnectionPoint, (void**)pCP);
|
||||
IConnectionPoint_Release(&Obj->IConnectionPoint_iface);
|
||||
return hr;
|
||||
*pCP = NULL;
|
||||
Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
|
||||
if (!Obj)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
Obj->IConnectionPoint_iface.lpVtbl = &ConnectionPointImpl_VTable;
|
||||
Obj->Obj = pUnk;
|
||||
Obj->ref = 1;
|
||||
Obj->iid = *riid;
|
||||
Obj->maxSinks = MAXSINKS;
|
||||
Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IUnknown*) * MAXSINKS);
|
||||
Obj->nSinks = 0;
|
||||
|
||||
*pCP = &Obj->IConnectionPoint_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -201,6 +201,7 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams)
|
||||
if(property_sheet_dialog_data) {
|
||||
if(property_sheet_dialog_data[1] == 0xffff) {
|
||||
ERR("Expected DLGTEMPLATE structure\n");
|
||||
FreeLibrary(hcomctl);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
||||
@@ -503,12 +503,7 @@ static BOOL WINAPI IRecordInfoImpl_IsMatchingType(IRecordInfo *iface, IRecordInf
|
||||
TRACE( "(%p)->(%p)\n", This, info2 );
|
||||
|
||||
IRecordInfo_GetGuid( info2, &guid2 );
|
||||
if (IsEqualGUID( &This->guid, &guid2 )) return TRUE;
|
||||
|
||||
FIXME( "records have different guids (%s %s) but could still match\n",
|
||||
debugstr_guid( &This->guid ), debugstr_guid( &guid2 ) );
|
||||
|
||||
return FALSE;
|
||||
return IsEqualGUID( &This->guid, &guid2 );
|
||||
}
|
||||
|
||||
static PVOID WINAPI IRecordInfoImpl_RecordCreate(IRecordInfo *iface)
|
||||
@@ -642,7 +637,12 @@ HRESULT WINAPI GetRecordInfoFromTypeInfo(ITypeInfo* pTI, IRecordInfo** ppRecInfo
|
||||
WARN("GetRefTypeInfo failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
ITypeInfo_GetTypeAttr(pTypeInfo, &typeattr);
|
||||
hres = ITypeInfo_GetTypeAttr(pTypeInfo, &typeattr);
|
||||
if(FAILED(hres)) {
|
||||
ITypeInfo_Release(pTypeInfo);
|
||||
WARN("GetTypeAttr failed for referenced type: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
}else {
|
||||
pTypeInfo = pTI;
|
||||
ITypeInfo_AddRef(pTypeInfo);
|
||||
|
||||
@@ -242,18 +242,71 @@ PSFacBuf_QueryInterface(LPPSFACTORYBUFFER iface, REFIID iid, LPVOID *ppv) {
|
||||
static ULONG WINAPI PSFacBuf_AddRef(LPPSFACTORYBUFFER iface) { return 2; }
|
||||
static ULONG WINAPI PSFacBuf_Release(LPPSFACTORYBUFFER iface) { return 1; }
|
||||
|
||||
static HRESULT
|
||||
_get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) {
|
||||
HRESULT hres;
|
||||
struct ifacepsredirect_data
|
||||
{
|
||||
ULONG size;
|
||||
DWORD mask;
|
||||
GUID iid;
|
||||
ULONG nummethods;
|
||||
GUID tlbid;
|
||||
GUID base;
|
||||
ULONG name_len;
|
||||
ULONG name_offset;
|
||||
};
|
||||
|
||||
struct tlibredirect_data
|
||||
{
|
||||
ULONG size;
|
||||
DWORD res;
|
||||
ULONG name_len;
|
||||
ULONG name_offset;
|
||||
LANGID langid;
|
||||
WORD flags;
|
||||
ULONG help_len;
|
||||
ULONG help_offset;
|
||||
WORD major_version;
|
||||
WORD minor_version;
|
||||
};
|
||||
|
||||
static BOOL actctx_get_typelib_module(REFIID riid, WCHAR *module, DWORD len)
|
||||
{
|
||||
struct ifacepsredirect_data *iface;
|
||||
struct tlibredirect_data *tlib;
|
||||
ACTCTX_SECTION_KEYED_DATA data;
|
||||
WCHAR *ptrW;
|
||||
|
||||
data.cbSize = sizeof(data);
|
||||
if (!FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION,
|
||||
riid, &data))
|
||||
return FALSE;
|
||||
|
||||
iface = (struct ifacepsredirect_data*)data.lpData;
|
||||
if (!FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION,
|
||||
&iface->tlbid, &data))
|
||||
return FALSE;
|
||||
|
||||
tlib = (struct tlibredirect_data*)data.lpData;
|
||||
ptrW = (WCHAR*)((BYTE*)data.lpSectionBase + tlib->name_offset);
|
||||
|
||||
if (tlib->name_len/sizeof(WCHAR) >= len) {
|
||||
ERR("need larger module buffer, %u\n", tlib->name_len);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memcpy(module, ptrW, tlib->name_len);
|
||||
module[tlib->name_len/sizeof(WCHAR)] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HRESULT reg_get_typelib_module(REFIID riid, WCHAR *module, DWORD len)
|
||||
{
|
||||
HKEY ikey;
|
||||
REGSAM opposite = (sizeof(void*) == 8) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
|
||||
BOOL is_wow64;
|
||||
char tlguid[200],typelibkey[300],interfacekey[300],ver[100];
|
||||
char tlfn[260];
|
||||
OLECHAR tlfnW[260];
|
||||
DWORD tlguidlen, verlen, type;
|
||||
LONG tlfnlen, err;
|
||||
ITypeLib *tl;
|
||||
|
||||
sprintf( interfacekey, "Interface\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\Typelib",
|
||||
riid->Data1, riid->Data2, riid->Data3,
|
||||
@@ -297,19 +350,37 @@ _get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, tlfn, -1, tlfnW, sizeof(tlfnW) / sizeof(tlfnW[0]));
|
||||
hres = LoadTypeLib(tlfnW,&tl);
|
||||
if (hres) {
|
||||
MultiByteToWideChar(CP_ACP, 0, tlfn, -1, module, len);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT
|
||||
_get_typeinfo_for_iid(REFIID riid, ITypeInfo **typeinfo)
|
||||
{
|
||||
OLECHAR moduleW[260];
|
||||
ITypeLib *typelib;
|
||||
HRESULT hres;
|
||||
|
||||
*typeinfo = NULL;
|
||||
|
||||
moduleW[0] = 0;
|
||||
if (!actctx_get_typelib_module(riid, moduleW, sizeof(moduleW)/sizeof(moduleW[0]))) {
|
||||
hres = reg_get_typelib_module(riid, moduleW, sizeof(moduleW)/sizeof(moduleW[0]));
|
||||
if (FAILED(hres))
|
||||
return hres;
|
||||
}
|
||||
|
||||
hres = LoadTypeLib(moduleW, &typelib);
|
||||
if (hres != S_OK) {
|
||||
ERR("Failed to load typelib for %s, but it should be there.\n",debugstr_guid(riid));
|
||||
return hres;
|
||||
}
|
||||
hres = ITypeLib_GetTypeInfoOfGuid(tl,riid,ti);
|
||||
if (hres) {
|
||||
ERR("typelib does not contain info for %s?\n",debugstr_guid(riid));
|
||||
ITypeLib_Release(tl);
|
||||
return hres;
|
||||
}
|
||||
ITypeLib_Release(tl);
|
||||
|
||||
hres = ITypeLib_GetTypeInfoOfGuid(typelib, riid, typeinfo);
|
||||
ITypeLib_Release(typelib);
|
||||
if (hres != S_OK)
|
||||
ERR("typelib does not contain info for %s\n", debugstr_guid(riid));
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
@@ -1714,9 +1785,7 @@ static HRESULT init_proxy_entry_point(TMProxyImpl *proxy, unsigned int num)
|
||||
/* nrofargs including This */
|
||||
int nrofargs = 1;
|
||||
ITypeInfo *tinfo2;
|
||||
#ifdef __i386__
|
||||
TMAsmProxy *xasm = proxy->asmstubs + num;
|
||||
#endif
|
||||
HRESULT hres;
|
||||
const FUNCDESC *fdesc;
|
||||
|
||||
|
||||
@@ -3393,18 +3393,27 @@ static HRESULT TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath
|
||||
|
||||
h = CreateFileW(pszPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if(h != INVALID_HANDLE_VALUE){
|
||||
FILE_NAME_INFORMATION *info;
|
||||
char data[MAX_PATH * sizeof(WCHAR) + sizeof(info->FileNameLength)];
|
||||
FILE_NAME_INFORMATION size_info;
|
||||
BOOL br;
|
||||
|
||||
info = (FILE_NAME_INFORMATION*)data;
|
||||
/* GetFileInformationByHandleEx returns the path of the file without
|
||||
* WOW64 redirection */
|
||||
br = GetFileInformationByHandleEx(h, FileNameInfo, data, sizeof(data));
|
||||
if(br){
|
||||
info->FileName[info->FileNameLength / sizeof(WCHAR)] = 0;
|
||||
lstrcpynW(pszPath + 2, info->FileName, cchPath - 2);
|
||||
br = GetFileInformationByHandleEx(h, FileNameInfo, &size_info, sizeof(size_info));
|
||||
if(br || GetLastError() == ERROR_MORE_DATA){
|
||||
FILE_NAME_INFORMATION *info;
|
||||
DWORD size = sizeof(*info) + size_info.FileNameLength + sizeof(WCHAR);
|
||||
|
||||
info = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
|
||||
br = GetFileInformationByHandleEx(h, FileNameInfo, info, size);
|
||||
if(br){
|
||||
info->FileName[info->FileNameLength / sizeof(WCHAR)] = 0;
|
||||
lstrcpynW(pszPath + 2, info->FileName, cchPath - 2);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, info);
|
||||
}
|
||||
|
||||
CloseHandle(h);
|
||||
}
|
||||
|
||||
@@ -6487,10 +6496,10 @@ __ASM_GLOBAL_FUNC( call_method,
|
||||
"movq 8(%rsp),%rdx\n\t"
|
||||
"movq 16(%rsp),%r8\n\t"
|
||||
"movq 24(%rsp),%r9\n\t"
|
||||
"movq %rcx,%xmm0\n\t"
|
||||
"movq %rdx,%xmm1\n\t"
|
||||
"movq %r8,%xmm2\n\t"
|
||||
"movq %r9,%xmm3\n\t"
|
||||
"movq 0(%rsp),%xmm0\n\t"
|
||||
"movq 8(%rsp),%xmm1\n\t"
|
||||
"movq 16(%rsp),%xmm2\n\t"
|
||||
"movq 24(%rsp),%xmm3\n\t"
|
||||
"callq *%rax\n\t"
|
||||
"leaq -16(%rbp),%rsp\n\t"
|
||||
"popq %rdi\n\t"
|
||||
|
||||
@@ -28,6 +28,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||
#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
|
||||
#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
|
||||
|
||||
/* ole32 exports those, not defined in public headers */
|
||||
ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG*, ULONG, ULONG, IUnknown*, REFIID);
|
||||
unsigned char * __RPC_USER WdtpInterfacePointer_UserMarshal(ULONG*, ULONG, unsigned char*, IUnknown*, REFIID);
|
||||
unsigned char * __RPC_USER WdtpInterfacePointer_UserUnmarshal(ULONG*, unsigned char*, IUnknown**, REFIID);
|
||||
|
||||
static void dump_user_flags(const ULONG *pFlags)
|
||||
{
|
||||
if (HIWORD(*pFlags) == NDR_LOCAL_DATA_REPRESENTATION)
|
||||
@@ -239,21 +244,21 @@ static unsigned int get_type_alignment(ULONG *pFlags, VARTYPE vt)
|
||||
return 7;
|
||||
}
|
||||
|
||||
static unsigned interface_variant_size(const ULONG *pFlags, REFIID riid, IUnknown *punk)
|
||||
/* WdtpInterfacePointer_UserSize takes care of 2 additional DWORDs to store marshalling buffer size */
|
||||
static unsigned interface_variant_size(ULONG *pFlags, REFIID riid, IUnknown *punk)
|
||||
{
|
||||
ULONG size = 0;
|
||||
HRESULT hr;
|
||||
|
||||
if (punk)
|
||||
{
|
||||
hr = CoGetMarshalSizeMax(&size, riid, punk, LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL);
|
||||
if (FAILED(hr))
|
||||
size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), 0, punk, riid);
|
||||
if (!size)
|
||||
{
|
||||
ERR("interface variant buffer size calculation failed, HRESULT=0x%x\n", hr);
|
||||
ERR("interface variant buffer size calculation failed\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
size += sizeof(ULONG); /* we have to store the buffersize in the stream */
|
||||
size += sizeof(ULONG);
|
||||
TRACE("wire-size extra of interface variant is %d\n", size);
|
||||
return size;
|
||||
}
|
||||
@@ -295,116 +300,48 @@ static ULONG wire_extra_user_size(ULONG *pFlags, ULONG Start, VARIANT *pvar)
|
||||
}
|
||||
}
|
||||
|
||||
/* helper: called for VT_DISPATCH variants to marshal the IDispatch* into the buffer. returns Buffer on failure, new position otherwise */
|
||||
static unsigned char* interface_variant_marshal(const ULONG *pFlags, unsigned char *Buffer,
|
||||
/* helper: called for VT_DISPATCH variants to marshal the IDispatch* into the buffer */
|
||||
static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Buffer,
|
||||
REFIID riid, IUnknown *punk)
|
||||
{
|
||||
IStream *working;
|
||||
HGLOBAL working_mem;
|
||||
void *working_memlocked;
|
||||
unsigned char *oldpos;
|
||||
ULONG size;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("pFlags=%d, Buffer=%p, pUnk=%p\n", *pFlags, Buffer, punk);
|
||||
|
||||
/* first DWORD is used to store pointer itself, truncated on win64 */
|
||||
if(!punk)
|
||||
{
|
||||
memset(Buffer, 0, sizeof(ULONG));
|
||||
return Buffer + sizeof(ULONG);
|
||||
}
|
||||
|
||||
oldpos = Buffer;
|
||||
|
||||
/* CoMarshalInterface needs a stream, whereas at this level we are operating in terms of buffers.
|
||||
* We create a stream on an HGLOBAL, so we can simply do a memcpy to move it to the buffer.
|
||||
* in rpcrt4/ndr_ole.c, a simple IStream implementation is wrapped around the buffer object,
|
||||
* but that would be overkill here, hence this implementation. We save the size because the unmarshal
|
||||
* code has no way to know how long the marshalled buffer is. */
|
||||
|
||||
size = interface_variant_size(pFlags, riid, punk);
|
||||
|
||||
working_mem = GlobalAlloc(0, size);
|
||||
if (!working_mem) return oldpos;
|
||||
|
||||
hr = CreateStreamOnHGlobal(working_mem, TRUE, &working);
|
||||
if (hr != S_OK) {
|
||||
GlobalFree(working_mem);
|
||||
return oldpos;
|
||||
}
|
||||
|
||||
hr = CoMarshalInterface(working, riid, punk, LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL);
|
||||
if (hr != S_OK) {
|
||||
IStream_Release(working); /* this also releases the hglobal */
|
||||
return oldpos;
|
||||
else
|
||||
{
|
||||
*(DWORD*)Buffer = (DWORD_PTR)punk;
|
||||
Buffer += sizeof(DWORD);
|
||||
}
|
||||
|
||||
working_memlocked = GlobalLock(working_mem);
|
||||
memcpy(Buffer, &size, sizeof(ULONG)); /* copy the buffersize */
|
||||
memcpy(Buffer + sizeof(ULONG), working_memlocked, size - sizeof(ULONG));
|
||||
GlobalUnlock(working_mem);
|
||||
|
||||
IStream_Release(working);
|
||||
|
||||
/* size includes the ULONG for the size written above */
|
||||
TRACE("done, size=%d\n", size);
|
||||
return Buffer + size;
|
||||
return WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), Buffer, punk, riid);
|
||||
}
|
||||
|
||||
/* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer. returns Buffer on failure, new position otherwise */
|
||||
static unsigned char *interface_variant_unmarshal(const ULONG *pFlags, unsigned char *Buffer,
|
||||
/* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer */
|
||||
static unsigned char *interface_variant_unmarshal(ULONG *pFlags, unsigned char *Buffer,
|
||||
REFIID riid, IUnknown **ppunk)
|
||||
{
|
||||
IStream *working;
|
||||
HGLOBAL working_mem;
|
||||
void *working_memlocked;
|
||||
unsigned char *oldpos;
|
||||
ULONG size;
|
||||
HRESULT hr;
|
||||
DWORD ptr;
|
||||
|
||||
TRACE("pFlags=%d, Buffer=%p, ppUnk=%p\n", *pFlags, Buffer, ppunk);
|
||||
|
||||
oldpos = Buffer;
|
||||
/* skip pointer part itself */
|
||||
ptr = *(DWORD*)Buffer;
|
||||
Buffer += sizeof(DWORD);
|
||||
|
||||
/* get the buffersize */
|
||||
memcpy(&size, Buffer, sizeof(ULONG));
|
||||
TRACE("buffersize=%d\n", size);
|
||||
|
||||
if(!size)
|
||||
if(!ptr)
|
||||
{
|
||||
*ppunk = NULL;
|
||||
return Buffer + sizeof(ULONG);
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
working_mem = GlobalAlloc(0, size);
|
||||
if (!working_mem) return oldpos;
|
||||
|
||||
hr = CreateStreamOnHGlobal(working_mem, TRUE, &working);
|
||||
if (hr != S_OK) {
|
||||
GlobalFree(working_mem);
|
||||
return oldpos;
|
||||
}
|
||||
|
||||
working_memlocked = GlobalLock(working_mem);
|
||||
|
||||
/* now we copy the contents of the marshalling buffer to working_memlocked, unlock it, and demarshal the stream */
|
||||
memcpy(working_memlocked, Buffer + sizeof(ULONG), size);
|
||||
GlobalUnlock(working_mem);
|
||||
|
||||
hr = CoUnmarshalInterface(working, riid, (void**)ppunk);
|
||||
if (hr != S_OK) {
|
||||
IStream_Release(working);
|
||||
return oldpos;
|
||||
}
|
||||
|
||||
IStream_Release(working); /* this also frees the underlying hglobal */
|
||||
|
||||
/* size includes the ULONG for the size written above */
|
||||
TRACE("done, processed=%d bytes\n", size);
|
||||
return Buffer + size;
|
||||
return WdtpInterfacePointer_UserUnmarshal(pFlags, Buffer, ppunk, riid);
|
||||
}
|
||||
|
||||
|
||||
ULONG WINAPI VARIANT_UserSize(ULONG *pFlags, ULONG Start, VARIANT *pvar)
|
||||
{
|
||||
int align;
|
||||
@@ -502,19 +439,15 @@ unsigned char * WINAPI VARIANT_UserMarshal(ULONG *pFlags, unsigned char *Buffer,
|
||||
Pos = VARIANT_UserMarshal(pFlags, Pos, V_VARIANTREF(pvar));
|
||||
break;
|
||||
case VT_UNKNOWN:
|
||||
/* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
|
||||
Pos = interface_variant_marshal(pFlags, Pos, &IID_IUnknown, V_UNKNOWN(pvar));
|
||||
break;
|
||||
case VT_UNKNOWN | VT_BYREF:
|
||||
/* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
|
||||
Pos = interface_variant_marshal(pFlags, Pos, &IID_IUnknown, *V_UNKNOWNREF(pvar));
|
||||
break;
|
||||
case VT_DISPATCH:
|
||||
/* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
|
||||
Pos = interface_variant_marshal(pFlags, Pos, &IID_IDispatch, (IUnknown*)V_DISPATCH(pvar));
|
||||
break;
|
||||
case VT_DISPATCH | VT_BYREF:
|
||||
/* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */
|
||||
Pos = interface_variant_marshal(pFlags, Pos, &IID_IDispatch, (IUnknown*)*V_DISPATCHREF(pvar));
|
||||
break;
|
||||
case VT_RECORD:
|
||||
@@ -617,19 +550,15 @@ unsigned char * WINAPI VARIANT_UserUnmarshal(ULONG *pFlags, unsigned char *Buffe
|
||||
Pos = VARIANT_UserUnmarshal(pFlags, Pos, V_VARIANTREF(pvar));
|
||||
break;
|
||||
case VT_UNKNOWN:
|
||||
/* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
|
||||
Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IUnknown, &V_UNKNOWN(pvar));
|
||||
break;
|
||||
case VT_UNKNOWN | VT_BYREF:
|
||||
/* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
|
||||
Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IUnknown, V_UNKNOWNREF(pvar));
|
||||
break;
|
||||
case VT_DISPATCH:
|
||||
/* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
|
||||
Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IDispatch, (IUnknown**)&V_DISPATCH(pvar));
|
||||
break;
|
||||
case VT_DISPATCH | VT_BYREF:
|
||||
/* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */
|
||||
Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IDispatch, (IUnknown**)V_DISPATCHREF(pvar));
|
||||
break;
|
||||
case VT_RECORD:
|
||||
@@ -2256,8 +2185,14 @@ HRESULT CALLBACK IEnumConnections_Next_Proxy(
|
||||
LPCONNECTDATA rgcd,
|
||||
ULONG *pcFetched)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
ULONG fetched;
|
||||
|
||||
TRACE("(%u, %p %p)\n", cConnections, rgcd, pcFetched);
|
||||
|
||||
if (!pcFetched)
|
||||
pcFetched = &fetched;
|
||||
|
||||
return IEnumConnections_RemoteNext_Proxy(This, cConnections, rgcd, pcFetched);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IEnumConnections_Next_Stub(
|
||||
@@ -2266,28 +2201,50 @@ HRESULT __RPC_STUB IEnumConnections_Next_Stub(
|
||||
LPCONNECTDATA rgcd,
|
||||
ULONG *pcFetched)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%u, %p, %p)\n", cConnections, rgcd, pcFetched);
|
||||
|
||||
*pcFetched = 0;
|
||||
hr = IEnumConnections_Next(This, cConnections, rgcd, pcFetched);
|
||||
if (hr == S_OK)
|
||||
*pcFetched = cConnections;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CALLBACK IEnumConnectionPoints_Next_Proxy(
|
||||
IEnumConnectionPoints* This,
|
||||
ULONG cConnections,
|
||||
LPCONNECTIONPOINT *ppCP,
|
||||
IConnectionPoint **ppCP,
|
||||
ULONG *pcFetched)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
ULONG fetched;
|
||||
|
||||
TRACE("(%u, %p %p)\n", cConnections, ppCP, pcFetched);
|
||||
|
||||
if (!pcFetched)
|
||||
pcFetched = &fetched;
|
||||
|
||||
return IEnumConnectionPoints_RemoteNext_Proxy(This, cConnections, ppCP, pcFetched);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IEnumConnectionPoints_Next_Stub(
|
||||
IEnumConnectionPoints* This,
|
||||
ULONG cConnections,
|
||||
LPCONNECTIONPOINT *ppCP,
|
||||
IConnectionPoint **ppCP,
|
||||
ULONG *pcFetched)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%u, %p, %p)\n", cConnections, ppCP, pcFetched);
|
||||
|
||||
*pcFetched = 0;
|
||||
hr = IEnumConnectionPoints_Next(This, cConnections, ppCP, pcFetched);
|
||||
if (hr == S_OK)
|
||||
*pcFetched = cConnections;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CALLBACK IPersistMemory_Load_Proxy(
|
||||
@@ -2295,8 +2252,12 @@ HRESULT CALLBACK IPersistMemory_Load_Proxy(
|
||||
LPVOID pMem,
|
||||
ULONG cbSize)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p, %u)\n", pMem, cbSize);
|
||||
|
||||
if (!pMem)
|
||||
return E_POINTER;
|
||||
|
||||
return IPersistMemory_RemoteLoad_Proxy(This, pMem, cbSize);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IPersistMemory_Load_Stub(
|
||||
@@ -2304,8 +2265,8 @@ HRESULT __RPC_STUB IPersistMemory_Load_Stub(
|
||||
BYTE *pMem,
|
||||
ULONG cbSize)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p, %u)\n", pMem, cbSize);
|
||||
return IPersistMemory_Load(This, pMem, cbSize);
|
||||
}
|
||||
|
||||
HRESULT CALLBACK IPersistMemory_Save_Proxy(
|
||||
@@ -2314,8 +2275,12 @@ HRESULT CALLBACK IPersistMemory_Save_Proxy(
|
||||
BOOL fClearDirty,
|
||||
ULONG cbSize)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p, %d, %u)\n", pMem, fClearDirty, cbSize);
|
||||
|
||||
if (!pMem)
|
||||
return E_POINTER;
|
||||
|
||||
return IPersistMemory_RemoteSave_Proxy(This, pMem, fClearDirty, cbSize);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IPersistMemory_Save_Stub(
|
||||
@@ -2324,23 +2289,25 @@ HRESULT __RPC_STUB IPersistMemory_Save_Stub(
|
||||
BOOL fClearDirty,
|
||||
ULONG cbSize)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p, %d, %u)\n", pMem, fClearDirty, cbSize);
|
||||
return IPersistMemory_Save(This, pMem, fClearDirty, cbSize);
|
||||
}
|
||||
|
||||
void CALLBACK IAdviseSinkEx_OnViewStatusChange_Proxy(
|
||||
IAdviseSinkEx* This,
|
||||
DWORD dwViewStatus)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
TRACE("(%p, 0x%08x)\n", This, dwViewStatus);
|
||||
IAdviseSinkEx_RemoteOnViewStatusChange_Proxy(This, dwViewStatus);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IAdviseSinkEx_OnViewStatusChange_Stub(
|
||||
IAdviseSinkEx* This,
|
||||
DWORD dwViewStatus)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p, 0x%08x)\n", This, dwViewStatus);
|
||||
IAdviseSinkEx_OnViewStatusChange(This, dwViewStatus);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CALLBACK IEnumOleUndoUnits_Next_Proxy(
|
||||
@@ -2349,8 +2316,14 @@ HRESULT CALLBACK IEnumOleUndoUnits_Next_Proxy(
|
||||
IOleUndoUnit **rgElt,
|
||||
ULONG *pcEltFetched)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
ULONG fetched;
|
||||
|
||||
TRACE("(%u, %p %p)\n", cElt, rgElt, pcEltFetched);
|
||||
|
||||
if (!pcEltFetched)
|
||||
pcEltFetched = &fetched;
|
||||
|
||||
return IEnumOleUndoUnits_RemoteNext_Proxy(This, cElt, rgElt, pcEltFetched);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IEnumOleUndoUnits_Next_Stub(
|
||||
@@ -2359,8 +2332,16 @@ HRESULT __RPC_STUB IEnumOleUndoUnits_Next_Stub(
|
||||
IOleUndoUnit **rgElt,
|
||||
ULONG *pcEltFetched)
|
||||
{
|
||||
FIXME("not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%u, %p, %p)\n", cElt, rgElt, pcEltFetched);
|
||||
|
||||
*pcEltFetched = 0;
|
||||
hr = IEnumOleUndoUnits_Next(This, cElt, rgElt, pcEltFetched);
|
||||
if (hr == S_OK)
|
||||
*pcEltFetched = cElt;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CALLBACK IQuickActivate_QuickActivate_Proxy(
|
||||
|
||||
@@ -270,8 +270,6 @@ typedef struct tagFMT_DATE_HEADER
|
||||
#define FMT_NUM_ON_OFF 0x3F /* Convert to "On" or "Off" */
|
||||
#define FMT_STR_COPY_SPACE 0x40 /* Copy len chars with space if no char */
|
||||
#define FMT_STR_COPY_SKIP 0x41 /* Copy len chars or skip if no char */
|
||||
/* Wine additions */
|
||||
#define FMT_WINE_HOURS_12 0x81 /* Hours using 12 hour clock */
|
||||
|
||||
/* Named Formats and their tokenised values */
|
||||
static const WCHAR szGeneralDate[] = { 'G','e','n','e','r','a','l',' ','D','a','t','e','\0' };
|
||||
|
||||
@@ -3931,9 +3931,6 @@ HRESULT WINAPI VarSub(LPVARIANT left, LPVARIANT right, LPVARIANT result)
|
||||
case VT_I2:
|
||||
V_I2(result) = V_I2(&lv) - V_I2(&rv);
|
||||
break;
|
||||
case VT_I1:
|
||||
V_I1(result) = V_I1(&lv) - V_I1(&rv);
|
||||
break;
|
||||
case VT_UI1:
|
||||
V_UI1(result) = V_UI2(&lv) - V_UI1(&rv);
|
||||
break;
|
||||
|
||||
@@ -112,7 +112,7 @@ typedef struct tagVARIANT_NUMBER_CHARS
|
||||
WCHAR cCurrencyDigitSeparator;
|
||||
} VARIANT_NUMBER_CHARS;
|
||||
|
||||
unsigned int get_type_size(ULONG*, VARTYPE);
|
||||
unsigned int get_type_size(ULONG*, VARTYPE) DECLSPEC_HIDDEN;
|
||||
BOOL VARIANT_GetLocalisedText(LANGID, DWORD, WCHAR *) DECLSPEC_HIDDEN;
|
||||
HRESULT VARIANT_ClearInd(VARIANTARG *) DECLSPEC_HIDDEN;
|
||||
BOOL get_date_format(LCID, DWORD, const SYSTEMTIME *,
|
||||
|
||||
@@ -4138,8 +4138,6 @@ HRESULT WINAPI VarDecFromI4(LONG lIn, DECIMAL* pDecOut)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define LOCALE_EN_US (MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT))
|
||||
|
||||
/* internal representation of the value stored in a DECIMAL. The bytes are
|
||||
stored from LSB at index 0 to MSB at index 11
|
||||
*/
|
||||
|
||||
@@ -147,7 +147,7 @@ reactos/dll/win32/odbc32 # Synced to WineStaging-1.7.37. Depends on
|
||||
reactos/dll/win32/odbccp32 # Synced to WineStaging-1.7.47
|
||||
reactos/dll/win32/ole32 # Synced to WineStaging-1.7.47
|
||||
reactos/dll/win32/oleacc # Synced to WineStaging-1.7.47
|
||||
reactos/dll/win32/oleaut32 # Synced to WineStaging-1.7.37
|
||||
reactos/dll/win32/oleaut32 # Synced to WineStaging-1.7.47
|
||||
reactos/dll/win32/olecli32 # Synced to WineStaging-1.7.37
|
||||
reactos/dll/win32/oledlg # Synced to WineStaging-1.7.37
|
||||
reactos/dll/win32/olepro32 # Synced to WineStaging-1.7.37
|
||||
|
||||
Reference in New Issue
Block a user