-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathREGEXP.cpp
More file actions
42 lines (27 loc) · 956 Bytes
/
Copy pathREGEXP.cpp
File metadata and controls
42 lines (27 loc) · 956 Bytes
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
#include "npole.h"
class CFactory : public IClassFactory{
private:
ULONG m_refc = 1;
CLSID m_clsid = {0x3F4DACA4,0x160D,0x11D2,{0xA8,0xE9,0x00,0x10,0x4B,0x36,0x5C,0x9F}}; // VBScript.RegExp
public:
HRESULT QueryInterface(REFIID riid, void** ppvObject){ return E_NOTIMPL; }
ULONG AddRef(){ return ++m_refc; }
ULONG Release(){ if(!--m_refc){ delete this; return 0; } return m_refc; }
HRESULT CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject){
return CoCreateInstance(m_clsid, nullptr, CLSCTX_INPROC_SERVER, IID_IDispatch, ppvObject);
}
HRESULT LockServer(BOOL fLock){
m_refc += fLock ? 1 : -1;
return S_OK;
}
} g_oFactory;
extern "C"
HRESULT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv){
g_oFactory.AddRef();
*ppv = (IClassFactory*)&g_oFactory;
return S_OK;
}
extern "C"
HRESULT DllCanUnloadNow(){
return S_FALSE;
}