Skip to content

Commit 90f1841

Browse files
author
theller
committed
Add a COM server dll implemented in C++, for testing.
--HG-- extra : convert_revision : svn%3Aa2f44796-8cc0-49ac-b43f-6a96d556d52d/trunk%40394
1 parent 2a8c53d commit 90f1841

17 files changed

+890
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// COMtypesTestServer.cpp : Implementation of DLL Exports.
2+
3+
#include "stdafx.h"
4+
#include "resource.h"
5+
#include "COMtypesTestServer.h"
6+
7+
class CCOMtypesTestServerModule : public CAtlDllModuleT< CCOMtypesTestServerModule >
8+
{
9+
public :
10+
DECLARE_LIBID(LIBID_COMtypesTestServerLib)
11+
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_COMTYPESTESTSERVER, "{8A5DE474-9B94-4C9D-8DC9-12D4A5DACBC3}")
12+
};
13+
14+
CCOMtypesTestServerModule _AtlModule;
15+
16+
17+
// DLL Entry Point
18+
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
19+
{
20+
hInstance;
21+
return _AtlModule.DllMain(dwReason, lpReserved);
22+
}
23+
24+
25+
// Used to determine whether the DLL can be unloaded by OLE
26+
STDAPI DllCanUnloadNow(void)
27+
{
28+
return _AtlModule.DllCanUnloadNow();
29+
}
30+
31+
32+
// Returns a class factory to create an object of the requested type
33+
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
34+
{
35+
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
36+
}
37+
38+
39+
// DllRegisterServer - Adds entries to the system registry
40+
STDAPI DllRegisterServer(void)
41+
{
42+
// registers object, typelib and all interfaces in typelib
43+
HRESULT hr = _AtlModule.DllRegisterServer();
44+
return hr;
45+
}
46+
47+
48+
// DllUnregisterServer - Removes entries from the system registry
49+
STDAPI DllUnregisterServer(void)
50+
{
51+
HRESULT hr = _AtlModule.DllUnregisterServer();
52+
return hr;
53+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
; COMtypesTestServer.def : Declares the module parameters.
2+
3+
LIBRARY "COMtypesTestServer.DLL"
4+
5+
EXPORTS
6+
DllCanUnloadNow PRIVATE
7+
DllGetClassObject PRIVATE
8+
DllRegisterServer PRIVATE
9+
DllUnregisterServer PRIVATE
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// COMtypesTestServer.idl : IDL source for COMtypesTestServer
2+
//
3+
4+
// This file will be processed by the MIDL tool to
5+
// produce the type library (COMtypesTestServer.tlb) and marshalling code.
6+
7+
import "oaidl.idl";
8+
import "ocidl.idl";
9+
10+
[
11+
object,
12+
uuid(466F83EA-A98E-4B26-8601-2721231A146A),
13+
dual,
14+
nonextensible,
15+
helpstring("ITestComServer Interface"),
16+
pointer_default(unique)
17+
]
18+
interface ITestComServer : IDispatch{
19+
};
20+
[
21+
uuid(6BDC9B16-0A3C-4903-9EF6-376B52F8DEDE),
22+
version(1.0),
23+
helpstring("COMtypesTestServer 1.0 Type Library")
24+
]
25+
library COMtypesTestServerLib
26+
{
27+
importlib("stdole2.tlb");
28+
[
29+
uuid(B08C8CA5-22E4-46A8-B114-B34F0B4CF63C),
30+
helpstring("_ITestComServerEvents Interface")
31+
]
32+
dispinterface _ITestComServerEvents
33+
{
34+
properties:
35+
methods:
36+
};
37+
[
38+
uuid(3FAA4F11-7846-4945-BDDF-8E413D939346),
39+
helpstring("TestComServer Class")
40+
]
41+
coclass TestComServer
42+
{
43+
[default] interface ITestComServer;
44+
[default, source] dispinterface _ITestComServerEvents;
45+
};
46+
};
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// Microsoft Visual C++ generated resource script.
2+
//
3+
#include "resource.h"
4+
5+
#define APSTUDIO_READONLY_SYMBOLS
6+
/////////////////////////////////////////////////////////////////////////////
7+
//
8+
// Generated from the TEXTINCLUDE 2 resource.
9+
//
10+
#include "winres.h"
11+
12+
/////////////////////////////////////////////////////////////////////////////
13+
#undef APSTUDIO_READONLY_SYMBOLS
14+
15+
/////////////////////////////////////////////////////////////////////////////
16+
// German (Germany) resources
17+
18+
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
19+
#ifdef _WIN32
20+
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
21+
#pragma code_page(1252)
22+
#endif //_WIN32
23+
24+
#ifdef APSTUDIO_INVOKED
25+
/////////////////////////////////////////////////////////////////////////////
26+
//
27+
// TEXTINCLUDE
28+
//
29+
30+
1 TEXTINCLUDE
31+
BEGIN
32+
"resource.h\0"
33+
END
34+
35+
2 TEXTINCLUDE
36+
BEGIN
37+
"#include ""winres.h""\r\n"
38+
"\0"
39+
END
40+
41+
3 TEXTINCLUDE
42+
BEGIN
43+
"1 TYPELIB ""COMtypesTestServer.tlb""\r\n"
44+
"\0"
45+
END
46+
47+
#endif // APSTUDIO_INVOKED
48+
49+
50+
/////////////////////////////////////////////////////////////////////////////
51+
//
52+
// Version
53+
//
54+
55+
VS_VERSION_INFO VERSIONINFO
56+
FILEVERSION 1,0,0,1
57+
PRODUCTVERSION 1,0,0,1
58+
FILEFLAGSMASK 0x3fL
59+
#ifdef _DEBUG
60+
FILEFLAGS 0x1L
61+
#else
62+
FILEFLAGS 0x0L
63+
#endif
64+
FILEOS 0x4L
65+
FILETYPE 0x2L
66+
FILESUBTYPE 0x0L
67+
BEGIN
68+
BLOCK "StringFileInfo"
69+
BEGIN
70+
BLOCK "040704e4"
71+
BEGIN
72+
VALUE "CompanyName", "TODO: <Company name>"
73+
VALUE "FileDescription", "TODO: <File description>"
74+
VALUE "FileVersion", "1.0.0.1"
75+
VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved."
76+
VALUE "InternalName", "COMtypesTestServer.dll"
77+
VALUE "OriginalFilename", "COMtypesTestServer.dll"
78+
VALUE "ProductName", "TODO: <Product name>"
79+
VALUE "ProductVersion", "1.0.0.1"
80+
END
81+
END
82+
BLOCK "VarFileInfo"
83+
BEGIN
84+
VALUE "Translation", 0x407, 1252
85+
END
86+
END
87+
88+
89+
/////////////////////////////////////////////////////////////////////////////
90+
//
91+
// REGISTRY
92+
//
93+
94+
IDR_COMTYPESTESTSERVER REGISTRY "COMtypesTestServer.rgs"
95+
IDR_TESTCOMSERVER REGISTRY "TestComServer.rgs"
96+
97+
/////////////////////////////////////////////////////////////////////////////
98+
//
99+
// String Table
100+
//
101+
102+
STRINGTABLE
103+
BEGIN
104+
IDS_PROJNAME "COMtypesTestServer"
105+
END
106+
107+
#endif // German (Germany) resources
108+
/////////////////////////////////////////////////////////////////////////////
109+
110+
111+
112+
#ifndef APSTUDIO_INVOKED
113+
/////////////////////////////////////////////////////////////////////////////
114+
//
115+
// Generated from the TEXTINCLUDE 3 resource.
116+
//
117+
1 TYPELIB "COMtypesTestServer.tlb"
118+
119+
/////////////////////////////////////////////////////////////////////////////
120+
#endif // not APSTUDIO_INVOKED
121+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
HKCR
2+
{
3+
NoRemove AppID
4+
{
5+
'%APPID%' = s 'COMtypesTestServer'
6+
'COMtypesTestServer.DLL'
7+
{
8+
val AppID = s '%APPID%'
9+
}
10+
}
11+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Microsoft Visual Studio Solution File, Format Version 8.00
2+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMtypesTestServer", "COMtypesTestServer.vcproj", "{A517258F-2C1C-4B50-BE7B-B6C0F57AEDF4}"
3+
ProjectSection(ProjectDependencies) = postProject
4+
EndProjectSection
5+
EndProject
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMtypesTestServerPS", "COMtypesTestServerPS.vcproj", "{59DA1381-9663-48FB-91C5-72371B9E1ACA}"
7+
ProjectSection(ProjectDependencies) = postProject
8+
{A517258F-2C1C-4B50-BE7B-B6C0F57AEDF4} = {A517258F-2C1C-4B50-BE7B-B6C0F57AEDF4}
9+
EndProjectSection
10+
EndProject
11+
Global
12+
GlobalSection(SolutionConfiguration) = preSolution
13+
Debug = Debug
14+
Release = Release
15+
EndGlobalSection
16+
GlobalSection(ProjectConfiguration) = postSolution
17+
{A517258F-2C1C-4B50-BE7B-B6C0F57AEDF4}.Debug.ActiveCfg = Debug|Win32
18+
{A517258F-2C1C-4B50-BE7B-B6C0F57AEDF4}.Debug.Build.0 = Debug|Win32
19+
{A517258F-2C1C-4B50-BE7B-B6C0F57AEDF4}.Release.ActiveCfg = Release|Win32
20+
{A517258F-2C1C-4B50-BE7B-B6C0F57AEDF4}.Release.Build.0 = Release|Win32
21+
{59DA1381-9663-48FB-91C5-72371B9E1ACA}.Debug.ActiveCfg = Debug|Win32
22+
{59DA1381-9663-48FB-91C5-72371B9E1ACA}.Release.ActiveCfg = Release|Win32
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
EndGlobalSection
26+
GlobalSection(ExtensibilityAddIns) = postSolution
27+
EndGlobalSection
28+
EndGlobal

0 commit comments

Comments
 (0)