Commit 050c3496 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Code clean up.

parent 3fbf3f66
...@@ -34,54 +34,47 @@ ...@@ -34,54 +34,47 @@
WINE_DEFAULT_DEBUG_CHANNEL(urlmon); WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
typedef struct { typedef struct {
const IMonikerVtbl *lpIMonikerVtbl;
const IMonikerVtbl* lpvtbl; /* VTable relative to the IMoniker interface.*/ LONG ref;
LONG ref; /* reference counter for this object */
LPOLESTR URLName; /* URL string identified by this URLmoniker */ LPOLESTR URLName; /* URL string identified by this URLmoniker */
} URLMonikerImpl; } URLMoniker;
/******************************************************************************* #define MONIKER_THIS(iface) DEFINE_THIS(URLMoniker, IMoniker, iface)
* URLMoniker_QueryInterface
*******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject); static HRESULT WINAPI URLMoniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
{
URLMoniker *This = MONIKER_THIS(iface);
/* Perform a sanity check on the parameters.*/ if(!ppv)
if ( (This==0) || (ppvObject==0) )
return E_INVALIDARG; return E_INVALIDARG;
/* Initialize the return parameter */ if(IsEqualIID(&IID_IUnknown, riid)) {
*ppvObject = 0; TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = iface;
/* Compare the riid with the interface IDs implemented by this object.*/ }else if(IsEqualIID(&IID_IPersist, riid)) {
if (IsEqualIID(&IID_IUnknown, riid) || TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
IsEqualIID(&IID_IPersist, riid) || *ppv = iface;
IsEqualIID(&IID_IPersistStream,riid) || }else if(IsEqualIID(&IID_IPersistStream,riid)) {
IsEqualIID(&IID_IMoniker, riid) TRACE("(%p)->(IID_IPersistStream %p)\n", This, ppv);
) *ppv = iface;
*ppvObject = iface; }else if(IsEqualIID(&IID_IMoniker, riid)) {
TRACE("(%p)->(IID_IMoniker %p)\n", This, ppv);
/* Check that we obtained an interface.*/ *ppv = iface;
if ((*ppvObject)==0) }else {
WARN("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
*ppv = NULL;
return E_NOINTERFACE; return E_NOINTERFACE;
}
/* Query Interface always increases the reference count by one when it is successful */ IMoniker_AddRef((IUnknown*)*ppv);
IMoniker_AddRef(iface);
return S_OK; return S_OK;
} }
/****************************************************************************** static ULONG WINAPI URLMoniker_AddRef(IMoniker *iface)
* URLMoniker_AddRef
******************************************************************************/
static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
ULONG refCount = InterlockedIncrement(&This->ref); ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%u\n",This, refCount); TRACE("(%p) ref=%u\n",This, refCount);
...@@ -89,17 +82,13 @@ static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface) ...@@ -89,17 +82,13 @@ static ULONG WINAPI URLMonikerImpl_AddRef(IMoniker* iface)
return refCount; return refCount;
} }
/****************************************************************************** static ULONG WINAPI URLMoniker_Release(IMoniker *iface)
* URLMoniker_Release
******************************************************************************/
static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
ULONG refCount = InterlockedDecrement(&This->ref); ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%u\n",This, refCount); TRACE("(%p) ref=%u\n",This, refCount);
/* destroy the object if there's no more reference on it */
if (!refCount) { if (!refCount) {
heap_free(This->URLName); heap_free(This->URLName);
heap_free(This); heap_free(This);
...@@ -110,58 +99,49 @@ static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface) ...@@ -110,58 +99,49 @@ static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface)
return refCount; return refCount;
} }
static HRESULT WINAPI URLMoniker_GetClassID(IMoniker *iface, CLSID *pClassID)
/******************************************************************************
* URLMoniker_GetClassID
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_GetClassID(IMoniker* iface,
CLSID *pClassID)/* Pointer to CLSID of object */
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
TRACE("(%p,%p)\n",This,pClassID); TRACE("(%p,%p)\n", This, pClassID);
if (pClassID==NULL) if(!pClassID)
return E_POINTER; return E_POINTER;
/* Windows always returns CLSID_StdURLMoniker */ /* Windows always returns CLSID_StdURLMoniker */
*pClassID = CLSID_StdURLMoniker; *pClassID = CLSID_StdURLMoniker;
return S_OK; return S_OK;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_IsDirty(IMoniker *iface)
* URLMoniker_IsDirty
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_IsDirty(IMoniker* iface)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
/* Note that the OLE-provided implementations of the IPersistStream::IsDirty
method in the OLE-provided moniker interfaces always return S_FALSE because
their internal state never changes. */
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
/* Note that the OLE-provided implementations of the IPersistStream::IsDirty
method in the OLE-provided moniker interfaces always return S_FALSE because
their internal state never changes. */
return S_FALSE; return S_FALSE;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm)
* URLMoniker_Load
*
* NOTE
* Writes a ULONG containing length of unicode string, followed
* by that many unicode characters
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface,IStream* pStm)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
HRESULT res; HRESULT res;
ULONG size; ULONG size;
ULONG got; ULONG got;
TRACE("(%p,%p)\n",This,pStm); TRACE("(%p,%p)\n",This,pStm);
if(!pStm) if(!pStm)
return E_INVALIDARG; return E_INVALIDARG;
/*
* NOTE
* Writes a ULONG containing length of unicode string, followed
* by that many unicode characters
*/
res = IStream_Read(pStm, &size, sizeof(ULONG), &got); res = IStream_Read(pStm, &size, sizeof(ULONG), &got);
if(SUCCEEDED(res)) { if(SUCCEEDED(res)) {
if(got == sizeof(ULONG)) { if(got == sizeof(ULONG)) {
...@@ -177,21 +157,17 @@ static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface,IStream* pStm) ...@@ -177,21 +157,17 @@ static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface,IStream* pStm)
else else
res = E_FAIL; res = E_FAIL;
} }
return res; return res;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClearDirty)
* URLMoniker_Save
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface,
IStream* pStm,/* pointer to the stream where the object is to be saved */
BOOL fClearDirty)/* Specifies whether to clear the dirty flag */
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
HRESULT res; HRESULT res;
ULONG size; ULONG size;
TRACE("(%p,%p,%d)\n",This,pStm,fClearDirty);
TRACE("(%p,%p,%d)\n", This, pStm, fClearDirty);
if(!pStm) if(!pStm)
return E_INVALIDARG; return E_INVALIDARG;
...@@ -200,17 +176,14 @@ static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface, ...@@ -200,17 +176,14 @@ static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface,
res=IStream_Write(pStm,&size,sizeof(ULONG),NULL); res=IStream_Write(pStm,&size,sizeof(ULONG),NULL);
if(SUCCEEDED(res)) if(SUCCEEDED(res))
res=IStream_Write(pStm,This->URLName,size,NULL); res=IStream_Write(pStm,This->URLName,size,NULL);
return res; return res;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_GetSizeMax(IMoniker* iface, ULARGE_INTEGER *pcbSize)
* URLMoniker_GetSizeMax
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface,
ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
TRACE("(%p,%p)\n",This,pcbSize); TRACE("(%p,%p)\n",This,pcbSize);
...@@ -221,16 +194,10 @@ static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface, ...@@ -221,16 +194,10 @@ static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface,
return S_OK; return S_OK;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_BindToObject(IMoniker *iface, IBindCtx* pbc, IMoniker *pmkToLeft,
* URLMoniker_BindToObject REFIID riid, void **ppv)
******************************************************************************/ {
static HRESULT WINAPI URLMonikerImpl_BindToObject(IMoniker* iface, URLMoniker *This = MONIKER_THIS(iface);
IBindCtx* pbc,
IMoniker* pmkToLeft,
REFIID riid,
VOID** ppv)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
IRunningObjectTable *obj_tbl; IRunningObjectTable *obj_tbl;
HRESULT hres; HRESULT hres;
...@@ -245,16 +212,10 @@ static HRESULT WINAPI URLMonikerImpl_BindToObject(IMoniker* iface, ...@@ -245,16 +212,10 @@ static HRESULT WINAPI URLMonikerImpl_BindToObject(IMoniker* iface,
return bind_to_object(iface, This->URLName, pbc, riid, ppv); return bind_to_object(iface, This->URLName, pbc, riid, ppv);
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_BindToStorage(IMoniker* iface, IBindCtx* pbc,
* URLMoniker_BindToStorage IMoniker* pmkToLeft, REFIID riid, void **ppvObject)
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
IBindCtx* pbc,
IMoniker* pmkToLeft,
REFIID riid,
VOID** ppvObject)
{ {
URLMonikerImpl *This = (URLMonikerImpl*)iface; URLMoniker *This = MONIKER_THIS(iface);
TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject); TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject);
...@@ -264,48 +225,34 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface, ...@@ -264,48 +225,34 @@ static HRESULT WINAPI URLMonikerImpl_BindToStorage(IMoniker* iface,
return bind_to_storage(This->URLName, pbc, riid, ppvObject); return bind_to_storage(This->URLName, pbc, riid, ppvObject);
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_Reduce(IMoniker *iface, IBindCtx *pbc,
* URLMoniker_Reduce DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
******************************************************************************/ {
static HRESULT WINAPI URLMonikerImpl_Reduce(IMoniker* iface, URLMoniker *This = MONIKER_THIS(iface);
IBindCtx* pbc,
DWORD dwReduceHowFar,
IMoniker** ppmkToLeft,
IMoniker** ppmkReduced)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
TRACE("(%p,%p,%d,%p,%p)\n",This,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced); TRACE("(%p,%p,%d,%p,%p)\n", This, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
if(!ppmkReduced) if(!ppmkReduced)
return E_INVALIDARG; return E_INVALIDARG;
URLMonikerImpl_AddRef(iface); IMoniker_AddRef(iface);
*ppmkReduced = iface; *ppmkReduced = iface;
return MK_S_REDUCED_TO_SELF; return MK_S_REDUCED_TO_SELF;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
* URLMoniker_ComposeWith BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite)
******************************************************************************/ {
static HRESULT WINAPI URLMonikerImpl_ComposeWith(IMoniker* iface, URLMoniker *This = MONIKER_THIS(iface);
IMoniker* pmkRight,
BOOL fOnlyIfNotGeneric,
IMoniker** ppmkComposite)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
FIXME("(%p)->(%p,%d,%p): stub\n",This,pmkRight,fOnlyIfNotGeneric,ppmkComposite); FIXME("(%p)->(%p,%d,%p): stub\n",This,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
return E_NOTIMPL; return E_NOTIMPL;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
* URLMoniker_Enum
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
TRACE("(%p,%d,%p)\n",This,fForward,ppenumMoniker);
TRACE("(%p,%d,%p)\n", This, fForward, ppenumMoniker);
if(!ppenumMoniker) if(!ppenumMoniker)
return E_INVALIDARG; return E_INVALIDARG;
...@@ -315,18 +262,15 @@ static HRESULT WINAPI URLMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMo ...@@ -315,18 +262,15 @@ static HRESULT WINAPI URLMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMo
return S_OK; return S_OK;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
* URLMoniker_IsEqual
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
CLSID clsid; CLSID clsid;
LPOLESTR urlPath; LPOLESTR urlPath;
IBindCtx* bind; IBindCtx* bind;
HRESULT res; HRESULT res;
TRACE("(%p,%p)\n",This,pmkOtherMoniker); TRACE("(%p,%p)\n",This, pmkOtherMoniker);
if(pmkOtherMoniker==NULL) if(pmkOtherMoniker==NULL)
return E_INVALIDARG; return E_INVALIDARG;
...@@ -352,13 +296,9 @@ static HRESULT WINAPI URLMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherM ...@@ -352,13 +296,9 @@ static HRESULT WINAPI URLMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherM
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_Hash(IMoniker *iface, DWORD *pdwHash)
* URLMoniker_Hash
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
int h = 0,i,skip,len; int h = 0,i,skip,len;
int off = 0; int off = 0;
LPOLESTR val; LPOLESTR val;
...@@ -375,8 +315,7 @@ static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) ...@@ -375,8 +315,7 @@ static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
for(i = len ; i > 0; i--) { for(i = len ; i > 0; i--) {
h = (h * 37) + val[off++]; h = (h * 37) + val[off++];
} }
} }else {
else {
/* only sample some characters */ /* only sample some characters */
skip = len / 8; skip = len / 8;
for(i = len; i > 0; i -= skip, off += skip) { for(i = len; i > 0; i -= skip, off += skip) {
...@@ -387,80 +326,50 @@ static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash) ...@@ -387,80 +326,50 @@ static HRESULT WINAPI URLMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
return S_OK; return S_OK;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_IsRunning(IMoniker* iface, IBindCtx* pbc,
* URLMoniker_IsRunning IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
******************************************************************************/ {
static HRESULT WINAPI URLMonikerImpl_IsRunning(IMoniker* iface, URLMoniker *This = MONIKER_THIS(iface);
IBindCtx* pbc,
IMoniker* pmkToLeft,
IMoniker* pmkNewlyRunning)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pmkNewlyRunning); FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pmkNewlyRunning);
return E_NOTIMPL; return E_NOTIMPL;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_GetTimeOfLastChange(IMoniker *iface,
* URLMoniker_GetTimeOfLastChange IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime)
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
IBindCtx* pbc,
IMoniker* pmkToLeft,
FILETIME* pFileTime)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pFileTime); FIXME("(%p)->(%p,%p,%p): stub\n", This, pbc, pmkToLeft, pFileTime);
return E_NOTIMPL; return E_NOTIMPL;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_Inverse(IMoniker *iface, IMoniker **ppmk)
* URLMoniker_Inverse
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
TRACE("(%p,%p)\n",This,ppmk); TRACE("(%p,%p)\n",This,ppmk);
return MK_E_NOINVERSE; return MK_E_NOINVERSE;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkPrefix)
* URLMoniker_CommonPrefixWith
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
FIXME("(%p)->(%p,%p): stub\n",This,pmkOther,ppmkPrefix); FIXME("(%p)->(%p,%p): stub\n",This,pmkOther,ppmkPrefix);
return E_NOTIMPL; return E_NOTIMPL;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath)
* URLMoniker_RelativePathTo
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
FIXME("(%p)->(%p,%p): stub\n",This,pmOther,ppmkRelPath); FIXME("(%p)->(%p,%p): stub\n",This,pmOther,ppmkRelPath);
return E_NOTIMPL; return E_NOTIMPL;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
* URLMoniker_GetDisplayName LPOLESTR *ppszDisplayName)
******************************************************************************/ {
static HRESULT WINAPI URLMonikerImpl_GetDisplayName(IMoniker* iface, URLMoniker *This = MONIKER_THIS(iface);
IBindCtx* pbc,
IMoniker* pmkToLeft,
LPOLESTR *ppszDisplayName)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
int len; int len;
TRACE("(%p,%p,%p,%p)\n",This,pbc,pmkToLeft,ppszDisplayName); TRACE("(%p,%p,%p,%p)\n", This, pbc, pmkToLeft, ppszDisplayName);
if(!ppszDisplayName) if(!ppszDisplayName)
return E_INVALIDARG; return E_INVALIDARG;
...@@ -476,28 +385,18 @@ static HRESULT WINAPI URLMonikerImpl_GetDisplayName(IMoniker* iface, ...@@ -476,28 +385,18 @@ static HRESULT WINAPI URLMonikerImpl_GetDisplayName(IMoniker* iface,
return S_OK; return S_OK;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
* URLMoniker_ParseDisplayName LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
******************************************************************************/ {
static HRESULT WINAPI URLMonikerImpl_ParseDisplayName(IMoniker* iface, URLMoniker *This = MONIKER_THIS(iface);
IBindCtx* pbc,
IMoniker* pmkToLeft,
LPOLESTR pszDisplayName,
ULONG* pchEaten,
IMoniker** ppmkOut)
{
URLMonikerImpl *This = (URLMonikerImpl *)iface;
FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut); FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
return E_NOTIMPL; return E_NOTIMPL;
} }
/****************************************************************************** static HRESULT WINAPI URLMoniker_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys)
* URLMoniker_IsSystemMoniker
******************************************************************************/
static HRESULT WINAPI URLMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
{ {
URLMonikerImpl *This = (URLMonikerImpl *)iface; URLMoniker *This = MONIKER_THIS(iface);
TRACE("(%p,%p)\n",This,pwdMksys); TRACE("(%p,%p)\n",This,pwdMksys);
if(!pwdMksys) if(!pwdMksys)
...@@ -507,47 +406,44 @@ static HRESULT WINAPI URLMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdM ...@@ -507,47 +406,44 @@ static HRESULT WINAPI URLMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdM
return S_OK; return S_OK;
} }
/********************************************************************************/ static const IMonikerVtbl URLMonikerVtbl =
/* Virtual function table for the URLMonikerImpl class which include IPersist,*/ {
/* IPersistStream and IMoniker functions. */ URLMoniker_QueryInterface,
static const IMonikerVtbl VT_URLMonikerImpl = URLMoniker_AddRef,
{ URLMoniker_Release,
URLMonikerImpl_QueryInterface, URLMoniker_GetClassID,
URLMonikerImpl_AddRef, URLMoniker_IsDirty,
URLMonikerImpl_Release, URLMoniker_Load,
URLMonikerImpl_GetClassID, URLMoniker_Save,
URLMonikerImpl_IsDirty, URLMoniker_GetSizeMax,
URLMonikerImpl_Load, URLMoniker_BindToObject,
URLMonikerImpl_Save, URLMoniker_BindToStorage,
URLMonikerImpl_GetSizeMax, URLMoniker_Reduce,
URLMonikerImpl_BindToObject, URLMoniker_ComposeWith,
URLMonikerImpl_BindToStorage, URLMoniker_Enum,
URLMonikerImpl_Reduce, URLMoniker_IsEqual,
URLMonikerImpl_ComposeWith, URLMoniker_Hash,
URLMonikerImpl_Enum, URLMoniker_IsRunning,
URLMonikerImpl_IsEqual, URLMoniker_GetTimeOfLastChange,
URLMonikerImpl_Hash, URLMoniker_Inverse,
URLMonikerImpl_IsRunning, URLMoniker_CommonPrefixWith,
URLMonikerImpl_GetTimeOfLastChange, URLMoniker_RelativePathTo,
URLMonikerImpl_Inverse, URLMoniker_GetDisplayName,
URLMonikerImpl_CommonPrefixWith, URLMoniker_ParseDisplayName,
URLMonikerImpl_RelativePathTo, URLMoniker_IsSystemMoniker
URLMonikerImpl_GetDisplayName,
URLMonikerImpl_ParseDisplayName,
URLMonikerImpl_IsSystemMoniker
}; };
/****************************************************************************** /******************************************************************************
* URLMoniker_Construct (local function) * URLMoniker_Construct (local function)
*******************************************************************************/ *******************************************************************************/
static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszLeftURLName, LPCOLESTR lpszURLName) static HRESULT URLMoniker_Construct(URLMoniker *This, LPCOLESTR lpszLeftURLName, LPCOLESTR lpszURLName)
{ {
HRESULT hres; HRESULT hres;
DWORD sizeStr = 0; DWORD sizeStr = 0;
TRACE("(%p,%s,%s)\n",This,debugstr_w(lpszLeftURLName),debugstr_w(lpszURLName)); TRACE("(%p,%s,%s)\n",This,debugstr_w(lpszLeftURLName),debugstr_w(lpszURLName));
This->lpvtbl = &VT_URLMonikerImpl; This->lpIMonikerVtbl = &URLMonikerVtbl;
This->ref = 0; This->ref = 0;
This->URLName = heap_alloc(INTERNET_MAX_URL_LENGTH*sizeof(WCHAR)); This->URLName = heap_alloc(INTERNET_MAX_URL_LENGTH*sizeof(WCHAR));
...@@ -592,7 +488,7 @@ static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszLeft ...@@ -592,7 +488,7 @@ static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszLeft
*/ */
HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk, DWORD dwFlags) HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk, DWORD dwFlags)
{ {
URLMonikerImpl *obj; URLMoniker *obj;
HRESULT hres; HRESULT hres;
LPOLESTR lefturl = NULL; LPOLESTR lefturl = NULL;
...@@ -614,10 +510,10 @@ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker ...@@ -614,10 +510,10 @@ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker
} }
} }
hres = URLMonikerImpl_Construct(obj, lefturl, szURL); hres = URLMoniker_Construct(obj, lefturl, szURL);
CoTaskMemFree(lefturl); CoTaskMemFree(lefturl);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
hres = URLMonikerImpl_QueryInterface((IMoniker*)obj, &IID_IMoniker, (void**)ppmk); hres = URLMoniker_QueryInterface((IMoniker*)obj, &IID_IMoniker, (void**)ppmk);
else else
heap_free(obj); heap_free(obj);
return hres; return hres;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment