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
c2089cbd
Commit
c2089cbd
authored
Jun 13, 2014
by
Andrew Eikum
Committed by
Alexandre Julliard
Jun 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Respect TreatAs in CoCreateInstance.
parent
42f51185
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
5 deletions
+36
-5
compobj.c
dlls/ole32/compobj.c
+10
-5
compobj.c
dlls/ole32/tests/compobj.c
+26
-0
No files found.
dlls/ole32/compobj.c
View file @
c2089cbd
...
...
@@ -3160,6 +3160,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(
HRESULT
hres
;
LPCLASSFACTORY
lpclf
=
0
;
APARTMENT
*
apt
;
CLSID
clsid
;
TRACE
(
"(rclsid=%s, pUnkOuter=%p, dwClsContext=%08x, riid=%s, ppv=%p)
\n
"
,
debugstr_guid
(
rclsid
),
pUnkOuter
,
dwClsContext
,
debugstr_guid
(
iid
),
ppv
);
...
...
@@ -3167,6 +3168,10 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(
if
(
ppv
==
0
)
return
E_POINTER
;
hres
=
CoGetTreatAsClass
(
rclsid
,
&
clsid
);
if
(
FAILED
(
hres
))
clsid
=
*
rclsid
;
*
ppv
=
0
;
if
(
!
(
apt
=
COM_CurrentApt
()))
...
...
@@ -3182,7 +3187,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(
/*
* The Standard Global Interface Table (GIT) object is a process-wide singleton.
*/
if
(
IsEqualIID
(
r
clsid
,
&
CLSID_StdGlobalInterfaceTable
))
if
(
IsEqualIID
(
&
clsid
,
&
CLSID_StdGlobalInterfaceTable
))
{
IGlobalInterfaceTable
*
git
=
get_std_git
();
hres
=
IGlobalInterfaceTable_QueryInterface
(
git
,
iid
,
ppv
);
...
...
@@ -3192,13 +3197,13 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(
return
S_OK
;
}
if
(
IsEqualCLSID
(
r
clsid
,
&
CLSID_ManualResetEvent
))
if
(
IsEqualCLSID
(
&
clsid
,
&
CLSID_ManualResetEvent
))
return
ManualResetEvent_Construct
(
pUnkOuter
,
iid
,
ppv
);
/*
* Get a class factory to construct the object we want.
*/
hres
=
CoGetClassObject
(
r
clsid
,
hres
=
CoGetClassObject
(
&
clsid
,
dwClsContext
,
NULL
,
&
IID_IClassFactory
,
...
...
@@ -3215,11 +3220,11 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(
if
(
FAILED
(
hres
))
{
if
(
hres
==
CLASS_E_NOAGGREGATION
&&
pUnkOuter
)
FIXME
(
"Class %s does not support aggregation
\n
"
,
debugstr_guid
(
r
clsid
));
FIXME
(
"Class %s does not support aggregation
\n
"
,
debugstr_guid
(
&
clsid
));
else
FIXME
(
"no instance created for interface %s of class %s, hres is 0x%08x
\n
"
,
debugstr_guid
(
iid
),
debugstr_guid
(
r
clsid
),
hres
);
debugstr_guid
(
&
clsid
),
hres
);
}
return
hres
;
...
...
dlls/ole32/tests/compobj.c
View file @
c2089cbd
...
...
@@ -1903,6 +1903,7 @@ static void test_TreatAsClass(void)
CLSID
out
;
static
GUID
deadbeef
=
{
0xdeadbeef
,
0xdead
,
0xbeef
,{
0xde
,
0xad
,
0xbe
,
0xef
,
0xde
,
0xad
,
0xbe
,
0xef
}};
static
const
char
deadbeefA
[]
=
"{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}"
;
IInternetProtocol
*
pIP
=
NULL
;
HKEY
clsidkey
,
deadbeefkey
;
LONG
lr
;
...
...
@@ -1935,6 +1936,21 @@ static void test_TreatAsClass(void)
ok
(
hr
==
S_OK
,
"CoGetTreatAsClass failed: %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
out
,
&
CLSID_FileProtocol
),
"expected to get substituted clsid
\n
"
);
OleInitialize
(
NULL
);
hr
=
CoCreateInstance
(
&
deadbeef
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IInternetProtocol
,
(
void
**
)
&
pIP
);
if
(
hr
==
REGDB_E_CLASSNOTREG
)
{
win_skip
(
"IE not installed so can't test CoCreateInstance
\n
"
);
goto
exit
;
}
ok
(
hr
==
S_OK
,
"CoCreateInstance failed: %08x
\n
"
,
hr
);
if
(
pIP
){
IInternetProtocol_Release
(
pIP
);
pIP
=
NULL
;
}
hr
=
pCoTreatAsClass
(
&
deadbeef
,
&
CLSID_NULL
);
ok
(
hr
==
S_OK
,
"CoTreatAsClass failed: %08x
\n
"
,
hr
);
...
...
@@ -1942,7 +1958,17 @@ static void test_TreatAsClass(void)
ok
(
hr
==
S_FALSE
,
"expected S_FALSE got %08x
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
out
,
&
deadbeef
),
"expected to get same clsid back
\n
"
);
/* bizarrely, native's CoTreatAsClass takes some time to take effect in CoCreateInstance */
Sleep
(
200
);
hr
=
CoCreateInstance
(
&
deadbeef
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IInternetProtocol
,
(
void
**
)
&
pIP
);
ok
(
hr
==
REGDB_E_CLASSNOTREG
,
"CoCreateInstance gave wrong error: %08x
\n
"
,
hr
);
if
(
pIP
)
IInternetProtocol_Release
(
pIP
);
exit:
OleUninitialize
();
RegCloseKey
(
deadbeefkey
);
RegDeleteKeyA
(
clsidkey
,
deadbeefA
);
RegCloseKey
(
clsidkey
);
...
...
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