source: trunk/DirectShowSpy/dllmain.h @ 267

Last change on this file since 267 was 267, checked in by roman, 10 years ago

Updated source code/copyright notice

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2014
3// Created by Roman Ryltsov roman@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 or otherwise
8// (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. The advise applies to hooking methods
12// used by DirectShowSpy in general as well.
13
14#pragma once
15
16////////////////////////////////////////////////////////////
17// CDirectShowSpyModule
18
19class CDirectShowSpyModule : 
20        public CAtlDllModuleT<CDirectShowSpyModule>
21{
22public:
23
24DECLARE_LIBID(LIBID_AlaxInfoDirectShowSpy)
25
26DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MODULE, "{DC64B11B-10DC-4F58-9485-17655B8A393E}")
27
28public:
29// CDirectShowSpyModule
30        CDirectShowSpyModule() throw()
31        {
32                AtlTraceSetDefaultSettings();
33                TraceModuleVersion();
34                _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
35                _W(CExceptionFilter::Initialize());
36        }
37        ~CDirectShowSpyModule() throw()
38        {
39                _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
40                CExceptionFilter::Terminate();
41        }
42
43// CAtlModule
44        HRESULT AddCommonRGSReplacements(IRegistrarBase* pRegistrar) throw()
45        {
46                _A(pRegistrar);
47                _ATLTRY
48                {
49                        __C(__super::AddCommonRGSReplacements(pRegistrar));
50                        _A(!IsEqualGUID(m_libid, GUID_NULL));
51                        __C(pRegistrar->AddReplacement(L"LIBID", _PersistHelper::StringFromIdentifier(m_libid)));
52                        TCHAR pszPath[MAX_PATH] = { 0 };
53                        _W(GetModuleFileName(_AtlBaseModule.GetModuleInstance(), pszPath, DIM(pszPath)));
54                        __C(pRegistrar->AddReplacement(L"FILENAME", CStringW(PathFindFileName(pszPath))));
55                        __C(pRegistrar->AddReplacement(L"DESCRIPTION", CStringW(AtlLoadString(IDS_PROJNAME))));
56                }
57                _ATLCATCH(Exception)
58                {
59                        _C(Exception);
60                }
61                return S_OK;
62        }
63        BOOL WINAPI DllMain(DWORD nReason, VOID* pvReserved) throw()
64        {
65                return __super::DllMain(nReason, pvReserved);
66        }
67};
68
69extern class CDirectShowSpyModule _AtlModule;
70
Note: See TracBrowser for help on using the repository browser.