Added multiple patches for partial implementation of various combase RoApi functions.

This commit is contained in:
Sebastian Lackner 2016-01-18 04:53:03 +01:00
parent 0d38eb5ab0
commit 436e8536e4
10 changed files with 536 additions and 1 deletions

View File

@ -0,0 +1,190 @@
From a197dcbcf3f89fecd23028760bdc57502e0c7633 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 01:42:05 +0100
Subject: combase: Implement RoGetActivationFactory.
---
dlls/combase/Makefile.in | 2 +-
dlls/combase/roapi.c | 137 +++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 134 insertions(+), 5 deletions(-)
diff --git a/dlls/combase/Makefile.in b/dlls/combase/Makefile.in
index c5ab8d2..cf17a36 100644
--- a/dlls/combase/Makefile.in
+++ b/dlls/combase/Makefile.in
@@ -1,5 +1,5 @@
MODULE = combase.dll
-IMPORTS = ole32
+IMPORTS = advapi32 ole32
C_SRCS = \
roapi.c \
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c
index a2dfd54..6fd4df5 100644
--- a/dlls/combase/roapi.c
+++ b/dlls/combase/roapi.c
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Martin Storsjo
+ * Copyright 2016 Michael Müller
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,13 +18,93 @@
*/
#include "objbase.h"
+#include "initguid.h"
+#define COBJMACROS
#include "roapi.h"
-#include "hstring.h"
+#include "winstring.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(combase);
+static const char *debugstr_hstring(HSTRING hstr)
+{
+ const WCHAR *str;
+ UINT32 len;
+ if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)";
+ str = WindowsGetStringRawBuffer(hstr, &len);
+ return wine_dbgstr_wn(str, len);
+}
+
+static HRESULT get_library_for_classid(const WCHAR *classid, WCHAR **out)
+{
+ static const WCHAR classkeyW[] = {'S','o','f','t','w','a','r','e','\\',
+ 'M','i','c','r','o','s','o','f','t','\\',
+ 'W','i','n','d','o','w','s','R','u','n','t','i','m','e','\\',
+ 'A','c','t','i','v','a','t','a','b','l','e','C','l','a','s','s','I','d',0};
+ static const WCHAR dllpathW[] = {'D','l','l','P','a','t','h',0};
+ HKEY hkey_root, hkey_class;
+ DWORD type, size;
+ HRESULT hr;
+ WCHAR *buf = NULL;
+
+ *out = NULL;
+
+ /* load class registry key */
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, classkeyW, 0, KEY_READ, &hkey_root))
+ return REGDB_E_READREGDB;
+ if (RegOpenKeyExW(hkey_root, classid, 0, KEY_READ, &hkey_class))
+ {
+ WARN("Class %s not found in registry\n", debugstr_w(classid));
+ RegCloseKey(hkey_root);
+ return REGDB_E_CLASSNOTREG;
+ }
+ RegCloseKey(hkey_root);
+
+ /* load (and expand) DllPath registry value */
+ if (RegQueryValueExW(hkey_class, dllpathW, NULL, &type, NULL, &size))
+ {
+ hr = REGDB_E_READREGDB;
+ goto done;
+ }
+ if (type != REG_SZ && type != REG_EXPAND_SZ)
+ {
+ hr = REGDB_E_READREGDB;
+ goto done;
+ }
+ if (!(buf = HeapAlloc(GetProcessHeap(), 0, size)))
+ {
+ hr = E_OUTOFMEMORY;
+ goto done;
+ }
+ if (RegQueryValueExW(hkey_class, dllpathW, NULL, NULL, (BYTE *)buf, &size))
+ {
+ hr = REGDB_E_READREGDB;
+ goto done;
+ }
+ if (type == REG_EXPAND_SZ)
+ {
+ WCHAR *expanded;
+ DWORD len = ExpandEnvironmentStringsW(buf, NULL, 0);
+ if (!(expanded = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
+ {
+ hr = E_OUTOFMEMORY;
+ goto done;
+ }
+ ExpandEnvironmentStringsW(buf, expanded, len);
+ HeapFree(GetProcessHeap(), 0, buf);
+ buf = expanded;
+ }
+
+ *out = buf;
+ return S_OK;
+
+done:
+ HeapFree(GetProcessHeap(), 0, buf);
+ RegCloseKey(hkey_class);
+ return hr;
+}
+
/***********************************************************************
* RoInitialize (combase.@)
*/
@@ -50,8 +131,56 @@ void WINAPI RoUninitialize(void)
/***********************************************************************
* RoGetActivationFactory (combase.@)
*/
-HRESULT WINAPI RoGetActivationFactory(HSTRING classid, REFIID iid, void **factory)
+HRESULT WINAPI RoGetActivationFactory(HSTRING classid, REFIID iid, void **class_factory)
{
- FIXME("stub: %p %p %p\n", classid, iid, factory);
- return E_NOTIMPL;
+ PFNGETACTIVATIONFACTORY pDllGetActivationFactory;
+ IActivationFactory *factory;
+ WCHAR *library;
+ HMODULE module;
+ HRESULT hr;
+
+ FIXME("(%s, %s, %p): semi-stub\n", debugstr_hstring(classid), debugstr_guid(iid), class_factory);
+
+ if (!iid || !class_factory)
+ return E_INVALIDARG;
+
+ hr = get_library_for_classid(WindowsGetStringRawBuffer(classid, NULL), &library);
+ if (FAILED(hr))
+ {
+ ERR("Failed to find library for %s\n", debugstr_hstring(classid));
+ return hr;
+ }
+
+ if (!(module = LoadLibraryW(library)))
+ {
+ ERR("Failed to load module %s\n", debugstr_w(library));
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ goto done;
+ }
+
+ if (!(pDllGetActivationFactory = (void *)GetProcAddress(module, "DllGetActivationFactory")))
+ {
+ ERR("Module %s does not implement DllGetActivationFactory\n", debugstr_w(library));
+ hr = E_FAIL;
+ goto done;
+ }
+
+ TRACE("Found library %s for class %s\n", debugstr_w(library), debugstr_hstring(classid));
+
+ hr = pDllGetActivationFactory(classid, &factory);
+ if (SUCCEEDED(hr))
+ {
+ hr = IActivationFactory_QueryInterface(factory, iid, class_factory);
+ if (SUCCEEDED(hr))
+ {
+ TRACE("Created interface %p\n", *class_factory);
+ module = NULL;
+ }
+ IActivationFactory_Release(factory);
+ }
+
+done:
+ HeapFree(GetProcessHeap(), 0, library);
+ if (module) FreeLibrary(module);
+ return hr;
}
--
2.6.4

View File

@ -0,0 +1,54 @@
From 822a4ee7b6ac2923a96393b934e1c51e3204d45c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 01:45:30 +0100
Subject: combase: Implement RoActivateInstance.
---
dlls/combase/combase.spec | 2 +-
dlls/combase/roapi.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 5082f39..9b1ab30 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -242,7 +242,7 @@
@ stdcall PropVariantClear(ptr) ole32.PropVariantClear
@ stdcall PropVariantCopy(ptr ptr) ole32.PropVariantCopy
@ stub ReleaseFuncDescs
-@ stub RoActivateInstance
+@ stdcall RoActivateInstance(ptr ptr)
@ stub RoCaptureErrorContext
@ stub RoClearError
@ stub RoFailFastWithErrorContext
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c
index 6fd4df5..695b6fd 100644
--- a/dlls/combase/roapi.c
+++ b/dlls/combase/roapi.c
@@ -184,3 +184,23 @@ done:
if (module) FreeLibrary(module);
return hr;
}
+
+/***********************************************************************
+ * RoActivateInstance (combase.@)
+ */
+HRESULT WINAPI RoActivateInstance(HSTRING classid, IInspectable **instance)
+{
+ IActivationFactory *factory;
+ HRESULT hr;
+
+ FIXME("(%s, %p): semi-stub\n", debugstr_hstring(classid), instance);
+
+ hr = RoGetActivationFactory(classid, &IID_IActivationFactory, (void **)&factory);
+ if (SUCCEEDED(hr))
+ {
+ hr = IActivationFactory_ActivateInstance(factory, instance);
+ IActivationFactory_Release(factory);
+ }
+
+ return hr;
+}
--
2.6.4

