- Sync ole32, oleaut32 with Wine 1.1.22

svn path=/trunk/; revision=41063
This commit is contained in:
Dmitry Chapyshev 2009-05-23 10:25:54 +00:00
parent 30f5bab35b
commit 3d634e9320
6 changed files with 408 additions and 233 deletions

View file

@ -56,6 +56,7 @@
#include "ole2.h"
#include "ole2ver.h"
#include "ctxtcall.h"
#include "dde.h"
#include "compobj_private.h"
@ -3525,7 +3526,8 @@ static BOOL COM_PeekMessage(struct apartment *apt, MSG *msg)
/* first try to retrieve messages for incoming COM calls to the apartment window */
return PeekMessageW(msg, apt->win, WM_USER, WM_APP - 1, PM_REMOVE|PM_NOYIELD) ||
/* next retrieve other messages necessary for the app to remain responsive */
PeekMessageW(msg, NULL, 0, 0, PM_QS_PAINT|PM_QS_POSTMESSAGE|PM_REMOVE|PM_NOYIELD);
PeekMessageW(msg, NULL, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE|PM_NOYIELD) ||
PeekMessageW(msg, NULL, 0, 0, PM_QS_PAINT|PM_QS_SENDMESSAGE|PM_REMOVE|PM_NOYIELD);
}
/***********************************************************************

View file

@ -84,6 +84,75 @@ HRESULT WINAPI OleQueryCreateFromData(IDataObject *data)
return found_static ? OLE_S_STATIC : S_FALSE;
}
static inline void init_fmtetc(FORMATETC *fmt, CLIPFORMAT cf, TYMED tymed)
{
fmt->cfFormat = cf;
fmt->ptd = NULL;
fmt->dwAspect = DVASPECT_CONTENT;
fmt->lindex = -1;
fmt->tymed = tymed;
}
/***************************************************************************
* get_storage
*
* Retrieve an object's storage from a variety of sources.
*
* FIXME: CF_FILENAME.
*/
static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf)
{
HRESULT hr;
FORMATETC fmt;
STGMEDIUM med;
IPersistStorage *persist;
CLSID clsid;
*src_cf = 0;
/* CF_EMBEDEDOBJECT */
init_fmtetc(&fmt, embedded_object_clipboard_format, TYMED_ISTORAGE);
med.tymed = TYMED_ISTORAGE;
med.u.pstg = stg;
hr = IDataObject_GetDataHere(data, &fmt, &med);
if(SUCCEEDED(hr))
{
*src_cf = embedded_object_clipboard_format;
return hr;
}
/* CF_EMBEDSOURCE */
init_fmtetc(&fmt, embed_source_clipboard_format, TYMED_ISTORAGE);
med.tymed = TYMED_ISTORAGE;
med.u.pstg = stg;
hr = IDataObject_GetDataHere(data, &fmt, &med);
if(SUCCEEDED(hr))
{
*src_cf = embed_source_clipboard_format;
return hr;
}
/* IPersistStorage */
hr = IDataObject_QueryInterface(data, &IID_IPersistStorage, (void**)&persist);
if(FAILED(hr)) return hr;
hr = IPersistStorage_GetClassID(persist, &clsid);
if(FAILED(hr)) goto end;
hr = IStorage_SetClass(stg, &clsid);
if(FAILED(hr)) goto end;
hr = IPersistStorage_Save(persist, stg, FALSE);
if(FAILED(hr)) goto end;
hr = IPersistStorage_SaveCompleted(persist, NULL);
end:
IPersistStorage_Release(persist);
return hr;
}
/******************************************************************************
* OleCreateFromDataEx [OLE32.@]
*
@ -91,125 +160,40 @@ HRESULT WINAPI OleQueryCreateFromData(IDataObject *data)
* the clipboard or OLE drag and drop.
*/
HRESULT WINAPI OleCreateFromDataEx(IDataObject *data, REFIID iid, DWORD flags,
DWORD renderopt, ULONG num_fmts, DWORD *adv_flags, FORMATETC *fmts,
DWORD renderopt, ULONG num_cache_fmts, DWORD *adv_flags, FORMATETC *cache_fmts,
IAdviseSink *sink, DWORD *conns,
IOleClientSite *client_site, IStorage *stg, void **obj)
{
HRESULT hr;
UINT src_cf;
FIXME("(%p, %s, %08x, %08x, %d, %p, %p, %p, %p, %p, %p, %p): stub\n",
data, debugstr_guid(iid), flags, renderopt, num_fmts, adv_flags, fmts,
data, debugstr_guid(iid), flags, renderopt, num_cache_fmts, adv_flags, cache_fmts,
sink, conns, client_site, stg, obj);
return E_NOTIMPL;
hr = get_storage(data, stg, &src_cf);
if(FAILED(hr)) return hr;
hr = OleLoad(stg, iid, client_site, obj);
if(FAILED(hr)) return hr;
/* FIXME: Init cache */
return hr;
}
/******************************************************************************
* OleCreateFromData [OLE32.@]
*
* Author : Abey George
* Creates an embedded object from data transfer object retrieved from
* the clipboard or OLE drag and drop.
* Returns : S_OK - Embedded object was created successfully.
* OLE_E_STATIC - OLE can create only a static object
* DV_E_FORMATETC - No acceptable format is available (only error return code)
* TODO : CF_FILENAME, CF_EMBEDEDOBJECT formats. Parameter renderopt is currently ignored.
*/
HRESULT WINAPI OleCreateFromData(LPDATAOBJECT pSrcDataObject, REFIID riid,
DWORD renderopt, LPFORMATETC pFormatEtc,
LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,
LPVOID* ppvObj)
HRESULT WINAPI OleCreateFromData(LPDATAOBJECT data, REFIID iid,
DWORD renderopt, LPFORMATETC fmt,
LPOLECLIENTSITE client_site, LPSTORAGE stg,
LPVOID* obj)
{
IEnumFORMATETC *pfmt;
FORMATETC fmt;
CHAR szFmtName[MAX_CLIPFORMAT_NAME];
STGMEDIUM std;
HRESULT hr;
HRESULT hr1;
DWORD advf = ADVF_PRIMEFIRST;
hr = IDataObject_EnumFormatEtc(pSrcDataObject, DATADIR_GET, &pfmt);
if (hr == S_OK)
{
memset(&std, 0, sizeof(STGMEDIUM));
hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL);
while (hr == S_OK)
{
GetClipboardFormatNameA(fmt.cfFormat, szFmtName, MAX_CLIPFORMAT_NAME-1);
/* first, Check for Embedded Object, Embed Source or Filename */
/* TODO: Currently checks only for Embed Source. */
if (!strcmp(szFmtName, CF_EMBEDSOURCE))
{
std.tymed = TYMED_HGLOBAL;
if ((hr1 = IDataObject_GetData(pSrcDataObject, &fmt, &std)) == S_OK)
{
ILockBytes *ptrILockBytes = 0;
IStorage *pStorage = 0;
IOleObject *pOleObject = 0;
IPersistStorage *pPersistStorage = 0;
CLSID clsID;
/* Create ILock bytes */
hr1 = CreateILockBytesOnHGlobal(std.u.hGlobal, FALSE, &ptrILockBytes);
/* Open storage on the ILock bytes */
if (hr1 == S_OK)
hr1 = StgOpenStorageOnILockBytes(ptrILockBytes, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &pStorage);
/* Get Class ID from the opened storage */
if (hr1 == S_OK)
hr1 = ReadClassStg(pStorage, &clsID);
/* Create default handler for Persist storage */
if (hr1 == S_OK)
hr1 = OleCreateDefaultHandler(&clsID, NULL, &IID_IPersistStorage, (LPVOID*)&pPersistStorage);
/* Load the storage to Persist storage */
if (hr1 == S_OK)
hr1 = IPersistStorage_Load(pPersistStorage, pStorage);
/* Query for IOleObject */
if (hr1 == S_OK)
hr1 = IPersistStorage_QueryInterface(pPersistStorage, &IID_IOleObject, (LPVOID*)&pOleObject);
/* Set client site with the IOleObject */
if (hr1 == S_OK)
hr1 = IOleObject_SetClientSite(pOleObject, pClientSite);
IPersistStorage_Release(pPersistStorage);
/* Query for the requested interface */
if (hr1 == S_OK)
hr1 = IPersistStorage_QueryInterface(pPersistStorage, riid, ppvObj);
IPersistStorage_Release(pPersistStorage);
IStorage_Release(pStorage);
if (hr1 == S_OK)
return S_OK;
}
/* Return error */
return DV_E_FORMATETC;
}
hr = IEnumFORMATETC_Next(pfmt, 1, &fmt, NULL);
}
}
return DV_E_FORMATETC;
return OleCreateFromDataEx(data, iid, 0, renderopt, fmt ? 1 : 0, fmt ? &advf : NULL,
fmt, NULL, NULL, client_site, stg, obj);
}

