diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-30 19:03:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-30 19:03:13 +0000 |
commit | 8257d9c829e65f5102632b1f448713730e2c8ddb (patch) | |
tree | ef8a25313b591243df5873a6ae633375c74fc2a8 /plugins/ShellExt/src/shlfactory.cpp | |
parent | 2c73bb570b16ed862a3e28e263198273d4591074 (diff) |
missing files
git-svn-id: http://svn.miranda-ng.org/main/trunk@5890 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ShellExt/src/shlfactory.cpp')
-rw-r--r-- | plugins/ShellExt/src/shlfactory.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
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;
+}
|