[PATCH 1/8] Add new dll ExplorerFrame.

David Hedberg david.hedberg at gmail.com
Thu Jul 29 14:10:15 CDT 2010


---
 configure.ac                            |    1 +
 dlls/explorerframe/Makefile.in          |   15 +++
 dlls/explorerframe/explorerframe.spec   |    9 ++
 dlls/explorerframe/explorerframe_main.c |  198 +++++++++++++++++++++++++++++++
 dlls/explorerframe/explorerframe_main.h |   30 +++++
 dlls/explorerframe/version.rc           |   29 +++++
 6 files changed, 282 insertions(+), 0 deletions(-)
 create mode 100644 dlls/explorerframe/Makefile.in
 create mode 100644 dlls/explorerframe/explorerframe.spec
 create mode 100644 dlls/explorerframe/explorerframe_main.c
 create mode 100644 dlls/explorerframe/explorerframe_main.h
 create mode 100644 dlls/explorerframe/version.rc

diff --git a/configure.ac b/configure.ac
index 2888d1e..1fad01c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2358,6 +2358,7 @@ WINE_CONFIG_LIB(dxerr9)
 WINE_CONFIG_DLL(dxgi,,[dxgi])
 WINE_CONFIG_TEST(dlls/dxgi/tests)
 WINE_CONFIG_LIB(dxguid)
+WINE_CONFIG_DLL(explorerframe,,[explorerframe])
 WINE_CONFIG_DLL(faultrep)
 WINE_CONFIG_DLL(fltlib)
 WINE_CONFIG_DLL(fusion)
