Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
efd0eead
Commit
efd0eead
authored
Nov 15, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atl: Properly fail on an aggregation attempt.
parent
e070173a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
15 deletions
+46
-15
registrar.c
dlls/atl/registrar.c
+34
-15
registrar.c
dlls/atl/tests/registrar.c
+12
-0
No files found.
dlls/atl/registrar.c
View file @
efd0eead
...
...
@@ -698,21 +698,22 @@ static const IRegistrarVtbl RegistrarVtbl = {
Registrar_ResourceUnregister
,
};
static
HRESULT
Registrar_create
(
const
IUnknown
*
pUnkOuter
,
REFIID
riid
,
void
**
ppvObject
)
/* Exported only by newer ATL versions */
static
HRESULT
AtlCreateRegistrar
(
IRegistrar
**
ret
)
{
Registrar
*
re
t
;
Registrar
*
re
gistrar
;
if
(
!
IsEqualGUID
(
&
IID_IUnknown
,
riid
)
&&
!
IsEqualGUID
(
&
IID_IRegistrar
,
riid
))
return
E_NOINTERFACE
;
registrar
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
registrar
));
if
(
!
registrar
)
return
E_OUTOFMEMORY
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
Registrar
));
ret
->
IRegistrar_iface
.
lpVtbl
=
&
RegistrarVtbl
;
ret
->
ref
=
1
;
ret
->
rep
=
NULL
;
*
ppvObject
=
ret
;
registrar
->
IRegistrar_iface
.
lpVtbl
=
&
RegistrarVtbl
;
registrar
->
ref
=
1
;
registrar
->
rep
=
NULL
;
InterlockedIncrement
(
&
dll_count
);
*
ret
=
&
registrar
->
IRegistrar_iface
;
return
S_OK
;
}
...
...
@@ -746,10 +747,25 @@ static ULONG WINAPI RegistrarCF_Release(IClassFactory *iface)
}
static
HRESULT
WINAPI
RegistrarCF_CreateInstance
(
IClassFactory
*
iface
,
LPUNKNOWN
pUnkOuter
,
REFIID
riid
,
void
**
ppv
Object
)
REFIID
riid
,
void
**
ppv
)
{
TRACE
(
"(%p)->(%s %p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppvObject
);
return
Registrar_create
(
pUnkOuter
,
riid
,
ppvObject
);
IRegistrar
*
registrar
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ppv
);
if
(
pUnkOuter
)
{
*
ppv
=
NULL
;
return
CLASS_E_NOAGGREGATION
;
}
hres
=
AtlCreateRegistrar
(
&
registrar
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
IRegistrar_QueryInterface
(
registrar
,
riid
,
ppv
);
IRegistrar_Release
(
registrar
);
return
hres
;
}
static
HRESULT
WINAPI
RegistrarCF_LockServer
(
IClassFactory
*
iface
,
BOOL
lock
)
...
...
@@ -801,10 +817,13 @@ static HRESULT do_register_dll_server(IRegistrar *pRegistrar, LPCOLESTR wszDll,
static
const
WCHAR
wszModule
[]
=
{
'M'
,
'O'
,
'D'
,
'U'
,
'L'
,
'E'
,
0
};
static
const
WCHAR
wszRegistry
[]
=
{
'R'
,
'E'
,
'G'
,
'I'
,
'S'
,
'T'
,
'R'
,
'Y'
,
0
};
if
(
pRegistrar
)
if
(
pRegistrar
)
{
registrar
=
pRegistrar
;
else
Registrar_create
(
NULL
,
&
IID_IRegistrar
,
(
void
**
)
&
registrar
);
}
else
{
hres
=
AtlCreateRegistrar
(
&
registrar
);
if
(
FAILED
(
hres
))
return
hres
;
}
IRegistrar_AddReplacement
(
registrar
,
wszModule
,
wszDll
);
...
...
dlls/atl/tests/registrar.c
View file @
efd0eead
...
...
@@ -135,11 +135,23 @@ static void test_registrar(void)
IRegistrar_Release
(
registrar
);
}
static
void
test_aggregation
(
void
)
{
IUnknown
*
unk
=
(
IUnknown
*
)
0xdeadbeef
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_Registrar
,
(
IUnknown
*
)
0xdeadbeef
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
ok
(
hres
==
CLASS_E_NOAGGREGATION
,
"CoCreateInstance failed: %08x, expected CLASS_E_NOAGGREGATION
\n
"
,
hres
);
ok
(
!
unk
,
"unk = %p
\n
"
,
unk
);
}
START_TEST
(
registrar
)
{
CoInitialize
(
NULL
);
test_registrar
();
test_aggregation
();
CoUninitialize
();
}
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