ReactOS 0.4.15-dev-8236-g99f0937
factory.cpp
Go to the documentation of this file.
1/* Copyright (c) Mark Harmstone 2016-17
2 *
3 * This file is part of WinBtrfs.
4 *
5 * WinBtrfs is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public Licence as published by
7 * the Free Software Foundation, either version 3 of the Licence, or
8 * (at your option) any later version.
9 *
10 * WinBtrfs is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public Licence for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public Licence
16 * along with WinBtrfs. If not, see <http://www.gnu.org/licenses/>. */
17
18#include "shellext.h"
19#include <windows.h>
20#include "factory.h"
21#include "iconoverlay.h"
22#include "contextmenu.h"
23#include "propsheet.h"
24#include "volpropsheet.h"
25
27 if (iid == IID_IUnknown || iid == IID_IClassFactory) {
28 *ppv = static_cast<IClassFactory*>(this);
29 } else {
30 *ppv = nullptr;
31 return E_NOINTERFACE;
32 }
33
34 reinterpret_cast<IUnknown*>(*ppv)->AddRef();
35
36 return S_OK;
37}
38
40 return E_NOTIMPL;
41}
42
43HRESULT __stdcall Factory::CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv) {
44 if (pUnknownOuter)
46
47 switch (type) {
49 if (iid == IID_IUnknown || iid == IID_IShellIconOverlayIdentifier) {
51 if (!bio)
52 return E_OUTOFMEMORY;
53
54 return bio->QueryInterface(iid, ppv);
55 }
56 break;
57
59 if (iid == IID_IUnknown || iid == IID_IContextMenu || iid == IID_IShellExtInit) {
61 if (!bcm)
62 return E_OUTOFMEMORY;
63
64 return bcm->QueryInterface(iid, ppv);
65 }
66 break;
67
69 if (iid == IID_IUnknown || iid == IID_IShellPropSheetExt || iid == IID_IShellExtInit) {
71 if (!bps)
72 return E_OUTOFMEMORY;
73
74 return bps->QueryInterface(iid, ppv);
75 }
76 break;
77
79 if (iid == IID_IUnknown || iid == IID_IShellPropSheetExt || iid == IID_IShellExtInit) {
81 if (!bps)
82 return E_OUTOFMEMORY;
83
84 return bps->QueryInterface(iid, ppv);
85 }
86 break;
87
88 default:
89 break;
90 }
91
92 *ppv = nullptr;
93 return E_NOINTERFACE;
94}
const GUID IID_IUnknown
const GUID IID_IClassFactory
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
Definition: contextmenu.cpp:70
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
Definition: propsheet.cpp:73
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
HRESULT __stdcall QueryInterface(REFIID riid, void **ppObj)
Definition: factory.cpp:26
virtual HRESULT __stdcall LockServer(BOOL bLock)
Definition: factory.cpp:39
virtual HRESULT __stdcall CreateInstance(IUnknown *pUnknownOuter, const IID &iid, void **ppv)
Definition: factory.cpp:43
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
@ FactoryContextMenu
Definition: factory.h:25
@ FactoryIconHandler
Definition: factory.h:24
@ FactoryVolPropSheet
Definition: factory.h:27
@ FactoryPropSheet
Definition: factory.h:26
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
REFIID LPVOID * ppv
Definition: atlbase.h:39
ULONG AddRef()
#define S_OK
Definition: intsafe.h:52
#define __stdcall
Definition: typedefs.h:25
static EFI_BLOCK_IO * bio
Definition: uefidisk.c:61
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662