Commit 72f3765a authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

itss: Standardize the COM usage in moniker.c.

parent 577f202d
......@@ -43,19 +43,24 @@ WINE_DEFAULT_DEBUG_CHANNEL(itss);
/*****************************************************************************/
typedef struct {
const IMonikerVtbl *vtbl_ITS_IMoniker;
IMoniker IMoniker_iface;
LONG ref;
LPWSTR szHtml;
WCHAR szFile[1];
} ITS_IMonikerImpl;
static inline ITS_IMonikerImpl *impl_from_IMoniker(IMoniker *iface)
{
return CONTAINING_RECORD(iface, ITS_IMonikerImpl, IMoniker_iface);
}
/*** IUnknown methods ***/
static HRESULT WINAPI ITS_IMonikerImpl_QueryInterface(
IMoniker* iface,
REFIID riid,
void** ppvObject)
{
ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface;
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IParseDisplayName))
......@@ -72,7 +77,7 @@ static HRESULT WINAPI ITS_IMonikerImpl_QueryInterface(
static ULONG WINAPI ITS_IMonikerImpl_AddRef(
IMoniker* iface)
{
ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface;
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
TRACE("%p\n", This);
return InterlockedIncrement(&This->ref);
}
......@@ -80,7 +85,7 @@ static ULONG WINAPI ITS_IMonikerImpl_AddRef(
static ULONG WINAPI ITS_IMonikerImpl_Release(
IMoniker* iface)
{
ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface;
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0) {
......@@ -96,7 +101,7 @@ static HRESULT WINAPI ITS_IMonikerImpl_GetClassID(
IMoniker* iface,
CLSID* pClassID)
{
ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface;
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
TRACE("%p %p\n", This, pClassID);
*pClassID = CLSID_ITStorage;
......@@ -155,7 +160,7 @@ static HRESULT WINAPI ITS_IMonikerImpl_BindToStorage(
REFIID riid,
void** ppvObj)
{
ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface;
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
DWORD grfMode = STGM_SIMPLE | STGM_READ | STGM_SHARE_EXCLUSIVE;
HRESULT r;
IStorage *stg = NULL;
......@@ -279,7 +284,7 @@ static HRESULT WINAPI ITS_IMonikerImpl_GetDisplayName(
IMoniker* pmkToLeft,
LPOLESTR* ppszDisplayName)
{
ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface;
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
static const WCHAR szFormat[] = {
'm','s','-','i','t','s',':','%','s',':',':','%','s',0 };
DWORD len = sizeof szFormat / sizeof(WCHAR);
......@@ -352,7 +357,7 @@ static HRESULT ITS_IMoniker_create( IMoniker **ppObj, LPCWSTR name, DWORD n )
sz = sizeof(ITS_IMonikerImpl) + strlenW( name )*sizeof(WCHAR);
itsmon = HeapAlloc( GetProcessHeap(), 0, sz );
itsmon->vtbl_ITS_IMoniker = &ITS_IMonikerImpl_Vtbl;
itsmon->IMoniker_iface.lpVtbl = &ITS_IMonikerImpl_Vtbl;
itsmon->ref = 1;
strcpyW( itsmon->szFile, name );
itsmon->szHtml = &itsmon->szFile[n];
......@@ -362,7 +367,7 @@ static HRESULT ITS_IMoniker_create( IMoniker **ppObj, LPCWSTR name, DWORD n )
TRACE("-> %p %s %s\n", itsmon,
debugstr_w(itsmon->szFile), debugstr_w(itsmon->szHtml) );
*ppObj = (IMoniker*) itsmon;
*ppObj = &itsmon->IMoniker_iface;
ITSS_LockModule();
return S_OK;
......@@ -371,16 +376,21 @@ static HRESULT ITS_IMoniker_create( IMoniker **ppObj, LPCWSTR name, DWORD n )
/*****************************************************************************/
typedef struct {
const IParseDisplayNameVtbl *vtbl_ITS_IParseDisplayName;
IParseDisplayName IParseDisplayName_iface;
LONG ref;
} ITS_IParseDisplayNameImpl;
static inline ITS_IParseDisplayNameImpl *impl_from_IParseDisplayName(IParseDisplayName *iface)
{
return CONTAINING_RECORD(iface, ITS_IParseDisplayNameImpl, IParseDisplayName_iface);
}
static HRESULT WINAPI ITS_IParseDisplayNameImpl_QueryInterface(
IParseDisplayName* iface,
REFIID riid,
void** ppvObject)
{
ITS_IParseDisplayNameImpl *This = (ITS_IParseDisplayNameImpl *)iface;
ITS_IParseDisplayNameImpl *This = impl_from_IParseDisplayName(iface);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IParseDisplayName))
......@@ -397,7 +407,7 @@ static HRESULT WINAPI ITS_IParseDisplayNameImpl_QueryInterface(
static ULONG WINAPI ITS_IParseDisplayNameImpl_AddRef(
IParseDisplayName* iface)
{
ITS_IParseDisplayNameImpl *This = (ITS_IParseDisplayNameImpl *)iface;
ITS_IParseDisplayNameImpl *This = impl_from_IParseDisplayName(iface);
TRACE("%p\n", This);
return InterlockedIncrement(&This->ref);
}
......@@ -405,7 +415,7 @@ static ULONG WINAPI ITS_IParseDisplayNameImpl_AddRef(
static ULONG WINAPI ITS_IParseDisplayNameImpl_Release(
IParseDisplayName* iface)
{
ITS_IParseDisplayNameImpl *This = (ITS_IParseDisplayNameImpl *)iface;
ITS_IParseDisplayNameImpl *This = impl_from_IParseDisplayName(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0) {
......@@ -428,7 +438,7 @@ static HRESULT WINAPI ITS_IParseDisplayNameImpl_ParseDisplayName(
const DWORD prefix_len = (sizeof szPrefix/sizeof szPrefix[0])-1;
DWORD n;
ITS_IParseDisplayNameImpl *This = (ITS_IParseDisplayNameImpl *)iface;
ITS_IParseDisplayNameImpl *This = impl_from_IParseDisplayName(iface);
TRACE("%p %s %p %p\n", This,
debugstr_w( pszDisplayName ), pchEaten, ppmkOut );
......@@ -469,7 +479,7 @@ HRESULT ITS_IParseDisplayName_create(IUnknown *pUnkOuter, LPVOID *ppObj)
return CLASS_E_NOAGGREGATION;
its = HeapAlloc( GetProcessHeap(), 0, sizeof(ITS_IParseDisplayNameImpl) );
its->vtbl_ITS_IParseDisplayName = &ITS_IParseDisplayNameImpl_Vtbl;
its->IParseDisplayName_iface.lpVtbl = &ITS_IParseDisplayNameImpl_Vtbl;
its->ref = 1;
TRACE("-> %p\n", its);
......
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