Show Bug ID link at log dialog
[TortoiseGit.git] / src / TortoiseOverlays / ShellExtClassFactory.cpp
blob96615229b60eaef20e62c0e92ab18ff16de2dc16
1 // TortoiseOverlays - an overlay handler for Tortoise clients
2 // Copyright (C) 2007 - TortoiseSVN
3 #include "stdafx.h"
4 #include "ShellExt.h"
5 #include "ShellExtClassFactory.h"
8 CShellExtClassFactory::CShellExtClassFactory(FileState state)
10 m_StateToMake = state;
12 m_cRef = 0L;
14 g_cRefThisDll++;
17 CShellExtClassFactory::~CShellExtClassFactory()
19 g_cRefThisDll--;
22 STDMETHODIMP CShellExtClassFactory::QueryInterface(REFIID riid,
23 LPVOID FAR *ppv)
25 *ppv = NULL;
27 // Any interface on this object is the object pointer
29 if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory))
31 *ppv = (LPCLASSFACTORY)this;
33 AddRef();
35 return NOERROR;
38 return E_NOINTERFACE;
41 STDMETHODIMP_(ULONG) CShellExtClassFactory::AddRef()
43 return ++m_cRef;
46 STDMETHODIMP_(ULONG) CShellExtClassFactory::Release()
48 if (--m_cRef)
49 return m_cRef;
51 delete this;
53 return 0L;
56 STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter,
57 REFIID riid,
58 LPVOID *ppvObj)
60 *ppvObj = NULL;
62 // Shell extensions typically don't support aggregation (inheritance)
64 if (pUnkOuter)
65 return CLASS_E_NOAGGREGATION;
67 // Create the main shell extension object. The shell will then call
68 // QueryInterface with IID_IShellExtInit--this is how shell extensions are
69 // initialized.
71 CShellExt* pShellExt = new CShellExt(m_StateToMake); //Create the CShellExt object
73 if (NULL == pShellExt)
74 return E_OUTOFMEMORY;
76 return pShellExt->QueryInterface(riid, ppvObj);
80 STDMETHODIMP CShellExtClassFactory::LockServer(BOOL /*fLock*/)
82 return E_NOTIMPL;