Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
7c908eb9
Commit
7c908eb9
authored
Apr 08, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evr: Cleanup class factory methods.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e68833a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
main.c
dlls/evr/main.c
+33
-33
No files found.
dlls/evr/main.c
View file @
7c908eb9
...
...
@@ -48,16 +48,16 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
return
TRUE
;
}
typedef
struct
{
struct
class_factory
{
IClassFactory
IClassFactory_iface
;
LONG
ref
;
LONG
refcount
;
HRESULT
(
*
pfnCreateInstance
)(
IUnknown
*
unk_outer
,
void
**
ppobj
);
}
IClassFactoryImpl
;
};
static
inline
IClassFactoryImpl
*
impl_from_IClassFactory
(
IClassFactory
*
iface
)
static
inline
struct
class_factory
*
impl_from_IClassFactory
(
IClassFactory
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IClassFactoryImpl
,
IClassFactory_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
class_factory
,
IClassFactory_iface
);
}
struct
object_creation_info
...
...
@@ -73,65 +73,65 @@ static const struct object_creation_info object_creation[] =
{
&
CLSID_MFVideoPresenter9
,
evr_presenter_create
},
};
static
HRESULT
WINAPI
classfactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
void
**
ppobj
)
static
HRESULT
WINAPI
classfactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
void
**
out
)
{
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
struct
class_factory
*
factory
=
impl_from_IClassFactory
(
iface
);
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_IClassFactory
))
{
IClassFactory_AddRef
(
iface
);
*
ppobj
=
&
This
->
IClassFactory_iface
;
*
out
=
&
factory
->
IClassFactory_iface
;
return
S_OK
;
}
WARN
(
"
(%p)->(%s,%p),not found
\n
"
,
This
,
debugstr_guid
(
riid
),
ppobj
);
WARN
(
"
Unimplemented interface %s.
\n
"
,
debugstr_guid
(
riid
)
);
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
classfactory_AddRef
(
IClassFactory
*
iface
)
{
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
return
InterlockedIncrement
(
&
This
->
ref
);
struct
class_factory
*
factory
=
impl_from_IClassFactory
(
iface
);
return
InterlockedIncrement
(
&
factory
->
refcount
);
}
static
ULONG
WINAPI
classfactory_Release
(
IClassFactory
*
iface
)
{
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
struct
class_factory
*
factory
=
impl_from_IClassFactory
(
iface
);
ULONG
ref
count
=
InterlockedDecrement
(
&
factory
->
refcount
);
if
(
ref
==
0
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
!
refcount
)
free
(
factory
);
return
ref
;
return
ref
count
;
}
static
HRESULT
WINAPI
classfactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
outer_unk
,
REFIID
riid
,
void
**
ppobj
)
{
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
HRESULT
hres
;
struct
class_factory
*
factory
=
impl_from_IClassFactory
(
iface
);
IUnknown
*
unk
;
HRESULT
hr
;
TRACE
(
"
(%p)->(%p,%s,%p)
\n
"
,
This
,
outer_unk
,
debugstr_guid
(
riid
),
ppobj
);
TRACE
(
"
%p, %p, %s, %p.
\n
"
,
iface
,
outer_unk
,
debugstr_guid
(
riid
),
ppobj
);
*
ppobj
=
NULL
;
if
(
outer_unk
&&
!
IsEqualGUID
(
riid
,
&
IID_IUnknown
))
return
E_NOINTERFACE
;
hr
es
=
This
->
pfnCreateInstance
(
outer_unk
,
(
void
**
)
&
unk
);
if
(
SUCCEEDED
(
hr
es
))
hr
=
factory
->
pfnCreateInstance
(
outer_unk
,
(
void
**
)
&
unk
);
if
(
SUCCEEDED
(
hr
))
{
hr
es
=
IUnknown_QueryInterface
(
unk
,
riid
,
ppobj
);
hr
=
IUnknown_QueryInterface
(
unk
,
riid
,
ppobj
);
IUnknown_Release
(
unk
);
}
return
hr
es
;
return
hr
;
}
static
HRESULT
WINAPI
classfactory_LockServer
(
IClassFactory
*
iface
,
BOOL
dolock
)
{
IClassFactoryImpl
*
This
=
impl_from_IClassFactory
(
iface
);
FIXME
(
"(%p)->(%d), stub!
\n
"
,
This
,
dolock
);
FIXME
(
"%p, %d stub!
\n
"
,
iface
,
dolock
);
return
S_OK
;
}
...
...
@@ -144,12 +144,12 @@ static const IClassFactoryVtbl classfactory_Vtbl =
classfactory_LockServer
};
HRESULT
WINAPI
DllGetClassObject
(
REFCLSID
rclsid
,
REFIID
riid
,
void
**
ppv
)
HRESULT
WINAPI
DllGetClassObject
(
REFCLSID
rclsid
,
REFIID
riid
,
void
**
out
)
{
struct
class_factory
*
factory
;
unsigned
int
i
;
IClassFactoryImpl
*
factory
;
TRACE
(
"
(%s,%s,%p)
\n
"
,
debugstr_guid
(
rclsid
),
debugstr_guid
(
riid
),
ppv
);
TRACE
(
"
%s, %s, %p.
\n
"
,
debugstr_guid
(
rclsid
),
debugstr_guid
(
riid
),
out
);
if
(
!
IsEqualGUID
(
&
IID_IClassFactory
,
riid
)
&&
!
IsEqualGUID
(
&
IID_IUnknown
,
riid
))
...
...
@@ -167,16 +167,16 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
return
CLASS_E_CLASSNOTAVAILABLE
;
}
factory
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
factory
));
if
(
factory
==
NULL
)
if
(
!
(
factory
=
malloc
(
sizeof
(
*
factory
))))
return
E_OUTOFMEMORY
;
factory
->
IClassFactory_iface
.
lpVtbl
=
&
classfactory_Vtbl
;
factory
->
ref
=
1
;
factory
->
ref
count
=
1
;
factory
->
pfnCreateInstance
=
object_creation
[
i
].
pfnCreateInstance
;
*
ppv
=
&
(
factory
->
IClassFactory_iface
);
*
out
=
&
factory
->
IClassFactory_iface
;
return
S_OK
;
}
...
...
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