Changed ICOM_THIS definition.

This commit is contained in:
Francois Gouget 1999-02-17 15:57:24 +00:00 committed by Alexandre Julliard
parent 4ca9d75542
commit 452db3f18a
10 changed files with 605 additions and 455 deletions

View File

@ -23,7 +23,7 @@ UINT32 cfFileContents=0;
/*********************************************************************** /***********************************************************************
* IEnumFORMATETC implementation * IEnumFORMATETC implementation
*/ */
typedef struct _IEnumFORMATETC typedef struct
{ {
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IEnumFORMATETC)* lpvtbl; ICOM_VTABLE(IEnumFORMATETC)* lpvtbl;
@ -32,11 +32,11 @@ typedef struct _IEnumFORMATETC
UINT32 posFmt; UINT32 posFmt;
UINT32 countFmt; UINT32 countFmt;
LPFORMATETC32 pFmt; LPFORMATETC32 pFmt;
} _IEnumFORMATETC; } IEnumFORMATETCImpl;
static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPUNKNOWN iface, REFIID riid, LPVOID* ppvObj); static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPENUMFORMATETC iface, REFIID riid, LPVOID* ppvObj);
static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPUNKNOWN iface); static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPENUMFORMATETC iface);
static ULONG WINAPI IEnumFORMATETC_fnRelease(LPUNKNOWN iface); static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface);
static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, FORMATETC32* rgelt, ULONG* pceltFethed); static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, FORMATETC32* rgelt, ULONG* pceltFethed);
static HRESULT WINAPI IEnumFORMATETC_fnSkip(LPENUMFORMATETC iface, ULONG celt); static HRESULT WINAPI IEnumFORMATETC_fnSkip(LPENUMFORMATETC iface, ULONG celt);
static HRESULT WINAPI IEnumFORMATETC_fnReset(LPENUMFORMATETC iface); static HRESULT WINAPI IEnumFORMATETC_fnReset(LPENUMFORMATETC iface);
@ -44,11 +44,9 @@ static HRESULT WINAPI IEnumFORMATETC_fnClone(LPENUMFORMATETC iface, LPENUMFORMAT
static struct ICOM_VTABLE(IEnumFORMATETC) efvt = static struct ICOM_VTABLE(IEnumFORMATETC) efvt =
{ {
{
IEnumFORMATETC_fnQueryInterface, IEnumFORMATETC_fnQueryInterface,
IEnumFORMATETC_fnAddRef, IEnumFORMATETC_fnAddRef,
IEnumFORMATETC_fnRelease IEnumFORMATETC_fnRelease,
},
IEnumFORMATETC_fnNext, IEnumFORMATETC_fnNext,
IEnumFORMATETC_fnSkip, IEnumFORMATETC_fnSkip,
IEnumFORMATETC_fnReset, IEnumFORMATETC_fnReset,
@ -57,10 +55,10 @@ static struct ICOM_VTABLE(IEnumFORMATETC) efvt =
LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT32 cfmt, const FORMATETC32 afmt[]) LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT32 cfmt, const FORMATETC32 afmt[])
{ {
_IEnumFORMATETC* ef; IEnumFORMATETCImpl* ef;
DWORD size=cfmt * sizeof(FORMATETC32); DWORD size=cfmt * sizeof(FORMATETC32);
ef=(_IEnumFORMATETC*)HeapAlloc(GetProcessHeap(),0,sizeof(_IEnumFORMATETC)); ef=(IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IEnumFORMATETCImpl));
ef->ref=1; ef->ref=1;
ef->lpvtbl=&efvt; ef->lpvtbl=&efvt;
@ -76,20 +74,20 @@ LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT32 cfmt, const FORMATETC32 afmt[]
shell32_ObjCount++; shell32_ObjCount++;
return (LPENUMFORMATETC)ef; return (LPENUMFORMATETC)ef;
} }
static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPUNKNOWN iface, REFIID riid, LPVOID* ppvObj) static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPENUMFORMATETC iface, REFIID riid, LPVOID* ppvObj)
{ {
ICOM_THIS(IEnumFORMATETC,iface); ICOM_THIS(IEnumFORMATETCImpl,iface);
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj); TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) if(IsEqualIID(riid, &IID_IUnknown))
{ *ppvObj = this; { *ppvObj = This;
} }
else if(IsEqualIID(riid, &IID_IEnumFORMATETC)) else if(IsEqualIID(riid, &IID_IEnumFORMATETC))
{ *ppvObj = (IDataObject*)this; { *ppvObj = (IDataObject*)This;
} }
if(*ppvObj) if(*ppvObj)
@ -101,46 +99,46 @@ static HRESULT WINAPI IEnumFORMATETC_fnQueryInterface(LPUNKNOWN iface, REFIID ri
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPUNKNOWN iface) static ULONG WINAPI IEnumFORMATETC_fnAddRef(LPENUMFORMATETC iface)
{ {
ICOM_THIS(IEnumFORMATETC,iface); ICOM_THIS(IEnumFORMATETCImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); TRACE(shell,"(%p)->(count=%lu)\n",This,(This->ref)+1);
shell32_ObjCount++; shell32_ObjCount++;
return ++(this->ref); return ++(This->ref);
} }
static ULONG WINAPI IEnumFORMATETC_fnRelease(LPUNKNOWN iface) static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
{ {
ICOM_THIS(IEnumFORMATETC,iface); ICOM_THIS(IEnumFORMATETCImpl,iface);
TRACE(shell,"(%p)->()\n",this); TRACE(shell,"(%p)->()\n",This);
shell32_ObjCount--; shell32_ObjCount--;
if (!--(this->ref)) if (!--(This->ref))
{ TRACE(shell," destroying IEnumFORMATETC(%p)\n",this); { TRACE(shell," destroying IEnumFORMATETC(%p)\n",This);
if (this->pFmt) if (This->pFmt)
{ SHFree (this->pFmt); { SHFree (This->pFmt);
} }
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, FORMATETC32 *rgelt, ULONG *pceltFethed) static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, FORMATETC32 *rgelt, ULONG *pceltFethed)
{ {
ICOM_THIS(IEnumFORMATETC,iface); ICOM_THIS(IEnumFORMATETCImpl,iface);
UINT32 cfetch; UINT32 cfetch;
HRESULT hres = S_FALSE; HRESULT hres = S_FALSE;
TRACE (shell, "(%p)->()\n", this); TRACE (shell, "(%p)->()\n", This);
if (this->posFmt < this->countFmt) if (This->posFmt < This->countFmt)
{ cfetch = this->countFmt - this->posFmt; { cfetch = This->countFmt - This->posFmt;
if (cfetch >= celt) if (cfetch >= celt)
{ cfetch = celt; { cfetch = celt;
hres = S_OK; hres = S_OK;
} }
memcpy(rgelt, &this->pFmt[this->posFmt], cfetch * sizeof(FORMATETC32)); memcpy(rgelt, &This->pFmt[This->posFmt], cfetch * sizeof(FORMATETC32));
this->posFmt += cfetch; This->posFmt += cfetch;
} }
else else
{ cfetch = 0; { cfetch = 0;
@ -154,35 +152,35 @@ static HRESULT WINAPI IEnumFORMATETC_fnNext(LPENUMFORMATETC iface, ULONG celt, F
} }
static HRESULT WINAPI IEnumFORMATETC_fnSkip(LPENUMFORMATETC iface, ULONG celt) static HRESULT WINAPI IEnumFORMATETC_fnSkip(LPENUMFORMATETC iface, ULONG celt)
{ {
ICOM_THIS(IEnumFORMATETC,iface); ICOM_THIS(IEnumFORMATETCImpl,iface);
FIXME (shell, "(%p)->(num=%lu)\n", this, celt); FIXME (shell, "(%p)->(num=%lu)\n", This, celt);
this->posFmt += celt; This->posFmt += celt;
if (this->posFmt > this->countFmt) if (This->posFmt > This->countFmt)
{ this->posFmt = this->countFmt; { This->posFmt = This->countFmt;
return S_FALSE; return S_FALSE;
} }
return S_OK; return S_OK;
} }
static HRESULT WINAPI IEnumFORMATETC_fnReset(LPENUMFORMATETC iface) static HRESULT WINAPI IEnumFORMATETC_fnReset(LPENUMFORMATETC iface)
{ {
ICOM_THIS(IEnumFORMATETC,iface); ICOM_THIS(IEnumFORMATETCImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
this->posFmt = 0; This->posFmt = 0;
return S_OK; return S_OK;
} }
static HRESULT WINAPI IEnumFORMATETC_fnClone(LPENUMFORMATETC iface, LPENUMFORMATETC* ppenum) static HRESULT WINAPI IEnumFORMATETC_fnClone(LPENUMFORMATETC iface, LPENUMFORMATETC* ppenum)
{ {
ICOM_THIS(IEnumFORMATETC,iface); ICOM_THIS(IEnumFORMATETCImpl,iface);
FIXME (shell, "(%p)->(ppenum=%p)\n", this, ppenum); FIXME (shell, "(%p)->(ppenum=%p)\n", This, ppenum);
return E_NOTIMPL; return E_NOTIMPL;
} }
/*********************************************************************** /***********************************************************************
* IDataObject implementation * IDataObject implementation
*/ */
typedef struct _IDataObject typedef struct
{ {
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IDataObject)* lpvtbl; ICOM_VTABLE(IDataObject)* lpvtbl;
@ -191,11 +189,11 @@ typedef struct _IDataObject
LPSHELLFOLDER psf; LPSHELLFOLDER psf;
LPIDLLIST lpill; /* the data of the dataobject */ LPIDLLIST lpill; /* the data of the dataobject */
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
} _IDataObject; } IDataObjectImpl;
static HRESULT WINAPI IDataObject_fnQueryInterface(LPUNKNOWN iface, REFIID riid, LPVOID* ppvObj); static HRESULT WINAPI IDataObject_fnQueryInterface(LPDATAOBJECT iface, REFIID riid, LPVOID* ppvObj);
static ULONG WINAPI IDataObject_fnAddRef(LPUNKNOWN iface); static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface);
static ULONG WINAPI IDataObject_fnRelease(LPUNKNOWN iface); static ULONG WINAPI IDataObject_fnRelease(LPDATAOBJECT iface);
static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetcIn, STGMEDIUM32* pmedium); static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetcIn, STGMEDIUM32* pmedium);
static HRESULT WINAPI IDataObject_fnGetDataHere(LPDATAOBJECT iface, LPFORMATETC32 pformatetc, STGMEDIUM32* pmedium); static HRESULT WINAPI IDataObject_fnGetDataHere(LPDATAOBJECT iface, LPFORMATETC32 pformatetc, STGMEDIUM32* pmedium);
static HRESULT WINAPI IDataObject_fnQueryGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetc); static HRESULT WINAPI IDataObject_fnQueryGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetc);
@ -208,11 +206,9 @@ static HRESULT WINAPI IDataObject_fnEnumDAdvise(LPDATAOBJECT iface, IEnumSTATDAT
static struct ICOM_VTABLE(IDataObject) dtovt = static struct ICOM_VTABLE(IDataObject) dtovt =
{ {
{
IDataObject_fnQueryInterface, IDataObject_fnQueryInterface,
IDataObject_fnAddRef, IDataObject_fnAddRef,
IDataObject_fnRelease IDataObject_fnRelease,
},
IDataObject_fnGetData, IDataObject_fnGetData,
IDataObject_fnGetDataHere, IDataObject_fnGetDataHere,
IDataObject_fnQueryGetData, IDataObject_fnQueryGetData,
@ -229,8 +225,8 @@ static struct ICOM_VTABLE(IDataObject) dtovt =
*/ */
LPDATAOBJECT IDataObject_Constructor(HWND32 hwndOwner, LPSHELLFOLDER psf, LPITEMIDLIST * apidl, UINT32 cidl) LPDATAOBJECT IDataObject_Constructor(HWND32 hwndOwner, LPSHELLFOLDER psf, LPITEMIDLIST * apidl, UINT32 cidl)
{ {
_IDataObject* dto; IDataObjectImpl* dto;
if (!(dto = (_IDataObject*)HeapAlloc(GetProcessHeap(),0,sizeof(_IDataObject)))) if (!(dto = (IDataObjectImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDataObjectImpl))))
return NULL; return NULL;
dto->ref=1; dto->ref=1;
@ -252,20 +248,20 @@ LPDATAOBJECT IDataObject_Constructor(HWND32 hwndOwner, LPSHELLFOLDER psf, LPITEM
/*************************************************************************** /***************************************************************************
* IDataObject_QueryInterface * IDataObject_QueryInterface
*/ */
static HRESULT WINAPI IDataObject_fnQueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID * ppvObj) static HRESULT WINAPI IDataObject_fnQueryInterface(LPDATAOBJECT iface, REFIID riid, LPVOID * ppvObj)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj); TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj);
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this; { *ppvObj = This;
} }
else if(IsEqualIID(riid, &IID_IDataObject)) /*IDataObject*/ else if(IsEqualIID(riid, &IID_IDataObject)) /*IDataObject*/
{ *ppvObj = (IDataObject*)this; { *ppvObj = (IDataObject*)This;
} }
if(*ppvObj) if(*ppvObj)
@ -279,32 +275,32 @@ static HRESULT WINAPI IDataObject_fnQueryInterface (LPUNKNOWN iface, REFIID riid
/************************************************************************** /**************************************************************************
* IDataObject_AddRef * IDataObject_AddRef
*/ */
static ULONG WINAPI IDataObject_fnAddRef(LPUNKNOWN iface) static ULONG WINAPI IDataObject_fnAddRef(LPDATAOBJECT iface)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); TRACE(shell,"(%p)->(count=%lu)\n",This,(This->ref)+1);
shell32_ObjCount++; shell32_ObjCount++;
return ++(this->ref); return ++(This->ref);
} }
/************************************************************************** /**************************************************************************
* IDataObject_Release * IDataObject_Release
*/ */
static ULONG WINAPI IDataObject_fnRelease(LPUNKNOWN iface) static ULONG WINAPI IDataObject_fnRelease(LPDATAOBJECT iface)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
TRACE(shell,"(%p)->()\n",this); TRACE(shell,"(%p)->()\n",This);
shell32_ObjCount--; shell32_ObjCount--;
if (!--(this->ref)) if (!--(This->ref))
{ TRACE(shell," destroying IDataObject(%p)\n",this); { TRACE(shell," destroying IDataObject(%p)\n",This);
IDLList_Destructor(this->lpill); IDLList_Destructor(This->lpill);
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
/************************************************************************** /**************************************************************************
* DATAOBJECT_InitShellIDList (internal) * DATAOBJECT_InitShellIDList (internal)
@ -359,7 +355,7 @@ static BOOL32 DATAOBJECT_InitFileContents(void)
*/ */
static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetcIn, STGMEDIUM32 *pmedium) static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetcIn, STGMEDIUM32 *pmedium)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
char temp[256]; char temp[256];
UINT32 cItems; UINT32 cItems;
DWORD size, size1, size2; DWORD size, size1, size2;
@ -368,7 +364,7 @@ static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pf
HGLOBAL32 hmem; HGLOBAL32 hmem;
GetClipboardFormatName32A (pformatetcIn->cfFormat, temp, 256); GetClipboardFormatName32A (pformatetcIn->cfFormat, temp, 256);
WARN (shell, "(%p)->(%p %p format=%s)semi-stub\n", this, pformatetcIn, pmedium, temp); WARN (shell, "(%p)->(%p %p format=%s)semi-stub\n", This, pformatetcIn, pmedium, temp);
if (!DATAOBJECT_InitShellIDList()) /* is the clipformat registred? */ if (!DATAOBJECT_InitShellIDList()) /* is the clipformat registred? */
{ return(E_UNEXPECTED); { return(E_UNEXPECTED);
@ -379,19 +375,19 @@ static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pf
&& (pformatetcIn->dwAspect & DVASPECT_CONTENT) && (pformatetcIn->dwAspect & DVASPECT_CONTENT)
&& pformatetcIn->lindex==-1 && pformatetcIn->lindex==-1
&& (pformatetcIn->tymed&TYMED_HGLOBAL)) && (pformatetcIn->tymed&TYMED_HGLOBAL))
{ cItems = this->lpill->lpvtbl->fnGetCount(this->lpill); { cItems = This->lpill->lpvtbl->fnGetCount(This->lpill);
if (cItems < 1) if (cItems < 1)
{ return(E_UNEXPECTED); { return(E_UNEXPECTED);
} }
pidl = this->lpill->lpvtbl->fnGetElement(this->lpill, 0); pidl = This->lpill->lpvtbl->fnGetElement(This->lpill, 0);
pdump(this->pidl); pdump(This->pidl);
pdump(pidl); pdump(pidl);
/*hack consider only the first item*/ /*hack consider only the first item*/
cItems = 2; cItems = 2;
size = sizeof(CIDA) + sizeof (UINT32)*(cItems-1); size = sizeof(CIDA) + sizeof (UINT32)*(cItems-1);
size1 = ILGetSize (this->pidl); size1 = ILGetSize (This->pidl);
size2 = ILGetSize (pidl); size2 = ILGetSize (pidl);
hmem = GlobalAlloc32(GMEM_FIXED, size+size1+size2); hmem = GlobalAlloc32(GMEM_FIXED, size+size1+size2);
pcida = GlobalLock32 (hmem); pcida = GlobalLock32 (hmem);
@ -404,10 +400,10 @@ static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pf
pcida->aoffset[1] = size+size1; pcida->aoffset[1] = size+size1;
TRACE(shell,"-- %lu %lu %lu\n",size, size1, size2 ); TRACE(shell,"-- %lu %lu %lu\n",size, size1, size2 );
TRACE(shell,"-- %p %p\n",this->pidl, pidl); TRACE(shell,"-- %p %p\n",This->pidl, pidl);
TRACE(shell,"-- %p %p %p\n",pcida, (LPBYTE)pcida+size,(LPBYTE)pcida+size+size1); TRACE(shell,"-- %p %p %p\n",pcida, (LPBYTE)pcida+size,(LPBYTE)pcida+size+size1);
memcpy ((LPBYTE)pcida+size, this->pidl, size1); memcpy ((LPBYTE)pcida+size, This->pidl, size1);
memcpy ((LPBYTE)pcida+size+size1, pidl, size2); memcpy ((LPBYTE)pcida+size+size1, pidl, size2);
TRACE(shell,"-- after copy\n"); TRACE(shell,"-- after copy\n");
@ -425,49 +421,49 @@ static HRESULT WINAPI IDataObject_fnGetData(LPDATAOBJECT iface, LPFORMATETC32 pf
} }
static HRESULT WINAPI IDataObject_fnGetDataHere(LPDATAOBJECT iface, LPFORMATETC32 pformatetc, STGMEDIUM32 *pmedium) static HRESULT WINAPI IDataObject_fnGetDataHere(LPDATAOBJECT iface, LPFORMATETC32 pformatetc, STGMEDIUM32 *pmedium)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnQueryGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetc) static HRESULT WINAPI IDataObject_fnQueryGetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetc)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnGetCanonicalFormatEtc(LPDATAOBJECT iface, LPFORMATETC32 pformatectIn, LPFORMATETC32 pformatetcOut) static HRESULT WINAPI IDataObject_fnGetCanonicalFormatEtc(LPDATAOBJECT iface, LPFORMATETC32 pformatectIn, LPFORMATETC32 pformatetcOut)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnSetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetc, STGMEDIUM32 *pmedium, BOOL32 fRelease) static HRESULT WINAPI IDataObject_fnSetData(LPDATAOBJECT iface, LPFORMATETC32 pformatetc, STGMEDIUM32 *pmedium, BOOL32 fRelease)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnEnumFormatEtc(LPDATAOBJECT iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc) static HRESULT WINAPI IDataObject_fnEnumFormatEtc(LPDATAOBJECT iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnDAdvise(LPDATAOBJECT iface, LPFORMATETC32 *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection) static HRESULT WINAPI IDataObject_fnDAdvise(LPDATAOBJECT iface, LPFORMATETC32 *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnDUnadvise(LPDATAOBJECT iface, DWORD dwConnection) static HRESULT WINAPI IDataObject_fnDUnadvise(LPDATAOBJECT iface, DWORD dwConnection)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDataObject_fnEnumDAdvise(LPDATAOBJECT iface, IEnumSTATDATA **ppenumAdvise) static HRESULT WINAPI IDataObject_fnEnumDAdvise(LPDATAOBJECT iface, IEnumSTATDATA **ppenumAdvise)
{ {
ICOM_THIS(IDataObject,iface); ICOM_THIS(IDataObjectImpl,iface);
FIXME (shell, "(%p)->()\n", this); FIXME (shell, "(%p)->()\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }

View File

@ -18,11 +18,12 @@
#include "shlguid.h" #include "shlguid.h"
/* IPersistFile Implementation */ /* IPersistFile Implementation */
typedef struct _IPersistFile { typedef struct
{
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IPersistFile)* lpvtbl; ICOM_VTABLE(IPersistFile)* lpvtbl;
DWORD ref; DWORD ref;
} _IPersistFile; } IPersistFileImpl;
static struct ICOM_VTABLE(IPersistFile) pfvt; static struct ICOM_VTABLE(IPersistFile) pfvt;
@ -32,9 +33,9 @@ static struct ICOM_VTABLE(IPersistFile) pfvt;
*/ */
LPPERSISTFILE IPersistFile_Constructor(void) LPPERSISTFILE IPersistFile_Constructor(void)
{ {
_IPersistFile* sl; IPersistFileImpl* sl;
sl = (_IPersistFile*)HeapAlloc(GetProcessHeap(),0,sizeof(_IPersistFile)); sl = (IPersistFileImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IPersistFileImpl));
sl->ref = 1; sl->ref = 1;
sl->lpvtbl = &pfvt; sl->lpvtbl = &pfvt;
@ -49,18 +50,18 @@ LPPERSISTFILE IPersistFile_Constructor(void)
static HRESULT WINAPI IPersistFile_fnQueryInterface( static HRESULT WINAPI IPersistFile_fnQueryInterface(
LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj) LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj)
{ {
ICOM_THIS(IPersistFile,iface); ICOM_THIS(IPersistFileImpl,iface);
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid); TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",This,xriid);
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this; { *ppvObj = This;
} }
else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/ else if(IsEqualIID(riid, &IID_IPersistFile)) /*IPersistFile*/
{ *ppvObj = (LPPERSISTFILE)this; { *ppvObj = (LPPERSISTFILE)This;
} }
if(*ppvObj) if(*ppvObj)
@ -76,64 +77,64 @@ static HRESULT WINAPI IPersistFile_fnQueryInterface(
*/ */
static ULONG WINAPI IPersistFile_fnAddRef(LPUNKNOWN iface) static ULONG WINAPI IPersistFile_fnAddRef(LPUNKNOWN iface)
{ {
ICOM_THIS(IPersistFile,iface); ICOM_THIS(IPersistFileImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount++; shell32_ObjCount++;
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IPersistFile_Release * IPersistFile_Release
*/ */
static ULONG WINAPI IPersistFile_fnRelease(LPUNKNOWN iface) static ULONG WINAPI IPersistFile_fnRelease(LPUNKNOWN iface)
{ {
ICOM_THIS(IPersistFile,iface); ICOM_THIS(IPersistFileImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount--; shell32_ObjCount--;
if (!--(this->ref)) if (!--(This->ref))
{ TRACE(shell,"-- destroying IPersistFile(%p)\n",this); { TRACE(shell,"-- destroying IPersistFile(%p)\n",This);
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
static HRESULT WINAPI IPersistFile_fnGetClassID(const IPersist* iface, CLSID *pClassID) static HRESULT WINAPI IPersistFile_fnGetClassID(const IPersist* iface, CLSID *pClassID)
{ {
ICOM_CTHIS(IPersistFile,iface); ICOM_CTHIS(IPersistFile,iface);
FIXME(shell,"(%p)\n",this); FIXME(shell,"(%p)\n",This);
return NOERROR; return NOERROR;
} }
static HRESULT WINAPI IPersistFile_fnIsDirty(const IPersistFile* iface) static HRESULT WINAPI IPersistFile_fnIsDirty(const IPersistFile* iface)
{ {
ICOM_CTHIS(IPersistFile,iface); ICOM_CTHIS(IPersistFile,iface);
FIXME(shell,"(%p)\n",this); FIXME(shell,"(%p)\n",This);
return NOERROR; return NOERROR;
} }
static HRESULT WINAPI IPersistFile_fnLoad(LPPERSISTFILE iface, LPCOLESTR32 pszFileName, DWORD dwMode) static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR32 pszFileName, DWORD dwMode)
{ {
ICOM_THIS(IPersistFile,iface); ICOM_THIS(IPersistFileImpl,iface);
FIXME(shell,"(%p)->(%s)\n",this,debugstr_w(pszFileName)); FIXME(shell,"(%p)->(%s)\n",This,debugstr_w(pszFileName));
return E_FAIL; return E_FAIL;
} }
static HRESULT WINAPI IPersistFile_fnSave(LPPERSISTFILE iface, LPCOLESTR32 pszFileName, BOOL32 fRemember) static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR32 pszFileName, BOOL32 fRemember)
{ {
ICOM_THIS(IPersistFile,iface); ICOM_THIS(IPersistFileImpl,iface);
FIXME(shell,"(%p)->(%s)\n",this,debugstr_w(pszFileName)); FIXME(shell,"(%p)->(%s)\n",This,debugstr_w(pszFileName));
return NOERROR; return NOERROR;
} }
static HRESULT WINAPI IPersistFile_fnSaveCompleted(LPPERSISTFILE iface, LPCOLESTR32 pszFileName) static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR32 pszFileName)
{ {
ICOM_THIS(IPersistFile,iface); ICOM_THIS(IPersistFileImpl,iface);
FIXME(shell,"(%p)->(%s)\n",this,debugstr_w(pszFileName)); FIXME(shell,"(%p)->(%s)\n",This,debugstr_w(pszFileName));
return NOERROR; return NOERROR;
} }
static HRESULT WINAPI IPersistFile_fnGetCurFile(const IPersistFile* iface, LPOLESTR32 *ppszFileName) static HRESULT WINAPI IPersistFile_fnGetCurFile(const IPersistFile* iface, LPOLESTR32 *ppszFileName)
{ {
ICOM_CTHIS(IPersistFile,iface); ICOM_CTHIS(IPersistFileImpl,iface);
FIXME(shell,"(%p)\n",this); FIXME(shell,"(%p)\n",This);
return NOERROR; return NOERROR;
} }
@ -158,6 +159,12 @@ static struct ICOM_VTABLE(IPersistFile) pfvt =
/************************************************************************** /**************************************************************************
* IShellLink's IClassFactory implementation * IShellLink's IClassFactory implementation
*/ */
typedef struct
{
/* IUnknown fields */
ICOM_VTABLE(IClassFactory)* lpvtbl;
DWORD ref;
} IClassFactoryImpl;
static ICOM_VTABLE(IClassFactory) slcfvt; static ICOM_VTABLE(IClassFactory) slcfvt;
@ -167,9 +174,9 @@ static ICOM_VTABLE(IClassFactory) slcfvt;
LPCLASSFACTORY IShellLink_CF_Constructor(void) LPCLASSFACTORY IShellLink_CF_Constructor(void)
{ {
_IClassFactory* lpclf; IClassFactoryImpl* lpclf;
lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory)); lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
lpclf->ref = 1; lpclf->ref = 1;
lpclf->lpvtbl = &slcfvt; lpclf->lpvtbl = &slcfvt;
TRACE(shell,"(%p)->()\n",lpclf); TRACE(shell,"(%p)->()\n",lpclf);
@ -180,20 +187,20 @@ LPCLASSFACTORY IShellLink_CF_Constructor(void)
* IShellLink_CF_QueryInterface * IShellLink_CF_QueryInterface
*/ */
static HRESULT WINAPI IShellLink_CF_QueryInterface( static HRESULT WINAPI IShellLink_CF_QueryInterface(
LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) IClassFactory* iface, REFIID riid, LPVOID *ppvObj)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid); TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",This,xriid);
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = (LPUNKNOWN)this; { *ppvObj = (LPUNKNOWN)This;
} }
else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
{ *ppvObj = (LPCLASSFACTORY)this; { *ppvObj = (LPCLASSFACTORY)This;
} }
if(*ppvObj) if(*ppvObj)
@ -207,43 +214,43 @@ static HRESULT WINAPI IShellLink_CF_QueryInterface(
/****************************************************************************** /******************************************************************************
* IShellLink_CF_AddRef * IShellLink_CF_AddRef
*/ */
static ULONG WINAPI IShellLink_CF_AddRef(LPCLASSFACTORY iface) static ULONG WINAPI IShellLink_CF_AddRef(IClassFactory* iface)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount++; shell32_ObjCount++;
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IShellLink_CF_Release * IShellLink_CF_Release
*/ */
static ULONG WINAPI IShellLink_CF_Release(LPCLASSFACTORY iface) static ULONG WINAPI IShellLink_CF_Release(IClassFactory* iface)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount--; shell32_ObjCount--;
if (!--(this->ref)) if (!--(This->ref))
{ TRACE(shell,"-- destroying IClassFactory(%p)\n",this); { TRACE(shell,"-- destroying IClassFactory(%p)\n",This);
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
/****************************************************************************** /******************************************************************************
* IShellLink_CF_CreateInstance * IShellLink_CF_CreateInstance
*/ */
static HRESULT WINAPI IShellLink_CF_CreateInstance( static HRESULT WINAPI IShellLink_CF_CreateInstance(
LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject) IClassFactory* iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
IUnknown *pObj = NULL; IUnknown *pObj = NULL;
HRESULT hres; HRESULT hres;
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject); TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);
*ppObject = NULL; *ppObject = NULL;
@ -265,17 +272,17 @@ static HRESULT WINAPI IShellLink_CF_CreateInstance(
hres = IUnknown_QueryInterface(pObj,riid, ppObject); hres = IUnknown_QueryInterface(pObj,riid, ppObject);
IUnknown_Release(pObj); IUnknown_Release(pObj);
TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject); TRACE(shell,"-- Object created: (%p)->%p\n",This,*ppObject);
return hres; return hres;
} }
/****************************************************************************** /******************************************************************************
* IShellLink_CF_LockServer * IShellLink_CF_LockServer
*/ */
static HRESULT WINAPI IShellLink_CF_LockServer(LPCLASSFACTORY iface, BOOL32 fLock) static HRESULT WINAPI IShellLink_CF_LockServer(IClassFactory* iface, BOOL32 fLock)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock); TRACE(shell,"%p->(0x%x), not implemented\n",This, fLock);
return E_NOTIMPL; return E_NOTIMPL;
} }
static ICOM_VTABLE(IClassFactory) slcfvt = static ICOM_VTABLE(IClassFactory) slcfvt =
@ -504,9 +511,9 @@ static ICOM_VTABLE(IClassFactory) slwcfvt;
LPCLASSFACTORY IShellLinkW_CF_Constructor(void) LPCLASSFACTORY IShellLinkW_CF_Constructor(void)
{ {
_IClassFactory* lpclf; IClassFactoryImpl* lpclf;
lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory)); lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
lpclf->ref = 1; lpclf->ref = 1;
lpclf->lpvtbl = &slwcfvt; lpclf->lpvtbl = &slwcfvt;
TRACE(shell,"(%p)->()\n",lpclf); TRACE(shell,"(%p)->()\n",lpclf);
@ -519,18 +526,18 @@ LPCLASSFACTORY IShellLinkW_CF_Constructor(void)
static HRESULT WINAPI IShellLinkW_CF_QueryInterface( static HRESULT WINAPI IShellLinkW_CF_QueryInterface(
LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid); TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",This,xriid);
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = (LPUNKNOWN)this; { *ppvObj = (LPUNKNOWN)This;
} }
else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
{ *ppvObj = (LPCLASSFACTORY)this; { *ppvObj = (LPCLASSFACTORY)This;
} }
if(*ppvObj) { if(*ppvObj) {
@ -546,27 +553,27 @@ static HRESULT WINAPI IShellLinkW_CF_QueryInterface(
*/ */
static ULONG WINAPI IShellLinkW_CF_AddRef(LPCLASSFACTORY iface) static ULONG WINAPI IShellLinkW_CF_AddRef(LPCLASSFACTORY iface)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount++; shell32_ObjCount++;
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IShellLinkW_CF_Release * IShellLinkW_CF_Release
*/ */
static ULONG WINAPI IShellLinkW_CF_Release(LPCLASSFACTORY iface) static ULONG WINAPI IShellLinkW_CF_Release(LPCLASSFACTORY iface)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount--; shell32_ObjCount--;
if (!--(this->ref)) if (!--(This->ref))
{ TRACE(shell,"-- destroying IClassFactory(%p)\n",this); { TRACE(shell,"-- destroying IClassFactory(%p)\n",This);
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
/****************************************************************************** /******************************************************************************
* IShellLinkW_CF_CreateInstance * IShellLinkW_CF_CreateInstance
@ -574,13 +581,13 @@ static ULONG WINAPI IShellLinkW_CF_Release(LPCLASSFACTORY iface)
static HRESULT WINAPI IShellLinkW_CF_CreateInstance( static HRESULT WINAPI IShellLinkW_CF_CreateInstance(
LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject) LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
IUnknown *pObj = NULL; IUnknown *pObj = NULL;
HRESULT hres; HRESULT hres;
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject); TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);
*ppObject = NULL; *ppObject = NULL;
@ -602,7 +609,7 @@ static HRESULT WINAPI IShellLinkW_CF_CreateInstance(
hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject); hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject);
pObj->lpvtbl->fnRelease(pObj); pObj->lpvtbl->fnRelease(pObj);
TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject); TRACE(shell,"-- Object created: (%p)->%p\n",This,*ppObject);
return hres; return hres;
} }
@ -612,8 +619,8 @@ static HRESULT WINAPI IShellLinkW_CF_CreateInstance(
static HRESULT WINAPI IShellLinkW_CF_LockServer(LPCLASSFACTORY iface, BOOL32 fLock) static HRESULT WINAPI IShellLinkW_CF_LockServer(LPCLASSFACTORY iface, BOOL32 fLock)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock); TRACE(shell,"%p->(0x%x), not implemented\n",This, fLock);
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -695,7 +702,7 @@ LPSHELLLINKW IShellLinkW_Constructor(void)
} }
/************************************************************************** /**************************************************************************
* IShellLinkW::QueryInterface * IShellLinkW_QueryInterface
*/ */
static HRESULT WINAPI IShellLinkW_QueryInterface( static HRESULT WINAPI IShellLinkW_QueryInterface(
LPSHELLLINKW this, REFIID riid, LPVOID *ppvObj) LPSHELLLINKW this, REFIID riid, LPVOID *ppvObj)

View File

@ -212,6 +212,13 @@ DWORD WINAPI SHGetMalloc(LPMALLOC32 *lpmal)
* IClassFactory Implementation * IClassFactory Implementation
*/ */
typedef struct
{
/* IUnknown fields */
ICOM_VTABLE(IClassFactory)* lpvtbl;
DWORD ref;
} IClassFactoryImpl;
static ICOM_VTABLE(IClassFactory) clfvt; static ICOM_VTABLE(IClassFactory) clfvt;
/************************************************************************** /**************************************************************************
@ -220,9 +227,9 @@ static ICOM_VTABLE(IClassFactory) clfvt;
LPCLASSFACTORY IClassFactory_Constructor(void) LPCLASSFACTORY IClassFactory_Constructor(void)
{ {
_IClassFactory* lpclf; IClassFactoryImpl* lpclf;
lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory)); lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
lpclf->ref = 1; lpclf->ref = 1;
lpclf->lpvtbl = &clfvt; lpclf->lpvtbl = &clfvt;
@ -236,18 +243,18 @@ LPCLASSFACTORY IClassFactory_Constructor(void)
static HRESULT WINAPI IClassFactory_fnQueryInterface( static HRESULT WINAPI IClassFactory_fnQueryInterface(
LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid); TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",This,xriid);
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this; { *ppvObj = This;
} }
else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
{ *ppvObj = (IClassFactory*)this; { *ppvObj = (IClassFactory*)This;
} }
if(*ppvObj) if(*ppvObj)
@ -263,27 +270,27 @@ static HRESULT WINAPI IClassFactory_fnQueryInterface(
*/ */
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface) static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount++; shell32_ObjCount++;
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IClassFactory_Release * IClassFactory_Release
*/ */
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface) static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref); TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount--; shell32_ObjCount--;
if (!--(this->ref)) if (!--(This->ref))
{ TRACE(shell,"-- destroying IClassFactory(%p)\n",this); { TRACE(shell,"-- destroying IClassFactory(%p)\n",This);
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
/****************************************************************************** /******************************************************************************
* IClassFactory_CreateInstance * IClassFactory_CreateInstance
@ -291,13 +298,13 @@ static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
static HRESULT WINAPI IClassFactory_fnCreateInstance( static HRESULT WINAPI IClassFactory_fnCreateInstance(
LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject) LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
IUnknown *pObj = NULL; IUnknown *pObj = NULL;
HRESULT hres; HRESULT hres;
char xriid[50]; char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid); WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject); TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);
*ppObject = NULL; *ppObject = NULL;
@ -331,7 +338,7 @@ static HRESULT WINAPI IClassFactory_fnCreateInstance(
hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject); hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject);
pObj->lpvtbl->fnRelease(pObj); pObj->lpvtbl->fnRelease(pObj);
TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject); TRACE(shell,"-- Object created: (%p)->%p\n",This,*ppObject);
return hres; return hres;
} }
@ -340,8 +347,8 @@ static HRESULT WINAPI IClassFactory_fnCreateInstance(
*/ */
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL32 fLock) static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL32 fLock)
{ {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock); TRACE(shell,"%p->(0x%x), not implemented\n",This, fLock);
return E_NOTIMPL; return E_NOTIMPL;
} }

View File

@ -652,8 +652,8 @@ BOOL32 WINAPI IsEqualGUID32(REFGUID rguid1,REFGUID rguid2);
#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g,h) #define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g,h)
#define ICOM_THIS(iface,me) struct _##iface* this=(struct _##iface*)me #define ICOM_THIS(impl,iface) impl* const This=(impl*)iface
#define ICOM_CTHIS(iface,me) const _##iface* this=(const _##iface*)me #define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface
#endif #endif

View File

@ -80,7 +80,8 @@ struct FORMATETC32
* STGMEDIUM structure * STGMEDIUM structure
*/ */
typedef enum tagTYMED typedef enum tagTYMED
{ TYMED_HGLOBAL = 1, {
TYMED_HGLOBAL = 1,
TYMED_FILE = 2, TYMED_FILE = 2,
TYMED_ISTREAM = 4, TYMED_ISTREAM = 4,
TYMED_ISTORAGE = 8, TYMED_ISTORAGE = 8,
@ -110,47 +111,117 @@ struct STGMEDIUM32
/***************************************************************************** /*****************************************************************************
* IAdviseSink interface * IAdviseSink interface
*/ */
/* FIXME: not implemented */
#define ICOM_INTERFACE IAdviseSink #define ICOM_INTERFACE IAdviseSink
ICOM_BEGIN(IAdviseSink,IUnknown) #define IAdviseSink_METHODS \
ICOM_END(IAdviseSink) ICOM_VMETHOD2(OnDataChange, FORMATETC32*,pFormatetc, STGMEDIUM32*,pStgmed) \
ICOM_VMETHOD2(OnViewChange, DWORD,dwAspect, LONG,lindex) \
ICOM_VMETHOD1(OnRename, IMoniker*,pmk) \
ICOM_VMETHOD (OnSave) \
ICOM_VMETHOD (OnClose)
#define IAdviseSink_IMETHODS \
IUnknown_IMETHODS \
IAdviseSink_METHODS
ICOM_DEFINE(IAdviseSink,IUnknown)
#undef ICOM_INTERFACE #undef ICOM_INTERFACE
#ifdef ICOM_CINTERFACE
/*** IUnknown methods ***/
#define IAdviseSink_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IAdviseSink_AddRef(p) ICOM_CALL (AddRef,p)
#define IAdviseSink_Release(p) ICOM_CALL (Release,p)
/*** IAdviseSink methods ***/
#define IAdviseSink_OnDataChange(p,a,b) ICOM_CALL2(OnDataChange,p,a,b)
#define IAdviseSink_OnViewChange(p,a,b) ICOM_CALL2(OnViewChange,p,a,b)
#define IAdviseSink_OnRename(p,a) ICOM_CALL1(OnRename,p,a)
#define IAdviseSink_OnSave(p) ICOM_CALL (OnSave,p)
#define IAdviseSink_OnClose(p) ICOM_CALL (OnClose,p)
#endif
/***************************************************************************** /*****************************************************************************
* IAdviseSink2 interface * IAdviseSink2 interface
*/ */
/* FIXME: not implemented */ #define ICOM_INTERFACE IAdviseSink2
#define IAdviseSink2_METHODS \
ICOM_VMETHOD1(OnLinkSrcChange, IMoniker*,pmk)
#define IAdviseSink2_IMETHODS \
IAdviseSink_IMETHODS \
IAdviseSink2_METHODS
ICOM_DEFINE(IAdviseSink2,IAdviseSink)
#undef ICOM_INTERFACE
#ifdef ICOM_CINTERFACE
/*** IUnknown methods ***/
#define IAdviseSink2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IAdviseSink2_AddRef(p) ICOM_CALL (AddRef,p)
#define IAdviseSink2_Release(p) ICOM_CALL (Release,p)
/*** IAdviseSink methods ***/
#define IAdviseSink2_OnDataChange(p,a,b) ICOM_CALL2(IAdviseSink,OnDataChange,p,a,b)
#define IAdviseSink2_OnViewChange(p,a,b) ICOM_CALL2(IAdviseSink,OnViewChange,p,a,b)
#define IAdviseSink2_OnRename(p,a) ICOM_CALL1(IAdviseSink,OnRename,p,a)
#define IAdviseSink2_OnSave(p) ICOM_CALL (IAdviseSink,OnSave,p)
#define IAdviseSink2_OnClose(p) ICOM_CALL (IAdviseSink,OnClose,p)
/*** IAdviseSink2 methods ***/
#define IAdviseSink2_OnLinkSrcChange(p,a) ICOM_CALL(OnLinkSrcChange,p,a)
#endif
/***************************************************************************** /*****************************************************************************
* IDataAdviseHolder interface * IDataAdviseHolder interface
*/ */
#define ICOM_INTERFACE IDataAdviseHolder
#define IDataAdviseHolder_METHODS \
ICOM_METHOD5(HRESULT,Advise, IDataObject*,pDataObject, FORMATETC32*,pFetc, DWORD,advf, IAdviseSink*,pAdvise, DWORD*,pdwConnection) \
ICOM_METHOD1(HRESULT,Unadvise, DWORD,dwConnection) \
ICOM_METHOD1(HRESULT,EnumAdvise, IEnumSTATDATA**,ppenumAdvise) \
ICOM_METHOD3(HRESULT,SendOnDataChange, IDataObject*,pDataObject, DWORD,dwReserved, DWORD,advf)
#define IDataAdviseHolder_IMETHODS \
IUnknown_IMETHODS \
IDataAdviseHolder_METHODS
ICOM_DEFINE(IDataAdviseHolder,IUnknown)
#undef ICOM_INTERFACE
#ifdef ICOM_CINTERFACE
/*** IUnknown methods ***/
#define IDataAdviseHolder_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IDataAdviseHolder_AddRef(p) ICOM_CALL (AddRef,p)
#define IDataAdviseHolder_Release(p) ICOM_CALL (Release,p)
/*** IDataAdviseHolder methods ***/
#define IDataAdviseHolder_Advise(p,a,b,c,d,e) ICOM_CALL5(Advise,p,a,b,c,d,e)
#define IDataAdviseHolder_Unadvise(p,a) ICOM_CALL1(Unadvise,p,a)
#define IDataAdviseHolder_EnumAdvise(p,a) ICOM_CALL1(EnumAdvise,p,a)
#define IDataAdviseHolder_SendOnDataChange(p,a,b,c) ICOM_CALL3(SendOnDataChange,p,a,b,c)
#endif
/* FIXME: not implemented */ /* FIXME: not implemented */
HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
/***************************************************************************** /*****************************************************************************
* IDataObject interface * IDataObject interface
*/ */
#define ICOM_INTERFACE IDataObject #define ICOM_INTERFACE IDataObject
ICOM_BEGIN(IDataObject,IUnknown) #define IDataObject_METHODS \
ICOM_METHOD2(HRESULT,GetData, LPFORMATETC32,pformatetcIn, STGMEDIUM32*,pmedium); ICOM_METHOD2(HRESULT,GetData, LPFORMATETC32,pformatetcIn, STGMEDIUM32*,pmedium) \
ICOM_METHOD2(HRESULT,GetDataHere, LPFORMATETC32,pformatetc, STGMEDIUM32*,pmedium); ICOM_METHOD2(HRESULT,GetDataHere, LPFORMATETC32,pformatetc, STGMEDIUM32*,pmedium) \
ICOM_METHOD1(HRESULT,QueryGetData, LPFORMATETC32,pformatetc); ICOM_METHOD1(HRESULT,QueryGetData, LPFORMATETC32,pformatetc) \
ICOM_METHOD2(HRESULT,GetCanonicalFormatEtc, LPFORMATETC32,pformatectIn, LPFORMATETC32,pformatetcOut); ICOM_METHOD2(HRESULT,GetCanonicalFormatEtc, LPFORMATETC32,pformatectIn, LPFORMATETC32,pformatetcOut) \
ICOM_METHOD3(HRESULT,SetData, LPFORMATETC32,pformatetc, STGMEDIUM32*,pmedium, BOOL32,fRelease); ICOM_METHOD3(HRESULT,SetData, LPFORMATETC32,pformatetc, STGMEDIUM32*,pmedium, BOOL32,fRelease) \
ICOM_METHOD2(HRESULT,EnumFormatEtc, DWORD,dwDirection, IEnumFORMATETC**,ppenumFormatEtc); ICOM_METHOD2(HRESULT,EnumFormatEtc, DWORD,dwDirection, IEnumFORMATETC**,ppenumFormatEtc) \
ICOM_METHOD4(HRESULT,DAdvise, LPFORMATETC32*,pformatetc, DWORD,advf, IAdviseSink*,pAdvSink, DWORD*,pdwConnection); ICOM_METHOD4(HRESULT,DAdvise, LPFORMATETC32*,pformatetc, DWORD,advf, IAdviseSink*,pAdvSink, DWORD*,pdwConnection) \
ICOM_METHOD1(HRESULT,DUnadvise, DWORD,dwConnection); ICOM_METHOD1(HRESULT,DUnadvise, DWORD,dwConnection) \
ICOM_METHOD1(HRESULT,EnumDAdvise, IEnumSTATDATA**,ppenumAdvise); ICOM_METHOD1(HRESULT,EnumDAdvise, IEnumSTATDATA**,ppenumAdvise)
ICOM_END(IDataObject) #define IDataObject_IMETHODS \
IUnknown_IMETHODS \
IDataObject_METHODS
ICOM_DEFINE(IDataObject,IUnknown)
#undef ICOM_INTERFACE #undef ICOM_INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE) #ifdef ICOM_CINTERFACE
/*** IUnknown methods ***/ /*** IUnknown methods ***/
#define IDataObject_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b) #define IDataObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IDataObject_AddRef(p) ICOM_ICALL (IUnknown,AddRef,p) #define IDataObject_AddRef(p) ICOM_CALL (AddRef,p)
#define IDataObject_Release(p) ICOM_ICALL (IUnknown,Release,p) #define IDataObject_Release(p) ICOM_CALL (Release,p)
/*** IDataObject methods ***/ /*** IDataObject methods ***/
#define IDataObject_GetData(p,a,b) ICOM_CALL2(GetData,p,a,b) #define IDataObject_GetData(p,a,b) ICOM_CALL2(GetData,p,a,b)
#define IDataObject_GetDataHere(p,a,b) ICOM_CALL2(GetDataHere,p,a,b) #define IDataObject_GetDataHere(p,a,b) ICOM_CALL2(GetDataHere,p,a,b)
@ -168,19 +239,22 @@ ICOM_END(IDataObject)
* IEnumFORMATETC interface * IEnumFORMATETC interface
*/ */
#define ICOM_INTERFACE IEnumFORMATETC #define ICOM_INTERFACE IEnumFORMATETC
ICOM_BEGIN(IEnumFORMATETC,IUnknown) #define IEnumFORMATETC_METHODS \
ICOM_METHOD3(HRESULT,Next, ULONG,celt, FORMATETC32*,rgelt, ULONG*,pceltFethed); ICOM_METHOD3(HRESULT,Next, ULONG,celt, FORMATETC32*,rgelt, ULONG*,pceltFethed) \
ICOM_METHOD1(HRESULT,Skip, ULONG,celt); ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \
ICOM_METHOD (HRESULT,Reset); ICOM_METHOD (HRESULT,Reset) \
ICOM_METHOD1(HRESULT,Clone, IEnumFORMATETC**,ppenum); ICOM_METHOD1(HRESULT,Clone, IEnumFORMATETC**,ppenum)
ICOM_END(IEnumFORMATETC) #define IEnumFORMATETC_IMETHODS \
IUnknown_IMETHODS \
IEnumFORMATETC_METHODS
ICOM_DEFINE(IEnumFORMATETC,IUnknown)
#undef ICOM_INTERFACE #undef ICOM_INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE) #ifdef ICOM_CINTERFACE
/*** IUnknown methods ***/ /*** IUnknown methods ***/
#define IEnumFORMATETC_QueryInterface(p,a,b) ICOM_ICALL2(IUnknown,QueryInterface,p,a,b) #define IEnumFORMATETC_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IEnumFORMATETC_AddRef(p) ICOM_ICALL (IUnknown,AddRef,p) #define IEnumFORMATETC_AddRef(p) ICOM_CALL (AddRef,p)
#define IEnumFORMATETC_Release(p) ICOM_ICALL (IUnknown,Release,p) #define IEnumFORMATETC_Release(p) ICOM_CALL (Release,p)
/*** IEnumFORMATETC methods ***/ /*** IEnumFORMATETC methods ***/
#define IEnumFORMATETC_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c) #define IEnumFORMATETC_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
#define IEnumFORMATETC_Skip(p,a) ICOM_CALL1(Skip,p,a) #define IEnumFORMATETC_Skip(p,a) ICOM_CALL1(Skip,p,a)
@ -192,7 +266,45 @@ ICOM_END(IEnumFORMATETC)
/***************************************************************************** /*****************************************************************************
* IEnumSTATDATA interface * IEnumSTATDATA interface
*/ */
typedef struct tagSTATDATA
{
FORMATETC32 formatetc;
DWORD advf;
IAdviseSink* pAdvSink;
DWORD dwConnection;
} STATDATA32;
#define ICOM_INTERFACE IEnumSTATDATA
#define IEnumSTATDATA_METHODS \
ICOM_METHOD3(HRESULT,Next, ULONG,celt, STATDATA32*,rgelt, ULONG*,pceltFethed) \
ICOM_METHOD1(HRESULT,Skip, ULONG,celt) \
ICOM_METHOD (HRESULT,Reset) \
ICOM_METHOD1(HRESULT,Clone, IEnumSTATDATA**,ppenum)
#define IEnumSTATDATA_IMETHODS \
IUnknown_IMETHODS \
IEnumSTATDATA_METHODS
ICOM_DEFINE(IEnumSTATDATA,IUnknown)
#undef ICOM_INTERFACE
#ifdef ICOM_CINTERFACE
/*** IUnknown methods ***/
#define IEnumSTATDATA_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IEnumSTATDATA_AddRef(p) ICOM_CALL (AddRef,p)
#define IEnumSTATDATA_Release(p) ICOM_CALL (Release,p)
/*** IEnumSTATDATA methods ***/
#define IEnumSTATDATA_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
#define IEnumSTATDATA_Skip(p,a) ICOM_CALL1(Skip,p,a)
#define IEnumSTATDATA_Reset(p) ICOM_CALL (Reset,p)
#define IEnumSTATDATA_Clone(p,a) ICOM_CALL1(Clone,p,a)
#endif
/*****************************************************************************
* Additional API
*/
/* FIXME: not implemented */ /* FIXME: not implemented */
HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
#endif /* __WINE_WINE_OBJ_DATAOBJECT_H */ #endif /* __WINE_WINE_OBJ_DATAOBJECT_H */

View File

@ -2158,39 +2158,46 @@ HRESULT WINAPI DirectSoundCreate(LPGUID lpGUID,LPDIRECTSOUND *ppDS,IUnknown *pUn
/******************************************************************************* /*******************************************************************************
* DirectSound ClassFactory * DirectSound ClassFactory
*/ */
typedef struct
{
/* IUnknown fields */
ICOM_VTABLE(IClassFactory)* lpvtbl;
DWORD ref;
} IClassFactoryImpl;
static HRESULT WINAPI static HRESULT WINAPI
DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
char buf[80]; char buf[80];
if (HIWORD(riid)) if (HIWORD(riid))
WINE_StringFromCLSID(riid,buf); WINE_StringFromCLSID(riid,buf);
else else
sprintf(buf,"<guid-0x%04x>",LOWORD(riid)); sprintf(buf,"<guid-0x%04x>",LOWORD(riid));
FIXME(dsound,"(%p)->(%s,%p),stub!\n",this,buf,ppobj); FIXME(dsound,"(%p)->(%s,%p),stub!\n",This,buf,ppobj);
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI static ULONG WINAPI
DSCF_AddRef(LPCLASSFACTORY iface) { DSCF_AddRef(LPCLASSFACTORY iface) {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
return ++(this->ref); return ++(This->ref);
} }
static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) { static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
/* static class, won't be freed */ /* static class, won't be freed */
return --(this->ref); return --(This->ref);
} }
static HRESULT WINAPI DSCF_CreateInstance( static HRESULT WINAPI DSCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) { ) {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
char buf[80]; char buf[80];
WINE_StringFromCLSID(riid,buf); WINE_StringFromCLSID(riid,buf);
TRACE(dsound,"(%p)->(%p,%s,%p)\n",this,pOuter,buf,ppobj); TRACE(dsound,"(%p)->(%p,%s,%p)\n",This,pOuter,buf,ppobj);
if (!memcmp(riid,&IID_IDirectSound,sizeof(IID_IDirectSound))) { if (!memcmp(riid,&IID_IDirectSound,sizeof(IID_IDirectSound))) {
/* FIXME: reuse already created dsound if present? */ /* FIXME: reuse already created dsound if present? */
return DirectSoundCreate(riid,(LPDIRECTSOUND*)ppobj,pOuter); return DirectSoundCreate(riid,(LPDIRECTSOUND*)ppobj,pOuter);
@ -2199,19 +2206,19 @@ static HRESULT WINAPI DSCF_CreateInstance(
} }
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL32 dolock) { static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL32 dolock) {
ICOM_THIS(IClassFactory,iface); ICOM_THIS(IClassFactoryImpl,iface);
FIXME(dsound,"(%p)->(%d),stub!\n",this,dolock); FIXME(dsound,"(%p)->(%d),stub!\n",This,dolock);
return S_OK; return S_OK;
} }
static ICOM_VTABLE(IClassFactory) DSCF_VTable = { static ICOM_VTABLE(IClassFactory) DSCF_Vtbl = {
DSCF_QueryInterface, DSCF_QueryInterface,
DSCF_AddRef, DSCF_AddRef,
DSCF_Release, DSCF_Release,
DSCF_CreateInstance, DSCF_CreateInstance,
DSCF_LockServer DSCF_LockServer
}; };
static _IClassFactory DSOUND_CF = {&DSCF_VTable, 1 }; static IClassFactoryImpl DSOUND_CF = {&DSCF_Vtbl, 1 };
/******************************************************************************* /*******************************************************************************
* DllGetClassObject [DSOUND.4] * DllGetClassObject [DSOUND.4]
@ -2246,7 +2253,7 @@ DWORD WINAPI DSOUND_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
TRACE(dsound, "(%p,%p,%p)\n", xbuf, buf, ppv); TRACE(dsound, "(%p,%p,%p)\n", xbuf, buf, ppv);
if (!memcmp(riid,&IID_IClassFactory,sizeof(IID_IClassFactory))) { if (!memcmp(riid,&IID_IClassFactory,sizeof(IID_IClassFactory))) {
*ppv = (LPVOID)&DSOUND_CF; *ppv = (LPVOID)&DSOUND_CF;
IClassFactory_AddRef(&DSOUND_CF); IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK; return S_OK;
} }
FIXME(dsound, "(%p,%p,%p): no interface found.\n", xbuf, buf, ppv); FIXME(dsound, "(%p,%p,%p): no interface found.\n", xbuf, buf, ppv);

View File

@ -45,6 +45,8 @@
#include "objbase.h" #include "objbase.h"
#include "ifs.h"
/**************************************************************************** /****************************************************************************
* COM External Lock structures and methods declaration * COM External Lock structures and methods declaration
* *
@ -1283,7 +1285,7 @@ HRESULT WINAPI CoCreateInstance(
hres = CoGetClassObject(rclsid, hres = CoGetClassObject(rclsid,
dwClsContext, dwClsContext,
NULL, NULL,
(const REFIID) &IID_IClassFactory, &IID_IClassFactory,
(LPVOID)&lpclf); (LPVOID)&lpclf);
if (FAILED(hres)) if (FAILED(hres))

147
ole/ifs.c
View File

@ -18,44 +18,51 @@
#include "module.h" #include "module.h"
#include "debug.h" #include "debug.h"
#include "ifs.h"
/* --- IUnknown implementation */ /* --- IUnknown implementation */
typedef struct
{
/* IUnknown fields */
ICOM_VTABLE(IUnknown)* lpvtbl;
DWORD ref;
} IUnknownImpl;
/****************************************************************************** /******************************************************************************
* IUnknown_AddRef [VTABLE:IUNKNOWN.1] * IUnknown_AddRef [VTABLE:IUNKNOWN.1]
*/ */
static ULONG WINAPI IUnknown_fnAddRef(LPUNKNOWN iface) { static ULONG WINAPI IUnknown_fnAddRef(LPUNKNOWN iface) {
ICOM_THIS(IUnknown,iface); ICOM_THIS(IUnknownImpl,iface);
TRACE(relay,"(%p)->AddRef()\n",this); TRACE(relay,"(%p)->AddRef()\n",This);
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IUnknown_Release [VTABLE:IUNKNOWN.2] * IUnknown_Release [VTABLE:IUNKNOWN.2]
*/ */
static ULONG WINAPI IUnknown_fnRelease(LPUNKNOWN iface) { static ULONG WINAPI IUnknown_fnRelease(LPUNKNOWN iface) {
ICOM_THIS(IUnknown,iface); ICOM_THIS(IUnknownImpl,iface);
TRACE(relay,"(%p)->Release()\n",this); TRACE(relay,"(%p)->Release()\n",This);
if (!--(this->ref)) { if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,this); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
/****************************************************************************** /******************************************************************************
* IUnknown_QueryInterface [VTABLE:IUNKNOWN.0] * IUnknown_QueryInterface [VTABLE:IUNKNOWN.0]
*/ */
static HRESULT WINAPI IUnknown_fnQueryInterface(LPUNKNOWN iface,REFIID refiid,LPVOID *obj) { static HRESULT WINAPI IUnknown_fnQueryInterface(LPUNKNOWN iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IUnknown,iface); ICOM_THIS(IUnknownImpl,iface);
char xrefiid[50]; char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(relay,"(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj); TRACE(relay,"(%p)->QueryInterface(%s,%p)\n",This,xrefiid,obj);
if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) { if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
*obj = this; *obj = This;
return 0; return 0;
} }
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
@ -72,9 +79,9 @@ static ICOM_VTABLE(IUnknown) uvt = {
*/ */
LPUNKNOWN LPUNKNOWN
IUnknown_Constructor() { IUnknown_Constructor() {
_IUnknown* unk; IUnknownImpl* unk;
unk = (_IUnknown*)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknown)); unk = (IUnknownImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknownImpl));
unk->lpvtbl = &uvt; unk->lpvtbl = &uvt;
unk->ref = 1; unk->ref = 1;
return (LPUNKNOWN)unk; return (LPUNKNOWN)unk;
@ -84,7 +91,8 @@ IUnknown_Constructor() {
/* --- IMalloc16 implementation */ /* --- IMalloc16 implementation */
typedef struct _IMalloc16 { typedef struct
{
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IMalloc16)* lpvtbl; ICOM_VTABLE(IMalloc16)* lpvtbl;
DWORD ref; DWORD ref;
@ -93,21 +101,21 @@ typedef struct _IMalloc16 {
* heaps * heaps
*/ */
HGLOBAL16 heap; HGLOBAL16 heap;
} _IMalloc16; } IMalloc16Impl;
/****************************************************************************** /******************************************************************************
* IMalloc16_QueryInterface [COMPOBJ.500] * IMalloc16_QueryInterface [COMPOBJ.500]
*/ */
HRESULT WINAPI IMalloc16_fnQueryInterface(IMalloc16* iface,REFIID refiid,LPVOID *obj) { HRESULT WINAPI IMalloc16_fnQueryInterface(IMalloc16* iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IMalloc16,iface); ICOM_THIS(IMalloc16Impl,iface);
char xrefiid[50]; char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(relay,"(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj); TRACE(relay,"(%p)->QueryInterface(%s,%p)\n",This,xrefiid,obj);
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) || if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
!memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc)) !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
) { ) {
*obj = this; *obj = This;
return 0; return 0;
} }
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
@ -117,8 +125,8 @@ HRESULT WINAPI IMalloc16_fnQueryInterface(IMalloc16* iface,REFIID refiid,LPVOID
* IMalloc16_AddRef [COMPOBJ.501] * IMalloc16_AddRef [COMPOBJ.501]
*/ */
ULONG WINAPI IMalloc16_fnAddRef(IMalloc16* iface) { ULONG WINAPI IMalloc16_fnAddRef(IMalloc16* iface) {
ICOM_THIS(IMalloc16,iface); ICOM_THIS(IMalloc16Impl,iface);
TRACE(relay,"(%p)->AddRef()\n",this); TRACE(relay,"(%p)->AddRef()\n",This);
return 1; /* cannot be freed */ return 1; /* cannot be freed */
} }
@ -126,8 +134,8 @@ ULONG WINAPI IMalloc16_fnAddRef(IMalloc16* iface) {
* IMalloc16_Release [COMPOBJ.502] * IMalloc16_Release [COMPOBJ.502]
*/ */
ULONG WINAPI IMalloc16_fnRelease(IMalloc16* iface) { ULONG WINAPI IMalloc16_fnRelease(IMalloc16* iface) {
ICOM_THIS(IMalloc16,iface); ICOM_THIS(IMalloc16Impl,iface);
TRACE(relay,"(%p)->Release()\n",this); TRACE(relay,"(%p)->Release()\n",This);
return 1; /* cannot be freed */ return 1; /* cannot be freed */
} }
@ -135,36 +143,36 @@ ULONG WINAPI IMalloc16_fnRelease(IMalloc16* iface) {
* IMalloc16_Alloc [COMPOBJ.503] * IMalloc16_Alloc [COMPOBJ.503]
*/ */
LPVOID WINAPI IMalloc16_fnAlloc(IMalloc16* iface,DWORD cb) { LPVOID WINAPI IMalloc16_fnAlloc(IMalloc16* iface,DWORD cb) {
ICOM_THIS(IMalloc16,iface); ICOM_THIS(IMalloc16Impl,iface);
TRACE(relay,"(%p)->Alloc(%ld)\n",this,cb); TRACE(relay,"(%p)->Alloc(%ld)\n",This,cb);
return (LPVOID)PTR_SEG_OFF_TO_SEGPTR(this->heap,LOCAL_Alloc(this->heap,0,cb)); return (LPVOID)PTR_SEG_OFF_TO_SEGPTR(This->heap,LOCAL_Alloc(This->heap,0,cb));
} }
/****************************************************************************** /******************************************************************************
* IMalloc16_Realloc [COMPOBJ.504] * IMalloc16_Realloc [COMPOBJ.504]
*/ */
LPVOID WINAPI IMalloc16_fnRealloc(IMalloc16* iface,LPVOID pv,DWORD cb) { LPVOID WINAPI IMalloc16_fnRealloc(IMalloc16* iface,LPVOID pv,DWORD cb) {
ICOM_THIS(IMalloc16,iface); ICOM_THIS(IMalloc16Impl,iface);
TRACE(relay,"(%p)->Realloc(%p,%ld)\n",this,pv,cb); TRACE(relay,"(%p)->Realloc(%p,%ld)\n",This,pv,cb);
return (LPVOID)PTR_SEG_OFF_TO_SEGPTR(this->heap,LOCAL_ReAlloc(this->heap,0,LOWORD(pv),cb)); return (LPVOID)PTR_SEG_OFF_TO_SEGPTR(This->heap,LOCAL_ReAlloc(This->heap,0,LOWORD(pv),cb));
} }
/****************************************************************************** /******************************************************************************
* IMalloc16_Free [COMPOBJ.505] * IMalloc16_Free [COMPOBJ.505]
*/ */
VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,LPVOID pv) { VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,LPVOID pv) {
ICOM_THIS(IMalloc16,iface); ICOM_THIS(IMalloc16Impl,iface);
TRACE(relay,"(%p)->Free(%p)\n",this,pv); TRACE(relay,"(%p)->Free(%p)\n",This,pv);
LOCAL_Free(this->heap,LOWORD(pv)); LOCAL_Free(This->heap,LOWORD(pv));
} }
/****************************************************************************** /******************************************************************************
* IMalloc16_GetSize [COMPOBJ.506] * IMalloc16_GetSize [COMPOBJ.506]
*/ */
DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,LPVOID pv) { DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,LPVOID pv) {
ICOM_CTHIS(IMalloc16,iface); ICOM_CTHIS(IMalloc16Impl,iface);
TRACE(relay,"(%p)->GetSize(%p)\n",this,pv); TRACE(relay,"(%p)->GetSize(%p)\n",This,pv);
return LOCAL_Size(this->heap,LOWORD(pv)); return LOCAL_Size(This->heap,LOWORD(pv));
} }
/****************************************************************************** /******************************************************************************
@ -172,7 +180,7 @@ DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,LPVOID pv) {
*/ */
INT16 WINAPI IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) { INT16 WINAPI IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) {
ICOM_CTHIS(IMalloc16,iface); ICOM_CTHIS(IMalloc16,iface);
TRACE(relay,"(%p)->DidAlloc(%p)\n",this,pv); TRACE(relay,"(%p)->DidAlloc(%p)\n",This,pv);
return (INT16)-1; return (INT16)-1;
} }
@ -180,8 +188,8 @@ INT16 WINAPI IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) {
* IMalloc16_HeapMinimize [COMPOBJ.508] * IMalloc16_HeapMinimize [COMPOBJ.508]
*/ */
LPVOID WINAPI IMalloc16_fnHeapMinimize(IMalloc16* iface) { LPVOID WINAPI IMalloc16_fnHeapMinimize(IMalloc16* iface) {
ICOM_THIS(IMalloc16,iface); ICOM_THIS(IMalloc16Impl,iface);
TRACE(relay,"(%p)->HeapMinimize()\n",this); TRACE(relay,"(%p)->HeapMinimize()\n",This);
return NULL; return NULL;
} }
@ -192,12 +200,12 @@ static ICOM_VTABLE(IMalloc16)* msegvt16 = NULL;
*/ */
LPMALLOC16 LPMALLOC16
IMalloc16_Constructor() { IMalloc16_Constructor() {
_IMalloc16* this; IMalloc16Impl* This;
HMODULE16 hcomp = GetModuleHandle16("COMPOBJ"); HMODULE16 hcomp = GetModuleHandle16("COMPOBJ");
this = (_IMalloc16*)SEGPTR_NEW(_IMalloc16); This = (IMalloc16Impl*)SEGPTR_NEW(IMalloc16Impl);
if (!msegvt16) { if (!msegvt16) {
this->lpvtbl = msegvt16 = SEGPTR_NEW(ICOM_VTABLE(IMalloc16)); This->lpvtbl = msegvt16 = SEGPTR_NEW(ICOM_VTABLE(IMalloc16));
#define VTENT(x) msegvt16->fn##x = (void*)WIN32_GetProcAddress16(hcomp,"IMalloc16_"#x);assert(msegvt16->fn##x) #define VTENT(x) msegvt16->fn##x = (void*)WIN32_GetProcAddress16(hcomp,"IMalloc16_"#x);assert(msegvt16->fn##x)
VTENT(QueryInterface); VTENT(QueryInterface);
@ -212,35 +220,36 @@ IMalloc16_Constructor() {
msegvt16 = (ICOM_VTABLE(IMalloc16)*)SEGPTR_GET(msegvt16); msegvt16 = (ICOM_VTABLE(IMalloc16)*)SEGPTR_GET(msegvt16);
#undef VTENT #undef VTENT
} }
this->ref = 1; This->ref = 1;
/* FIXME: implement multiple heaps */ /* FIXME: implement multiple heaps */
this->heap = GlobalAlloc16(GMEM_MOVEABLE,64000); This->heap = GlobalAlloc16(GMEM_MOVEABLE,64000);
LocalInit(this->heap,0,64000); LocalInit(This->heap,0,64000);
return (LPMALLOC16)SEGPTR_GET(this); return (LPMALLOC16)SEGPTR_GET(This);
} }
/* --- IMalloc32 implementation */ /* --- IMalloc32 implementation */
typedef struct _IMalloc32 { typedef struct
{
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IMalloc32)* lpvtbl; ICOM_VTABLE(IMalloc32)* lpvtbl;
DWORD ref; DWORD ref;
} _IMalloc32; } IMalloc32Impl;
/****************************************************************************** /******************************************************************************
* IMalloc32_QueryInterface [VTABLE] * IMalloc32_QueryInterface [VTABLE]
*/ */
static HRESULT WINAPI IMalloc32_fnQueryInterface(LPMALLOC32 iface,REFIID refiid,LPVOID *obj) { static HRESULT WINAPI IMalloc32_fnQueryInterface(LPMALLOC32 iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IMalloc32,iface); ICOM_THIS(IMalloc32Impl,iface);
char xrefiid[50]; char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(relay,"(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj); TRACE(relay,"(%p)->QueryInterface(%s,%p)\n",This,xrefiid,obj);
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) || if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
!memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc)) !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
) { ) {
*obj = this; *obj = This;
return S_OK; return S_OK;
} }
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
@ -250,8 +259,8 @@ static HRESULT WINAPI IMalloc32_fnQueryInterface(LPMALLOC32 iface,REFIID refiid,
* IMalloc32_AddRef [VTABLE] * IMalloc32_AddRef [VTABLE]
*/ */
static ULONG WINAPI IMalloc32_fnAddRef(LPMALLOC32 iface) { static ULONG WINAPI IMalloc32_fnAddRef(LPMALLOC32 iface) {
ICOM_THIS(IMalloc32,iface); ICOM_THIS(IMalloc32Impl,iface);
TRACE(relay,"(%p)->AddRef()\n",this); TRACE(relay,"(%p)->AddRef()\n",This);
return 1; /* cannot be freed */ return 1; /* cannot be freed */
} }
@ -259,8 +268,8 @@ static ULONG WINAPI IMalloc32_fnAddRef(LPMALLOC32 iface) {
* IMalloc32_Release [VTABLE] * IMalloc32_Release [VTABLE]
*/ */
static ULONG WINAPI IMalloc32_fnRelease(LPMALLOC32 iface) { static ULONG WINAPI IMalloc32_fnRelease(LPMALLOC32 iface) {
ICOM_THIS(IMalloc32,iface); ICOM_THIS(IMalloc32Impl,iface);
TRACE(relay,"(%p)->Release()\n",this); TRACE(relay,"(%p)->Release()\n",This);
return 1; /* cannot be freed */ return 1; /* cannot be freed */
} }
@ -268,8 +277,8 @@ static ULONG WINAPI IMalloc32_fnRelease(LPMALLOC32 iface) {
* IMalloc32_Alloc [VTABLE] * IMalloc32_Alloc [VTABLE]
*/ */
static LPVOID WINAPI IMalloc32_fnAlloc(LPMALLOC32 iface,DWORD cb) { static LPVOID WINAPI IMalloc32_fnAlloc(LPMALLOC32 iface,DWORD cb) {
ICOM_THIS(IMalloc32,iface); ICOM_THIS(IMalloc32Impl,iface);
TRACE(relay,"(%p)->Alloc(%ld)\n",this,cb); TRACE(relay,"(%p)->Alloc(%ld)\n",This,cb);
return HeapAlloc(GetProcessHeap(),0,cb); return HeapAlloc(GetProcessHeap(),0,cb);
} }
@ -277,8 +286,8 @@ static LPVOID WINAPI IMalloc32_fnAlloc(LPMALLOC32 iface,DWORD cb) {
* IMalloc32_Realloc [VTABLE] * IMalloc32_Realloc [VTABLE]
*/ */
static LPVOID WINAPI IMalloc32_fnRealloc(LPMALLOC32 iface,LPVOID pv,DWORD cb) { static LPVOID WINAPI IMalloc32_fnRealloc(LPMALLOC32 iface,LPVOID pv,DWORD cb) {
ICOM_THIS(IMalloc32,iface); ICOM_THIS(IMalloc32Impl,iface);
TRACE(relay,"(%p)->Realloc(%p,%ld)\n",this,pv,cb); TRACE(relay,"(%p)->Realloc(%p,%ld)\n",This,pv,cb);
return HeapReAlloc(GetProcessHeap(),0,pv,cb); return HeapReAlloc(GetProcessHeap(),0,pv,cb);
} }
@ -286,8 +295,8 @@ static LPVOID WINAPI IMalloc32_fnRealloc(LPMALLOC32 iface,LPVOID pv,DWORD cb) {
* IMalloc32_Free [VTABLE] * IMalloc32_Free [VTABLE]
*/ */
static VOID WINAPI IMalloc32_fnFree(LPMALLOC32 iface,LPVOID pv) { static VOID WINAPI IMalloc32_fnFree(LPMALLOC32 iface,LPVOID pv) {
ICOM_THIS(IMalloc32,iface); ICOM_THIS(IMalloc32Impl,iface);
TRACE(relay,"(%p)->Free(%p)\n",this,pv); TRACE(relay,"(%p)->Free(%p)\n",This,pv);
HeapFree(GetProcessHeap(),0,pv); HeapFree(GetProcessHeap(),0,pv);
} }
@ -296,7 +305,7 @@ static VOID WINAPI IMalloc32_fnFree(LPMALLOC32 iface,LPVOID pv) {
*/ */
static DWORD WINAPI IMalloc32_fnGetSize(const IMalloc32* iface,LPVOID pv) { static DWORD WINAPI IMalloc32_fnGetSize(const IMalloc32* iface,LPVOID pv) {
ICOM_CTHIS(IMalloc32,iface); ICOM_CTHIS(IMalloc32,iface);
TRACE(relay,"(%p)->GetSize(%p)\n",this,pv); TRACE(relay,"(%p)->GetSize(%p)\n",This,pv);
return HeapSize(GetProcessHeap(),0,pv); return HeapSize(GetProcessHeap(),0,pv);
} }
@ -304,8 +313,8 @@ static DWORD WINAPI IMalloc32_fnGetSize(const IMalloc32* iface,LPVOID pv) {
* IMalloc32_DidAlloc [VTABLE] * IMalloc32_DidAlloc [VTABLE]
*/ */
static INT32 WINAPI IMalloc32_fnDidAlloc(const IMalloc32* iface,LPVOID pv) { static INT32 WINAPI IMalloc32_fnDidAlloc(const IMalloc32* iface,LPVOID pv) {
ICOM_CTHIS(IMalloc32,iface); ICOM_CTHIS(IMalloc32Impl,iface);
TRACE(relay,"(%p)->DidAlloc(%p)\n",this,pv); TRACE(relay,"(%p)->DidAlloc(%p)\n",This,pv);
return -1; return -1;
} }
@ -313,8 +322,8 @@ static INT32 WINAPI IMalloc32_fnDidAlloc(const IMalloc32* iface,LPVOID pv) {
* IMalloc32_HeapMinimize [VTABLE] * IMalloc32_HeapMinimize [VTABLE]
*/ */
static LPVOID WINAPI IMalloc32_fnHeapMinimize(LPMALLOC32 iface) { static LPVOID WINAPI IMalloc32_fnHeapMinimize(LPMALLOC32 iface) {
ICOM_THIS(IMalloc32,iface); ICOM_THIS(IMalloc32Impl,iface);
TRACE(relay,"(%p)->HeapMinimize()\n",this); TRACE(relay,"(%p)->HeapMinimize()\n",This);
return NULL; return NULL;
} }
@ -335,12 +344,12 @@ static ICOM_VTABLE(IMalloc32) VT_IMalloc32 = {
*/ */
LPMALLOC32 LPMALLOC32
IMalloc32_Constructor() { IMalloc32_Constructor() {
_IMalloc32* this; IMalloc32Impl* This;
this = (_IMalloc32*)HeapAlloc(GetProcessHeap(),0,sizeof(_IMalloc32)); This = (IMalloc32Impl*)HeapAlloc(GetProcessHeap(),0,sizeof(IMalloc32Impl));
this->lpvtbl = &VT_IMalloc32; This->lpvtbl = &VT_IMalloc32;
this->ref = 1; This->ref = 1;
return (LPMALLOC32)this; return (LPMALLOC32)This;
} }
/**************************************************************************** /****************************************************************************

7
ole/ifs.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef __WINE_OLE_IFS_H
#define __WINE_OLE_IFS_H
extern LPMALLOC16 IMalloc16_Constructor();
extern LPMALLOC32 IMalloc32_Constructor();
#endif /* __WINE_OLE_IFS_H */

View File

@ -664,7 +664,8 @@ STORAGE_get_free_pps_entry(HFILE32 hf) {
/* --- IStream16 implementation */ /* --- IStream16 implementation */
typedef struct _IStream16 { typedef struct
{
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IStream16)* lpvtbl; ICOM_VTABLE(IStream16)* lpvtbl;
DWORD ref; DWORD ref;
@ -674,7 +675,7 @@ typedef struct _IStream16 {
int ppsent; int ppsent;
HFILE32 hf; HFILE32 hf;
ULARGE_INTEGER offset; ULARGE_INTEGER offset;
} _IStream16; } IStream16Impl;
/****************************************************************************** /******************************************************************************
* IStream16_QueryInterface [STORAGE.518] * IStream16_QueryInterface [STORAGE.518]
@ -682,12 +683,12 @@ typedef struct _IStream16 {
HRESULT WINAPI IStream16_fnQueryInterface( HRESULT WINAPI IStream16_fnQueryInterface(
LPUNKNOWN iface,REFIID refiid,LPVOID *obj LPUNKNOWN iface,REFIID refiid,LPVOID *obj
) { ) {
ICOM_THIS(IStream16,iface); ICOM_THIS(IStream16Impl,iface);
char xrefiid[50]; char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(relay,"(%p)->(%s,%p)\n",this,xrefiid,obj); TRACE(relay,"(%p)->(%s,%p)\n",This,xrefiid,obj);
if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) { if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
*obj = this; *obj = This;
return 0; return 0;
} }
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
@ -698,23 +699,23 @@ HRESULT WINAPI IStream16_fnQueryInterface(
* IStream16_AddRef [STORAGE.519] * IStream16_AddRef [STORAGE.519]
*/ */
ULONG WINAPI IStream16_fnAddRef(LPUNKNOWN iface) { ULONG WINAPI IStream16_fnAddRef(LPUNKNOWN iface) {
ICOM_THIS(IStream16,iface); ICOM_THIS(IStream16Impl,iface);
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IStream16_Release [STORAGE.520] * IStream16_Release [STORAGE.520]
*/ */
ULONG WINAPI IStream16_fnRelease(LPUNKNOWN iface) { ULONG WINAPI IStream16_fnRelease(LPUNKNOWN iface) {
ICOM_THIS(IStream16,iface); ICOM_THIS(IStream16Impl,iface);
FlushFileBuffers(this->hf); FlushFileBuffers(This->hf);
this->ref--; This->ref--;
if (!this->ref) { if (!This->ref) {
CloseHandle(this->hf); CloseHandle(This->hf);
SEGPTR_FREE(this); SEGPTR_FREE(This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
/****************************************************************************** /******************************************************************************
@ -724,10 +725,10 @@ ULONG WINAPI IStream16_fnRelease(LPUNKNOWN iface) {
* Does not handle 64 bits * Does not handle 64 bits
*/ */
HRESULT WINAPI IStream16_fnSeek( HRESULT WINAPI IStream16_fnSeek(
LPSTREAM16 iface,LARGE_INTEGER offset,DWORD whence,ULARGE_INTEGER *newpos IStream16* iface,LARGE_INTEGER offset,DWORD whence,ULARGE_INTEGER *newpos
) { ) {
ICOM_THIS(IStream16,iface); ICOM_THIS(IStream16Impl,iface);
TRACE(relay,"(%p)->([%ld.%ld],%ld,%p)\n",this,offset.HighPart,offset.LowPart,whence,newpos); TRACE(relay,"(%p)->([%ld.%ld],%ld,%p)\n",This,offset.HighPart,offset.LowPart,whence,newpos);
switch (whence) { switch (whence) {
/* unix SEEK_xx should be the same as win95 ones */ /* unix SEEK_xx should be the same as win95 ones */
@ -736,8 +737,8 @@ HRESULT WINAPI IStream16_fnSeek(
* right now. * right now.
*/ */
assert(offset.HighPart==0); assert(offset.HighPart==0);
this->offset.HighPart = offset.HighPart; This->offset.HighPart = offset.HighPart;
this->offset.LowPart = offset.LowPart; This->offset.LowPart = offset.LowPart;
break; break;
case SEEK_CUR: case SEEK_CUR:
if (offset.HighPart < 0) { if (offset.HighPart < 0) {
@ -746,21 +747,21 @@ HRESULT WINAPI IStream16_fnSeek(
offset.LowPart = (0xffffffff ^ offset.LowPart)+1; offset.LowPart = (0xffffffff ^ offset.LowPart)+1;
assert(offset.HighPart==0); assert(offset.HighPart==0);
assert(this->offset.LowPart >= offset.LowPart); assert(This->offset.LowPart >= offset.LowPart);
this->offset.LowPart -= offset.LowPart; This->offset.LowPart -= offset.LowPart;
} else { } else {
assert(offset.HighPart==0); assert(offset.HighPart==0);
this->offset.LowPart+= offset.LowPart; This->offset.LowPart+= offset.LowPart;
} }
break; break;
case SEEK_END: case SEEK_END:
assert(offset.HighPart==0); assert(offset.HighPart==0);
this->offset.LowPart = this->stde.pps_size-offset.LowPart; This->offset.LowPart = This->stde.pps_size-offset.LowPart;
break; break;
} }
if (this->offset.LowPart>this->stde.pps_size) if (This->offset.LowPart>This->stde.pps_size)
this->offset.LowPart=this->stde.pps_size; This->offset.LowPart=This->stde.pps_size;
if (newpos) *newpos = this->offset; if (newpos) *newpos = This->offset;
return S_OK; return S_OK;
} }
@ -770,56 +771,56 @@ HRESULT WINAPI IStream16_fnSeek(
HRESULT WINAPI IStream16_fnRead( HRESULT WINAPI IStream16_fnRead(
LPSEQUENTIALSTREAM iface,void *pv,ULONG cb,ULONG *pcbRead LPSEQUENTIALSTREAM iface,void *pv,ULONG cb,ULONG *pcbRead
) { ) {
ICOM_THIS(IStream16,iface); ICOM_THIS(IStream16Impl,iface);
BYTE block[BIGSIZE]; BYTE block[BIGSIZE];
ULONG *bytesread=pcbRead,xxread; ULONG *bytesread=pcbRead,xxread;
int blocknr; int blocknr;
TRACE(relay,"(%p)->(%p,%ld,%p)\n",this,pv,cb,pcbRead); TRACE(relay,"(%p)->(%p,%ld,%p)\n",This,pv,cb,pcbRead);
if (!pcbRead) bytesread=&xxread; if (!pcbRead) bytesread=&xxread;
*bytesread = 0; *bytesread = 0;
if (cb>this->stde.pps_size-this->offset.LowPart) if (cb>This->stde.pps_size-This->offset.LowPart)
cb=this->stde.pps_size-this->offset.LowPart; cb=This->stde.pps_size-This->offset.LowPart;
if (this->stde.pps_size < 0x1000) { if (This->stde.pps_size < 0x1000) {
/* use small block reader */ /* use small block reader */
blocknr = STORAGE_get_nth_next_small_blocknr(this->hf,this->stde.pps_sb,this->offset.LowPart/SMALLSIZE); blocknr = STORAGE_get_nth_next_small_blocknr(This->hf,This->stde.pps_sb,This->offset.LowPart/SMALLSIZE);
while (cb) { while (cb) {
int cc; int cc;
if (!STORAGE_get_small_block(this->hf,blocknr,block)) { if (!STORAGE_get_small_block(This->hf,blocknr,block)) {
WARN(ole,"small block read failed!!!\n"); WARN(ole,"small block read failed!!!\n");
return E_FAIL; return E_FAIL;
} }
cc = cb; cc = cb;
if (cc>SMALLSIZE-(this->offset.LowPart&(SMALLSIZE-1))) if (cc>SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1)))
cc=SMALLSIZE-(this->offset.LowPart&(SMALLSIZE-1)); cc=SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1));
memcpy((LPBYTE)pv,block+(this->offset.LowPart&(SMALLSIZE-1)),cc); memcpy((LPBYTE)pv,block+(This->offset.LowPart&(SMALLSIZE-1)),cc);
this->offset.LowPart+=cc; This->offset.LowPart+=cc;
(LPBYTE)pv+=cc; (LPBYTE)pv+=cc;
*bytesread+=cc; *bytesread+=cc;
cb-=cc; cb-=cc;
blocknr = STORAGE_get_next_small_blocknr(this->hf,blocknr); blocknr = STORAGE_get_next_small_blocknr(This->hf,blocknr);
} }
} else { } else {
/* use big block reader */ /* use big block reader */
blocknr = STORAGE_get_nth_next_big_blocknr(this->hf,this->stde.pps_sb,this->offset.LowPart/BIGSIZE); blocknr = STORAGE_get_nth_next_big_blocknr(This->hf,This->stde.pps_sb,This->offset.LowPart/BIGSIZE);
while (cb) { while (cb) {
int cc; int cc;
if (!STORAGE_get_big_block(this->hf,blocknr,block)) { if (!STORAGE_get_big_block(This->hf,blocknr,block)) {
WARN(ole,"big block read failed!!!\n"); WARN(ole,"big block read failed!!!\n");
return E_FAIL; return E_FAIL;
} }
cc = cb; cc = cb;
if (cc>BIGSIZE-(this->offset.LowPart&(BIGSIZE-1))) if (cc>BIGSIZE-(This->offset.LowPart&(BIGSIZE-1)))
cc=BIGSIZE-(this->offset.LowPart&(BIGSIZE-1)); cc=BIGSIZE-(This->offset.LowPart&(BIGSIZE-1));
memcpy((LPBYTE)pv,block+(this->offset.LowPart&(BIGSIZE-1)),cc); memcpy((LPBYTE)pv,block+(This->offset.LowPart&(BIGSIZE-1)),cc);
this->offset.LowPart+=cc; This->offset.LowPart+=cc;
(LPBYTE)pv+=cc; (LPBYTE)pv+=cc;
*bytesread+=cc; *bytesread+=cc;
cb-=cc; cb-=cc;
blocknr=STORAGE_get_next_big_blocknr(this->hf,blocknr); blocknr=STORAGE_get_next_big_blocknr(This->hf,blocknr);
} }
} }
return S_OK; return S_OK;
@ -831,23 +832,23 @@ HRESULT WINAPI IStream16_fnRead(
HRESULT WINAPI IStream16_fnWrite( HRESULT WINAPI IStream16_fnWrite(
LPSEQUENTIALSTREAM iface,const void *pv,ULONG cb,ULONG *pcbWrite LPSEQUENTIALSTREAM iface,const void *pv,ULONG cb,ULONG *pcbWrite
) { ) {
ICOM_THIS(IStream16,iface); ICOM_THIS(IStream16Impl,iface);
BYTE block[BIGSIZE]; BYTE block[BIGSIZE];
ULONG *byteswritten=pcbWrite,xxwritten; ULONG *byteswritten=pcbWrite,xxwritten;
int oldsize,newsize,i,curoffset=0,lastblocknr,blocknr,cc; int oldsize,newsize,i,curoffset=0,lastblocknr,blocknr,cc;
HFILE32 hf = this->hf; HFILE32 hf = This->hf;
if (!pcbWrite) byteswritten=&xxwritten; if (!pcbWrite) byteswritten=&xxwritten;
*byteswritten = 0; *byteswritten = 0;
TRACE(relay,"(%p)->(%p,%ld,%p)\n",this,pv,cb,pcbWrite); TRACE(relay,"(%p)->(%p,%ld,%p)\n",This,pv,cb,pcbWrite);
/* do we need to junk some blocks? */ /* do we need to junk some blocks? */
newsize = this->offset.LowPart+cb; newsize = This->offset.LowPart+cb;
oldsize = this->stde.pps_size; oldsize = This->stde.pps_size;
if (newsize < oldsize) { if (newsize < oldsize) {
if (oldsize < 0x1000) { if (oldsize < 0x1000) {
/* only small blocks */ /* only small blocks */
blocknr=STORAGE_get_nth_next_small_blocknr(hf,this->stde.pps_sb,newsize/SMALLSIZE); blocknr=STORAGE_get_nth_next_small_blocknr(hf,This->stde.pps_sb,newsize/SMALLSIZE);
assert(blocknr>=0); assert(blocknr>=0);
@ -856,7 +857,7 @@ HRESULT WINAPI IStream16_fnWrite(
return E_FAIL; return E_FAIL;
} else { } else {
if (newsize >= 0x1000) { if (newsize >= 0x1000) {
blocknr=STORAGE_get_nth_next_big_blocknr(hf,this->stde.pps_sb,newsize/BIGSIZE); blocknr=STORAGE_get_nth_next_big_blocknr(hf,This->stde.pps_sb,newsize/BIGSIZE);
assert(blocknr>=0); assert(blocknr>=0);
/* will set the rest of the chain to 'free' */ /* will set the rest of the chain to 'free' */
@ -868,7 +869,7 @@ HRESULT WINAPI IStream16_fnWrite(
*/ */
LPBYTE curdata,data = HeapAlloc(GetProcessHeap(),0,newsize+BIGSIZE); LPBYTE curdata,data = HeapAlloc(GetProcessHeap(),0,newsize+BIGSIZE);
cc = newsize; cc = newsize;
blocknr = this->stde.pps_sb; blocknr = This->stde.pps_sb;
curdata = data; curdata = data;
while (cc>0) { while (cc>0) {
if (!STORAGE_get_big_block(hf,blocknr,curdata)) { if (!STORAGE_get_big_block(hf,blocknr,curdata)) {
@ -880,10 +881,10 @@ HRESULT WINAPI IStream16_fnWrite(
blocknr = STORAGE_get_next_big_blocknr(hf,blocknr); blocknr = STORAGE_get_next_big_blocknr(hf,blocknr);
} }
/* frees complete chain for this stream */ /* frees complete chain for this stream */
if (!STORAGE_set_big_chain(hf,this->stde.pps_sb,STORAGE_CHAINENTRY_FREE)) if (!STORAGE_set_big_chain(hf,This->stde.pps_sb,STORAGE_CHAINENTRY_FREE))
return E_FAIL; return E_FAIL;
curdata = data; curdata = data;
blocknr = this->stde.pps_sb = STORAGE_get_free_small_blocknr(hf); blocknr = This->stde.pps_sb = STORAGE_get_free_small_blocknr(hf);
if (blocknr<0) if (blocknr<0)
return E_FAIL; return E_FAIL;
cc = newsize; cc = newsize;
@ -908,13 +909,13 @@ HRESULT WINAPI IStream16_fnWrite(
HeapFree(GetProcessHeap(),0,data); HeapFree(GetProcessHeap(),0,data);
} }
} }
this->stde.pps_size = newsize; This->stde.pps_size = newsize;
} }
if (newsize > oldsize) { if (newsize > oldsize) {
if (oldsize >= 0x1000) { if (oldsize >= 0x1000) {
/* should return the block right before the 'endofchain' */ /* should return the block right before the 'endofchain' */
blocknr = STORAGE_get_nth_next_big_blocknr(hf,this->stde.pps_sb,this->stde.pps_size/BIGSIZE); blocknr = STORAGE_get_nth_next_big_blocknr(hf,This->stde.pps_sb,This->stde.pps_size/BIGSIZE);
assert(blocknr>=0); assert(blocknr>=0);
lastblocknr = blocknr; lastblocknr = blocknr;
for (i=oldsize/BIGSIZE;i<newsize/BIGSIZE;i++) { for (i=oldsize/BIGSIZE;i<newsize/BIGSIZE;i++) {
@ -931,9 +932,9 @@ HRESULT WINAPI IStream16_fnWrite(
if (newsize < 0x1000) { if (newsize < 0x1000) {
/* find startblock */ /* find startblock */
if (!oldsize) if (!oldsize)
this->stde.pps_sb = blocknr = STORAGE_get_free_small_blocknr(hf); This->stde.pps_sb = blocknr = STORAGE_get_free_small_blocknr(hf);
else else
blocknr = STORAGE_get_nth_next_small_blocknr(hf,this->stde.pps_sb,this->stde.pps_size/SMALLSIZE); blocknr = STORAGE_get_nth_next_small_blocknr(hf,This->stde.pps_sb,This->stde.pps_size/SMALLSIZE);
if (blocknr<0) if (blocknr<0)
return E_FAIL; return E_FAIL;
@ -956,12 +957,12 @@ HRESULT WINAPI IStream16_fnWrite(
blocknr=STORAGE_get_free_big_blocknr(hf); blocknr=STORAGE_get_free_big_blocknr(hf);
if (blocknr<0) if (blocknr<0)
return E_FAIL; return E_FAIL;
this->stde.pps_sb = blocknr; This->stde.pps_sb = blocknr;
} else { } else {
/* Migrate small blocks to big blocks */ /* Migrate small blocks to big blocks */
LPBYTE curdata,data = HeapAlloc(GetProcessHeap(),0,oldsize+BIGSIZE); LPBYTE curdata,data = HeapAlloc(GetProcessHeap(),0,oldsize+BIGSIZE);
cc = oldsize; cc = oldsize;
blocknr = this->stde.pps_sb; blocknr = This->stde.pps_sb;
curdata = data; curdata = data;
/* slurp in */ /* slurp in */
while (cc>0) { while (cc>0) {
@ -974,14 +975,14 @@ HRESULT WINAPI IStream16_fnWrite(
blocknr = STORAGE_get_next_small_blocknr(hf,blocknr); blocknr = STORAGE_get_next_small_blocknr(hf,blocknr);
} }
/* free small block chain */ /* free small block chain */
if (!STORAGE_set_small_chain(hf,this->stde.pps_sb,STORAGE_CHAINENTRY_FREE)) if (!STORAGE_set_small_chain(hf,This->stde.pps_sb,STORAGE_CHAINENTRY_FREE))
return E_FAIL; return E_FAIL;
curdata = data; curdata = data;
blocknr = this->stde.pps_sb = STORAGE_get_free_big_blocknr(hf); blocknr = This->stde.pps_sb = STORAGE_get_free_big_blocknr(hf);
if (blocknr<0) if (blocknr<0)
return E_FAIL; return E_FAIL;
/* put the data into the big blocks */ /* put the data into the big blocks */
cc = this->stde.pps_size; cc = This->stde.pps_size;
while (cc>0) { while (cc>0) {
if (!STORAGE_put_big_block(hf,blocknr,curdata)) if (!STORAGE_put_big_block(hf,blocknr,curdata))
return E_FAIL; return E_FAIL;
@ -1017,18 +1018,18 @@ HRESULT WINAPI IStream16_fnWrite(
return E_FAIL; return E_FAIL;
} }
} }
this->stde.pps_size = newsize; This->stde.pps_size = newsize;
} }
/* There are just some cases where we didn't modify it, we write it out /* There are just some cases where we didn't modify it, we write it out
* everytime * everytime
*/ */
if (!STORAGE_put_pps_entry(hf,this->ppsent,&(this->stde))) if (!STORAGE_put_pps_entry(hf,This->ppsent,&(This->stde)))
return E_FAIL; return E_FAIL;
/* finally the write pass */ /* finally the write pass */
if (this->stde.pps_size < 0x1000) { if (This->stde.pps_size < 0x1000) {
blocknr = STORAGE_get_nth_next_small_blocknr(hf,this->stde.pps_sb,this->offset.LowPart/SMALLSIZE); blocknr = STORAGE_get_nth_next_small_blocknr(hf,This->stde.pps_sb,This->offset.LowPart/SMALLSIZE);
assert(blocknr>=0); assert(blocknr>=0);
while (cb>0) { while (cb>0) {
/* we ensured that it is allocated above */ /* we ensured that it is allocated above */
@ -1039,10 +1040,10 @@ HRESULT WINAPI IStream16_fnWrite(
if (!STORAGE_get_small_block(hf,blocknr,block)) if (!STORAGE_get_small_block(hf,blocknr,block))
return E_FAIL; return E_FAIL;
cc = SMALLSIZE-(this->offset.LowPart&(SMALLSIZE-1)); cc = SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1));
if (cc>cb) if (cc>cb)
cc=cb; cc=cb;
memcpy( ((LPBYTE)block)+(this->offset.LowPart&(SMALLSIZE-1)), memcpy( ((LPBYTE)block)+(This->offset.LowPart&(SMALLSIZE-1)),
(LPBYTE)(pv+curoffset), (LPBYTE)(pv+curoffset),
cc cc
); );
@ -1051,12 +1052,12 @@ HRESULT WINAPI IStream16_fnWrite(
cb -= cc; cb -= cc;
curoffset += cc; curoffset += cc;
(LPBYTE)pv += cc; (LPBYTE)pv += cc;
this->offset.LowPart += cc; This->offset.LowPart += cc;
*byteswritten += cc; *byteswritten += cc;
blocknr = STORAGE_get_next_small_blocknr(hf,blocknr); blocknr = STORAGE_get_next_small_blocknr(hf,blocknr);
} }
} else { } else {
blocknr = STORAGE_get_nth_next_big_blocknr(hf,this->stde.pps_sb,this->offset.LowPart/BIGSIZE); blocknr = STORAGE_get_nth_next_big_blocknr(hf,This->stde.pps_sb,This->offset.LowPart/BIGSIZE);
assert(blocknr>=0); assert(blocknr>=0);
while (cb>0) { while (cb>0) {
/* we ensured that it is allocated above, so it better is */ /* we ensured that it is allocated above, so it better is */
@ -1067,10 +1068,10 @@ HRESULT WINAPI IStream16_fnWrite(
if (!STORAGE_get_big_block(hf,blocknr,block)) if (!STORAGE_get_big_block(hf,blocknr,block))
return E_FAIL; return E_FAIL;
cc = BIGSIZE-(this->offset.LowPart&(BIGSIZE-1)); cc = BIGSIZE-(This->offset.LowPart&(BIGSIZE-1));
if (cc>cb) if (cc>cb)
cc=cb; cc=cb;
memcpy( ((LPBYTE)block)+(this->offset.LowPart&(BIGSIZE-1)), memcpy( ((LPBYTE)block)+(This->offset.LowPart&(BIGSIZE-1)),
(LPBYTE)(pv+curoffset), (LPBYTE)(pv+curoffset),
cc cc
); );
@ -1079,7 +1080,7 @@ HRESULT WINAPI IStream16_fnWrite(
cb -= cc; cb -= cc;
curoffset += cc; curoffset += cc;
(LPBYTE)pv += cc; (LPBYTE)pv += cc;
this->offset.LowPart += cc; This->offset.LowPart += cc;
*byteswritten += cc; *byteswritten += cc;
blocknr = STORAGE_get_next_big_blocknr(hf,blocknr); blocknr = STORAGE_get_next_big_blocknr(hf,blocknr);
} }
@ -1091,7 +1092,7 @@ HRESULT WINAPI IStream16_fnWrite(
* _create_istream16 [Internal] * _create_istream16 [Internal]
*/ */
static void _create_istream16(LPSTREAM16 *str) { static void _create_istream16(LPSTREAM16 *str) {
_IStream16* lpst; IStream16Impl* lpst;
if (!strvt16.bvt.bvt.fnQueryInterface) { if (!strvt16.bvt.bvt.fnQueryInterface) {
HMODULE16 wp = GetModuleHandle16("STORAGE"); HMODULE16 wp = GetModuleHandle16("STORAGE");
@ -1146,7 +1147,7 @@ static void _create_istream16(LPSTREAM16 *str) {
segstrvt16 = &strvt16; segstrvt16 = &strvt16;
} }
} }
lpst = SEGPTR_NEW(_IStream16); lpst = SEGPTR_NEW(IStream16Impl);
lpst->lpvtbl = segstrvt16; lpst->lpvtbl = segstrvt16;
lpst->ref = 1; lpst->ref = 1;
lpst->thisptr = SEGPTR_GET(lpst); lpst->thisptr = SEGPTR_GET(lpst);
@ -1156,7 +1157,8 @@ static void _create_istream16(LPSTREAM16 *str) {
/* --- IStream32 implementation */ /* --- IStream32 implementation */
typedef struct _IStream32 { typedef struct
{
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IStream32)* lpvtbl; ICOM_VTABLE(IStream32)* lpvtbl;
DWORD ref; DWORD ref;
@ -1165,7 +1167,7 @@ typedef struct _IStream32 {
int ppsent; int ppsent;
HFILE32 hf; HFILE32 hf;
ULARGE_INTEGER offset; ULARGE_INTEGER offset;
} _IStream32; } IStream32Impl;
/***************************************************************************** /*****************************************************************************
* IStream32_QueryInterface [VTABLE] * IStream32_QueryInterface [VTABLE]
@ -1173,13 +1175,13 @@ typedef struct _IStream32 {
HRESULT WINAPI IStream32_fnQueryInterface( HRESULT WINAPI IStream32_fnQueryInterface(
LPUNKNOWN iface,REFIID refiid,LPVOID *obj LPUNKNOWN iface,REFIID refiid,LPVOID *obj
) { ) {
ICOM_THIS(IStream32,iface); ICOM_THIS(IStream32Impl,iface);
char xrefiid[50]; char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(relay,"(%p)->(%s,%p)\n",this,xrefiid,obj); TRACE(relay,"(%p)->(%s,%p)\n",This,xrefiid,obj);
if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) { if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
*obj = this; *obj = This;
return 0; return 0;
} }
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
@ -1190,28 +1192,29 @@ HRESULT WINAPI IStream32_fnQueryInterface(
* IStream32_AddRef [VTABLE] * IStream32_AddRef [VTABLE]
*/ */
ULONG WINAPI IStream32_fnAddRef(LPUNKNOWN iface) { ULONG WINAPI IStream32_fnAddRef(LPUNKNOWN iface) {
ICOM_THIS(IStream32,iface); ICOM_THIS(IStream32Impl,iface);
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IStream32_Release [VTABLE] * IStream32_Release [VTABLE]
*/ */
ULONG WINAPI IStream32_fnRelease(LPUNKNOWN iface) { ULONG WINAPI IStream32_fnRelease(LPUNKNOWN iface) {
ICOM_THIS(IStream32,iface); ICOM_THIS(IStream32Impl,iface);
FlushFileBuffers(this->hf); FlushFileBuffers(This->hf);
this->ref--; This->ref--;
if (!this->ref) { if (!This->ref) {
CloseHandle(this->hf); CloseHandle(This->hf);
SEGPTR_FREE(this); SEGPTR_FREE(This);
return 0; return 0;
} }
return this->ref; return This->ref;
} }
/* --- IStorage16 implementation */ /* --- IStorage16 implementation */
typedef struct _IStorage16 { typedef struct
{
/* IUnknown fields */ /* IUnknown fields */
ICOM_VTABLE(IStorage16)* lpvtbl; ICOM_VTABLE(IStorage16)* lpvtbl;
DWORD ref; DWORD ref;
@ -1220,7 +1223,7 @@ typedef struct _IStorage16 {
struct storage_pps_entry stde; struct storage_pps_entry stde;
int ppsent; int ppsent;
HFILE32 hf; HFILE32 hf;
} _IStorage16; } IStorage16Impl;
/****************************************************************************** /******************************************************************************
* IStorage16_QueryInterface [STORAGE.500] * IStorage16_QueryInterface [STORAGE.500]
@ -1228,14 +1231,14 @@ typedef struct _IStorage16 {
HRESULT WINAPI IStorage16_fnQueryInterface( HRESULT WINAPI IStorage16_fnQueryInterface(
LPUNKNOWN iface,REFIID refiid,LPVOID *obj LPUNKNOWN iface,REFIID refiid,LPVOID *obj
) { ) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
char xrefiid[50]; char xrefiid[50];
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(relay,"(%p)->(%s,%p)\n",this,xrefiid,obj); TRACE(relay,"(%p)->(%s,%p)\n",This,xrefiid,obj);
if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) { if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
*obj = this; *obj = This;
return 0; return 0;
} }
return OLE_E_ENUM_NOMORE; return OLE_E_ENUM_NOMORE;
@ -1245,19 +1248,19 @@ HRESULT WINAPI IStorage16_fnQueryInterface(
* IStorage16_AddRef [STORAGE.501] * IStorage16_AddRef [STORAGE.501]
*/ */
ULONG WINAPI IStorage16_fnAddRef(LPUNKNOWN iface) { ULONG WINAPI IStorage16_fnAddRef(LPUNKNOWN iface) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
return ++(this->ref); return ++(This->ref);
} }
/****************************************************************************** /******************************************************************************
* IStorage16_Release [STORAGE.502] * IStorage16_Release [STORAGE.502]
*/ */
ULONG WINAPI IStorage16_fnRelease(LPUNKNOWN iface) { ULONG WINAPI IStorage16_fnRelease(LPUNKNOWN iface) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
this->ref--; This->ref--;
if (this->ref) if (This->ref)
return this->ref; return This->ref;
SEGPTR_FREE(this); SEGPTR_FREE(This);
return 0; return 0;
} }
@ -1267,19 +1270,19 @@ ULONG WINAPI IStorage16_fnRelease(LPUNKNOWN iface) {
HRESULT WINAPI IStorage16_fnStat( HRESULT WINAPI IStorage16_fnStat(
LPSTORAGE16 iface,STATSTG *pstatstg, DWORD grfStatFlag LPSTORAGE16 iface,STATSTG *pstatstg, DWORD grfStatFlag
) { ) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
TRACE(ole,"(%p)->(%p,0x%08lx)\n", TRACE(ole,"(%p)->(%p,0x%08lx)\n",
this,pstatstg,grfStatFlag This,pstatstg,grfStatFlag
); );
pstatstg->pwcsName=(LPOLESTR16)SEGPTR_GET(SEGPTR_STRDUP_WtoA(this->stde.pps_rawname)); pstatstg->pwcsName=(LPOLESTR16)SEGPTR_GET(SEGPTR_STRDUP_WtoA(This->stde.pps_rawname));
pstatstg->type = this->stde.pps_type; pstatstg->type = This->stde.pps_type;
pstatstg->cbSize.LowPart = this->stde.pps_size; pstatstg->cbSize.LowPart = This->stde.pps_size;
pstatstg->mtime = this->stde.pps_ft1; /* FIXME */ /* why? */ pstatstg->mtime = This->stde.pps_ft1; /* FIXME */ /* why? */
pstatstg->atime = this->stde.pps_ft2; /* FIXME */ pstatstg->atime = This->stde.pps_ft2; /* FIXME */
pstatstg->ctime = this->stde.pps_ft2; /* FIXME */ pstatstg->ctime = This->stde.pps_ft2; /* FIXME */
pstatstg->grfMode = 0; /* FIXME */ pstatstg->grfMode = 0; /* FIXME */
pstatstg->grfLocksSupported = 0; /* FIXME */ pstatstg->grfLocksSupported = 0; /* FIXME */
pstatstg->clsid = this->stde.pps_guid; pstatstg->clsid = This->stde.pps_guid;
pstatstg->grfStateBits = 0; /* FIXME */ pstatstg->grfStateBits = 0; /* FIXME */
pstatstg->reserved = 0; pstatstg->reserved = 0;
return S_OK; return S_OK;
@ -1291,9 +1294,9 @@ HRESULT WINAPI IStorage16_fnStat(
HRESULT WINAPI IStorage16_fnCommit( HRESULT WINAPI IStorage16_fnCommit(
LPSTORAGE16 iface,DWORD commitflags LPSTORAGE16 iface,DWORD commitflags
) { ) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
FIXME(ole,"(%p)->(0x%08lx),STUB!\n", FIXME(ole,"(%p)->(0x%08lx),STUB!\n",
this,commitflags This,commitflags
); );
return S_OK; return S_OK;
} }
@ -1302,7 +1305,7 @@ HRESULT WINAPI IStorage16_fnCommit(
* IStorage16_CopyTo [STORAGE.507] * IStorage16_CopyTo [STORAGE.507]
*/ */
HRESULT WINAPI IStorage16_fnCopyTo(LPSTORAGE16 iface,DWORD ciidExclude,const IID *rgiidExclude,SNB16 SNB16Exclude,IStorage16 *pstgDest) { HRESULT WINAPI IStorage16_fnCopyTo(LPSTORAGE16 iface,DWORD ciidExclude,const IID *rgiidExclude,SNB16 SNB16Exclude,IStorage16 *pstgDest) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
char xguid[50]; char xguid[50];
if (rgiidExclude) if (rgiidExclude)
@ -1310,7 +1313,7 @@ HRESULT WINAPI IStorage16_fnCopyTo(LPSTORAGE16 iface,DWORD ciidExclude,const IID
else else
strcpy(xguid,"<no guid>"); strcpy(xguid,"<no guid>");
FIXME(ole,"IStorage16(%p)->(0x%08lx,%s,%p,%p),stub!\n", FIXME(ole,"IStorage16(%p)->(0x%08lx,%s,%p,%p),stub!\n",
this,ciidExclude,xguid,SNB16Exclude,pstgDest This,ciidExclude,xguid,SNB16Exclude,pstgDest
); );
return S_OK; return S_OK;
} }
@ -1322,31 +1325,31 @@ HRESULT WINAPI IStorage16_fnCopyTo(LPSTORAGE16 iface,DWORD ciidExclude,const IID
HRESULT WINAPI IStorage16_fnCreateStorage( HRESULT WINAPI IStorage16_fnCreateStorage(
LPSTORAGE16 iface,LPCOLESTR16 pwcsName,DWORD grfMode,DWORD dwStgFormat,DWORD reserved2, IStorage16 **ppstg LPSTORAGE16 iface,LPCOLESTR16 pwcsName,DWORD grfMode,DWORD dwStgFormat,DWORD reserved2, IStorage16 **ppstg
) { ) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
_IStorage16* lpstg; IStorage16Impl* lpstg;
int ppsent,x; int ppsent,x;
struct storage_pps_entry stde; struct storage_pps_entry stde;
struct storage_header sth; struct storage_header sth;
HFILE32 hf=this->hf; HFILE32 hf=This->hf;
READ_HEADER; READ_HEADER;
TRACE(ole,"(%p)->(%s,0x%08lx,0x%08lx,0x%08lx,%p)\n", TRACE(ole,"(%p)->(%s,0x%08lx,0x%08lx,0x%08lx,%p)\n",
this,pwcsName,grfMode,dwStgFormat,reserved2,ppstg This,pwcsName,grfMode,dwStgFormat,reserved2,ppstg
); );
if (grfMode & STGM_TRANSACTED) if (grfMode & STGM_TRANSACTED)
FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n"); FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n");
_create_istorage16(ppstg); _create_istorage16(ppstg);
lpstg = (_IStorage16*)PTR_SEG_TO_LIN(*ppstg); lpstg = (IStorage16Impl*)PTR_SEG_TO_LIN(*ppstg);
lpstg->hf = this->hf; lpstg->hf = This->hf;
ppsent=STORAGE_get_free_pps_entry(lpstg->hf); ppsent=STORAGE_get_free_pps_entry(lpstg->hf);
if (ppsent<0) if (ppsent<0)
return E_FAIL; return E_FAIL;
stde=this->stde; stde=This->stde;
if (stde.pps_dir==-1) { if (stde.pps_dir==-1) {
stde.pps_dir = ppsent; stde.pps_dir = ppsent;
x = this->ppsent; x = This->ppsent;
} else { } else {
FIXME(ole," use prev chain too ?\n"); FIXME(ole," use prev chain too ?\n");
x=stde.pps_dir; x=stde.pps_dir;
@ -1382,19 +1385,19 @@ HRESULT WINAPI IStorage16_fnCreateStorage(
HRESULT WINAPI IStorage16_fnCreateStream( HRESULT WINAPI IStorage16_fnCreateStream(
LPSTORAGE16 iface,LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2, IStream16 **ppstm LPSTORAGE16 iface,LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2, IStream16 **ppstm
) { ) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
_IStream16* lpstr; IStream16Impl* lpstr;
int ppsent,x; int ppsent,x;
struct storage_pps_entry stde; struct storage_pps_entry stde;
TRACE(ole,"(%p)->(%s,0x%08lx,0x%08lx,0x%08lx,%p)\n", TRACE(ole,"(%p)->(%s,0x%08lx,0x%08lx,0x%08lx,%p)\n",
this,pwcsName,grfMode,reserved1,reserved2,ppstm This,pwcsName,grfMode,reserved1,reserved2,ppstm
); );
if (grfMode & STGM_TRANSACTED) if (grfMode & STGM_TRANSACTED)
FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n"); FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n");
_create_istream16(ppstm); _create_istream16(ppstm);
lpstr = (_IStream16*)PTR_SEG_TO_LIN(*ppstm); lpstr = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstm);
DuplicateHandle( GetCurrentProcess(), this->hf, GetCurrentProcess(), DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(),
&lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS ); &lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS );
lpstr->offset.LowPart = 0; lpstr->offset.LowPart = 0;
lpstr->offset.HighPart = 0; lpstr->offset.HighPart = 0;
@ -1402,9 +1405,9 @@ HRESULT WINAPI IStorage16_fnCreateStream(
ppsent=STORAGE_get_free_pps_entry(lpstr->hf); ppsent=STORAGE_get_free_pps_entry(lpstr->hf);
if (ppsent<0) if (ppsent<0)
return E_FAIL; return E_FAIL;
stde=this->stde; stde=This->stde;
if (stde.pps_next==-1) if (stde.pps_next==-1)
x=this->ppsent; x=This->ppsent;
else else
while (stde.pps_next!=-1) { while (stde.pps_next!=-1) {
x=stde.pps_next; x=stde.pps_next;
@ -1435,22 +1438,22 @@ HRESULT WINAPI IStorage16_fnCreateStream(
HRESULT WINAPI IStorage16_fnOpenStorage( HRESULT WINAPI IStorage16_fnOpenStorage(
LPSTORAGE16 iface,LPCOLESTR16 pwcsName, IStorage16 *pstgPrio, DWORD grfMode, SNB16 snbExclude, DWORD reserved, IStorage16 **ppstg LPSTORAGE16 iface,LPCOLESTR16 pwcsName, IStorage16 *pstgPrio, DWORD grfMode, SNB16 snbExclude, DWORD reserved, IStorage16 **ppstg
) { ) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
_IStream16* lpstg; IStream16Impl* lpstg;
WCHAR name[33]; WCHAR name[33];
int newpps; int newpps;
TRACE(relay,"(%p)->(%s,%p,0x%08lx,%p,0x%08lx,%p)\n", TRACE(relay,"(%p)->(%s,%p,0x%08lx,%p,0x%08lx,%p)\n",
this,pwcsName,pstgPrio,grfMode,snbExclude,reserved,ppstg This,pwcsName,pstgPrio,grfMode,snbExclude,reserved,ppstg
); );
if (grfMode & STGM_TRANSACTED) if (grfMode & STGM_TRANSACTED)
FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n"); FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n");
_create_istorage16(ppstg); _create_istorage16(ppstg);
lpstg = (_IStream16*)PTR_SEG_TO_LIN(*ppstg); lpstg = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstg);
DuplicateHandle( GetCurrentProcess(), this->hf, GetCurrentProcess(), DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(),
&lpstg->hf, 0, TRUE, DUPLICATE_SAME_ACCESS ); &lpstg->hf, 0, TRUE, DUPLICATE_SAME_ACCESS );
lstrcpyAtoW(name,pwcsName); lstrcpyAtoW(name,pwcsName);
newpps = STORAGE_look_for_named_pps(lpstg->hf,this->stde.pps_dir,name); newpps = STORAGE_look_for_named_pps(lpstg->hf,This->stde.pps_dir,name);
if (newpps==-1) { if (newpps==-1) {
IStream16_fnRelease((IUnknown*)lpstg); IStream16_fnRelease((IUnknown*)lpstg);
return E_FAIL; return E_FAIL;
@ -1470,22 +1473,22 @@ HRESULT WINAPI IStorage16_fnOpenStorage(
HRESULT WINAPI IStorage16_fnOpenStream( HRESULT WINAPI IStorage16_fnOpenStream(
LPSTORAGE16 iface,LPCOLESTR16 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream16 **ppstm LPSTORAGE16 iface,LPCOLESTR16 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream16 **ppstm
) { ) {
ICOM_THIS(IStorage16,iface); ICOM_THIS(IStorage16Impl,iface);
_IStream16* lpstr; IStream16Impl* lpstr;
WCHAR name[33]; WCHAR name[33];
int newpps; int newpps;
TRACE(relay,"(%p)->(%s,%p,0x%08lx,0x%08lx,%p)\n", TRACE(relay,"(%p)->(%s,%p,0x%08lx,0x%08lx,%p)\n",
this,pwcsName,reserved1,grfMode,reserved2,ppstm This,pwcsName,reserved1,grfMode,reserved2,ppstm
); );
if (grfMode & STGM_TRANSACTED) if (grfMode & STGM_TRANSACTED)
FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n"); FIXME(ole,"We do not support transacted Compound Storage. Using direct mode.\n");
_create_istream16(ppstm); _create_istream16(ppstm);
lpstr = (_IStream16*)PTR_SEG_TO_LIN(*ppstm); lpstr = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstm);
DuplicateHandle( GetCurrentProcess(), this->hf, GetCurrentProcess(), DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(),
&lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS ); &lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS );
lstrcpyAtoW(name,pwcsName); lstrcpyAtoW(name,pwcsName);
newpps = STORAGE_look_for_named_pps(lpstr->hf,this->stde.pps_dir,name); newpps = STORAGE_look_for_named_pps(lpstr->hf,This->stde.pps_dir,name);
if (newpps==-1) { if (newpps==-1) {
IStream16_fnRelease((IUnknown*)lpstr); IStream16_fnRelease((IUnknown*)lpstr);
return E_FAIL; return E_FAIL;
@ -1505,7 +1508,7 @@ HRESULT WINAPI IStorage16_fnOpenStream(
* _create_istorage16 [INTERNAL] * _create_istorage16 [INTERNAL]
*/ */
static void _create_istorage16(LPSTORAGE16 *stg) { static void _create_istorage16(LPSTORAGE16 *stg) {
_IStorage16* lpst; IStorage16Impl* lpst;
if (!stvt16.bvt.fnQueryInterface) { if (!stvt16.bvt.fnQueryInterface) {
HMODULE16 wp = GetModuleHandle16("STORAGE"); HMODULE16 wp = GetModuleHandle16("STORAGE");
@ -1563,7 +1566,7 @@ static void _create_istorage16(LPSTORAGE16 *stg) {
segstvt16 = &stvt16; segstvt16 = &stvt16;
} }
} }
lpst = SEGPTR_NEW(_IStorage16); lpst = SEGPTR_NEW(IStorage16Impl);
lpst->lpvtbl = segstvt16; lpst->lpvtbl = segstvt16;
lpst->ref = 1; lpst->ref = 1;
lpst->thisptr = SEGPTR_GET(lpst); lpst->thisptr = SEGPTR_GET(lpst);
@ -1582,7 +1585,7 @@ HRESULT WINAPI StgCreateDocFile16(
) { ) {
HFILE32 hf; HFILE32 hf;
int i,ret; int i,ret;
_IStorage16* lpstg; IStorage16Impl* lpstg;
struct storage_pps_entry stde; struct storage_pps_entry stde;
TRACE(ole,"(%s,0x%08lx,0x%08lx,%p)\n", TRACE(ole,"(%s,0x%08lx,0x%08lx,%p)\n",
@ -1594,7 +1597,7 @@ HRESULT WINAPI StgCreateDocFile16(
WARN(ole,"couldn't open file for storage:%ld\n",GetLastError()); WARN(ole,"couldn't open file for storage:%ld\n",GetLastError());
return E_FAIL; return E_FAIL;
} }
lpstg = (_IStorage16*)PTR_SEG_TO_LIN(*ppstgOpen); lpstg = (IStorage16Impl*)PTR_SEG_TO_LIN(*ppstgOpen);
lpstg->hf = hf; lpstg->hf = hf;
/* FIXME: check for existance before overwriting? */ /* FIXME: check for existance before overwriting? */
if (!STORAGE_init_storage(hf)) { if (!STORAGE_init_storage(hf)) {
@ -1679,7 +1682,7 @@ HRESULT WINAPI StgOpenStorage16(
) { ) {
HFILE32 hf; HFILE32 hf;
int ret,i; int ret,i;
_IStorage16* lpstg; IStorage16Impl* lpstg;
struct storage_pps_entry stde; struct storage_pps_entry stde;
TRACE(ole,"(%s,%p,0x%08lx,%p,%ld,%p)\n", TRACE(ole,"(%s,%p,0x%08lx,%p,%ld,%p)\n",
@ -1691,7 +1694,7 @@ HRESULT WINAPI StgOpenStorage16(
WARN(ole,"Couldn't open file for storage\n"); WARN(ole,"Couldn't open file for storage\n");
return E_FAIL; return E_FAIL;
} }
lpstg = (_IStorage16*)PTR_SEG_TO_LIN(*ppstgOpen); lpstg = (IStorage16Impl*)PTR_SEG_TO_LIN(*ppstgOpen);
lpstg->hf = hf; lpstg->hf = hf;
i=0;ret=0; i=0;ret=0;