ReactOS 0.4.16-dev-1041-g8b6907f
netcfgclass_iface.c
Go to the documentation of this file.
1#include "precomp.h"
2
3typedef struct
4{
5 const INetCfgClass *lpVtbl;
6 const INetCfgClassSetup *lpVtblSetup;
9 INetCfg *pNetCfg;
11
13{
14 return (INetCfgClassImpl*)((char *)iface - FIELD_OFFSET(INetCfgClassImpl, lpVtblSetup));
15}
16
17/***************************************************************
18 * INetCfgClassSetup
19 */
20
24 INetCfgClassSetup *iface,
25 REFIID iid,
26 LPVOID *ppvObj)
27{
29 return INetCfgClass_QueryInterface((INetCfgClass*)This, iid, ppvObj);
30}
31
32
36 INetCfgClassSetup *iface)
37{
39 return INetCfgClass_AddRef((INetCfgClass*)This);
40}
41
45 INetCfgClassSetup *iface)
46{
48 return INetCfgClass_Release((INetCfgClass*)This);
49}
50
54 _In_ INetCfgClassSetup *iface,
56 _In_opt_ OBO_TOKEN *pOboToken,
57 _Out_opt_ INetCfgComponent **ppnccItem)
58{
59// INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
60 return S_OK;
61}
62
66 _In_ INetCfgClassSetup *iface,
67 _In_ LPCWSTR pszwComponentId,
68 _In_opt_ OBO_TOKEN *pOboToken,
69 _In_opt_ DWORD dwSetupFlags,
70 _In_opt_ DWORD dwUpgradeFromBuildNo,
71 _In_opt_ LPCWSTR pszwAnswerFile,
72 _In_opt_ LPCWSTR pszwAnswerSections,
73 _Out_opt_ INetCfgComponent **ppComponent)
74{
75// INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
76
77 if (ppComponent)
78 *ppComponent = NULL;
79
80 InstallNetworkComponent(pszwComponentId);
81
82 return S_OK;
83}
84
85
89 _In_ INetCfgClassSetup *iface,
90 _In_ INetCfgComponent *pComponent,
91 _In_opt_ OBO_TOKEN *pOboToken,
92 _Out_opt_ LPWSTR *pmszwRefs)
93{
94// INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
95
96 return S_OK;
97}
98
99static const INetCfgClassSetupVtbl vt_NetCfgClassSetup =
100{
107};
108
109/***************************************************************
110 * INetCfgClass
111 */
112
114WINAPI
116 INetCfgClass *iface,
117 REFIID iid,
118 LPVOID *ppvObj)
119{
121 *ppvObj = NULL;
122
123 if (IsEqualIID (iid, &IID_IUnknown) ||
125 {
126 *ppvObj = This;
127 INetCfgClass_AddRef(iface);
128 return S_OK;
129 }
130 else if (IsEqualIID (iid, &IID_INetCfgClassSetup))
131 {
132 *ppvObj = (LPVOID)&This->lpVtblSetup;
133 INetCfgClass_AddRef(iface);
134 return S_OK;
135 }
136
137 return E_NOINTERFACE;
138}
139
140ULONG
141WINAPI
143 INetCfgClass *iface)
144{
146 ULONG refCount = InterlockedIncrement(&This->ref);
147
148 return refCount;
149}
150
151ULONG
152WINAPI
154 INetCfgClass *iface)
155{
157 ULONG refCount = InterlockedDecrement(&This->ref);
158
159 if (!refCount)
160 {
162 }
163 return refCount;
164}
165
167WINAPI
169 INetCfgClass *iface,
170 INetCfgComponent **pComponent)
171{
172// HRESULT hr;
173// INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
174
175
176 /* TODO */
177
178 return S_FALSE;
179}
180
182WINAPI
184 INetCfgClass *iface,
185 IEnumNetCfgComponent **ppenumComponent)
186{
187// INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
188
189
190 return E_NOINTERFACE;
191}
192
193static const INetCfgClassVtbl vt_NetCfgClass =
194{
200};
201
203WINAPI
205 IUnknown *pUnkOuter,
206 REFIID riid,
207 LPVOID *ppv,
208 const GUID *pguidClass,
209 INetCfg *pNetCfg)
210{
212
213 if (!ppv)
214 return E_POINTER;
215
217 if (!This)
218 return E_OUTOFMEMORY;
219
220 This->ref = 1;
221 This->lpVtbl = (const INetCfgClass*)&vt_NetCfgClass;
222 This->lpVtblSetup = (const INetCfgClassSetup*)&vt_NetCfgClassSetup;
223
224 memcpy(&This->ClassGuid, pguidClass, sizeof(GUID));
225 This->pNetCfg = pNetCfg;
226
227 if (!SUCCEEDED(INetCfgClass_QueryInterface((INetCfgClass*)This, riid, ppv)))
228 {
229 INetCfgClass_Release((INetCfgClass*)This);
230 return E_NOINTERFACE;
231 }
232
233 INetCfgClass_Release((INetCfgClass*)This);
234 return S_OK;
235}
#define __inline
Definition: _wctype.cpp:15
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
const GUID IID_IUnknown
static HWND hwndParent
Definition: cryptui.c:300
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG WINAPI INetCfgClass_fnAddRef(INetCfgClass *iface)
ULONG WINAPI INetCfgClassSetup_fnRelease(INetCfgClassSetup *iface)
static __inline LPINetCfgClassImpl impl_from_INetCfgClassSetup(INetCfgClassSetup *iface)
static const INetCfgClassSetupVtbl vt_NetCfgClassSetup
HRESULT WINAPI INetCfgClass_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, const GUID *pguidClass, INetCfg *pNetCfg)
HRESULT WINAPI INetCfgClassSetup_fnDeInstall(_In_ INetCfgClassSetup *iface, _In_ INetCfgComponent *pComponent, _In_opt_ OBO_TOKEN *pOboToken, _Out_opt_ LPWSTR *pmszwRefs)
struct INetCfgClassImpl * LPINetCfgClassImpl
HRESULT WINAPI INetCfgClassSetup_fnInstall(_In_ INetCfgClassSetup *iface, _In_ LPCWSTR pszwComponentId, _In_opt_ OBO_TOKEN *pOboToken, _In_opt_ DWORD dwSetupFlags, _In_opt_ DWORD dwUpgradeFromBuildNo, _In_opt_ LPCWSTR pszwAnswerFile, _In_opt_ LPCWSTR pszwAnswerSections, _Out_opt_ INetCfgComponent **ppComponent)
HRESULT WINAPI INetCfgClass_fnFindComponent(INetCfgClass *iface, INetCfgComponent **pComponent)
HRESULT WINAPI INetCfgClassSetup_fnSelectAndInstall(_In_ INetCfgClassSetup *iface, _In_ HWND hwndParent, _In_opt_ OBO_TOKEN *pOboToken, _Out_opt_ INetCfgComponent **ppnccItem)
HRESULT WINAPI INetCfgClass_fnEnumComponents(INetCfgClass *iface, IEnumNetCfgComponent **ppenumComponent)
static const INetCfgClassVtbl vt_NetCfgClass
ULONG WINAPI INetCfgClass_fnRelease(INetCfgClass *iface)
HRESULT WINAPI INetCfgClassSetup_fnQueryInterface(INetCfgClassSetup *iface, REFIID iid, LPVOID *ppvObj)
HRESULT WINAPI INetCfgClass_fnQueryInterface(INetCfgClass *iface, REFIID iid, LPVOID *ppvObj)
ULONG WINAPI INetCfgClassSetup_fnAddRef(INetCfgClassSetup *iface)
EXTERN_C const IID IID_INetCfgClassSetup
Definition: netcfgx.h:361
EXTERN_C const IID IID_INetCfgClass
Definition: netcfgx.h:317
#define INetCfgClass_Release(p)
Definition: netcfgx.h:335
#define INetCfgClass_QueryInterface(p, a, b)
Definition: netcfgx.h:333
#define INetCfgClass_AddRef(p)
Definition: netcfgx.h:334
#define _Out_opt_
Definition: no_sal2.h:214
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define LPVOID
Definition: nt_native.h:45
long LONG
Definition: pedump.c:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
static HRESULT InstallNetworkComponent(LPWSTR pszComponentName, const GUID *pClassGuid)
Definition: setup.cpp:54
const INetCfgClass * lpVtbl
const INetCfgClassSetup * lpVtblSetup
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_POINTER
Definition: winerror.h:2365
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185