From 8257d9c829e65f5102632b1f448713730e2c8ddb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 30 Aug 2013 19:03:13 +0000 Subject: missing files git-svn-id: http://svn.miranda-ng.org/main/trunk@5890 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ShellExt/src/shlfactory.cpp | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 plugins/ShellExt/src/shlfactory.cpp (limited to 'plugins/ShellExt/src/shlfactory.cpp') diff --git a/plugins/ShellExt/src/shlfactory.cpp b/plugins/ShellExt/src/shlfactory.cpp new file mode 100644 index 0000000000..973dbb0aec --- /dev/null +++ b/plugins/ShellExt/src/shlfactory.cpp @@ -0,0 +1,72 @@ +#include "stdafx.h" +#include "shlcom.h" + +///////////////////////////////////////////////////////////////////////////////////////// + +TClassFactoryRec::TClassFactoryRec() : + RefCount(0) +{ + DllFactoryCount++; +} + +HRESULT TClassFactoryRec::QueryInterface(REFIID riid, void **ppvObject) +{ + if (riid == IID_IUnknown) + logA("TClassFactoryRec retrieved as IUnknown: %d\n", RefCount); + else if (riid == IID_IClassFactory) + logA("TClassFactoryRec retrieved as IClassFactory: %d\n", RefCount); + else { + #ifdef LOG_ENABLED + RPC_CSTR szGuid; + UuidToStringA(&riid, &szGuid); + logA("TClassFactoryRec::QueryInterface {%s} failed\n", szGuid); + RpcStringFreeA(&szGuid); + #endif + *ppvObject = NULL; + return E_NOINTERFACE; + } + + AddRef(); + *ppvObject = this; + return S_OK; +} + +ULONG TClassFactoryRec::AddRef() +{ + return ++RefCount; +} + +ULONG TClassFactoryRec::Release() +{ + ULONG result = --RefCount; + if (result == 0) { + logA("TClassFactoryRec released\n"); + delete this; + DllFactoryCount--; + } + return result; +} + +HRESULT TClassFactoryRec::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject) +{ + if (ppvObject == 0) + return E_POINTER; + + *ppvObject = NULL; + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + TShellExt *p = new TShellExt(); + if (p == NULL) + return E_OUTOFMEMORY; + + HRESULT hr = p->QueryInterface(riid, ppvObject); + if ( FAILED(hr)) + delete p; + return hr; +} + +HRESULT TClassFactoryRec::LockServer(BOOL) +{ + return E_NOTIMPL; +} -- cgit v1.2.3