5 #include "menuengine.h"
12 * Since COM objects cannot be constructed like your traditional object (i.e.
13 * with a proper constructor), they have to be constructed by another object,
16 * The class factory is an object which exists exactly once, and it cannot
17 * be constructed or destroyed. Its sole purpose is to construct objects
21 STDMETHODIMP
class_factory_query_interface(IClassFactory
*this,
22 REFIID guid
, void **pointer
)
24 if (!IsEqualIID(guid
, &IID_IUnknown
) &&
25 !IsEqualIID(guid
, &IID_IClassFactory
)) {
34 static ULONG STDMETHODCALLTYPE
return_one(IClassFactory
*this)
39 static STDMETHODIMP
create_instance(IClassFactory
*this_
,
40 IUnknown
*outer
, REFIID guid
, void **pointer
)
43 struct git_data
*data
;
48 return CLASS_E_NOAGGREGATION
;
50 if (!(data
= GlobalAlloc(GMEM_FIXED
, sizeof(struct git_data
))))
52 memset(data
, 0, sizeof(struct git_data
));
54 data
->shell_ext
.virtual_table
= &git_shell_ext_virtual_table
;
55 data
->menu
.virtual_table
= &git_menu_virtual_table
;
56 data
->columns
.virtual_table
= &git_columns_virtual_table
;
57 data
->shell_ext
.git_data
= data
->menu
.git_data
=
58 data
->columns
.git_data
= data
;
60 result
= query_interface_git_data(data
, guid
, pointer
);
62 InterlockedIncrement(&object_count
);
66 static STDMETHODIMP
lock_server(IClassFactory
*this, BOOL lock
)
69 InterlockedIncrement(&lock_count
);
71 InterlockedDecrement(&lock_count
);
76 IClassFactoryVtbl factory_virtual_table
= {
77 class_factory_query_interface
,
84 IClassFactory factory
= {
85 &factory_virtual_table