View File

@ -0,0 +1,48 @@
From 5b266003834315ef007372bccfa77f563e1e70bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 01:47:08 +0100
Subject: combase: Add stub for RoGetApartmentIdentifier.
---
dlls/combase/combase.spec | 2 +-
dlls/combase/roapi.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 9b1ab30..3bf0bf2 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -250,7 +250,7 @@
@ stub RoGetActivatableClassRegistration
@ stdcall RoGetActivationFactory(ptr ptr ptr)
@ stub RoGetAgileReference
-@ stub RoGetApartmentIdentifier
+@ stdcall RoGetApartmentIdentifier(ptr)
@ stub RoGetErrorReportingFlags
@ stub RoGetMatchingRestrictedErrorInfo
@ stub RoGetParameterizedTypeInstanceIID
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c
index 695b6fd..cd545f1 100644
--- a/dlls/combase/roapi.c
+++ b/dlls/combase/roapi.c
@@ -204,3 +204,17 @@ HRESULT WINAPI RoActivateInstance(HSTRING classid, IInspectable **instance)
return hr;
}
+
+/***********************************************************************
+ * RoGetApartmentIdentifier (combase.@)
+ */
+HRESULT WINAPI RoGetApartmentIdentifier(UINT64 *identifier)
+{
+ FIXME("(%p): stub\n", identifier);
+
+ if (!identifier)
+ return E_INVALIDARG;
+
+ *identifier = 0xdeadbeef;
+ return S_OK;
+}
--
2.6.4

