Vincent Povirk : mscoree: Add stub implementation of IMetaDataDispenserEx.

Alexandre Julliard julliard at winehq.org
Thu Nov 11 12:05:51 CST 2010


Module: wine
Branch: master
Commit: 9e20c21dbdf442138afb45884fcf7f5998352302
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9e20c21dbdf442138afb45884fcf7f5998352302

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Tue Oct  5 13:21:25 2010 -0500

mscoree: Add stub implementation of IMetaDataDispenserEx.

---

 dlls/mscoree/Makefile.in       |    1 +
 dlls/mscoree/corruntimehost.c  |   22 ++++-
 dlls/mscoree/metadata.c        |  202 ++++++++++++++++++++++++++++++++++++++++
 dlls/mscoree/mscoree_private.h |    2 +
 4 files changed, 226 insertions(+), 1 deletions(-)

diff --git a/dlls/mscoree/Makefile.in b/dlls/mscoree/Makefile.in
index 284b18f..914aff4 100644
--- a/dlls/mscoree/Makefile.in
+++ b/dlls/mscoree/Makefile.in
@@ -5,6 +5,7 @@ C_SRCS = \
 	assembly.c \
 	config.c \
 	corruntimehost.c \
+	metadata.c \
 	metahost.c \
 	mscoree_main.c
 
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c
index 58d5e3b..8145948 100644
--- a/dlls/mscoree/corruntimehost.c
+++ b/dlls/mscoree/corruntimehost.c
@@ -618,16 +618,36 @@ HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version,
 HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv)
 {
     IUnknown *unk;
+    HRESULT hr;
 
     if (IsEqualGUID(clsid, &CLSID_CorRuntimeHost))
+    {
         unk = (IUnknown*)&This->lpVtbl;
+        IUnknown_AddRef(unk);
+    }
     else if (IsEqualGUID(clsid, &CLSID_CLRRuntimeHost))
+    {
         unk = (IUnknown*)&This->lpCLRHostVtbl;
+        IUnknown_AddRef(unk);
+    }
+    else if (IsEqualGUID(clsid, &CLSID_CorMetaDataDispenser) ||
+             IsEqualGUID(clsid, &CLSID_CorMetaDataDispenserRuntime))
+    {
+        hr = MetaDataDispenser_CreateInstance(&unk);
+        if (FAILED(hr))
+            return hr;
+    }
     else
         unk = NULL;
 
     if (unk)
-        return IUnknown_QueryInterface(unk, riid, ppv);
+    {
+        hr = IUnknown_QueryInterface(unk, riid, ppv);
+
+        IUnknown_Release(unk);
+
+        return hr;
+    }
     else
         FIXME("not implemented for class %s\n", debugstr_guid(clsid));
 
diff --git a/dlls/mscoree/metadata.c b/dlls/mscoree/metadata.c
new file mode 100644
index 0000000..c9b8c72
--- /dev/null
+++ b/dlls/mscoree/metadata.c
@@ -0,0 +1,202 @@
+/*
+ * IMetaDataDispenserEx - dynamic creation/editing of assemblies
+ *
+ * Copyright 2010 Vincent Povirk for CodeWeavers
+ *
+ * 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 <stdio.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#define COBJMACROS
+
+#include "wine/library.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "ole2.h"
+
+#include "cor.h"
+#include "metahost.h"
+#include "wine/list.h"
+#include "mscoree_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
+
+typedef struct MetaDataDispenser
+{
+    const struct IMetaDataDispenserExVtbl *lpVtbl;
+    LONG ref;
+} MetaDataDispenser;
+
+static HRESULT WINAPI MetaDataDispenser_QueryInterface(IMetaDataDispenserEx* iface,
+    REFIID riid, void **ppvObject)
+{
+    TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
+
+    if (IsEqualGUID(riid, &IID_IMetaDataDispenserEx) ||
+        IsEqualGUID(riid, &IID_IMetaDataDispenser) ||
+        IsEqualGUID(riid, &IID_IUnknown))
+    {
+        *ppvObject = iface;
+    }
+    else
+    {
+        FIXME("Unsupported interface %s\n", debugstr_guid(riid));
+        return E_NOINTERFACE;
+    }
+
+    IMetaDataDispenserEx_AddRef( iface );
+
+    return S_OK;
+}
+
+static ULONG WINAPI MetaDataDispenser_AddRef(IMetaDataDispenserEx* iface)
+{
+    MetaDataDispenser *This = (MetaDataDispenser*)iface;
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("%p ref=%u\n", This, ref);
+
+    MSCOREE_LockModule();
+
+    return ref;
+}
+
+static ULONG WINAPI MetaDataDispenser_Release(IMetaDataDispenserEx* iface)
+{
+    MetaDataDispenser *This = (MetaDataDispenser*)iface;
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("%p ref=%u\n", This, ref);
+
+    if (ref == 0)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    MSCOREE_UnlockModule();
+
+    return ref;
+}
+
+static HRESULT WINAPI MetaDataDispenser_DefineScope(IMetaDataDispenserEx* iface,
+    REFCLSID rclsid, DWORD dwCreateFlags, REFIID riid, IUnknown **ppIUnk)
+{
+    FIXME("%p %s %x %s %p\n", iface, debugstr_guid(rclsid), dwCreateFlags,
+        debugstr_guid(riid), ppIUnk);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_OpenScope(IMetaDataDispenserEx* iface,
+    LPCWSTR szScope, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
+{
+    FIXME("%p %s %x %s %p\n", iface, debugstr_w(szScope), dwOpenFlags,
+        debugstr_guid(riid), ppIUnk);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_OpenScopeOnMemory(IMetaDataDispenserEx* iface,
+    const void *pData, ULONG cbData, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
+{
+    FIXME("%p %p %u %x %s %p\n", iface, pData, cbData, dwOpenFlags,
+        debugstr_guid(riid), ppIUnk);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_SetOption(IMetaDataDispenserEx* iface,
+    REFGUID optionid, const VARIANT *value)
+{
+    FIXME("%p %s\n", iface, debugstr_guid(optionid));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_GetOption(IMetaDataDispenserEx* iface,
+    REFGUID optionid, VARIANT *pvalue)
+{
+    FIXME("%p %s\n", iface, debugstr_guid(optionid));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_OpenScopeOnITypeInfo(IMetaDataDispenserEx* iface,
+    ITypeInfo *pITI, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
+{
+    FIXME("%p %p %u %s %p\n", iface, pITI, dwOpenFlags, debugstr_guid(riid), ppIUnk);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_GetCORSystemDirectory(IMetaDataDispenserEx* iface,
+    LPWSTR szBuffer, DWORD cchBuffer, DWORD *pchBuffer)
+{
+    FIXME("%p %p %u %p\n", iface, szBuffer, cchBuffer, pchBuffer);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_FindAssembly(IMetaDataDispenserEx* iface,
+    LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
+    LPWSTR szName, ULONG cchName, ULONG *pcName)
+{
+    FIXME("%p %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
+        debugstr_w(szPrivateBin), debugstr_w(szGlobalBin),
+        debugstr_w(szAssemblyName), szName, cchName, pcName);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MetaDataDispenser_FindAssemblyModule(IMetaDataDispenserEx* iface,
+    LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
+    LPCWSTR szModuleName, LPWSTR szName, ULONG cchName, ULONG *pcName)
+{
+    FIXME("%p %s %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
+        debugstr_w(szPrivateBin), debugstr_w(szGlobalBin), debugstr_w(szAssemblyName),
+        debugstr_w(szModuleName), szName, cchName, pcName);
+    return E_NOTIMPL;
+}
+
+const struct IMetaDataDispenserExVtbl MetaDataDispenserVtbl =
+{
+    MetaDataDispenser_QueryInterface,
+    MetaDataDispenser_AddRef,
+    MetaDataDispenser_Release,
+    MetaDataDispenser_DefineScope,
+    MetaDataDispenser_OpenScope,
+    MetaDataDispenser_OpenScopeOnMemory,
+    MetaDataDispenser_SetOption,
+    MetaDataDispenser_GetOption,
+    MetaDataDispenser_OpenScopeOnITypeInfo,
+    MetaDataDispenser_GetCORSystemDirectory,
+    MetaDataDispenser_FindAssembly,
+    MetaDataDispenser_FindAssemblyModule
+};
+
+HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk)
+{
+    MetaDataDispenser *This;
+
+    This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetaDataDispenser));
+
+    if (!This)
+        return E_OUTOFMEMORY;
+
+    This->lpVtbl = &MetaDataDispenserVtbl;
+    This->ref = 1;
+
+    *ppUnk = (IUnknown*)This;
+
+    return S_OK;
+}
diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h
index 49cd6a2..46c49c6 100644
--- a/dlls/mscoree/mscoree_private.h
+++ b/dlls/mscoree/mscoree_private.h
@@ -54,6 +54,8 @@ extern HRESULT force_get_runtime_info(ICLRRuntimeInfo **result);
 
 extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result);
 
+extern HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk);
+
 typedef struct parsed_config_file
 {
     struct list supported_runtimes;




More information about the wine-cvs mailing list