View file

@ -1378,19 +1378,25 @@ ULONG __RPC_USER HMETAFILEPICT_UserSize(ULONG *pFlags, ULONG StartingSize, HMETA
TRACE("(%s, %d, &%p)\n", debugstr_user_flags(pFlags), StartingSize, *phMfp);
size += sizeof(ULONG);
size += sizeof(HMETAFILEPICT);
if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
if(LOWORD(*pFlags) == MSHCTX_INPROC)
size += sizeof(HMETAFILEPICT);
else
{
METAFILEPICT *mfpict = GlobalLock(*phMfp);
/* FIXME: raise an exception if mfpict is NULL? */
size += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
size += sizeof(ULONG);
size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF);
if (*phMfp)
{
METAFILEPICT *mfpict = GlobalLock(*phMfp);
GlobalUnlock(*phMfp);
/* FIXME: raise an exception if mfpict is NULL? */
size += 3 * sizeof(ULONG);
size += sizeof(ULONG);
size = HMETAFILE_UserSize(pFlags, size, &mfpict->hMF);
GlobalUnlock(*phMfp);
}
}
return size;
@ -1420,32 +1426,40 @@ unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal(ULONG *pFlags, unsigned cha
TRACE("(%s, %p, &%p)\n", debugstr_user_flags(pFlags), pBuffer, *phMfp);
if (LOWORD(*pFlags) == MSHCTX_INPROC)
*(ULONG *)pBuffer = WDT_INPROC_CALL;
else
*(ULONG *)pBuffer = WDT_REMOTE_CALL;
pBuffer += sizeof(ULONG);
*(HMETAFILEPICT *)pBuffer = *phMfp;
pBuffer += sizeof(HMETAFILEPICT);
if ((LOWORD(*pFlags) != MSHCTX_INPROC) && *phMfp)
{
METAFILEPICT *mfpict = GlobalLock(*phMfp);
remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer;
/* FIXME: raise an exception if mfpict is NULL? */
remmfpict->mm = mfpict->mm;
remmfpict->xExt = mfpict->xExt;
remmfpict->yExt = mfpict->yExt;
pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
*(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX;
if (sizeof(HMETAFILEPICT) == 8)
*(ULONG *)pBuffer = WDT_INPROC64_CALL;
else
*(ULONG *)pBuffer = WDT_INPROC_CALL;
pBuffer += sizeof(ULONG);
*(HMETAFILEPICT *)pBuffer = *phMfp;
pBuffer += sizeof(HMETAFILEPICT);
}
else
{
*(ULONG *)pBuffer = WDT_REMOTE_CALL;
pBuffer += sizeof(ULONG);
*(ULONG *)pBuffer = (ULONG)(ULONG_PTR)*phMfp;
pBuffer += sizeof(ULONG);
pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF);
if (*phMfp)
{
METAFILEPICT *mfpict = GlobalLock(*phMfp);
remoteMETAFILEPICT * remmfpict = (remoteMETAFILEPICT *)pBuffer;
GlobalUnlock(*phMfp);
/* FIXME: raise an exception if mfpict is NULL? */
remmfpict->mm = mfpict->mm;
remmfpict->xExt = mfpict->xExt;
remmfpict->yExt = mfpict->yExt;
pBuffer += 3 * sizeof(ULONG);
*(ULONG *)pBuffer = USER_MARSHAL_PTR_PREFIX;
pBuffer += sizeof(ULONG);
pBuffer = HMETAFILE_UserMarshal(pFlags, pBuffer, &mfpict->hMF);
GlobalUnlock(*phMfp);
}
}
return pBuffer;
}
@ -1477,40 +1491,45 @@ unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *pFlags, unsigned c
fContext = *(ULONG *)pBuffer;
pBuffer += sizeof(ULONG);
if ((fContext == WDT_INPROC_CALL) || !*(HMETAFILEPICT *)pBuffer)
if ((fContext == WDT_INPROC_CALL) || fContext == WDT_INPROC64_CALL)
{
*phMfp = *(HMETAFILEPICT *)pBuffer;
pBuffer += sizeof(HMETAFILEPICT);
}
else
{
METAFILEPICT *mfpict;
const remoteMETAFILEPICT *remmfpict;
ULONG user_marshal_prefix;
pBuffer += sizeof(HMETAFILEPICT);
remmfpict = (const remoteMETAFILEPICT *)pBuffer;
*phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
if (!*phMfp)
RpcRaiseException(E_OUTOFMEMORY);
mfpict = GlobalLock(*phMfp);
mfpict->mm = remmfpict->mm;
mfpict->xExt = remmfpict->xExt;
mfpict->yExt = remmfpict->yExt;
pBuffer += FIELD_OFFSET(remoteMETAFILEPICT, hMF);
user_marshal_prefix = *(ULONG *)pBuffer;
ULONG handle = *(ULONG *)pBuffer;
pBuffer += sizeof(ULONG);
*phMfp = NULL;
if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX)
RpcRaiseException(RPC_X_INVALID_TAG);
if(handle)
{
METAFILEPICT *mfpict;
const remoteMETAFILEPICT *remmfpict;
ULONG user_marshal_prefix;
pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF);
remmfpict = (const remoteMETAFILEPICT *)pBuffer;
GlobalUnlock(*phMfp);
*phMfp = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
if (!*phMfp)
RpcRaiseException(E_OUTOFMEMORY);
mfpict = GlobalLock(*phMfp);
mfpict->mm = remmfpict->mm;
mfpict->xExt = remmfpict->xExt;
mfpict->yExt = remmfpict->yExt;
pBuffer += 3 * sizeof(ULONG);
user_marshal_prefix = *(ULONG *)pBuffer;
pBuffer += sizeof(ULONG);
if (user_marshal_prefix != USER_MARSHAL_PTR_PREFIX)
RpcRaiseException(RPC_X_INVALID_TAG);
pBuffer = HMETAFILE_UserUnmarshal(pFlags, pBuffer, &mfpict->hMF);
GlobalUnlock(*phMfp);
}
}
return pBuffer;
}
@ -1570,10 +1589,19 @@ void __RPC_USER HMETAFILEPICT_UserFree(ULONG *pFlags, HMETAFILEPICT *phMfp)
* pFlags, it actually takes a pointer to a USER_MARSHAL_CB structure, of which
* the first parameter is a ULONG.
*/
ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, IUnknown *punk, ULONG StartingSize, REFIID riid)
ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, ULONG StartingSize, IUnknown *punk, REFIID riid)
{
FIXME("(%s, 0%x, %p, %d, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, punk, StartingSize, debugstr_guid(riid));
return 0;
DWORD marshal_size = 0;
HRESULT hr;
TRACE("(%s, 0%x, %d, %p, %s)\n", debugstr_user_flags(pFlags), RealFlags, StartingSize, punk, debugstr_guid(riid));
hr = CoGetMarshalSizeMax(&marshal_size, riid, punk, LOWORD(RealFlags), NULL, MSHLFLAGS_NORMAL);
if(FAILED(hr)) return StartingSize;
ALIGN_LENGTH(StartingSize, 3);
StartingSize += 2 * sizeof(DWORD);
return StartingSize + marshal_size;
}
/******************************************************************************
@ -1598,8 +1626,40 @@ ULONG __RPC_USER WdtpInterfacePointer_UserSize(ULONG *pFlags, ULONG RealFlags, I
*/
unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG RealFlags, unsigned char *pBuffer, IUnknown *punk, REFIID riid)
{
FIXME("(%s, 0x%x, %p, &%p, %s): stub\n", debugstr_user_flags(pFlags), RealFlags, pBuffer, punk, debugstr_guid(riid));
return NULL;
HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, 0);
IStream *stm;
DWORD size;
void *ptr;
TRACE("(%s, 0x%x, %p, &%p, %s)\n", debugstr_user_flags(pFlags), RealFlags, pBuffer, punk, debugstr_guid(riid));
if(!h) return NULL;
if(CreateStreamOnHGlobal(h, TRUE, &stm) != S_OK)
{
GlobalFree(h);
return NULL;
}
if(CoMarshalInterface(stm, riid, punk, LOWORD(RealFlags), NULL, MSHLFLAGS_NORMAL) != S_OK)
{
IStream_Release(stm);
return NULL;
}
ALIGN_POINTER(pBuffer, 3);
size = GlobalSize(h);
*(DWORD *)pBuffer = size;
pBuffer += sizeof(DWORD);
*(DWORD *)pBuffer = size;
pBuffer += sizeof(DWORD);
ptr = GlobalLock(h);
memcpy(pBuffer, ptr, size);
GlobalUnlock(h);
IStream_Release(stm);
return pBuffer + size;
}
/******************************************************************************
@ -1623,24 +1683,61 @@ unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG Rea
*/
unsigned char * WINAPI WdtpInterfacePointer_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffer, IUnknown **ppunk, REFIID riid)
{
FIXME("(%s, %p, %p, %s): stub\n", debugstr_user_flags(pFlags), pBuffer, ppunk, debugstr_guid(riid));
return NULL;
HRESULT hr;
HGLOBAL h;
IStream *stm;
DWORD size;
void *ptr;
TRACE("(%s, %p, %p, %s)\n", debugstr_user_flags(pFlags), pBuffer, ppunk, debugstr_guid(riid));
ALIGN_POINTER(pBuffer, 3);
size = *(DWORD *)pBuffer;
pBuffer += sizeof(DWORD);
if(size != *(DWORD *)pBuffer)
RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL);
pBuffer += sizeof(DWORD);
/* FIXME: sanity check on size */
h = GlobalAlloc(GMEM_MOVEABLE, size);
if(!h) RaiseException(RPC_X_NO_MEMORY, 0, 0, NULL);
if(CreateStreamOnHGlobal(h, TRUE, &stm) != S_OK)
{
GlobalFree(h);
RaiseException(RPC_X_NO_MEMORY, 0, 0, NULL);
}
ptr = GlobalLock(h);
memcpy(ptr, pBuffer, size);
GlobalUnlock(h);
hr = CoUnmarshalInterface(stm, riid, (void**)ppunk);
IStream_Release(stm);
if(hr != S_OK) RaiseException(hr, 0, 0, NULL);
return pBuffer + size;
}
/******************************************************************************
* WdtpInterfacePointer_UserFree [OLE32.@]
*
* Frees an unmarshaled interface pointer.
* Releases an unmarshaled interface pointer.
*
* PARAMS
* punk [I] Interface pointer to free.
* punk [I] Interface pointer to release.
*
* RETURNS
* Nothing.
*/
void WINAPI WdtpInterfacePointer_UserFree(IUnknown *punk)
{
FIXME("(%p): stub\n", punk);
TRACE("(%p)\n", punk);
if(punk) IUnknown_Release(punk);
}
/******************************************************************************
@ -1698,14 +1795,20 @@ ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM
TRACE("TYMED_ISTREAM\n");
if (pStgMedium->u.pstm)
{
FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm);
IUnknown *unk;
IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk);
size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStream);
IUnknown_Release(unk);
}
break;
case TYMED_ISTORAGE:
TRACE("TYMED_ISTORAGE\n");
if (pStgMedium->u.pstg)
{
FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg);
IUnknown *unk;
IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk);
size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, unk, &IID_IStorage);
IUnknown_Release(unk);
}
break;
case TYMED_GDI:
@ -1730,7 +1833,7 @@ ULONG __RPC_USER STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, STGMEDIUM
}
if (pStgMedium->pUnkForRelease)
FIXME("buffer size pUnkForRelease\n");
size = WdtpInterfacePointer_UserSize(pFlags, LOWORD(*pFlags), size, pStgMedium->pUnkForRelease, &IID_IUnknown);
return size;
}
@ -1804,14 +1907,20 @@ unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *p
TRACE("TYMED_ISTREAM\n");
if (pStgMedium->u.pstm)
{
FIXME("not implemented for IStream %p\n", pStgMedium->u.pstm);
IUnknown *unk;
IStream_QueryInterface(pStgMedium->u.pstm, &IID_IUnknown, (void**)&unk);
pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStream);
IUnknown_Release(unk);
}
break;
case TYMED_ISTORAGE:
TRACE("TYMED_ISTORAGE\n");
if (pStgMedium->u.pstg)
{
FIXME("not implemented for IStorage %p\n", pStgMedium->u.pstg);
IUnknown *unk;
IStorage_QueryInterface(pStgMedium->u.pstg, &IID_IUnknown, (void**)&unk);
pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, unk, &IID_IStorage);
IUnknown_Release(unk);
}
break;
case TYMED_GDI:
@ -1836,7 +1945,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserMarshal(ULONG *pFlags, unsigned char *p
}
if (pStgMedium->pUnkForRelease)
FIXME("marshal pUnkForRelease\n");
pBuffer = WdtpInterfacePointer_UserMarshal(pFlags, LOWORD(*pFlags), pBuffer, pStgMedium->pUnkForRelease, &IID_IUnknown);
return pBuffer;
}
@ -1932,7 +2041,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char
TRACE("TYMED_ISTREAM\n");
if (content)
{
FIXME("not implemented for IStream\n");
pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstm, &IID_IStream);
}
else
pStgMedium->u.pstm = NULL;
@ -1941,7 +2050,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char
TRACE("TYMED_ISTORAGE\n");
if (content)
{
FIXME("not implemented for IStorage\n");
pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, (IUnknown**)&pStgMedium->u.pstg, &IID_IStorage);
}
else
pStgMedium->u.pstg = NULL;
@ -1975,7 +2084,7 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char
pStgMedium->pUnkForRelease = NULL;
if (releaseunk)
FIXME("unmarshal pUnkForRelease\n");
pBuffer = WdtpInterfacePointer_UserUnmarshal(pFlags, pBuffer, &pStgMedium->pUnkForRelease, &IID_IUnknown);
return pBuffer;
}
@ -2297,8 +2406,15 @@ HRESULT CALLBACK ISequentialStream_Read_Proxy(
ULONG cb,
ULONG *pcbRead)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULONG read;
HRESULT hr;
TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead);
hr = ISequentialStream_RemoteRead_Proxy(This, pv, cb, &read);
if(pcbRead) *pcbRead = read;
return hr;
}
HRESULT __RPC_STUB ISequentialStream_Read_Stub(
@ -2307,8 +2423,8 @@ HRESULT __RPC_STUB ISequentialStream_Read_Stub(
ULONG cb,
ULONG *pcbRead)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbRead);
return ISequentialStream_Read(This, pv, cb, pcbRead);
}
HRESULT CALLBACK ISequentialStream_Write_Proxy(
@ -2317,8 +2433,15 @@ HRESULT CALLBACK ISequentialStream_Write_Proxy(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULONG written;
HRESULT hr;
TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
hr = ISequentialStream_RemoteWrite_Proxy(This, pv, cb, &written);
if(pcbWritten) *pcbWritten = written;
return hr;
}
HRESULT __RPC_STUB ISequentialStream_Write_Stub(
@ -2327,8 +2450,8 @@ HRESULT __RPC_STUB ISequentialStream_Write_Stub(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
return ISequentialStream_Write(This, pv, cb, pcbWritten);
}
HRESULT CALLBACK IStream_Seek_Proxy(
@ -2337,8 +2460,15 @@ HRESULT CALLBACK IStream_Seek_Proxy(
DWORD dwOrigin,
ULARGE_INTEGER *plibNewPosition)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULARGE_INTEGER newpos;
HRESULT hr;
TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
hr = IStream_RemoteSeek_Proxy(This, dlibMove, dwOrigin, &newpos);
if(plibNewPosition) *plibNewPosition = newpos;
return hr;
}
HRESULT __RPC_STUB IStream_Seek_Stub(
@ -2347,8 +2477,8 @@ HRESULT __RPC_STUB IStream_Seek_Stub(
DWORD dwOrigin,
ULARGE_INTEGER *plibNewPosition)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%s, %d, %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition);
return IStream_Seek(This, dlibMove, dwOrigin, plibNewPosition);
}
HRESULT CALLBACK IStream_CopyTo_Proxy(
@ -2358,8 +2488,16 @@ HRESULT CALLBACK IStream_CopyTo_Proxy(
ULARGE_INTEGER *pcbRead,
ULARGE_INTEGER *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULARGE_INTEGER read, written;
HRESULT hr;
TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
hr = IStream_RemoteCopyTo_Proxy(This, pstm, cb, &read, &written);
if(pcbRead) *pcbRead = read;
if(pcbWritten) *pcbWritten = written;
return hr;
}
HRESULT __RPC_STUB IStream_CopyTo_Stub(
@ -2369,8 +2507,9 @@ HRESULT __RPC_STUB IStream_CopyTo_Stub(
ULARGE_INTEGER *pcbRead,
ULARGE_INTEGER *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %s, %p, %p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten);
return IStream_CopyTo(This, pstm, cb, pcbRead, pcbWritten);
}
HRESULT CALLBACK IEnumSTATSTG_Next_Proxy(
@ -2407,8 +2546,10 @@ HRESULT CALLBACK IStorage_OpenStream_Proxy(
DWORD reserved2,
IStream **ppstm)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%s, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm);
if(reserved1) WARN("reserved1 %p\n", reserved1);
return IStorage_RemoteOpenStream_Proxy(This, pwcsName, 0, NULL, grfMode, reserved2, ppstm);
}
HRESULT __RPC_STUB IStorage_OpenStream_Stub(
@ -2420,8 +2561,10 @@ HRESULT __RPC_STUB IStorage_OpenStream_Stub(
DWORD reserved2,
IStream **ppstm)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%s, %d, %p, %08x, %d %p)\n", This, debugstr_w(pwcsName), cbReserved1, reserved1, grfMode, reserved2, ppstm);
if(cbReserved1 || reserved1) WARN("cbReserved1 %d reserved1 %p\n", cbReserved1, reserved1);
return IStorage_OpenStream(This, pwcsName, NULL, grfMode, reserved2, ppstm);
}
HRESULT CALLBACK IStorage_EnumElements_Proxy(
@ -2431,8 +2574,10 @@ HRESULT CALLBACK IStorage_EnumElements_Proxy(
DWORD reserved3,
IEnumSTATSTG **ppenum)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%d, %p, %d, %p)\n", This, reserved1, reserved2, reserved3, ppenum);
if(reserved2) WARN("reserved2 %p\n", reserved2);
return IStorage_RemoteEnumElements_Proxy(This, reserved1, 0, NULL, reserved3, ppenum);
}
HRESULT __RPC_STUB IStorage_EnumElements_Stub(
@ -2443,8 +2588,10 @@ HRESULT __RPC_STUB IStorage_EnumElements_Stub(
DWORD reserved3,
IEnumSTATSTG **ppenum)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%d, %d, %p, %d, %p)\n", This, reserved1, cbReserved2, reserved2, reserved3, ppenum);
if(cbReserved2 || reserved2) WARN("cbReserved2 %d reserved2 %p\n", cbReserved2, reserved2);
return IStorage_EnumElements(This, reserved1, NULL, reserved3, ppenum);
}
HRESULT CALLBACK ILockBytes_ReadAt_Proxy(
@ -2454,8 +2601,15 @@ HRESULT CALLBACK ILockBytes_ReadAt_Proxy(
ULONG cb,
ULONG *pcbRead)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULONG read;
HRESULT hr;
TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead);
hr = ILockBytes_RemoteReadAt_Proxy(This, ulOffset, pv, cb, &read);
if(pcbRead) *pcbRead = read;
return hr;
}
HRESULT __RPC_STUB ILockBytes_ReadAt_Stub(
@ -2465,8 +2619,8 @@ HRESULT __RPC_STUB ILockBytes_ReadAt_Stub(
ULONG cb,
ULONG *pcbRead)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbRead);
return ILockBytes_ReadAt(This, ulOffset, pv, cb, pcbRead);
}
HRESULT CALLBACK ILockBytes_WriteAt_Proxy(
@ -2476,8 +2630,15 @@ HRESULT CALLBACK ILockBytes_WriteAt_Proxy(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULONG written;
HRESULT hr;
TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
hr = ILockBytes_RemoteWriteAt_Proxy(This, ulOffset, pv, cb, &written);
if(pcbWritten) *pcbWritten = written;
return hr;
}
HRESULT __RPC_STUB ILockBytes_WriteAt_Stub(
@ -2487,8 +2648,8 @@ HRESULT __RPC_STUB ILockBytes_WriteAt_Stub(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
return ILockBytes_WriteAt(This, ulOffset, pv, cb, pcbWritten);
}
HRESULT CALLBACK IFillLockBytes_FillAppend_Proxy(
@ -2497,8 +2658,15 @@ HRESULT CALLBACK IFillLockBytes_FillAppend_Proxy(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULONG written;
HRESULT hr;
TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
hr = IFillLockBytes_RemoteFillAppend_Proxy(This, pv, cb, &written);
if(pcbWritten) *pcbWritten = written;
return hr;
}
HRESULT __RPC_STUB IFillLockBytes_FillAppend_Stub(
@ -2507,8 +2675,8 @@ HRESULT __RPC_STUB IFillLockBytes_FillAppend_Stub(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %d, %p)\n", This, pv, cb, pcbWritten);
return IFillLockBytes_FillAppend(This, pv, cb, pcbWritten);
}
HRESULT CALLBACK IFillLockBytes_FillAt_Proxy(
@ -2518,8 +2686,15 @@ HRESULT CALLBACK IFillLockBytes_FillAt_Proxy(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
ULONG written;
HRESULT hr;
TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
hr = IFillLockBytes_RemoteFillAt_Proxy(This, ulOffset, pv, cb, &written);
if(pcbWritten) *pcbWritten = written;
return hr;
}
HRESULT __RPC_STUB IFillLockBytes_FillAt_Stub(
@ -2529,8 +2704,8 @@ HRESULT __RPC_STUB IFillLockBytes_FillAt_Stub(
ULONG cb,
ULONG *pcbWritten)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%s, %p, %d, %p)\n", This, wine_dbgstr_longlong(ulOffset.QuadPart), pv, cb, pcbWritten);
return IFillLockBytes_FillAt(This, ulOffset, pv, cb, pcbWritten);
}
HRESULT CALLBACK IEnumFORMATETC_Next_Proxy(
@ -2678,8 +2853,8 @@ HRESULT CALLBACK IDataObject_GetData_Proxy(
FORMATETC *pformatetcIn,
STGMEDIUM *pmedium)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pmedium);
return IDataObject_RemoteGetData_Proxy(This, pformatetcIn, pmedium);
}
HRESULT __RPC_STUB IDataObject_GetData_Stub(
@ -2687,8 +2862,8 @@ HRESULT __RPC_STUB IDataObject_GetData_Stub(
FORMATETC *pformatetcIn,
STGMEDIUM *pRemoteMedium)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %p)\n", This, pformatetcIn, pRemoteMedium);
return IDataObject_GetData(This, pformatetcIn, pRemoteMedium);
}
HRESULT CALLBACK IDataObject_GetDataHere_Proxy(
@ -2696,8 +2871,8 @@ HRESULT CALLBACK IDataObject_GetDataHere_Proxy(
FORMATETC *pformatetc,
STGMEDIUM *pmedium)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %p)\n", This, pformatetc, pmedium);
return IDataObject_RemoteGetDataHere_Proxy(This, pformatetc, pmedium);
}
HRESULT __RPC_STUB IDataObject_GetDataHere_Stub(
@ -2705,8 +2880,8 @@ HRESULT __RPC_STUB IDataObject_GetDataHere_Stub(
FORMATETC *pformatetc,
STGMEDIUM *pRemoteMedium)
{
FIXME(":stub\n");
return E_NOTIMPL;
TRACE("(%p)->(%p, %p)\n", This, pformatetc, pRemoteMedium);
return IDataObject_GetDataHere(This, pformatetc, pRemoteMedium);
}
HRESULT CALLBACK IDataObject_SetData_Proxy(

View file

@ -299,7 +299,7 @@ _get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) {
return E_FAIL;
}
RegCloseKey(ikey);
sprintf(typelibkey,"Typelib\\%s\\%s\\0\\win32",tlguid,ver);
sprintf(typelibkey,"Typelib\\%s\\%s\\0\\win%u",tlguid,ver,(sizeof(void*) == 8) ? 64 : 32);
tlfnlen = sizeof(tlfn);
if (RegQueryValueA(HKEY_CLASSES_ROOT,typelibkey,tlfn,&tlfnlen)) {
ERR("Could not get typelib fn?\n");

View file

@ -265,12 +265,14 @@ static WCHAR *get_lcid_subkey( LCID lcid, SYSKIND syskind, WCHAR *buffer )
static const WCHAR LcidFormatW[] = {'%','l','x','\\',0};
static const WCHAR win16W[] = {'w','i','n','1','6',0};
static const WCHAR win32W[] = {'w','i','n','3','2',0};
static const WCHAR win64W[] = {'w','i','n','6','4',0};
sprintfW( buffer, LcidFormatW, lcid );
switch(syskind)
{
case SYS_WIN16: strcatW( buffer, win16W ); break;
case SYS_WIN32: strcatW( buffer, win32W ); break;
case SYS_WIN64: strcatW( buffer, win64W ); break;
default:
TRACE("Typelib is for unsupported syskind %i\n", syskind);
return NULL;
@ -535,6 +537,12 @@ HRESULT WINAPI RegisterTypeLib(
if (FAILED(ITypeLib_GetLibAttr(ptlib, &attr)))
return E_FAIL;
#ifdef _WIN64
if (attr->syskind != SYS_WIN64) return TYPE_E_BADMODULEKIND;
#else
if (attr->syskind != SYS_WIN32 && attr->syskind != SYS_WIN16) return TYPE_E_BADMODULEKIND;
#endif
get_typelib_key( &attr->guid, attr->wMajorVerNum, attr->wMinorVerNum, keyName );
res = S_OK;
@ -780,7 +788,7 @@ HRESULT WINAPI UnRegisterTypeLib(
/* Create the path to the key */
get_typelib_key( libid, wVerMajor, wVerMinor, keyName );
if (syskind != SYS_WIN16 && syskind != SYS_WIN32)
if (syskind != SYS_WIN16 && syskind != SYS_WIN32 && syskind != SYS_WIN64)
{
TRACE("Unsupported syskind %i\n", syskind);
result = E_INVALIDARG;
@ -1926,7 +1934,7 @@ MSFT_DoFuncs(TLBContext* pcx,
(*pptfd)->funcdesc.callconv = (pFuncRec->FKCCIC) >> 8 & 0xF;
(*pptfd)->funcdesc.cParams = pFuncRec->nrargs ;
(*pptfd)->funcdesc.cParamsOpt = pFuncRec->nroargs ;
(*pptfd)->funcdesc.oVft = (pFuncRec->VtableOffset * sizeof(void *))/4;
(*pptfd)->funcdesc.oVft = pFuncRec->VtableOffset;
(*pptfd)->funcdesc.wFuncFlags = LOWORD(pFuncRec->Flags) ;
MSFT_GetTdesc(pcx,
@ -2185,7 +2193,7 @@ static ITypeInfoImpl * MSFT_DoTypeInfo(
ptiRet->TypeAttr.wMajorVerNum=LOWORD(tiBase.version);
ptiRet->TypeAttr.wMinorVerNum=HIWORD(tiBase.version);
ptiRet->TypeAttr.cImplTypes=tiBase.cImplTypes;
ptiRet->TypeAttr.cbSizeVft=(tiBase.cbSizeVft * sizeof(void *))/4; /* FIXME: this is only the non inherited part */
ptiRet->TypeAttr.cbSizeVft=tiBase.cbSizeVft; /* FIXME: this is only the non inherited part */
if(ptiRet->TypeAttr.typekind == TKIND_ALIAS)
MSFT_GetTdesc(pcx, tiBase.datatype1,
&ptiRet->TypeAttr.tdescAlias, ptiRet);
@ -3947,7 +3955,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
(*ppTypeInfoImpl)->TypeAttr.cbAlignment = pTITail->cbAlignment;
(*ppTypeInfoImpl)->TypeAttr.cbSizeInstance = pTITail->cbSizeInstance;
(*ppTypeInfoImpl)->TypeAttr.cbSizeVft = (pTITail->cbSizeVft * sizeof(void *))/4;
(*ppTypeInfoImpl)->TypeAttr.cbSizeVft = pTITail->cbSizeVft;
switch(pTIHeader->typekind) {
case TKIND_ENUM:
@ -7528,7 +7536,7 @@ HRESULT WINAPI CreateDispTypeInfo(
(*ppFuncDesc)->funcdesc.callconv = md->cc;
(*ppFuncDesc)->funcdesc.cParams = md->cArgs;
(*ppFuncDesc)->funcdesc.cParamsOpt = 0;
(*ppFuncDesc)->funcdesc.oVft = md->iMeth << 2;
(*ppFuncDesc)->funcdesc.oVft = md->iMeth * sizeof(void *);
(*ppFuncDesc)->funcdesc.cScodes = 0;
(*ppFuncDesc)->funcdesc.wFuncFlags = 0;
(*ppFuncDesc)->funcdesc.elemdescFunc.tdesc.vt = md->vtReturn;

View file

@ -1305,11 +1305,17 @@ static HRESULT VARIANT_FormatNumber(LPVARIANT pVarIn, LPOLESTR lpszFormat,
else
{
rgbDig[have_int + need_frac] = 0;
have_int++;
if (exponent < 0)
exponent++;
else
have_int++;
}
}
else
(*prgbDig)++;
/* We converted trailing digits to zeroes => have_frac has changed */
while (have_frac > 0 && rgbDig[have_int + have_frac - 1] == 0)
have_frac--;
}
}
TRACE("have_int=%d,need_int=%d,have_frac=%d,need_frac=%d,pad=%d,exp=%d\n",