2 #include "menuengine.h"
9 * Since COM objects cannot be constructed like your traditional object (i.e.
10 * with a proper constructor), they have to be constructed by another object,
13 * The class factory is an object which exists exactly once, and it cannot
14 * be constructed or destroyed. Its sole purpose is to construct objects
18 STDMETHODIMP
class_factory_query_interface(IClassFactory
*this,
19 REFIID guid
, void **pointer
)
21 if (!IsEqualIID(guid
, &IID_IUnknown
) &&
22 !IsEqualIID(guid
, &IID_IClassFactory
)) {
31 static ULONG STDMETHODCALLTYPE
return_one(IClassFactory
*this)
36 static STDMETHODIMP
create_instance(IClassFactory
*this_
,
37 IUnknown
*outer
, REFIID guid
, void **pointer
)
40 struct git_data
*data
;
45 return CLASS_E_NOAGGREGATION
;
47 if (!(data
= GlobalAlloc(GMEM_FIXED
, sizeof(struct git_data
))))
49 memset(data
, 0, sizeof(struct git_data
));
51 data
->shell_ext
.virtual_table
= &git_shell_ext_virtual_table
;
52 data
->menu
.virtual_table
= &git_menu_virtual_table
;
53 data
->columns
.virtual_table
= &git_columns_virtual_table
;
54 data
->shell_ext
.git_data
= data
->menu
.git_data
=
55 data
->columns
.git_data
= data
;
57 result
= query_interface_git_data(data
, guid
, pointer
);
59 InterlockedIncrement(&object_count
);
63 static STDMETHODIMP
lock_server(IClassFactory
*this, BOOL lock
)
66 InterlockedIncrement(&lock_count
);
68 InterlockedDecrement(&lock_count
);
73 IClassFactoryVtbl factory_virtual_table
= {
74 class_factory_query_interface
,
81 IClassFactory factory
= {
82 &factory_virtual_table