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
719088ca
Commit
719088ca
authored
Feb 05, 2007
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Feb 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
browseui: Add class factory.
parent
d34691e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
2 deletions
+110
-2
browseui_main.c
dlls/browseui/browseui_main.c
+110
-2
No files found.
dlls/browseui/browseui_main.c
View file @
719088ca
...
...
@@ -24,6 +24,8 @@
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#include "wine/debug.h"
#include "windef.h"
#include "winbase.h"
...
...
@@ -38,6 +40,103 @@ LONG BROWSEUI_refCount = 0;
HINSTANCE
browseui_hinstance
=
0
;
typedef
HRESULT
(
WINAPI
*
LPFNCONSTRUCTOR
)(
IUnknown
*
pUnkOuter
,
IUnknown
**
ppvOut
);
static
const
struct
{
REFCLSID
clsid
;
LPFNCONSTRUCTOR
ctor
;
}
ClassesTable
[]
=
{
{
NULL
,
NULL
}
};
typedef
struct
tagClassFactory
{
const
IClassFactoryVtbl
*
vtbl
;
LONG
ref
;
LPFNCONSTRUCTOR
ctor
;
}
ClassFactory
;
static
const
IClassFactoryVtbl
ClassFactoryVtbl
;
static
HRESULT
ClassFactory_Constructor
(
LPFNCONSTRUCTOR
ctor
,
LPVOID
*
ppvOut
)
{
ClassFactory
*
This
=
CoTaskMemAlloc
(
sizeof
(
ClassFactory
));
This
->
vtbl
=
&
ClassFactoryVtbl
;
This
->
ref
=
1
;
This
->
ctor
=
ctor
;
*
ppvOut
=
(
LPVOID
)
This
;
TRACE
(
"Created class factory %p
\n
"
,
This
);
BROWSEUI_refCount
++
;
return
S_OK
;
}
static
void
ClassFactory_Destructor
(
ClassFactory
*
This
)
{
TRACE
(
"Destroying class factory %p
\n
"
,
This
);
CoTaskMemFree
(
This
);
BROWSEUI_refCount
--
;
}
static
HRESULT
WINAPI
ClassFactory_QueryInterface
(
IClassFactory
*
iface
,
REFIID
riid
,
LPVOID
*
ppvOut
)
{
*
ppvOut
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IClassFactory
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
IClassFactory_AddRef
(
iface
);
*
ppvOut
=
iface
;
return
S_OK
;
}
WARN
(
"Unknown interface %s
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
ClassFactory_AddRef
(
IClassFactory
*
iface
)
{
ClassFactory
*
This
=
(
ClassFactory
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
ref
);
}
static
ULONG
WINAPI
ClassFactory_Release
(
IClassFactory
*
iface
)
{
ClassFactory
*
This
=
(
ClassFactory
*
)
iface
;
ULONG
ret
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ret
==
0
)
ClassFactory_Destructor
(
This
);
return
ret
;
}
static
HRESULT
WINAPI
ClassFactory_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
punkOuter
,
REFIID
iid
,
LPVOID
*
ppvOut
)
{
ClassFactory
*
This
=
(
ClassFactory
*
)
iface
;
HRESULT
ret
;
IUnknown
*
obj
;
TRACE
(
"(%p, %p, %s, %p)
\n
"
,
iface
,
punkOuter
,
debugstr_guid
(
iid
),
ppvOut
);
ret
=
This
->
ctor
(
punkOuter
,
&
obj
);
if
(
FAILED
(
ret
))
return
ret
;
ret
=
IUnknown_QueryInterface
(
obj
,
iid
,
ppvOut
);
IUnknown_Release
(
obj
);
return
ret
;
}
static
HRESULT
WINAPI
ClassFactory_LockServer
(
IClassFactory
*
iface
,
BOOL
fLock
)
{
FIXME
(
"(%p, %s) - not implemented
\n
"
,
iface
,
(
fLock
?
"TRUE"
:
"FALSE"
));
return
E_NOTIMPL
;
}
static
const
IClassFactoryVtbl
ClassFactoryVtbl
=
{
/* IUnknown */
ClassFactory_QueryInterface
,
ClassFactory_AddRef
,
ClassFactory_Release
,
/* IClassFactory*/
ClassFactory_CreateInstance
,
ClassFactory_LockServer
};
/*************************************************************************
* BROWSEUI DllMain
*/
...
...
@@ -83,8 +182,17 @@ HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
/***********************************************************************
* DllGetClassObject (BROWSEUI.@)
*/
HRESULT
WINAPI
DllGetClassObject
(
REFCLSID
clsid
,
REFIID
iid
,
LPVOID
*
ppv
)
HRESULT
WINAPI
DllGetClassObject
(
REFCLSID
clsid
,
REFIID
iid
,
LPVOID
*
ppv
Out
)
{
*
ppv
=
NULL
;
int
i
;
*
ppvOut
=
NULL
;
if
(
!
IsEqualIID
(
iid
,
&
IID_IUnknown
)
&&
!
IsEqualIID
(
iid
,
&
IID_IClassFactory
))
return
E_NOINTERFACE
;
for
(
i
=
0
;
ClassesTable
[
i
].
clsid
!=
NULL
;
i
++
)
if
(
IsEqualCLSID
(
ClassesTable
[
i
].
clsid
,
clsid
))
{
return
ClassFactory_Constructor
(
ClassesTable
[
i
].
ctor
,
ppvOut
);
}
return
CLASS_E_CLASSNOTAVAILABLE
;
}
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