-
Notifications
You must be signed in to change notification settings - Fork 195
/
CHashCheckClassFactory.hpp
41 lines (33 loc) · 1.16 KB
/
CHashCheckClassFactory.hpp
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
/**
* 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.
**/
#ifndef __CHASHCHECKCLASSFACTORY_HPP__
#define __CHASHCHECKCLASSFACTORY_HPP__
#include "globals.h"
class CHashCheckClassFactory : public IClassFactory
{
protected:
CREF m_cRef;
public:
CHashCheckClassFactory( ) { InterlockedIncrement(&g_cRefThisDll); m_cRef = 1; }
~CHashCheckClassFactory( ) { InterlockedDecrement(&g_cRefThisDll); }
// IUnknown members
STDMETHODIMP QueryInterface( REFIID, LPVOID * );
STDMETHODIMP_(ULONG) AddRef( ) { return(InterlockedIncrement(&m_cRef)); }
STDMETHODIMP_(ULONG) Release( )
{
// We need a non-volatile variable, hence the cRef variable
LONG cRef = InterlockedDecrement(&m_cRef);
if (cRef == 0) delete this;
return(cRef);
}
// IClassFactory members
STDMETHODIMP CreateInstance( LPUNKNOWN, REFIID, LPVOID * );
STDMETHODIMP LockServer( BOOL ) { return(E_NOTIMPL); }
};
typedef CHashCheckClassFactory *LPCHASHCHECKCLASSFACTORY;
#endif