source: trunk/DirectShowSpy/dllmain.h @ 276

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

Updated header (on use, applicability, redistribution)

  • Property svn:keywords set to Id
File size: 2.4 KB
RevLine 
[95]1////////////////////////////////////////////////////////////
[267]2// Copyright (C) Roman Ryltsov, 2008-2014
[276]3// Created by Roman Ryltsov roman@alax.info, http://alax.info
[267]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
[276]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).
[267]9//
10// Please keep in mind that DirectShowSpy is a developer tool, it is strongly recommended
[276]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.
[95]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        {
[147]34                AtlTraceSetDefaultSettings();
[95]35                TraceModuleVersion();
[144]36                _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
[147]37                _W(CExceptionFilter::Initialize());
[95]38        }
39        ~CDirectShowSpyModule() throw()
40        {
[144]41                _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this);
[95]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.