David Hedberg : comdlg32: Add DllGetClassObject and a default class factory .
Alexandre Julliard
julliard at winehq.org
Tue Mar 29 11:43:02 CDT 2011
Module: wine
Branch: master
Commit: 55c717e84cd87d841da49f4fbd3210efaa2479a0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=55c717e84cd87d841da49f4fbd3210efaa2479a0
Author: David Hedberg <david.hedberg at gmail.com>
Date: Thu Mar 24 22:38:50 2011 +0100
comdlg32: Add DllGetClassObject and a default class factory.
---
dlls/comdlg32/cdlg32.c | 97 +++++++++++++++++++++++++++++++++++++++++++
dlls/comdlg32/comdlg32.spec | 1 +
2 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/dlls/comdlg32/cdlg32.c b/dlls/comdlg32/cdlg32.c
index 9502443..0982dfb 100644
--- a/dlls/comdlg32/cdlg32.c
+++ b/dlls/comdlg32/cdlg32.c
@@ -21,6 +21,8 @@
#include <stdarg.h>
+#define COBJMACROS
+
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
@@ -167,3 +169,98 @@ DWORD WINAPI CommDlgExtendedError(void)
else
return 0; /* we never set an error, so there isn't one */
}
+
+/*************************************************************************
+ * Implement the CommDlg32 class factory
+ *
+ * (Taken from shdocvw/factory.c; based on implementation in
+ * ddraw/main.c)
+ */
+typedef struct
+{
+ IClassFactory IClassFactory_iface;
+ HRESULT (*cf)(IUnknown*, REFIID, void**);
+} IClassFactoryImpl;
+
+static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+ return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
+}
+
+/*************************************************************************
+ * CDLGCF_QueryInterface (IUnknown)
+ */
+static HRESULT WINAPI CDLGCF_QueryInterface(IClassFactory* iface,
+ REFIID riid, void **ppobj)
+{
+ TRACE("%p (%s %p)\n", iface, debugstr_guid(riid), ppobj);
+
+ if(!ppobj)
+ return E_POINTER;
+
+ if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid))
+ {
+ *ppobj = iface;
+ IClassFactory_AddRef(iface);
+ return S_OK;
+ }
+
+ WARN("Interface not supported.\n");
+
+ *ppobj = NULL;
+ return E_NOINTERFACE;
+}
+
+/*************************************************************************
+ * CDLGCF_AddRef (IUnknown)
+ */
+static ULONG WINAPI CDLGCF_AddRef(IClassFactory *iface)
+{
+ return 2; /* non-heap based object */
+}
+
+/*************************************************************************
+ * CDLGCF_Release (IUnknown)
+ */
+static ULONG WINAPI CDLGCF_Release(IClassFactory *iface)
+{
+ return 1; /* non-heap based object */
+}
+
+/*************************************************************************
+ * CDLGCF_CreateInstance (IClassFactory)
+ */
+static HRESULT WINAPI CDLGCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
+ REFIID riid, void **ppobj)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+ return This->cf(pOuter, riid, ppobj);
+}
+
+/*************************************************************************
+ * CDLGCF_LockServer (IClassFactory)
+ */
+static HRESULT WINAPI CDLGCF_LockServer(IClassFactory *iface, BOOL dolock)
+{
+ TRACE("%p (%d)\n", iface, dolock);
+ return S_OK;
+}
+
+static const IClassFactoryVtbl CDLGCF_Vtbl =
+{
+ CDLGCF_QueryInterface,
+ CDLGCF_AddRef,
+ CDLGCF_Release,
+ CDLGCF_CreateInstance,
+ CDLGCF_LockServer
+};
+
+/*************************************************************************
+ * DllGetClassObject (COMMDLG32.@)
+ */
+HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
+{
+ TRACE("%s, %s, %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
diff --git a/dlls/comdlg32/comdlg32.spec b/dlls/comdlg32/comdlg32.spec
index 618ccd0..118d3d7 100644
--- a/dlls/comdlg32/comdlg32.spec
+++ b/dlls/comdlg32/comdlg32.spec
@@ -3,6 +3,7 @@
@ stdcall ChooseFontA(ptr)
@ stdcall ChooseFontW(ptr)
@ stdcall CommDlgExtendedError()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall FindTextA(ptr)
@ stdcall FindTextW(ptr)
@ stdcall GetFileTitleA(str ptr long)
More information about the wine-cvs
mailing list