1 // TortoiseOverlays - an overlay handler for Tortoise clients
\r
2 // Copyright (C) 2007 - TortoiseSVN
\r
5 #pragma warning (disable : 4786)
\r
7 // Initialize GUIDs (should be done only and at-least once per DLL/EXE)
\r
8 #include <initguid.h>
\r
11 #include "ShellExt.h"
\r
14 // *********************** CShellExt *************************
\r
15 CShellExt::CShellExt(FileState state)
\r
24 CShellExt::~CShellExt()
\r
30 STDMETHODIMP CShellExt::QueryInterface(REFIID riid, LPVOID FAR *ppv)
\r
34 if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown))
\r
36 *ppv = (LPSHELLEXTINIT)this;
\r
38 else if (IsEqualIID(riid, IID_IContextMenu))
\r
40 *ppv = (LPCONTEXTMENU)this;
\r
42 else if (IsEqualIID(riid, IID_IContextMenu2))
\r
44 *ppv = (LPCONTEXTMENU2)this;
\r
46 else if (IsEqualIID(riid, IID_IContextMenu3))
\r
48 *ppv = (LPCONTEXTMENU3)this;
\r
50 else if (IsEqualIID(riid, IID_IShellIconOverlayIdentifier))
\r
52 *ppv = (IShellIconOverlayIdentifier*)this;
\r
54 else if (IsEqualIID(riid, IID_IShellPropSheetExt))
\r
56 *ppv = (LPSHELLPROPSHEETEXT)this;
\r
65 return E_NOINTERFACE;
\r
68 STDMETHODIMP_(ULONG) CShellExt::AddRef()
\r
73 STDMETHODIMP_(ULONG) CShellExt::Release()
\r
78 for (vector<DLLPointers>::iterator it = m_dllpointers.begin(); it != m_dllpointers.end(); ++it)
\r
80 if (it->pShellIconOverlayIdentifier != NULL)
\r
81 it->pShellIconOverlayIdentifier->Release();
\r
82 if (it->hDll != NULL)
\r
83 FreeLibrary(it->hDll);
\r
86 it->pDllGetClassObject = NULL;
\r
87 it->pDllCanUnloadNow = NULL;
\r
88 it->pShellIconOverlayIdentifier = NULL;
\r
91 m_dllpointers.clear();
\r