View File

@ -0,0 +1,34 @@
From 2ad226c2f25a9bd0130f5ae8393e719b37a36afc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 02:00:04 +0100
Subject: include/objidl.idl: Add IApartmentShutdown interface.
---
include/objidl.idl | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/objidl.idl b/include/objidl.idl
index c18442f..4388bab 100644
--- a/include/objidl.idl
+++ b/include/objidl.idl
@@ -2451,6 +2451,17 @@ interface IDummyHICONIncluder : IUnknown
HRESULT Dummy([in] HICON hIcon, [in] HDC hdc);
}
+[
+ object,
+ local,
+ pointer_default(unique),
+ uuid(a2f05a09-27a2-42b5-bc0e-ac163ef49d9b)
+]
+interface IApartmentShutdown : IUnknown
+{
+ void OnUninitialize([in] UINT64 identifier);
+}
+
cpp_quote("#ifdef USE_COM_CONTEXT_DEF")
typedef DWORD CPFLAGS;
--
2.6.4

View File

@ -0,0 +1,52 @@
From 01ba1b422251cc4a326063f8500afd1cbdce2aa6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 02:01:59 +0100
Subject: combase: Add stub for RoRegisterForApartmentShutdown.
---
dlls/combase/combase.spec | 2 +-
dlls/combase/roapi.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 3bf0bf2..7ae1f6e 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -263,7 +263,7 @@
@ stub RoOriginateLanguageException
@ stub RoParameterizedTypeExtraGetTypeSignature
@ stub RoRegisterActivationFactories
-@ stub RoRegisterForApartmentShutdown
+@ stdcall RoRegisterForApartmentShutdown(ptr ptr ptr)
@ stub RoReportCapabilityCheckFailure
@ stub RoReportFailedDelegate
@ stub RoReportUnhandledError
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c
index cd545f1..035fa47 100644
--- a/dlls/combase/roapi.c
+++ b/dlls/combase/roapi.c
@@ -218,3 +218,21 @@ HRESULT WINAPI RoGetApartmentIdentifier(UINT64 *identifier)
*identifier = 0xdeadbeef;
return S_OK;
}
+
+/***********************************************************************
+ * RoRegisterForApartmentShutdown (combase.@)
+ */
+HRESULT WINAPI RoRegisterForApartmentShutdown(IApartmentShutdown *callback,
+ UINT64 *identifier, APARTMENT_SHUTDOWN_REGISTRATION_COOKIE *cookie)
+{
+ HRESULT hr;
+
+ FIXME("(%p, %p, %p): stub\n", callback, identifier, cookie);
+
+ hr = RoGetApartmentIdentifier(identifier);
+ if (FAILED(hr))
+ return hr;
+
+ *cookie = (void *)0xcafecafe;
+ return S_OK;
+}
--
2.6.4

