[SHIMGVW] Fix DLL stubs, intended to fix a crash on Windows. Patch by Ricardo Hanke.
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 12 Dec 2014 13:08:59 +0000 (13:08 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 12 Dec 2014 13:08:59 +0000 (13:08 +0000)
CORE-8073 #resolve #comment Committed in r65614. Thanks!

svn path=/trunk/; revision=65614

reactos/dll/win32/shimgvw/CMakeLists.txt
reactos/dll/win32/shimgvw/comsup.c [new file with mode: 0644]
reactos/dll/win32/shimgvw/comsup.h [new file with mode: 0644]
reactos/dll/win32/shimgvw/shimgvw.spec

index be17acc..8895a0b 100644 (file)
@@ -3,6 +3,7 @@ spec2def(shimgvw.dll shimgvw.spec)
 
 list(APPEND SOURCE
     shimgvw.c
+    comsup.c
     shimgvw.rc
     ${CMAKE_CURRENT_BINARY_DIR}/shimgvw_stubs.c
     ${CMAKE_CURRENT_BINARY_DIR}/shimgvw.def)
diff --git a/reactos/dll/win32/shimgvw/comsup.c b/reactos/dll/win32/shimgvw/comsup.c
new file mode 100644 (file)
index 0000000..473d634
--- /dev/null
@@ -0,0 +1,58 @@
+#define INITGUID
+
+#include <windef.h>
+#include <comsup.h>
+
+LONG LockCount;
+LONG ObjectCount;
+
+
+VOID
+DllInitServer(VOID)
+{
+    ObjectCount = 0;
+    LockCount = 0;
+}
+
+
+STDAPI
+DllRegisterServer(VOID)
+{
+    /* Always return S_OK, since there is currently nothing that can go wrong */
+    return S_OK;
+}
+
+
+STDAPI
+DllUnregisterServer(VOID)
+{
+    /* Always return S_OK, since there is currently nothing that can go wrong */
+    return S_OK;
+}
+
+
+STDAPI
+DllCanUnloadNow(VOID)
+{
+       if ((ObjectCount != 0) || (LockCount != 0))
+    {
+        return S_FALSE;
+    }
+    else
+    {    
+        return S_OK;
+    }
+}
+
+
+STDAPI
+DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
+{
+    HRESULT hr;
+
+    /* There are no classes to export, so always return CLASS_E_CLASSNOTAVAILABLE*/
+    *ppv = NULL;
+    hr = CLASS_E_CLASSNOTAVAILABLE;
+    
+    return hr;
+}
diff --git a/reactos/dll/win32/shimgvw/comsup.h b/reactos/dll/win32/shimgvw/comsup.h
new file mode 100644 (file)
index 0000000..9ac6d85
--- /dev/null
@@ -0,0 +1,4 @@
+extern LONG LockCount;
+extern LONG ObjectCount;
+
+VOID DllInitServer(VOID);
\ No newline at end of file
index 427eaa4..fd06419 100644 (file)
@@ -7,8 +7,8 @@
 @ stdcall ImageView_PrintToW(ptr ptr wstr long)
 @ stdcall imageview_fullscreenW(ptr ptr wstr long) ImageView_FullscreenW
 @ stub ConvertDIBSECTIONToThumbnail
-@ stub -private DllCanUnloadNow
-@ stub -private DllGetClassObject
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
 @ stub -private DllInstall
-@ stub -private DllRegisterServer
-@ stub -private DllUnregisterServer
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()