diff --git a/dlls/explorerframe/Makefile.in b/dlls/explorerframe/Makefile.in
new file mode 100644
index 0000000..8c68535
--- /dev/null
+++ b/dlls/explorerframe/Makefile.in
@@ -0,0 +1,15 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = explorerframe.dll
+IMPORTS   = uuid shell32 kernel32 user32
+DELAYIMPORTS = ole32
+
+C_SRCS = \
+	explorerframe_main.c
+
+RC_SRCS = \
+	version.rc
+
+ at MAKE_DLL_RULES@
\ No newline at end of file
diff --git a/dlls/explorerframe/explorerframe.spec b/dlls/explorerframe/explorerframe.spec
new file mode 100644
index 0000000..0bff42f
--- /dev/null
+++ b/dlls/explorerframe/explorerframe.spec
@@ -0,0 +1,9 @@
+# Windows 7 ExplorerFrame.dll
+
+# 110 stub EXPLORERFRAME_110
+# 111 stub EXPLORERFRAME_111
+# 134 stub EXPLORERFRAME_134
+
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllGetVersion(ptr)
diff --git a/dlls/explorerframe/explorerframe_main.c b/dlls/explorerframe/explorerframe_main.c
new file mode 100644
index 0000000..d8c7749
--- /dev/null
+++ b/dlls/explorerframe/explorerframe_main.c
@@ -0,0 +1,198 @@
+/*
+ * ExplorerFrame main functions
+ *
+ * Copyright 2010 David Hedberg
+ *
+ * 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 <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "winuser.h"
+#include "winerror.h"
+#include "shlwapi.h"
+
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+#include "explorerframe_main.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(explorerframe);
+
+HINSTANCE explorerframe_hinstance;
+LONG EFRAME_refCount;
+
+/*************************************************************************
+ * ExplorerFrame DllMain
+ */
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
+{
+    TRACE("%p 0x%x %p\n", hinst, fdwReason, fImpLoad);
+    switch (fdwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+        explorerframe_hinstance = hinst;
+        break;
+    case DLL_PROCESS_DETACH:
+        break;
+    }
+    return TRUE;
+}
+
+/*************************************************************************
+ *              DllCanUnloadNow (ExplorerFrame.@)
+ */
+HRESULT WINAPI DllCanUnloadNow(void)
+{
+    return EFRAME_refCount ? S_FALSE : S_OK;
+}
+
+/*************************************************************************
+ *              DllGetVersion (ExplorerFrame.@)
+ */
+HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
+{
+    if(info->cbSize == sizeof(DLLVERSIONINFO) ||
+       info->cbSize == sizeof(DLLVERSIONINFO2))
+    {
+        /* Windows 7 */
+        info->dwMajorVersion = 6;
+        info->dwMinorVersion = 1;
+        info->dwBuildNumber = 7600;
+        info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
+        if(info->cbSize == sizeof(DLLVERSIONINFO2))
+        {
+            DLLVERSIONINFO2 *info2 = (DLLVERSIONINFO2*)info;
+            info2->dwFlags = 0;
+            info2->ullVersion = MAKEDLLVERULL(info->dwMajorVersion,
+                                              info->dwMinorVersion,
+                                              info->dwBuildNumber,
+                                              16385); /* "hotfix number" */
+        }
+        return S_OK;
+    }
+
+    WARN("wrong DLLVERSIONINFO size from app.\n");
+    return E_INVALIDARG;
+}
+
+/*************************************************************************
+ * Implement the ExplorerFrame class factory
+ *
+ * (Taken from shdocvw/factory.c; based on implementation in
+ *  ddraw/main.c)
+ */
+
+#define FACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl)
+
+typedef struct
+{
+    const IClassFactoryVtbl *lpClassFactoryVtbl;
+    HRESULT (*cf)(LPUNKNOWN, REFIID, LPVOID *);
+    LONG ref;
+} IClassFactoryImpl;
+
+
+/*************************************************************************
+ * EFCF_QueryInterface (IUnknown)
+ */
+static HRESULT WINAPI EFCF_QueryInterface(LPCLASSFACTORY iface,
+                                          REFIID riid, LPVOID *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;
+}
+
+/*************************************************************************
+ * EFCF_AddRef (IUnknown)
+ */
+static ULONG WINAPI EFCF_AddRef(LPCLASSFACTORY iface)
+{
+    EFRAME_LockModule();
+
+    return 2; /* non-heap based object */
+}
+
+/*************************************************************************
+ * EFCF_Release (IUnknown)
+ */
+static ULONG WINAPI EFCF_Release(LPCLASSFACTORY iface)
+{
+    EFRAME_UnlockModule();
+
+    return 1; /* non-heap based object */
+}
+
+/*************************************************************************
+ * EFCF_CreateInstance (IClassFactory)
+ */
+static HRESULT WINAPI EFCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
+                                          REFIID riid, LPVOID *ppobj)
+{
+    IClassFactoryImpl *This = (IClassFactoryImpl *) iface;
+    return This->cf(pOuter, riid, ppobj);
+}
+
+/*************************************************************************
+ * EFCF_LockServer (IClassFactory)
+ */
+static HRESULT WINAPI EFCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
+{
+    TRACE("%p (%d)\n", iface, dolock);
+
+    if (dolock)
+        EFRAME_LockModule();
+    else
+        EFRAME_UnlockModule();
+
+    return S_OK;
+}
+
+static const IClassFactoryVtbl EFCF_Vtbl =
+{
+    EFCF_QueryInterface,
+    EFCF_AddRef,
+    EFCF_Release,
+    EFCF_CreateInstance,
+    EFCF_LockServer
+};
+
+/*************************************************************************
+ *              DllGetClassObject (ExplorerFrame.@)
+ */
+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/explorerframe/explorerframe_main.h b/dlls/explorerframe/explorerframe_main.h
new file mode 100644
index 0000000..45be664
--- /dev/null
+++ b/dlls/explorerframe/explorerframe_main.h
@@ -0,0 +1,30 @@
+/*
+ * ExplorerFrame main include
+ *
+ * Copyright 2010 David Hedberg
+ *
+ * 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 __WINE_EXPLORERFRAME_H
+#define __WINE_EXPLORERFRAME_H
+
+extern HINSTANCE explorerframe_hinstance;
+
+extern LONG EFRAME_refCount;
+static inline void EFRAME_LockModule(void) { InterlockedIncrement( &EFRAME_refCount ); }
+static inline void EFRAME_UnlockModule(void) { InterlockedDecrement( &EFRAME_refCount ); }
+
+#endif /* __WINE_EXPLORERFRAME_H */
diff --git a/dlls/explorerframe/version.rc b/dlls/explorerframe/version.rc
new file mode 100644
index 0000000..257b1fc
--- /dev/null
+++ b/dlls/explorerframe/version.rc
@@ -0,0 +1,29 @@
+/*
+ * ExplorerFrame Version Resource
+ *
+ * Copyright 2010 David Hedberg
+ *
+ * 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
+ */
+
+#define WINE_OLESELFREGISTER
+#define WINE_FILEDESCRIPTION_STR "Wine ExplorerFrame"
+#define WINE_FILENAME_STR "explorerframe.dll"
+#define WINE_FILEVERSION 6,1,7600,16385
+#define WINE_FILEVERSION_STR "6.1.7600.16385"
+#define WINE_PRODUCTVERSION 6,1,7600,16385
+#define WINE_PRODUCTVERSION_STR "6.1.7600.16385"
+
+#include "wine/wine_common_ver.rc"
-- 
1.7.2




More information about the wine-patches mailing list