ole32: Simplify CreateClassMoniker().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
39070fd4f6
commit
5e1a8ada72
|
@ -656,48 +656,26 @@ static const IROTDataVtbl ROTDataVtbl =
|
|||
ClassMonikerROTData_GetComparisonData
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* ClassMoniker_Construct (local function)
|
||||
*******************************************************************************/
|
||||
static HRESULT ClassMoniker_Construct(ClassMoniker* This, REFCLSID rclsid)
|
||||
{
|
||||
TRACE("(%p,%s)\n",This,debugstr_guid(rclsid));
|
||||
|
||||
/* Initialize the virtual function table. */
|
||||
This->IMoniker_iface.lpVtbl = &ClassMonikerVtbl;
|
||||
This->IROTData_iface.lpVtbl = &ROTDataVtbl;
|
||||
This->ref = 0;
|
||||
This->clsid = *rclsid;
|
||||
This->pMarshal = NULL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CreateClassMoniker [OLE32.@]
|
||||
******************************************************************************/
|
||||
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **ppmk)
|
||||
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **moniker)
|
||||
{
|
||||
ClassMoniker* newClassMoniker;
|
||||
HRESULT hr;
|
||||
ClassMoniker *object;
|
||||
|
||||
TRACE("(%s,%p)\n", debugstr_guid(rclsid), ppmk);
|
||||
TRACE("%s, %p\n", debugstr_guid(rclsid), moniker);
|
||||
|
||||
newClassMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(ClassMoniker));
|
||||
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (!newClassMoniker)
|
||||
return STG_E_INSUFFICIENTMEMORY;
|
||||
object->IMoniker_iface.lpVtbl = &ClassMonikerVtbl;
|
||||
object->IROTData_iface.lpVtbl = &ROTDataVtbl;
|
||||
object->ref = 1;
|
||||
object->clsid = *rclsid;
|
||||
|
||||
hr = ClassMoniker_Construct(newClassMoniker, rclsid);
|
||||
*moniker = &object->IMoniker_iface;
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, newClassMoniker);
|
||||
return hr;
|
||||
}
|
||||
|
||||
return ClassMoniker_QueryInterface(&newClassMoniker->IMoniker_iface, &IID_IMoniker,
|
||||
(void**)ppmk);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT ClassMoniker_CreateFromDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten,
|
||||
|
|
Loading…
Reference in New Issue