7 * Since COM objects cannot be constructed like your traditional object (i.e.
8 * with a proper constructor), they have to be constructed by another object,
11 * The class factory is an object which exists exactly once, and it cannot
12 * be constructed or destroyed. Its sole purpose is to construct objects
16 STDMETHODIMP
class_factory_query_interface(IClassFactory
*this,
17 REFIID guid
, void **pointer
)
19 if (!IsEqualIID(guid
, &IID_IUnknown
) &&
20 !IsEqualIID(guid
, &IID_IClassFactory
)) {
29 static ULONG STDMETHODCALLTYPE
return_one(IClassFactory
*this)
34 static STDMETHODIMP
create_instance(IClassFactory
*this_
,
35 IUnknown
*outer
, REFIID guid
, void **pointer
)
38 struct git_data
*data
;
43 return CLASS_E_NOAGGREGATION
;
45 if (!(data
= GlobalAlloc(GMEM_FIXED
, sizeof(struct git_data
))))
47 memset(data
, 0, sizeof(struct git_data
));
49 data
->shell_ext
.virtual_table
= &git_shell_ext_virtual_table
;
50 data
->menu
.virtual_table
= &git_menu_virtual_table
;
51 data
->shell_ext
.git_data
= data
->menu
.git_data
= data
;
53 result
= query_interface_git_data(data
, guid
, pointer
);
55 InterlockedIncrement(&object_count
);
59 static STDMETHODIMP
lock_server(IClassFactory
*this, BOOL lock
)
62 InterlockedIncrement(&lock_count
);
64 InterlockedDecrement(&lock_count
);
69 IClassFactoryVtbl factory_virtual_table
= {
70 class_factory_query_interface
,
77 IClassFactory factory
= {
78 &factory_virtual_table