-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectFactory.cpp
More file actions
62 lines (45 loc) · 1.56 KB
/
Copy pathObjectFactory.cpp
File metadata and controls
62 lines (45 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2018 EnVisioNate LLC. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "Property.h"
#include "Properties.h"
#ifdef PROPERTIES_SAMPLE
extern bool trialExpired;
#endif
ObjectFactory::ObjectFactory(const CLSID &clsid) : theClass(clsid) { };
HRESULT STDMETHODCALLTYPE ObjectFactory::QueryInterface(const struct _GUID &iid,void **ppv) {
*ppv = NULL;
if ( iid != IID_IUnknown && iid != IID_IClassFactory )
return E_NOINTERFACE;
*ppv = this;
AddRef();
return S_OK;
}
unsigned long __stdcall ObjectFactory::AddRef() {return 1;}
unsigned long __stdcall ObjectFactory::Release() {return 1;}
HRESULT STDMETHODCALLTYPE ObjectFactory::CreateInstance(IUnknown *pUnkOuter,REFIID riid,void **ppv) {
HRESULT hres;
*ppv = NULL;
if ( theClass == CLSID_InnoVisioNateProperty ) {
Property *p = new Property();
hres = p -> QueryInterface(riid,ppv);
if ( ! ppv )
delete p;
return hres;
}
if ( theClass == CLSID_InnoVisioNateProperties ) {
if ( pUnkOuter && riid != IID_IUnknown )
return E_INVALIDARG;
Properties *p = new Properties(pUnkOuter);
p -> InternalAddRef();
hres = p -> InternalQueryInterface(riid,ppv);
p -> InternalRelease();
if ( ! ppv )
delete p;
return hres;
}
return E_FAIL;
}
HRESULT STDMETHODCALLTYPE ObjectFactory::LockServer(int) {
return 0;
}