Robert Shearman : ole32:
Get the threading model value for inproc classes and output a
Alexandre Julliard
julliard at wine.codeweavers.com
Sat Aug 26 13:47:40 CDT 2006
Module: wine
Branch: master
Commit: c1eb2c70032307fb775c86293b799c6c306e4f5a
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c1eb2c70032307fb775c86293b799c6c306e4f5a
Author: Robert Shearman <rob at codeweavers.com>
Date: Sat Aug 26 11:41:42 2006 +0100
ole32: Get the threading model value for inproc classes and output a
fixme if we should create it in an apartment of another type.
---
dlls/ole32/compobj.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index e049563..1f13fd0 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -1627,14 +1627,59 @@ static DWORD COM_RegReadPath(HKEY hkeyro
return ret;
}
+static void get_threading_model(HKEY key, LPWSTR value, DWORD len)
+{
+ static const WCHAR wszThreadingModel[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
+ DWORD keytype;
+ DWORD ret;
+ DWORD dwLength = len * sizeof(WCHAR);
+
+ ret = RegQueryValueExW(key, wszThreadingModel, NULL, &keytype, (LPBYTE)value, &dwLength);
+ if ((ret != ERROR_SUCCESS) || (keytype != REG_SZ))
+ value[0] = '\0';
+}
+
static HRESULT get_inproc_class_object(HKEY hkeydll, REFCLSID rclsid, REFIID riid, void **ppv)
{
+ static const WCHAR wszApartment[] = {'A','p','a','r','t','m','e','n','t',0};
+ static const WCHAR wszFree[] = {'F','r','e','e',0};
+ static const WCHAR wszBoth[] = {'B','o','t','h',0};
HINSTANCE hLibrary;
typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv);
DllGetClassObjectFunc DllGetClassObject;
WCHAR dllpath[MAX_PATH+1];
+ WCHAR threading_model[10 /* strlenW(L"apartment")+1 */];
HRESULT hr;
+ get_threading_model(hkeydll, threading_model, ARRAYSIZE(threading_model));
+ /* "Apartment" */
+ if (!strcmpiW(threading_model, wszApartment))
+ {
+ APARTMENT *apt = COM_CurrentApt();
+ if (apt->multi_threaded)
+ {
+ FIXME("should create object %s in single-threaded apartment\n",
+ debugstr_guid(rclsid));
+ }
+ }
+ /* "Free" */
+ else if (!strcmpiW(threading_model, wszFree))
+ {
+ APARTMENT *apt = COM_CurrentApt();
+ if (!apt->multi_threaded)
+ {
+ FIXME("should create object %s in multi-threaded apartment\n",
+ debugstr_guid(rclsid));
+ }
+ }
+ /* everything except "Apartment", "Free" and "Both" */
+ else if (strcmpiW(threading_model, wszBoth))
+ {
+ /* everything else is main-threaded */
+ FIXME("unrecognised threading model %s for object %s, should be main-threaded?\n",
+ debugstr_w(threading_model), debugstr_guid(rclsid));
+ }
+
if (COM_RegReadPath(hkeydll, NULL, NULL, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
{
/* failure: CLSID is not found in registry */
More information about the wine-cvs
mailing list