View File

@ -0,0 +1,45 @@
From ce24c3401d5a103c9cf8e7e6a82cdb61026741fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 02:03:47 +0100
Subject: combase: Add stub for RoGetServerActivatableClasses.
---
dlls/combase/combase.spec | 2 +-
dlls/combase/roapi.c | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 7ae1f6e..3a17e4a 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -254,7 +254,7 @@
@ stub RoGetErrorReportingFlags
@ stub RoGetMatchingRestrictedErrorInfo
@ stub RoGetParameterizedTypeInstanceIID
-@ stub RoGetServerActivatableClasses
+@ stdcall RoGetServerActivatableClasses(ptr ptr ptr)
@ stdcall RoInitialize(long)
@ stub RoInspectCapturedStackBackTrace
@ stub RoInspectThreadErrorInfo
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c
index 035fa47..832ec67 100644
--- a/dlls/combase/roapi.c
+++ b/dlls/combase/roapi.c
@@ -236,3 +236,14 @@ HRESULT WINAPI RoRegisterForApartmentShutdown(IApartmentShutdown *callback,
*cookie = (void *)0xcafecafe;
return S_OK;
}
+
+/***********************************************************************
+ * RoGetServerActivatableClasses (combase.@)
+ */
+HRESULT WINAPI RoGetServerActivatableClasses(HSTRING name, HSTRING **classes, DWORD *count)
+{
+ FIXME("(%s, %p, %p): stub\n", debugstr_hstring(name), classes, count);
+
+ *count = 0;
+ return S_OK;
+}
--
2.6.4

View File

@ -0,0 +1,50 @@
From 0d666ea4fd520d641ad108be069710c14d124f14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 02:20:39 +0100
Subject: combase: Add stub for RoRegisterActivationFactories.
---
dlls/combase/combase.spec | 2 +-
dlls/combase/roapi.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 3a17e4a..7a0decd 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -262,7 +262,7 @@
@ stub RoOriginateErrorW
@ stub RoOriginateLanguageException
@ stub RoParameterizedTypeExtraGetTypeSignature
-@ stub RoRegisterActivationFactories
+@ stdcall RoRegisterActivationFactories(ptr ptr long ptr)
@ stdcall RoRegisterForApartmentShutdown(ptr ptr ptr)
@ stub RoReportCapabilityCheckFailure
@ stub RoReportFailedDelegate
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c
index 832ec67..e8629cd 100644
--- a/dlls/combase/roapi.c
+++ b/dlls/combase/roapi.c
@@ -247,3 +247,19 @@ HRESULT WINAPI RoGetServerActivatableClasses(HSTRING name, HSTRING **classes, DW
*count = 0;
return S_OK;
}
+
+/***********************************************************************
+ * RoRegisterActivationFactories (combase.@)
+ */
+HRESULT WINAPI RoRegisterActivationFactories(HSTRING *classes, PFNGETACTIVATIONFACTORY *callbacks,
+ UINT32 count, RO_REGISTRATION_COOKIE *cookie)
+{
+ UINT32 i;
+
+ FIXME("(%p, %p, %d, %p): stub\n", classes, callbacks, count, cookie);
+
+ for (i = 0; i < count; i++)
+ FIXME(" %s\n", debugstr_hstring(classes[i]));
+
+ return S_OK;
+}
--
2.6.4

View File

