forked from gurnec/HashCheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHashCheckClassFactory.cpp
44 lines (37 loc) · 1009 Bytes
/
CHashCheckClassFactory.cpp
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
/**
* HashCheck Shell Extension
* Copyright (C) Kai Liu. All rights reserved.
*
* Please refer to readme.txt for information about this source code.
* Please refer to license.txt for details about distribution and modification.
**/
#include "CHashCheckClassFactory.hpp"
#include "CHashCheck.hpp"
STDMETHODIMP CHashCheckClassFactory::QueryInterface( REFIID riid, LPVOID *ppv )
{
if (IsEqualIID(riid, IID_IUnknown))
{
*ppv = this;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
*ppv = (LPCLASSFACTORY)this;
}
else
{
*ppv = NULL;
return(E_NOINTERFACE);
}
AddRef();
return(S_OK);
}
STDMETHODIMP CHashCheckClassFactory::CreateInstance( LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppv )
{
*ppv = NULL;
if (pUnkOuter) return(CLASS_E_NOAGGREGATION);
LPCHASHCHECK lpHashCheck = new CHashCheck;
if (lpHashCheck == NULL) return(E_OUTOFMEMORY);
HRESULT hr = lpHashCheck->QueryInterface(riid, ppv);
lpHashCheck->Release();
return(hr);
}