forked from aqrit/ddwrapper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
classfactory.cpp
59 lines (52 loc) · 1.58 KB
/
classfactory.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "header.h"
namespace classfactory
{
struct XVTBL
{
HRESULT (__stdcall * QueryInterface)( WRAP* This, const IID& riid, void** ppvObject );
ULONG (__stdcall * AddRef)( WRAP* This );
ULONG (__stdcall * Release)( WRAP* This );
HRESULT (__stdcall * CreateInstance)( WRAP* This, IUnknown *pUnkOuter, REFIID riid, void **ppvObject );
HRESULT (__stdcall * LockServer)( WRAP* This, BOOL fLock );
};
HRESULT __stdcall QueryInterface( WRAP* This, const IID& riid, void** ppvObject )
{
PROLOGUE;
HRESULT hResult = This->cf->lpVtbl->QueryInterface( This->cf, riid, ppvObject );
if( SUCCEEDED( hResult ) ) Wrap( This->dd_parent, iid_to_vtbl( riid ), ppvObject );
EPILOGUE( hResult );
}
ULONG __stdcall AddRef( WRAP* This )
{
PROLOGUE;
ULONG dwCount = This->cf->lpVtbl->AddRef( This->cf );
EPILOGUE( dwCount );
}
ULONG __stdcall Release( WRAP* This )
{
PROLOGUE;
ULONG dwCount = WrapRelease( This );
EPILOGUE( dwCount );
}
HRESULT __stdcall CreateInstance( WRAP* This, IUnknown *pUnkOuter, REFIID riid, void **ppvObject )
{
PROLOGUE;
HRESULT hResult = This->cf->lpVtbl->CreateInstance( This->cf, pUnkOuter, riid, ppvObject );
if( SUCCEEDED( hResult ) ) Wrap( This->dd_parent, iid_to_vtbl( riid ), ppvObject );
EPILOGUE( hResult );
}
HRESULT __stdcall LockServer( WRAP* This, BOOL fLock )
{
PROLOGUE;
HRESULT hResult = This->cf->lpVtbl->LockServer( This->cf, fLock );
EPILOGUE( hResult );
}
const XVTBL xVtbl =
{
QueryInterface, // 0x00
AddRef, // 0x04
Release, // 0x08
CreateInstance, // 0x0C
LockServer, // 0x10
};
};