source: trunk/DirectShowSpy/dllmain.h @ 937

Last change on this file since 937 was 831, checked in by roman, 4 years ago

Upgrade to VS2017; removed exception filter (hook); improved tracing

  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2015
3// Created by Roman Ryltsov roman@alax.info, http://alax.info
4//
5// This source code is published to complement DirectShowSpy developer powertoy
6// and demonstrate the internal use of APIs and tricks powering the tool. It is
7// allowed to freely re-use the portions of the code in other projects, commercial
8// or otherwise (provided that you don’t pretend that you wrote the original tool).
9//
10// Please keep in mind that DirectShowSpy is a developer tool, it is strongly recommended
11// that it is not shipped with release grade software. It is allowed to distribute
12// DirectShowSpy if only it is not registered with Windows by default and either
13// used privately, or registered on specific throubleshooting request. The advice applies
14// to hooking methods used by DirectShowSpy in general as well.
15
16#pragma once
17
18////////////////////////////////////////////////////////////
19// CDirectShowSpyModule
20
21class CDirectShowSpyModule : 
22        public CAtlDllModuleT<CDirectShowSpyModule>
23{
24public:
25
26DECLARE_LIBID(LIBID_AlaxInfoDirectShowSpy)
27
28DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MODULE, "{DC64B11B-10DC-4F58-9485-17655B8A393E}")
29
30public:
31// CDirectShowSpyModule
32        CDirectShowSpyModule() throw()
33        {
34                AtlTraceSetDefaultSettings();
35                TraceModuleVersion();
36                _Z4_THIS();
37                //_W(CExceptionFilter::Initialize());
38        }
39        ~CDirectShowSpyModule() throw()
40        {
41                _Z4_THIS();
42                CExceptionFilter::Terminate();
43        }
44
45// CAtlModule
46        HRESULT AddCommonRGSReplacements(IRegistrarBase* pRegistrar) throw()
47        {
48                _A(pRegistrar);
49                _ATLTRY
50                {
51                        __C(__super::AddCommonRGSReplacements(pRegistrar));
52                        _A(!IsEqualGUID(m_libid, GUID_NULL));
53                        __C(pRegistrar->AddReplacement(L"LIBID", _PersistHelper::StringFromIdentifier(m_libid)));
54                        TCHAR pszPath[MAX_PATH] = { 0 };
55                        _W(GetModuleFileName(_AtlBaseModule.GetModuleInstance(), pszPath, DIM(pszPath)));
56                        __C(pRegistrar->AddReplacement(L"FILENAME", CStringW(PathFindFileName(pszPath))));
57                        __C(pRegistrar->AddReplacement(L"DESCRIPTION", CStringW(AtlLoadString(IDS_PROJNAME))));
58                }
59                _ATLCATCH(Exception)
60                {
61                        _C(Exception);
62                }
63                return S_OK;
64        }
65        BOOL WINAPI DllMain(DWORD nReason, VOID* pvReserved) throw()
66        {
67                return __super::DllMain(nReason, pvReserved);
68        }
69};
70
71extern class CDirectShowSpyModule _AtlModule;
72
Note: See TracBrowser for help on using the repository browser.