Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
bd4975ac
Commit
bd4975ac
authored
May 05, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
May 05, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Use existing MTA in CoGetClassObject and CoCreateInstance.
Custom actions in the CS3 installer depend on this.
parent
d2820c06
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
8 deletions
+52
-8
compobj.c
dlls/ole32/compobj.c
+50
-6
compobj.c
dlls/ole32/tests/compobj.c
+2
-2
No files found.
dlls/ole32/compobj.c
View file @
bd4975ac
...
...
@@ -493,6 +493,31 @@ static APARTMENT *apartment_findmain(void)
return
result
;
}
/* gets the multi-threaded apartment if it exists. The caller must
* release the reference from the apartment as soon as the apartment pointer
* is no longer required. */
static
APARTMENT
*
apartment_find_multi_threaded
(
void
)
{
APARTMENT
*
result
=
NULL
;
struct
list
*
cursor
;
EnterCriticalSection
(
&
csApartment
);
LIST_FOR_EACH
(
cursor
,
&
apts
)
{
struct
apartment
*
apt
=
LIST_ENTRY
(
cursor
,
struct
apartment
,
entry
);
if
(
apt
->
multi_threaded
)
{
result
=
apt
;
apartment_addref
(
result
);
break
;
}
}
LeaveCriticalSection
(
&
csApartment
);
return
result
;
}
struct
host_object_params
{
HKEY
hkeydll
;
...
...
@@ -2237,6 +2262,7 @@ HRESULT WINAPI CoGetClassObject(
LPUNKNOWN
regClassObject
;
HRESULT
hres
=
E_UNEXPECTED
;
APARTMENT
*
apt
;
BOOL
release_apt
=
FALSE
;
TRACE
(
"
\n\t
CLSID:
\t
%s,
\n\t
IID:
\t
%s
\n
"
,
debugstr_guid
(
rclsid
),
debugstr_guid
(
iid
));
...
...
@@ -2245,11 +2271,14 @@ HRESULT WINAPI CoGetClassObject(
*
ppv
=
NULL
;
apt
=
COM_CurrentApt
();
if
(
!
apt
)
if
(
!
(
apt
=
COM_CurrentApt
()))
{
ERR
(
"apartment not initialised
\n
"
);
return
CO_E_NOTINITIALIZED
;
if
(
!
(
apt
=
apartment_find_multi_threaded
()))
{
ERR
(
"apartment not initialised
\n
"
);
return
CO_E_NOTINITIALIZED
;
}
release_apt
=
TRUE
;
}
if
(
pServerInfo
)
{
...
...
@@ -2273,7 +2302,7 @@ HRESULT WINAPI CoGetClassObject(
* is good since we are not returning it in the "out" parameter.
*/
IUnknown_Release
(
regClassObject
);
if
(
release_apt
)
apartment_release
(
apt
);
return
hres
;
}
...
...
@@ -2284,7 +2313,10 @@ HRESULT WINAPI CoGetClassObject(
HKEY
hkey
;
if
(
IsEqualCLSID
(
rclsid
,
&
CLSID_InProcFreeMarshaler
))
{
if
(
release_apt
)
apartment_release
(
apt
);
return
FTMarshalCF_Create
(
iid
,
ppv
);
}
hres
=
COM_OpenKeyForCLSID
(
rclsid
,
wszInprocServer32
,
KEY_READ
,
&
hkey
);
if
(
FAILED
(
hres
))
...
...
@@ -2308,7 +2340,10 @@ HRESULT WINAPI CoGetClassObject(
/* return if we got a class, otherwise fall through to one of the
* other types */
if
(
SUCCEEDED
(
hres
))
{
if
(
release_apt
)
apartment_release
(
apt
);
return
hres
;
}
}
/* Next try in-process handler */
...
...
@@ -2339,8 +2374,12 @@ HRESULT WINAPI CoGetClassObject(
/* return if we got a class, otherwise fall through to one of the
* other types */
if
(
SUCCEEDED
(
hres
))
{
if
(
release_apt
)
apartment_release
(
apt
);
return
hres
;
}
}
if
(
release_apt
)
apartment_release
(
apt
);
/* Next try out of process */
if
(
CLSCTX_LOCAL_SERVER
&
dwClsContext
)
...
...
@@ -2418,6 +2457,7 @@ HRESULT WINAPI CoCreateInstance(
{
HRESULT
hres
;
LPCLASSFACTORY
lpclf
=
0
;
APARTMENT
*
apt
;
TRACE
(
"(rclsid=%s, pUnkOuter=%p, dwClsContext=%08x, riid=%s, ppv=%p)
\n
"
,
debugstr_guid
(
rclsid
),
pUnkOuter
,
dwClsContext
,
debugstr_guid
(
iid
),
ppv
);
...
...
@@ -2433,10 +2473,14 @@ HRESULT WINAPI CoCreateInstance(
*/
*
ppv
=
0
;
if
(
!
COM_CurrentApt
(
))
if
(
!
(
apt
=
COM_CurrentApt
()
))
{
if
(
!
(
apt
=
apartment_find_multi_threaded
()))
{
ERR
(
"apartment not initialised
\n
"
);
return
CO_E_NOTINITIALIZED
;
}
apartment_release
(
apt
);
}
/*
...
...
dlls/ole32/tests/compobj.c
View file @
bd4975ac
...
...
@@ -276,7 +276,7 @@ static void test_CoCreateInstance(void)
pUnk
=
(
IUnknown
*
)
0xdeadbeef
;
hr
=
CoCreateInstance
(
rclsid
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
void
**
)
&
pUnk
);
todo_wine
ok
(
hr
==
S_OK
,
"CoCreateInstance should have returned S_OK instead of 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"CoCreateInstance should have returned S_OK instead of 0x%08x
\n
"
,
hr
);
if
(
pUnk
)
IUnknown_Release
(
pUnk
);
SetEvent
(
info
.
stop
);
...
...
@@ -325,7 +325,7 @@ static void test_CoGetClassObject(void)
pUnk
=
(
IUnknown
*
)
0xdeadbeef
;
hr
=
CoGetClassObject
(
rclsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IUnknown
,
(
void
**
)
&
pUnk
);
todo_wine
ok
(
hr
==
S_OK
,
"CoGetClassObject should have returned S_OK instead of 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"CoGetClassObject should have returned S_OK instead of 0x%08x
\n
"
,
hr
);
if
(
pUnk
)
IUnknown_Release
(
pUnk
);
SetEvent
(
info
.
stop
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment