mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
Sync to Wine-20040615:
Marcus Meissner <marcus@jet.franken.de> - Revert broken strict aliasing fix. Robert Shearman <R.J.Shearman@warwick.ac.uk> - Fix ref count on standard proxy creation. - Release channel buffer in StdMarshal_UnmarshalInterface, since we no longer use it and the proxy should have taken a reference on it. - Add a few comments. - Fixed CoMarshalInterThreadInterfaceInStream and CoGetInterfaceAndReleaseStream. Patrik Stridvall <ps@leissner.se> - Fixed some issues found by winapi_check. svn path=/trunk/; revision=9680
This commit is contained in:
parent
6c4df3df68
commit
92599b546e
12 changed files with 109 additions and 75 deletions
|
@ -1015,7 +1015,7 @@ _LocalServerThread(LPVOID param) {
|
||||||
strcpy(pipefn,PIPEPREF);
|
strcpy(pipefn,PIPEPREF);
|
||||||
WINE_StringFromCLSID(&newClass->classIdentifier,pipefn+strlen(PIPEPREF));
|
WINE_StringFromCLSID(&newClass->classIdentifier,pipefn+strlen(PIPEPREF));
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(newClass->classObject,&IID_IClassFactory,(LPVOID*)(char*)&classfac);
|
hres = IUnknown_QueryInterface(newClass->classObject,&IID_IClassFactory,(LPVOID*)&classfac);
|
||||||
if (hres) return hres;
|
if (hres) return hres;
|
||||||
|
|
||||||
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
|
hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
|
||||||
|
@ -1543,7 +1543,7 @@ HRESULT WINAPI CoCreateInstanceEx(
|
||||||
pUnkOuter,
|
pUnkOuter,
|
||||||
dwClsContext,
|
dwClsContext,
|
||||||
&IID_IUnknown,
|
&IID_IUnknown,
|
||||||
(VOID**)(char*)&pUnk);
|
(VOID**)&pUnk);
|
||||||
|
|
||||||
if (hr)
|
if (hr)
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -1085,7 +1085,7 @@ static HRESULT WINAPI DataCache_GetData(
|
||||||
{
|
{
|
||||||
/* Get the Persist Storage */
|
/* Get the Persist Storage */
|
||||||
|
|
||||||
hr = IDataObject_QueryInterface(iface, &IID_IPersistStorage, (void**)(char*)&pPersistStorage);
|
hr = IDataObject_QueryInterface(iface, &IID_IPersistStorage, (void**)&pPersistStorage);
|
||||||
|
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -1214,7 +1214,7 @@ static HRESULT WINAPI DataCache_IDataObject_SetData(
|
||||||
|
|
||||||
TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
|
TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
|
||||||
|
|
||||||
hres = IDataObject_QueryInterface(iface, &IID_IOleCache2, (void**)(char*)&oleCache);
|
hres = IDataObject_QueryInterface(iface, &IID_IOleCache2, (void**)&oleCache);
|
||||||
|
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ static HRESULT WINAPI DefaultHandler_GetExtent(
|
||||||
|
|
||||||
TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
|
TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(this->dataCache, &IID_IViewObject2, (void**)(char*)&cacheView);
|
hres = IUnknown_QueryInterface(this->dataCache, &IID_IViewObject2, (void**)&cacheView);
|
||||||
|
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
|
@ -1337,7 +1337,7 @@ static HRESULT WINAPI DefaultHandler_GetData(
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(this->dataCache,
|
hres = IUnknown_QueryInterface(this->dataCache,
|
||||||
&IID_IDataObject,
|
&IID_IDataObject,
|
||||||
(void**)(char*)&cacheDataObject);
|
(void**)&cacheDataObject);
|
||||||
|
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
|
@ -1381,7 +1381,7 @@ static HRESULT WINAPI DefaultHandler_QueryGetData(
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(this->dataCache,
|
hres = IUnknown_QueryInterface(this->dataCache,
|
||||||
&IID_IDataObject,
|
&IID_IDataObject,
|
||||||
(void**)(char*)&cacheDataObject);
|
(void**)&cacheDataObject);
|
||||||
|
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
|
@ -1434,7 +1434,7 @@ static HRESULT WINAPI DefaultHandler_SetData(
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(this->dataCache,
|
hres = IUnknown_QueryInterface(this->dataCache,
|
||||||
&IID_IDataObject,
|
&IID_IDataObject,
|
||||||
(void**)(char*)&cacheDataObject);
|
(void**)&cacheDataObject);
|
||||||
|
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
|
|
|
@ -587,7 +587,7 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface,
|
||||||
res=GetClassFile(This->filePathName,&clsID);
|
res=GetClassFile(This->filePathName,&clsID);
|
||||||
if (SUCCEEDED(res)){
|
if (SUCCEEDED(res)){
|
||||||
|
|
||||||
res=CoCreateInstance(&clsID,NULL,CLSCTX_ALL,&IID_IPersistFile,(void**)(char*)&ppf);
|
res=CoCreateInstance(&clsID,NULL,CLSCTX_ALL,&IID_IPersistFile,(void**)&ppf);
|
||||||
if (SUCCEEDED(res)){
|
if (SUCCEEDED(res)){
|
||||||
|
|
||||||
res=IPersistFile_Load(ppf,This->filePathName,STGM_READ);
|
res=IPersistFile_Load(ppf,This->filePathName,STGM_READ);
|
||||||
|
@ -602,11 +602,11 @@ HRESULT WINAPI FileMonikerImpl_BindToObject(IMoniker* iface,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassFactory,(void**)(char*)&pcf);
|
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassFactory,(void**)&pcf);
|
||||||
|
|
||||||
if (res==E_NOINTERFACE){
|
if (res==E_NOINTERFACE){
|
||||||
|
|
||||||
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)(char*)&pca);
|
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)&pca);
|
||||||
|
|
||||||
if (res==E_NOINTERFACE)
|
if (res==E_NOINTERFACE)
|
||||||
return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED;
|
return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED;
|
||||||
|
|
|
@ -144,7 +144,7 @@ static HRESULT WINAPI IMalloc_fnQueryInterface(LPMALLOC iface,REFIID refiid,LPVO
|
||||||
TRACE("(%s,%p)\n",debugstr_guid(refiid),obj);
|
TRACE("(%s,%p)\n",debugstr_guid(refiid),obj);
|
||||||
|
|
||||||
if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMalloc,refiid)) {
|
if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMalloc,refiid)) {
|
||||||
*obj = (LPMALLOC)(char*)&Malloc32;
|
*obj = (LPMALLOC)&Malloc32;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -380,7 +380,7 @@ static HRESULT WINAPI IMallocSpy_fnQueryInterface(LPMALLOCSPY iface,REFIID refii
|
||||||
TRACE("(%s,%p)\n",debugstr_guid(refiid),obj);
|
TRACE("(%s,%p)\n",debugstr_guid(refiid),obj);
|
||||||
|
|
||||||
if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMallocSpy,refiid)) {
|
if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMallocSpy,refiid)) {
|
||||||
*obj = (LPMALLOC)(char*)&MallocSpy;
|
*obj = (LPMALLOC)&MallocSpy;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -530,7 +530,7 @@ static ICOM_VTABLE(IMallocSpy) VT_IMallocSpy =
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc)
|
HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc)
|
||||||
{
|
{
|
||||||
*lpMalloc = (LPMALLOC)(char*)&Malloc32;
|
*lpMalloc = (LPMALLOC)&Malloc32;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,14 +541,14 @@ HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc)
|
||||||
*/
|
*/
|
||||||
LPVOID WINAPI CoTaskMemAlloc(ULONG size)
|
LPVOID WINAPI CoTaskMemAlloc(ULONG size)
|
||||||
{
|
{
|
||||||
return IMalloc_Alloc((LPMALLOC)(char*)&Malloc32,size);
|
return IMalloc_Alloc((LPMALLOC)&Malloc32,size);
|
||||||
}
|
}
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* CoTaskMemFree [OLE32.@]
|
* CoTaskMemFree [OLE32.@]
|
||||||
*/
|
*/
|
||||||
VOID WINAPI CoTaskMemFree(LPVOID ptr)
|
VOID WINAPI CoTaskMemFree(LPVOID ptr)
|
||||||
{
|
{
|
||||||
IMalloc_Free((LPMALLOC)(char*)&Malloc32, ptr);
|
IMalloc_Free((LPMALLOC)&Malloc32, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -558,7 +558,7 @@ VOID WINAPI CoTaskMemFree(LPVOID ptr)
|
||||||
*/
|
*/
|
||||||
LPVOID WINAPI CoTaskMemRealloc(LPVOID pvOld, ULONG size)
|
LPVOID WINAPI CoTaskMemRealloc(LPVOID pvOld, ULONG size)
|
||||||
{
|
{
|
||||||
return IMalloc_Realloc((LPMALLOC)(char*)&Malloc32, pvOld, size);
|
return IMalloc_Realloc((LPMALLOC)&Malloc32, pvOld, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -576,13 +576,13 @@ HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
/* HACK TO ACTIVATE OUT SPY */
|
/* HACK TO ACTIVATE OUT SPY */
|
||||||
if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)(char*)&MallocSpy;
|
if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)&MallocSpy;
|
||||||
|
|
||||||
if(Malloc32.pSpy) return CO_E_OBJISREG;
|
if(Malloc32.pSpy) return CO_E_OBJISREG;
|
||||||
|
|
||||||
EnterCriticalSection(&IMalloc32_SpyCS);
|
EnterCriticalSection(&IMalloc32_SpyCS);
|
||||||
|
|
||||||
if (SUCCEEDED(IUnknown_QueryInterface(pMallocSpy, &IID_IMallocSpy, (LPVOID*)(char*)&pSpy))) {
|
if (SUCCEEDED(IUnknown_QueryInterface(pMallocSpy, &IID_IMallocSpy, (LPVOID*)&pSpy))) {
|
||||||
Malloc32.pSpy = pSpy;
|
Malloc32.pSpy = pSpy;
|
||||||
hres = S_OK;
|
hres = S_OK;
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ HRESULT WINAPI CoRevokeMallocSpy(void)
|
||||||
EnterCriticalSection(&IMalloc32_SpyCS);
|
EnterCriticalSection(&IMalloc32_SpyCS);
|
||||||
|
|
||||||
/* if it's our spy it's time to dump the leaks */
|
/* if it's our spy it's time to dump the leaks */
|
||||||
if (Malloc32.pSpy == (IMallocSpy*)(char*)&MallocSpy) {
|
if (Malloc32.pSpy == (IMallocSpy*)&MallocSpy) {
|
||||||
MallocSpyDumpLeaks();
|
MallocSpyDumpLeaks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,7 +454,7 @@ HRESULT WINAPI ItemMonikerImpl_BindToObject(IMoniker* iface,
|
||||||
|
|
||||||
*ppvResult=0;
|
*ppvResult=0;
|
||||||
|
|
||||||
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&refid,(void**)(char*)&poic);
|
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&refid,(void**)&poic);
|
||||||
|
|
||||||
if (SUCCEEDED(res)){
|
if (SUCCEEDED(res)){
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ HRESULT WINAPI ItemMonikerImpl_BindToStorage(IMoniker* iface,
|
||||||
if(pmkToLeft==NULL)
|
if(pmkToLeft==NULL)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)(char*)&poic);
|
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
|
||||||
|
|
||||||
if (SUCCEEDED(res)){
|
if (SUCCEEDED(res)){
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ HRESULT WINAPI ItemMonikerImpl_IsRunning(IMoniker* iface,
|
||||||
/* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/
|
/* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/
|
||||||
/* passing the string contained within this moniker. */
|
/* passing the string contained within this moniker. */
|
||||||
|
|
||||||
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)(char*)&poic);
|
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
|
||||||
|
|
||||||
if (SUCCEEDED(res)){
|
if (SUCCEEDED(res)){
|
||||||
|
|
||||||
|
@ -876,11 +876,11 @@ HRESULT WINAPI ItemMonikerImpl_ParseDisplayName(IMoniker* iface,
|
||||||
/* Otherwise, the method calls IMoniker::BindToObject on the pmkToLeft parameter, requesting an */
|
/* Otherwise, the method calls IMoniker::BindToObject on the pmkToLeft parameter, requesting an */
|
||||||
/* IParseDisplayName interface pointer to the object identified by the moniker, and passes the display */
|
/* IParseDisplayName interface pointer to the object identified by the moniker, and passes the display */
|
||||||
/* name to IParseDisplayName::ParseDisplayName */
|
/* name to IParseDisplayName::ParseDisplayName */
|
||||||
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)(char*)&poic);
|
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
|
||||||
|
|
||||||
if (SUCCEEDED(res)){
|
if (SUCCEEDED(res)){
|
||||||
|
|
||||||
res=IOleItemContainer_GetObject(poic,This->itemName,BINDSPEED_MODERATE,pbc,&IID_IParseDisplayName,(void**)(char*)&ppdn);
|
res=IOleItemContainer_GetObject(poic,This->itemName,BINDSPEED_MODERATE,pbc,&IID_IParseDisplayName,(void**)&ppdn);
|
||||||
|
|
||||||
res=IMoniker_GetDisplayName(iface,pbc,NULL,&displayName);
|
res=IMoniker_GetDisplayName(iface,pbc,NULL,&displayName);
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ StdMarshalImpl_MarshalInterface(
|
||||||
IPSFactoryBuffer *psfacbuf;
|
IPSFactoryBuffer *psfacbuf;
|
||||||
|
|
||||||
TRACE("(...,%s,...)\n",debugstr_guid(riid));
|
TRACE("(...,%s,...)\n",debugstr_guid(riid));
|
||||||
IUnknown_QueryInterface((LPUNKNOWN)pv,&IID_IUnknown,(LPVOID*)(char*)&pUnk);
|
IUnknown_QueryInterface((LPUNKNOWN)pv,&IID_IUnknown,(LPVOID*)&pUnk);
|
||||||
mid.processid = GetCurrentProcessId();
|
mid.processid = GetCurrentProcessId();
|
||||||
mid.objectid = (DWORD)pUnk; /* FIXME */
|
mid.objectid = (DWORD)pUnk; /* FIXME */
|
||||||
IUnknown_Release(pUnk);
|
IUnknown_Release(pUnk);
|
||||||
|
@ -280,7 +280,7 @@ StdMarshalImpl_MarshalInterface(
|
||||||
FIXME("Failed to create a stub for %s\n",debugstr_guid(riid));
|
FIXME("Failed to create a stub for %s\n",debugstr_guid(riid));
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
IUnknown_QueryInterface((LPUNKNOWN)pv,riid,(LPVOID*)(char*)&pUnk);
|
IUnknown_QueryInterface((LPUNKNOWN)pv,riid,(LPVOID*)&pUnk);
|
||||||
MARSHAL_Register_Stub(&mid,pUnk,stub);
|
MARSHAL_Register_Stub(&mid,pUnk,stub);
|
||||||
IUnknown_Release(pUnk);
|
IUnknown_Release(pUnk);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -315,13 +315,20 @@ StdMarshalImpl_UnmarshalInterface(
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
hres = PIPE_GetNewPipeBuf(&mid,&chanbuf);
|
hres = PIPE_GetNewPipeBuf(&mid,&chanbuf);
|
||||||
|
IPSFactoryBuffer_Release(psfacbuf);
|
||||||
if (hres) {
|
if (hres) {
|
||||||
ERR("Failed to get an rpc channel buffer for %s\n",debugstr_guid(riid));
|
ERR("Failed to get an rpc channel buffer for %s\n",debugstr_guid(riid));
|
||||||
} else {
|
} else {
|
||||||
|
/* Connect the channel buffer to the proxy and release the no longer
|
||||||
|
* needed proxy.
|
||||||
|
* NOTE: The proxy should have taken an extra reference because it also
|
||||||
|
* aggregates the object, so we can safely release our reference to it. */
|
||||||
IRpcProxyBuffer_Connect(rpcproxy,chanbuf);
|
IRpcProxyBuffer_Connect(rpcproxy,chanbuf);
|
||||||
IRpcProxyBuffer_Release(rpcproxy); /* no need */
|
IRpcProxyBuffer_Release(rpcproxy);
|
||||||
|
/* IRpcProxyBuffer takes a reference on the channel buffer and
|
||||||
|
* we no longer need it, so release it */
|
||||||
|
IRpcChannelBuffer_Release(chanbuf);
|
||||||
}
|
}
|
||||||
IPSFactoryBuffer_Release(psfacbuf);
|
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,7 +455,7 @@ CoMarshalInterface( IStream *pStm, REFIID riid, IUnknown *pUnk,
|
||||||
);
|
);
|
||||||
STUBMGR_Start(); /* Just to be sure we have one running. */
|
STUBMGR_Start(); /* Just to be sure we have one running. */
|
||||||
mid.processid = GetCurrentProcessId();
|
mid.processid = GetCurrentProcessId();
|
||||||
IUnknown_QueryInterface(pUnk,&IID_IUnknown,(LPVOID*)(char*)&pUnknown);
|
IUnknown_QueryInterface(pUnk,&IID_IUnknown,(LPVOID*)&pUnknown);
|
||||||
mid.objectid = (DWORD)pUnknown;
|
mid.objectid = (DWORD)pUnknown;
|
||||||
IUnknown_Release(pUnknown);
|
IUnknown_Release(pUnknown);
|
||||||
memcpy(&mid.iid,riid,sizeof(mid.iid));
|
memcpy(&mid.iid,riid,sizeof(mid.iid));
|
||||||
|
@ -523,7 +530,7 @@ CoUnmarshalInterface(IStream *pStm, REFIID riid, LPVOID *ppv) {
|
||||||
FIXME("Stream read 3 failed, %lx, (%ld of %d)\n",hres,res,sizeof(xclsid));
|
FIXME("Stream read 3 failed, %lx, (%ld of %d)\n",hres,res,sizeof(xclsid));
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
hres=CoCreateInstance(&xclsid,NULL,CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,&IID_IMarshal,(void**)(char*)&pUnk);
|
hres=CoCreateInstance(&xclsid,NULL,CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,&IID_IMarshal,(void**)&pUnk);
|
||||||
if (hres) {
|
if (hres) {
|
||||||
FIXME("Failed to create instance of unmarshaller %s.\n",debugstr_guid(&xclsid));
|
FIXME("Failed to create instance of unmarshaller %s.\n",debugstr_guid(&xclsid));
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -596,45 +603,68 @@ CoReleaseMarshalData(IStream *pStm) {
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* CoMarshalInterThreadInterfaceInStream [OLE32.@]
|
* CoMarshalInterThreadInterfaceInStream [OLE32.@]
|
||||||
*
|
*
|
||||||
* Marshal interfaces across threads. We don't have a thread distinction,
|
* Marshal an interface across threads in the same process.
|
||||||
* meaning most interfaces just work across different threads, the RPC
|
*
|
||||||
* handles it.
|
* PARAMS
|
||||||
|
* riid [I] Identifier of the interface to be marshalled.
|
||||||
|
* pUnk [I] Pointer to IUnknown-derived interface that will be marshalled.
|
||||||
|
* ppStm [O] Pointer to IStream object that is created and then used to store the marshalled inteface.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: S_OK
|
||||||
|
* Failure: E_OUTOFMEMORY and other COM error codes
|
||||||
|
*
|
||||||
|
* SEE
|
||||||
|
* CoMarshalInterface(), CoUnmarshalInterface() and CoGetInterfaceAndReleaseStream()
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI
|
HRESULT WINAPI
|
||||||
CoMarshalInterThreadInterfaceInStream(
|
CoMarshalInterThreadInterfaceInStream(
|
||||||
REFIID riid, LPUNKNOWN pUnk, LPSTREAM * ppStm
|
REFIID riid, LPUNKNOWN pUnk, LPSTREAM * ppStm)
|
||||||
) {
|
{
|
||||||
ULONG res;
|
ULARGE_INTEGER xpos;
|
||||||
ULARGE_INTEGER xpos;
|
LARGE_INTEGER seekto;
|
||||||
LARGE_INTEGER seekto;
|
HRESULT hres;
|
||||||
HRESULT hres;
|
|
||||||
|
|
||||||
TRACE("(%s, %p, %p)\n",debugstr_guid(riid), pUnk, ppStm);
|
TRACE("(%s, %p, %p)\n",debugstr_guid(riid), pUnk, ppStm);
|
||||||
hres = CreateStreamOnHGlobal(0, TRUE, ppStm);
|
|
||||||
if (hres) return hres;
|
hres = CreateStreamOnHGlobal(0, TRUE, ppStm);
|
||||||
/* CoMarshalInterface(...); */
|
if (FAILED(hres)) return hres;
|
||||||
hres = IStream_Write(*ppStm,&pUnk,sizeof(LPUNKNOWN),&res);
|
hres = CoMarshalInterface(*ppStm, riid, pUnk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
|
||||||
if (hres) return hres;
|
|
||||||
memset(&seekto,0,sizeof(seekto));
|
/* FIXME: is this needed? */
|
||||||
IStream_Seek(*ppStm,seekto,SEEK_SET,&xpos);
|
memset(&seekto,0,sizeof(seekto));
|
||||||
return S_OK;
|
IStream_Seek(*ppStm,seekto,SEEK_SET,&xpos);
|
||||||
|
|
||||||
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* CoGetInterfaceAndReleaseStream [OLE32.@]
|
* CoGetInterfaceAndReleaseStream [OLE32.@]
|
||||||
|
*
|
||||||
|
* Unmarshalls an inteface from a stream and then releases the stream.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* pStm [I] Stream that contains the marshalled inteface.
|
||||||
|
* riid [I] Interface identifier of the object to unmarshall.
|
||||||
|
* ppv [O] Address of pointer where the requested interface object will be stored.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Success: S_OK
|
||||||
|
* Failure: A COM error code
|
||||||
|
*
|
||||||
|
* SEE
|
||||||
|
* CoMarshalInterThreadInterfaceInStream() and CoUnmarshalInteface()
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI
|
HRESULT WINAPI
|
||||||
CoGetInterfaceAndReleaseStream(LPSTREAM pStm,REFIID riid, LPVOID *ppv) {
|
CoGetInterfaceAndReleaseStream(LPSTREAM pStm,REFIID riid, LPVOID *ppv)
|
||||||
ULONG res;
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
LPUNKNOWN pUnk;
|
|
||||||
|
|
||||||
TRACE("(,%s,)\n",debugstr_guid(riid));
|
TRACE("(%p, %s, %p)\n", pStm, debugstr_guid(riid), ppv);
|
||||||
/* CoUnmarshalInterface(...); */
|
|
||||||
hres = IStream_Read(pStm,&pUnk,sizeof(LPUNKNOWN),&res);
|
hres = CoUnmarshalInterface(pStm, riid, ppv);
|
||||||
if (hres) return hres;
|
IStream_Release(pStm);
|
||||||
IStream_Release(pStm);
|
return hres;
|
||||||
return IUnknown_QueryInterface(pUnk,riid,ppv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
|
|
|
@ -505,7 +505,7 @@ HRESULT WINAPI OleRun(LPUNKNOWN pUnknown)
|
||||||
ICOM_THIS(IRunnableObject,pUnknown);
|
ICOM_THIS(IRunnableObject,pUnknown);
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
|
|
||||||
ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)(char*)&runable);
|
ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)&runable);
|
||||||
if (ret)
|
if (ret)
|
||||||
return 0; /* Appears to return no error. */
|
return 0; /* Appears to return no error. */
|
||||||
ret = IRunnableObject_Run(runable,NULL);
|
ret = IRunnableObject_Run(runable,NULL);
|
||||||
|
|
|
@ -710,7 +710,7 @@ HRESULT WINAPI OleSetContainedObject(
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(pUnknown,
|
hres = IUnknown_QueryInterface(pUnknown,
|
||||||
&IID_IRunnableObject,
|
&IID_IRunnableObject,
|
||||||
(void**)(char*)&runnable);
|
(void**)&runnable);
|
||||||
|
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
|
@ -756,7 +756,7 @@ HRESULT WINAPI OleLoad(
|
||||||
NULL,
|
NULL,
|
||||||
CLSCTX_INPROC_HANDLER,
|
CLSCTX_INPROC_HANDLER,
|
||||||
&IID_IOleObject,
|
&IID_IOleObject,
|
||||||
(void**)(char*)&oleObject);
|
(void**)&oleObject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If that fails, as it will most times, load the default
|
* If that fails, as it will most times, load the default
|
||||||
|
@ -767,7 +767,7 @@ HRESULT WINAPI OleLoad(
|
||||||
hres = OleCreateDefaultHandler(&storageInfo.clsid,
|
hres = OleCreateDefaultHandler(&storageInfo.clsid,
|
||||||
NULL,
|
NULL,
|
||||||
&IID_IOleObject,
|
&IID_IOleObject,
|
||||||
(void**)(char*)&oleObject);
|
(void**)&oleObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -786,7 +786,7 @@ HRESULT WINAPI OleLoad(
|
||||||
*/
|
*/
|
||||||
hres = IOleObject_QueryInterface(oleObject,
|
hres = IOleObject_QueryInterface(oleObject,
|
||||||
&IID_IPersistStorage,
|
&IID_IPersistStorage,
|
||||||
(void**)(char*)&persistStorage);
|
(void**)&persistStorage);
|
||||||
|
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
|
@ -860,7 +860,7 @@ HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCl
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(pUnknown,
|
hres = IUnknown_QueryInterface(pUnknown,
|
||||||
&IID_IRunnableObject,
|
&IID_IRunnableObject,
|
||||||
(void**)(char*)&runnable);
|
(void**)&runnable);
|
||||||
|
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
|
@ -2229,7 +2229,7 @@ HRESULT WINAPI OleDraw(
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(pUnk,
|
hres = IUnknown_QueryInterface(pUnk,
|
||||||
&IID_IViewObject,
|
&IID_IViewObject,
|
||||||
(void**)(char*)&viewobject);
|
(void**)&viewobject);
|
||||||
|
|
||||||
if (SUCCEEDED(hres))
|
if (SUCCEEDED(hres))
|
||||||
{
|
{
|
||||||
|
@ -2284,20 +2284,20 @@ HRESULT WINAPI OleCreate(
|
||||||
|
|
||||||
FIXME("\n\t%s\n\t%s semi-stub!\n", debugstr_guid(rclsid), debugstr_guid(riid));
|
FIXME("\n\t%s\n\t%s semi-stub!\n", debugstr_guid(rclsid), debugstr_guid(riid));
|
||||||
|
|
||||||
if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER , riid, (LPVOID*)(char*)&pUnk))))
|
if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER , riid, (LPVOID*)&pUnk))))
|
||||||
{
|
{
|
||||||
if (pClientSite)
|
if (pClientSite)
|
||||||
{
|
{
|
||||||
IOleObject * pOE;
|
IOleObject * pOE;
|
||||||
IPersistStorage * pPS;
|
IPersistStorage * pPS;
|
||||||
if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IOleObject, (LPVOID*)(char*)&pOE))))
|
if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IOleObject, (LPVOID*)&pOE))))
|
||||||
{
|
{
|
||||||
TRACE("trying to set clientsite %p\n", pClientSite);
|
TRACE("trying to set clientsite %p\n", pClientSite);
|
||||||
hres1 = IOleObject_SetClientSite(pOE, pClientSite);
|
hres1 = IOleObject_SetClientSite(pOE, pClientSite);
|
||||||
TRACE("-- result 0x%08lx\n", hres1);
|
TRACE("-- result 0x%08lx\n", hres1);
|
||||||
IOleObject_Release(pOE);
|
IOleObject_Release(pOE);
|
||||||
}
|
}
|
||||||
if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IPersistStorage, (LPVOID*)(char*)&pPS))))
|
if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IPersistStorage, (LPVOID*)&pPS))))
|
||||||
{
|
{
|
||||||
TRACE("trying to set stg %p\n", pStg);
|
TRACE("trying to set stg %p\n", pStg);
|
||||||
hres1 = IPersistStorage_InitNew(pPS, pStg);
|
hres1 = IPersistStorage_InitNew(pPS, pStg);
|
||||||
|
|
|
@ -151,7 +151,7 @@ HRESULT WINAPI OleCreateFromData(LPDATAOBJECT pSrcDataObject, REFIID riid,
|
||||||
/* Create default handler for Persist storage */
|
/* Create default handler for Persist storage */
|
||||||
|
|
||||||
if (hr1 == S_OK)
|
if (hr1 == S_OK)
|
||||||
hr1 = OleCreateDefaultHandler(&clsID, NULL, &IID_IPersistStorage, (LPVOID*)(char*)&pPersistStorage);
|
hr1 = OleCreateDefaultHandler(&clsID, NULL, &IID_IPersistStorage, (LPVOID*)&pPersistStorage);
|
||||||
|
|
||||||
/* Load the storage to Persist storage */
|
/* Load the storage to Persist storage */
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ HRESULT WINAPI OleCreateFromData(LPDATAOBJECT pSrcDataObject, REFIID riid,
|
||||||
/* Query for IOleObject */
|
/* Query for IOleObject */
|
||||||
|
|
||||||
if (hr1 == S_OK)
|
if (hr1 == S_OK)
|
||||||
hr1 = IPersistStorage_QueryInterface(pPersistStorage, &IID_IOleObject, (LPVOID*)(char*)&pOleObject);
|
hr1 = IPersistStorage_QueryInterface(pPersistStorage, &IID_IOleObject, (LPVOID*)&pOleObject);
|
||||||
|
|
||||||
/* Set client site with the IOleObject */
|
/* Set client site with the IOleObject */
|
||||||
|
|
||||||
|
|
|
@ -156,12 +156,12 @@ CFStub_Invoke(
|
||||||
}
|
}
|
||||||
memcpy(&iid,msg->Buffer,sizeof(iid));
|
memcpy(&iid,msg->Buffer,sizeof(iid));
|
||||||
TRACE("->CreateInstance(%s)\n",debugstr_guid(&iid));
|
TRACE("->CreateInstance(%s)\n",debugstr_guid(&iid));
|
||||||
hres = IUnknown_QueryInterface(This->pUnkServer,&IID_IClassFactory,(LPVOID*)(char*)&classfac);
|
hres = IUnknown_QueryInterface(This->pUnkServer,&IID_IClassFactory,(LPVOID*)&classfac);
|
||||||
if (hres) {
|
if (hres) {
|
||||||
FIXME("Ole server does not provide a IClassFactory?\n");
|
FIXME("Ole server does not provide a IClassFactory?\n");
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
hres = IClassFactory_CreateInstance(classfac,NULL,&iid,(LPVOID*)(char*)&ppv);
|
hres = IClassFactory_CreateInstance(classfac,NULL,&iid,(LPVOID*)&ppv);
|
||||||
IClassFactory_Release(classfac);
|
IClassFactory_Release(classfac);
|
||||||
if (hres) {
|
if (hres) {
|
||||||
msg->cbBuffer = 0;
|
msg->cbBuffer = 0;
|
||||||
|
@ -436,7 +436,8 @@ CFProxy_Construct(LPVOID *ppv,LPVOID *ppProxy) {
|
||||||
|
|
||||||
cf->lpvtbl_cf = &cfproxyvt;
|
cf->lpvtbl_cf = &cfproxyvt;
|
||||||
cf->lpvtbl_proxy = &pspbvtbl;
|
cf->lpvtbl_proxy = &pspbvtbl;
|
||||||
cf->ref = 2; /* we return 2 references to the object! */
|
/* 1 reference for the proxy and 1 for the object */
|
||||||
|
cf->ref = 2;
|
||||||
*ppv = &(cf->lpvtbl_cf);
|
*ppv = &(cf->lpvtbl_cf);
|
||||||
*ppProxy = &(cf->lpvtbl_proxy);
|
*ppProxy = &(cf->lpvtbl_proxy);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -5536,6 +5536,9 @@ HRESULT WINAPI StgCreateDocfile(
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* StgCreateStorageEx [OLE32.@]
|
||||||
|
*/
|
||||||
HRESULT WINAPI StgCreateStorageEx(const WCHAR* pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS* pStgOptions, void* reserved, REFIID riid, void** ppObjectOpen)
|
HRESULT WINAPI StgCreateStorageEx(const WCHAR* pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS* pStgOptions, void* reserved, REFIID riid, void** ppObjectOpen)
|
||||||
{
|
{
|
||||||
TRACE("(%s, %lx, %lx, %lx, %p, %p, %p, %p)\n", debugstr_w(pwcsName),
|
TRACE("(%s, %lx, %lx, %lx, %p, %p, %p, %p)\n", debugstr_w(pwcsName),
|
||||||
|
@ -5898,7 +5901,7 @@ HRESULT WINAPI OleLoadFromStream(IStream *pStm,REFIID iidInterface,void** ppvOb
|
||||||
res=CoCreateInstance(&clsid,NULL,CLSCTX_INPROC_SERVER,iidInterface,ppvObj);
|
res=CoCreateInstance(&clsid,NULL,CLSCTX_INPROC_SERVER,iidInterface,ppvObj);
|
||||||
if (!SUCCEEDED(res))
|
if (!SUCCEEDED(res))
|
||||||
return res;
|
return res;
|
||||||
res=IUnknown_QueryInterface((IUnknown*)*ppvObj,&IID_IPersistStream,(LPVOID*)(char*)&xstm);
|
res=IUnknown_QueryInterface((IUnknown*)*ppvObj,&IID_IPersistStream,(LPVOID*)&xstm);
|
||||||
if (!SUCCEEDED(res)) {
|
if (!SUCCEEDED(res)) {
|
||||||
IUnknown_Release((IUnknown*)*ppvObj);
|
IUnknown_Release((IUnknown*)*ppvObj);
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in a new issue