Commit ec1b3262 authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

uiribbon: Add stubs for IUIFramework.

parent ebe9e1fa
......@@ -18716,7 +18716,7 @@ wine_fn_config_dll typelib.dll16 enable_win16
wine_fn_config_dll ucrtbase enable_ucrtbase implib
wine_fn_config_test dlls/ucrtbase/tests ucrtbase_test
wine_fn_config_dll uiautomationcore enable_uiautomationcore
wine_fn_config_dll uiribbon enable_uiribbon
wine_fn_config_dll uiribbon enable_uiribbon clean
wine_fn_config_dll unicows enable_unicows implib
wine_fn_config_dll updspapi enable_updspapi
wine_fn_config_dll url enable_url implib
......
......@@ -3500,7 +3500,7 @@ WINE_CONFIG_DLL(typelib.dll16,enable_win16)
WINE_CONFIG_DLL(ucrtbase,,[implib])
WINE_CONFIG_TEST(dlls/ucrtbase/tests)
WINE_CONFIG_DLL(uiautomationcore)
WINE_CONFIG_DLL(uiribbon)
WINE_CONFIG_DLL(uiribbon,,[clean])
WINE_CONFIG_DLL(unicows,,[implib])
WINE_CONFIG_DLL(updspapi)
WINE_CONFIG_DLL(url,,[implib])
......
......@@ -2,4 +2,7 @@ MODULE = uiribbon.dll
IMPORTS = uuid ole32
C_SRCS = \
main.c
main.c \
uiribbon.c
IDL_SRCS = uiribbon_classes.idl
......@@ -26,6 +26,15 @@
#include "winuser.h"
#include "winreg.h"
#include "ole2.h"
#include "rpcproxy.h"
/* Define GUIDs, but only our own */
#include <unknwn.h>
#include <propsys.h>
#include "initguid.h"
#include "uiribbon_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(uiribbon);
......@@ -47,6 +56,96 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
typedef struct {
IClassFactory IClassFactory_iface;
LONG ref;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, void **ppObj);
} IClassFactoryImpl;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
struct object_creation_info
{
const CLSID *clsid;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, void **ppObj);
};
static const struct object_creation_info object_creation[] =
{
{ &CLSID_UIRibbonFramework, UIRibbonFrameworkImpl_Create },
};
static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, void **ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IClassFactory))
{
IClassFactory_AddRef(iface);
*ppobj = &This->IClassFactory_iface;
return S_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI XFCF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI XFCF_Release(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
static HRESULT WINAPI XFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, void **ppobj)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
HRESULT hres;
LPUNKNOWN punk;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
*ppobj = NULL;
hres = This->pfnCreateInstance(pOuter, (void **) &punk);
if (SUCCEEDED(hres)) {
hres = IUnknown_QueryInterface(punk, riid, ppobj);
IUnknown_Release(punk);
}
return hres;
}
static HRESULT WINAPI XFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%d), stub!\n",This,dolock);
return S_OK;
}
static const IClassFactoryVtbl XFCF_Vtbl =
{
XFCF_QueryInterface,
XFCF_AddRef,
XFCF_Release,
XFCF_CreateInstance,
XFCF_LockServer
};
/*******************************************************************************
* Retrieves class object from a DLL object
*
......@@ -65,9 +164,37 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
{
FIXME("(%s,%s,%p) stub!\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
unsigned int i;
IClassFactoryImpl *factory;
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if ( !IsEqualGUID( &IID_IClassFactory, riid )
&& ! IsEqualGUID( &IID_IUnknown, riid) )
return E_NOINTERFACE;
for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
if (i == sizeof(object_creation)/sizeof(object_creation[0]))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
if (factory == NULL) return E_OUTOFMEMORY;
factory->IClassFactory_iface.lpVtbl = &XFCF_Vtbl;
factory->ref = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
return CLASS_E_CLASSNOTAVAILABLE;
*ppv = &(factory->IClassFactory_iface);
return S_OK;
}
HRESULT WINAPI DllCanUnloadNow(void)
......
/*
* Copyright 2017 Fabian Maurer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/debug.h"
#define COBJMACROS
#include "uiribbon_private.h"
#include <stdio.h>
WINE_DEFAULT_DEBUG_CHANNEL(uiribbon);
static inline UIRibbonFrameworkImpl *impl_from_IUIFramework(IUIFramework *iface)
{
return CONTAINING_RECORD(iface, UIRibbonFrameworkImpl, IUIFramework_iface);
}
/*** IUnknown methods ***/
static HRESULT WINAPI UIRibbonFrameworkImpl_QueryInterface(IUIFramework *iface, REFIID riid, void **ppvObject)
{
UIRibbonFrameworkImpl *This = impl_from_IUIFramework(iface);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IUIFramework))
{
IUnknown_AddRef(iface);
*ppvObject = &This->IUIFramework_iface;
return S_OK;
}
ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
return E_NOINTERFACE;
}
static ULONG WINAPI UIRibbonFrameworkImpl_AddRef(IUIFramework *iface)
{
UIRibbonFrameworkImpl *This = impl_from_IUIFramework(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
return ref;
}
static ULONG WINAPI UIRibbonFrameworkImpl_Release(IUIFramework *iface)
{
UIRibbonFrameworkImpl *This = impl_from_IUIFramework(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
/*** IUIFramework methods ***/
static HRESULT WINAPI UIRibbonFrameworkImpl_Initialize(IUIFramework *iface, HWND frameWnd, IUIApplication *application)
{
FIXME("(%p, %p): stub!\n", frameWnd, application);
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_Destroy(IUIFramework *iface)
{
FIXME("(): stub!\n");
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_LoadUI(IUIFramework *iface, HINSTANCE instance, LPCWSTR resourceName)
{
FIXME("(%p, %s): stub!\n", instance, debugstr_w(resourceName));
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_GetView(IUIFramework *iface, UINT32 viewId, REFIID riid, void **ppv)
{
FIXME("(%u, %p, %p): stub!\n", viewId, riid, ppv);
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_GetUICommandProperty(IUIFramework *iface, UINT32 commandId, REFPROPERTYKEY key, PROPVARIANT *value)
{
FIXME("(%u, %p, %p): stub!\n", commandId, key, value);
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_SetUICommandProperty(IUIFramework *iface, UINT32 commandId, REFPROPERTYKEY key, PROPVARIANT value)
{
FIXME("(%u, %p): stub!\n", commandId, key);
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_InvalidateUICommand(IUIFramework *iface, UINT32 commandId, UI_INVALIDATIONS flags, const PROPERTYKEY *key)
{
FIXME("(%u, %#x, %p): stub!\n", commandId, flags, key);
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_FlushPendingInvalidations(IUIFramework *iface)
{
FIXME("(): stub!\n");
return E_NOTIMPL;
}
static HRESULT WINAPI UIRibbonFrameworkImpl_SetModes(IUIFramework *iface, INT32 iModes)
{
FIXME("(%d): stub!\n", iModes);
return E_NOTIMPL;
}
static const IUIFrameworkVtbl IUIFramework_Vtbl =
{
UIRibbonFrameworkImpl_QueryInterface,
UIRibbonFrameworkImpl_AddRef,
UIRibbonFrameworkImpl_Release,
UIRibbonFrameworkImpl_Initialize,
UIRibbonFrameworkImpl_Destroy,
UIRibbonFrameworkImpl_LoadUI,
UIRibbonFrameworkImpl_GetView,
UIRibbonFrameworkImpl_GetUICommandProperty,
UIRibbonFrameworkImpl_SetUICommandProperty,
UIRibbonFrameworkImpl_InvalidateUICommand,
UIRibbonFrameworkImpl_FlushPendingInvalidations,
UIRibbonFrameworkImpl_SetModes
};
HRESULT UIRibbonFrameworkImpl_Create(IUnknown *pUnkOuter, void **ppObj)
{
UIRibbonFrameworkImpl *object;
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(UIRibbonFrameworkImpl));
if (!object)
return E_OUTOFMEMORY;
object->IUIFramework_iface.lpVtbl = &IUIFramework_Vtbl;
object->ref = 1;
*ppObj = &object->IUIFramework_iface;
return S_OK;
}
/*
* Copyright 2017 Fabian Maurer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep register
#include "uiribbon.idl"
/*
* Copyright 2017 Fabian Maurer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __UIRIBBON_PRIVATE_INCLUDED__
#define __UIRIBBON_PRIVATE_INCLUDED__
#include "uiribbon.h"
typedef struct {
IUIFramework IUIFramework_iface;
LONG ref;
} UIRibbonFrameworkImpl;
HRESULT UIRibbonFrameworkImpl_Create(IUnknown *pUnkOuter, void **ppObj) DECLSPEC_HIDDEN;
#endif /* __UIRIBBON_PRIVATE_INCLUDED__ */
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