From 1f666978073d78ddad28e44e386fa709e2e7b464 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 27 Mar 2015 09:25:38 +0100 Subject: [PATCH] wiaservc-IEnumWIA_DEV_INFO: Various COM cleanup. --- patches/patchinstall.sh | 7 +- ...pointer-to-vtbl-instead-of-implement.patch | 78 +++++++++++++++++++ ...t-IWiaDevMgr-EnumDeviceInfo-by-retu.patch} | 24 +++--- 3 files changed, 95 insertions(+), 14 deletions(-) create mode 100644 patches/wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Return-pointer-to-vtbl-instead-of-implement.patch rename patches/wiaservc-IEnumWIA_DEV_INFO/{0001-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch => 0002-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch} (90%) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 477dcb83..e788bf4a 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -4186,11 +4186,14 @@ fi # | * [#27775] Implement empty enumerator for IWiaDevMgr::EnumDeviceInfo # | # | Modified files: -# | * dlls/wiaservc/Makefile.in, dlls/wiaservc/enumwiadevinfo.c, dlls/wiaservc/wiadevmgr.c, dlls/wiaservc/wiaservc_private.h +# | * dlls/wiaservc/Makefile.in, dlls/wiaservc/enumwiadevinfo.c, dlls/wiaservc/factory.c, dlls/wiaservc/wiadevmgr.c, +# | dlls/wiaservc/wiaservc_private.h # | if test "$enable_wiaservc_IEnumWIA_DEV_INFO" -eq 1; then - patch_apply wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch + patch_apply wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Return-pointer-to-vtbl-instead-of-implement.patch + patch_apply wiaservc-IEnumWIA_DEV_INFO/0002-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch ( + echo '+ { "Sebastian Lackner", "wiaservc: Return pointer to vtbl instead of implementation in wiadevmgr_Constructor.", 1 },'; echo '+ { "Mikael Ståldal", "wiaservc: Implement IWiaDevMgr::EnumDeviceInfo by returning an empty enumeration of devices.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Return-pointer-to-vtbl-instead-of-implement.patch b/patches/wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Return-pointer-to-vtbl-instead-of-implement.patch new file mode 100644 index 00000000..aaafaac0 --- /dev/null +++ b/patches/wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Return-pointer-to-vtbl-instead-of-implement.patch @@ -0,0 +1,78 @@ +From 18b3c656e19464999313d19ddee1d8168d87cb3a Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Fri, 27 Mar 2015 09:14:37 +0100 +Subject: wiaservc: Return pointer to vtbl instead of implementation in + wiadevmgr_Constructor. + +--- + dlls/wiaservc/factory.c | 8 ++++---- + dlls/wiaservc/wiadevmgr.c | 4 ++-- + dlls/wiaservc/wiaservc_private.h | 2 +- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/dlls/wiaservc/factory.c b/dlls/wiaservc/factory.c +index c76a363..9a607d5 100644 +--- a/dlls/wiaservc/factory.c ++++ b/dlls/wiaservc/factory.c +@@ -70,19 +70,19 @@ WIASERVC_IClassFactory_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, + REFIID riid, LPVOID *ppvObj) + { + HRESULT res; +- IUnknown *punk = NULL; ++ IWiaDevMgr *devmgr = NULL; + + TRACE("IID: %s\n", debugstr_guid(riid)); + + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + +- res = wiadevmgr_Constructor((LPVOID*) &punk); ++ res = wiadevmgr_Constructor(&devmgr); + if (FAILED(res)) + return res; + +- res = IUnknown_QueryInterface(punk, riid, ppvObj); +- IUnknown_Release(punk); ++ res = IWiaDevMgr_QueryInterface(devmgr, riid, ppvObj); ++ IWiaDevMgr_Release(devmgr); + return res; + } + +diff --git a/dlls/wiaservc/wiadevmgr.c b/dlls/wiaservc/wiadevmgr.c +index 2f0907b..6eb82aa 100644 +--- a/dlls/wiaservc/wiadevmgr.c ++++ b/dlls/wiaservc/wiadevmgr.c +@@ -164,7 +164,7 @@ static const IWiaDevMgrVtbl WIASERVC_IWiaDevMgr_Vtbl = + wiadevmgr_AddDeviceDlg + }; + +-HRESULT wiadevmgr_Constructor(LPVOID *ppObj) ++HRESULT wiadevmgr_Constructor(IWiaDevMgr **ppObj) + { + wiadevmgr *This; + TRACE("(%p)\n", ppObj); +@@ -173,7 +173,7 @@ HRESULT wiadevmgr_Constructor(LPVOID *ppObj) + { + This->IWiaDevMgr_iface.lpVtbl = &WIASERVC_IWiaDevMgr_Vtbl; + This->ref = 1; +- *ppObj = This; ++ *ppObj = &This->IWiaDevMgr_iface; + return S_OK; + } + *ppObj = NULL; +diff --git a/dlls/wiaservc/wiaservc_private.h b/dlls/wiaservc/wiaservc_private.h +index b7faf89..33c9ba1 100644 +--- a/dlls/wiaservc/wiaservc_private.h ++++ b/dlls/wiaservc/wiaservc_private.h +@@ -34,7 +34,7 @@ typedef struct + LONG ref; + } wiadevmgr; + +-HRESULT wiadevmgr_Constructor(LPVOID *ppObj) DECLSPEC_HIDDEN; ++HRESULT wiadevmgr_Constructor(IWiaDevMgr **ppObj) DECLSPEC_HIDDEN; + + /* Little helper functions */ + static inline char * +-- +2.3.3 + diff --git a/patches/wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch b/patches/wiaservc-IEnumWIA_DEV_INFO/0002-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch similarity index 90% rename from patches/wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch rename to patches/wiaservc-IEnumWIA_DEV_INFO/0002-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch index 161db2ee..16822390 100644 --- a/patches/wiaservc-IEnumWIA_DEV_INFO/0001-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch +++ b/patches/wiaservc-IEnumWIA_DEV_INFO/0002-wiaservc-Implement-IWiaDevMgr-EnumDeviceInfo-by-retu.patch @@ -1,4 +1,4 @@ -From 8a333a76ccdf50d3073f546a3b104d404e476377 Mon Sep 17 00:00:00 2001 +From 5b772e16b29cb0831e5e431c78e2bd7e601d162e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20St=C3=A5ldal?= Date: Sun, 11 May 2014 12:07:20 +0200 Subject: wiaservc: Implement IWiaDevMgr::EnumDeviceInfo by returning an empty @@ -28,7 +28,7 @@ index b40c8f0..0bdbff1 100644 diff --git a/dlls/wiaservc/enumwiadevinfo.c b/dlls/wiaservc/enumwiadevinfo.c new file mode 100644 -index 0000000..724a218 +index 0000000..85c75ce --- /dev/null +++ b/dlls/wiaservc/enumwiadevinfo.c @@ -0,0 +1,140 @@ @@ -157,7 +157,7 @@ index 0000000..724a218 + enumwiadevinfo_GetCount +}; + -+HRESULT enumwiadevinfo_Constructor(LPVOID *ppObj) ++HRESULT enumwiadevinfo_Constructor(IEnumWIA_DEV_INFO **ppObj) +{ + enumwiadevinfo *This; + TRACE("(%p)\n", ppObj); @@ -166,14 +166,14 @@ index 0000000..724a218 + { + This->IEnumWIA_DEV_INFO_iface.lpVtbl = &WIASERVC_IEnumWIA_DEV_INFO_Vtbl; + This->ref = 1; -+ *ppObj = This; ++ *ppObj = &This->IEnumWIA_DEV_INFO_iface; + return S_OK; + } + *ppObj = NULL; + return E_OUTOFMEMORY; +} diff --git a/dlls/wiaservc/wiadevmgr.c b/dlls/wiaservc/wiadevmgr.c -index 2f0907b..bcef9ef 100644 +index 6eb82aa..8305ae2 100644 --- a/dlls/wiaservc/wiadevmgr.c +++ b/dlls/wiaservc/wiadevmgr.c @@ -72,8 +72,18 @@ static ULONG WINAPI wiadevmgr_Release(IWiaDevMgr *iface) @@ -183,27 +183,27 @@ index 2f0907b..bcef9ef 100644 - FIXME("(%p, %d, %p): stub\n", This, lFlag, ppIEnum); - return E_NOTIMPL; + HRESULT res; -+ IUnknown *punk = NULL; ++ IEnumWIA_DEV_INFO *enumdevinfo = NULL; + + FIXME("(%p, %d, %p): returning empty IEnumWIA_DEV_INFO\n", This, lFlag, ppIEnum); + -+ res = enumwiadevinfo_Constructor((LPVOID*) &punk); ++ res = enumwiadevinfo_Constructor(&enumdevinfo); + if (FAILED(res)) + return res; + -+ res = IUnknown_QueryInterface(punk, &IID_IEnumWIA_DEV_INFO, (void **)ppIEnum); -+ IUnknown_Release(punk); ++ res = IEnumWIA_DEV_INFO_QueryInterface(enumdevinfo, &IID_IEnumWIA_DEV_INFO, (void **)ppIEnum); ++ IEnumWIA_DEV_INFO_Release(enumdevinfo); + return res; } static HRESULT WINAPI wiadevmgr_CreateDevice(IWiaDevMgr *iface, BSTR bstrDeviceID, IWiaItem **ppWiaItemRoot) diff --git a/dlls/wiaservc/wiaservc_private.h b/dlls/wiaservc/wiaservc_private.h -index b7faf89..08b7d9b 100644 +index 33c9ba1..22ad553 100644 --- a/dlls/wiaservc/wiaservc_private.h +++ b/dlls/wiaservc/wiaservc_private.h @@ -36,6 +36,14 @@ typedef struct - HRESULT wiadevmgr_Constructor(LPVOID *ppObj) DECLSPEC_HIDDEN; + HRESULT wiadevmgr_Constructor(IWiaDevMgr **ppObj) DECLSPEC_HIDDEN; +typedef struct +{ @@ -211,7 +211,7 @@ index b7faf89..08b7d9b 100644 + LONG ref; +} enumwiadevinfo; + -+HRESULT enumwiadevinfo_Constructor(LPVOID *ppObj) DECLSPEC_HIDDEN; ++HRESULT enumwiadevinfo_Constructor(IEnumWIA_DEV_INFO **ppObj) DECLSPEC_HIDDEN; + /* Little helper functions */ static inline char *