wia [2/2]: marshal WIA COM interfaces in our sti.dll

Damjan Jovanovic damjan.jov at gmail.com
Wed Oct 28 04:26:26 CDT 2009


Changelog:
* marshal WIA COM interfaces in our sti.dll

The Windows registry shows that sti.dll is used for this purpose.

Damjan Jovanovic
-------------- next part --------------
diff --git a/dlls/sti/Makefile.in b/dlls/sti/Makefile.in
index 5bc46bc..4da1c95 100644
--- a/dlls/sti/Makefile.in
+++ b/dlls/sti/Makefile.in
@@ -4,13 +4,19 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = sti.dll
 IMPORTLIB = sti
-IMPORTS   = uuid ole32 advapi32 kernel32
+IMPORTS   = uuid ole32 advapi32 kernel32 rpcrt4 oleaut32
+EXTRADEFS = -DENTRY_PREFIX=STI_ -DPROXY_DELEGATION -DREGISTER_PROXY_DLL
 
 C_SRCS = \
 	regsvr.c \
 	sti.c \
 	sti_main.c
 
+IDL_P_SRCS = \
+	sti_wia.idl
+
+EXTRA_OBJS = dlldata.o
+
 @MAKE_DLL_RULES@
 
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/sti/regsvr.c b/dlls/sti/regsvr.c
index 018c178..6b5b066 100644
--- a/dlls/sti/regsvr.c
+++ b/dlls/sti/regsvr.c
@@ -31,6 +31,7 @@
 #include "objbase.h"
 #include "initguid.h"
 #include "sti.h"
+#include "wia.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
@@ -395,6 +396,9 @@ static struct regsvr_interface const interface_list[] = {
     { NULL }			/* list terminator */
 };
 
+extern HRESULT WINAPI STI_DllRegisterServer(void) DECLSPEC_HIDDEN;
+extern HRESULT WINAPI STI_DllUnregisterServer(void) DECLSPEC_HIDDEN;
+
 /***********************************************************************
  *		DllRegisterServer (INETCOMM.@)
  */
@@ -404,7 +408,9 @@ HRESULT WINAPI DllRegisterServer(void)
 
     TRACE("\n");
 
-    hr = register_coclasses(coclass_list);
+    hr = STI_DllRegisterServer();
+    if (SUCCEEDED(hr))
+        hr = register_coclasses(coclass_list);
     if (SUCCEEDED(hr))
 	hr = register_interfaces(interface_list);
     return hr;
@@ -422,5 +428,7 @@ HRESULT WINAPI DllUnregisterServer(void)
     hr = unregister_coclasses(coclass_list);
     if (SUCCEEDED(hr))
 	hr = unregister_interfaces(interface_list);
+    if (SUCCEEDED(hr))
+        hr = STI_DllUnregisterServer();
     return hr;
 }
diff --git a/dlls/sti/sti_main.c b/dlls/sti/sti_main.c
index 4e91698..55c4b78 100644
--- a/dlls/sti/sti_main.c
+++ b/dlls/sti/sti_main.c
@@ -32,6 +32,9 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(sti);
 
+extern HRESULT WINAPI STI_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLSPEC_HIDDEN;
+extern BOOL WINAPI STI_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
+
 typedef HRESULT (*fnCreateInstance)(REFIID riid, IUnknown *pUnkOuter, LPVOID *ppObj);
 
 typedef struct
@@ -129,17 +132,9 @@ static sti_cf the_sti_cf = { &sti_cf_vtbl, sti_create };
 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
     TRACE("(0x%p, %d, %p)\n",hInstDLL,fdwReason,lpvReserved);
-
-    switch(fdwReason) {
-        case DLL_WINE_PREATTACH:
-            return FALSE;
-        case DLL_PROCESS_ATTACH:
-            DisableThreadLibraryCalls(hInstDLL);
-            break;
-        case DLL_PROCESS_DETACH:
-            break;
-    }
-    return TRUE;
+    if (fdwReason == DLL_WINE_PREATTACH)
+        return FALSE;
+    return STI_DllMain(hInstDLL, fdwReason, lpvReserved);
 }
 
 /******************************************************************************
@@ -156,8 +151,9 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
        cf = (IClassFactory *)&the_sti_cf.vtbl;
     }
 
-    if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
-    return IClassFactory_QueryInterface( cf, iid, ppv );
+    if (cf)
+        return IClassFactory_QueryInterface( cf, iid, ppv );
+    return STI_DllGetClassObject( rclsid, iid, ppv );
 }
 
 /******************************************************************************
diff --git a/dlls/sti/sti_wia.idl b/dlls/sti/sti_wia.idl
new file mode 100644
index 0000000..64ae79c
--- /dev/null
+++ b/dlls/sti/sti_wia.idl
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2009 Damjan Jovanovic
+ *
+ * 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 "wia.idl"


More information about the wine-patches mailing list