@ -0,0 +1,42 @@
From 718d3be80d5d8d89f3a120ee6c0a5977390cc26d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 02:21:48 +0100
Subject: combase: Add stub for CleanupTlsOleState.
---
dlls/combase/combase.spec | 2 +-
dlls/combase/roapi.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 7a0decd..d03287b 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -66,7 +66,7 @@
@ stdcall CLSIDFromProgID(wstr ptr) ole32.CLSIDFromProgID
@ stdcall CLSIDFromString(wstr ptr) ole32.CLSIDFromString
@ stub CleanupOleStateInAllTls
-@ stub CleanupTlsOleState
+@ stdcall CleanupTlsOleState(ptr)
@ stub ClearCleanupFlag
@ stdcall CoAddRefServerProcess() ole32.CoAddRefServerProcess
@ stub CoAllowUnmarshalerCLSID
diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c
index e8629cd..e838412 100644
--- a/dlls/combase/roapi.c
+++ b/dlls/combase/roapi.c
@@ -263,3 +263,11 @@ HRESULT WINAPI RoRegisterActivationFactories(HSTRING *classes, PFNGETACTIVATIONF
return S_OK;
}
+
+/***********************************************************************
+ * CleanupTlsOleState (combase.@)
+ */
+void WINAPI CleanupTlsOleState(void *unknown)
+{
+ FIXME("(%p): stub\n", unknown);
+}
--
2.6.4

View File

@ -0,0 +1,3 @@
Fixes: Implement semi-stub for RoGetActivationFactory
Fixes: Implement semi-stub for RoActivateInstance
Fixes: Implement stubs for further combase Ro* functions

View File

@ -2605,14 +2605,31 @@ fi
# Patchset combase-RoApi
# |
# | Modified files:
# | * include/Makefile.in, include/activation.idl, include/roapi.h
# | * dlls/combase/Makefile.in, dlls/combase/combase.spec, dlls/combase/roapi.c, include/Makefile.in, include/activation.idl,
# | include/objidl.idl, include/roapi.h
# |
if test "$enable_combase_RoApi" -eq 1; then
patch_apply combase-RoApi/0001-include-Add-activation.idl-with-IActivationFactory-i.patch
patch_apply combase-RoApi/0002-include-roapi.h-Add-further-typedefs.patch
patch_apply combase-RoApi/0003-combase-Implement-RoGetActivationFactory.patch
patch_apply combase-RoApi/0004-combase-Implement-RoActivateInstance.patch
patch_apply combase-RoApi/0005-combase-Add-stub-for-RoGetApartmentIdentifier.patch
patch_apply combase-RoApi/0006-include-objidl.idl-Add-IApartmentShutdown-interface.patch
patch_apply combase-RoApi/0007-combase-Add-stub-for-RoRegisterForApartmentShutdown.patch
patch_apply combase-RoApi/0008-combase-Add-stub-for-RoGetServerActivatableClasses.patch
patch_apply combase-RoApi/0009-combase-Add-stub-for-RoRegisterActivationFactories.patch
patch_apply combase-RoApi/0010-combase-Add-stub-for-CleanupTlsOleState.patch
(
echo '+ { "Michael Müller", "include: Add activation.idl with IActivationFactory interface.", 1 },';
echo '+ { "Michael Müller", "include/roapi.h: Add further typedefs.", 1 },';
echo '+ { "Michael Müller", "combase: Implement RoGetActivationFactory.", 1 },';
echo '+ { "Michael Müller", "combase: Implement RoActivateInstance.", 1 },';
echo '+ { "Michael Müller", "combase: Add stub for RoGetApartmentIdentifier.", 1 },';
echo '+ { "Michael Müller", "include/objidl.idl: Add IApartmentShutdown interface.", 1 },';
echo '+ { "Michael Müller", "combase: Add stub for RoRegisterForApartmentShutdown.", 1 },';
echo '+ { "Michael Müller", "combase: Add stub for RoGetServerActivatableClasses.", 1 },';
echo '+ { "Michael Müller", "combase: Add stub for RoRegisterActivationFactories.", 1 },';
echo '+ { "Michael Müller", "combase: Add stub for CleanupTlsOleState.", 1 },';
) >> "$patchlist"
fi