mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[NETCFGX][PSDK] Add the interfaces INetCfgClass and INetCfgClassSetup
This will enable us to install networking drivers and services properly.
This commit is contained in:
parent
45ed1a9b6d
commit
47bae01cfa
5 changed files with 307 additions and 1 deletions
|
@ -11,6 +11,7 @@ list(APPEND SOURCE
|
|||
netcfg_iface.c
|
||||
netcfgbindinginterface_iface.c
|
||||
netcfgbindingpath_iface.c
|
||||
netcfgclass_iface.c
|
||||
inetcfgcomp_iface.c
|
||||
tcpipconf_notify.c
|
||||
propertypage.c
|
||||
|
|
|
@ -845,7 +845,7 @@ INetCfg_fnQueryNetCfgClass(
|
|||
REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
return E_FAIL;
|
||||
return INetCfgClass_Constructor((IUnknown *)iface, riid, ppvObject, pguidClass, iface);
|
||||
}
|
||||
|
||||
static const INetCfgVtbl vt_NetCfg =
|
||||
|
|
233
dll/win32/netcfgx/netcfgclass_iface.c
Normal file
233
dll/win32/netcfgx/netcfgclass_iface.c
Normal file
|
@ -0,0 +1,233 @@
|
|||
#include "precomp.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const INetCfgClass *lpVtbl;
|
||||
const INetCfgClassSetup *lpVtblSetup;
|
||||
LONG ref;
|
||||
GUID ClassGuid;
|
||||
INetCfg *pNetCfg;
|
||||
} INetCfgClassImpl, *LPINetCfgClassImpl;
|
||||
|
||||
static __inline LPINetCfgClassImpl impl_from_INetCfgClassSetup(INetCfgClassSetup *iface)
|
||||
{
|
||||
return (INetCfgClassImpl*)((char *)iface - FIELD_OFFSET(INetCfgClassImpl, lpVtblSetup));
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* INetCfgClassSetup
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
INetCfgClassSetup_fnQueryInterface(
|
||||
INetCfgClassSetup *iface,
|
||||
REFIID iid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
|
||||
return INetCfgClass_QueryInterface((INetCfgClass*)This, iid, ppvObj);
|
||||
}
|
||||
|
||||
|
||||
ULONG
|
||||
WINAPI
|
||||
INetCfgClassSetup_fnAddRef(
|
||||
INetCfgClassSetup *iface)
|
||||
{
|
||||
INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
|
||||
return INetCfgClass_AddRef((INetCfgClass*)This);
|
||||
}
|
||||
|
||||
ULONG
|
||||
WINAPI
|
||||
INetCfgClassSetup_fnRelease(
|
||||
INetCfgClassSetup *iface)
|
||||
{
|
||||
INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
|
||||
return INetCfgClass_Release((INetCfgClass*)This);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
INetCfgClassSetup_fnSelectAndInstall(
|
||||
_In_ INetCfgClassSetup *iface,
|
||||
_In_ HWND hwndParent,
|
||||
_In_opt_ OBO_TOKEN *pOboToken,
|
||||
_Out_opt_ INetCfgComponent **ppnccItem)
|
||||
{
|
||||
// INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
|
||||
|
||||
if (ppComponent)
|
||||
*ppComponent = NULL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
INetCfgClassSetup_fnDeInstall(
|
||||
_In_ INetCfgClassSetup *iface,
|
||||
_In_ INetCfgComponent *pComponent,
|
||||
_In_opt_ OBO_TOKEN *pOboToken,
|
||||
_Out_opt_ LPWSTR *pmszwRefs)
|
||||
{
|
||||
// INetCfgClassImpl *This = impl_from_INetCfgClassSetup(iface);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const INetCfgClassSetupVtbl vt_NetCfgClassSetup =
|
||||
{
|
||||
INetCfgClassSetup_fnQueryInterface,
|
||||
INetCfgClassSetup_fnAddRef,
|
||||
INetCfgClassSetup_fnRelease,
|
||||
INetCfgClassSetup_fnSelectAndInstall,
|
||||
INetCfgClassSetup_fnInstall,
|
||||
INetCfgClassSetup_fnDeInstall
|
||||
};
|
||||
|
||||
/***************************************************************
|
||||
* INetCfgClass
|
||||
*/
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
INetCfgClass_fnQueryInterface(
|
||||
INetCfgClass *iface,
|
||||
REFIID iid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
INetCfgClassImpl *This = (INetCfgClassImpl*)iface;
|
||||
*ppvObj = NULL;
|
||||
|
||||
if (IsEqualIID (iid, &IID_IUnknown) ||
|
||||
IsEqualIID (iid, &IID_INetCfgClass))
|
||||
{
|
||||
*ppvObj = This;
|
||||
INetCfgClass_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
else if (IsEqualIID (iid, &IID_INetCfgClassSetup))
|
||||
{
|
||||
*ppvObj = (LPVOID)&This->lpVtblSetup;
|
||||
INetCfgClass_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG
|
||||
WINAPI
|
||||
INetCfgClass_fnAddRef(
|
||||
INetCfgClass *iface)
|
||||
{
|
||||
INetCfgClassImpl *This = (INetCfgClassImpl*)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
|
||||
return refCount;
|
||||
}
|
||||
|
||||
ULONG
|
||||
WINAPI
|
||||
INetCfgClass_fnRelease(
|
||||
INetCfgClass *iface)
|
||||
{
|
||||
INetCfgClassImpl *This = (INetCfgClassImpl*)iface;
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
|
||||
if (!refCount)
|
||||
{
|
||||
CoTaskMemFree(This);
|
||||
}
|
||||
return refCount;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
INetCfgClass_fnFindComponent(
|
||||
INetCfgClass *iface,
|
||||
INetCfgComponent **pComponent)
|
||||
{
|
||||
// HRESULT hr;
|
||||
// INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
|
||||
|
||||
|
||||
/* TODO */
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
INetCfgClass_fnEnumComponents(
|
||||
INetCfgClass *iface,
|
||||
IEnumNetCfgComponent **ppenumComponent)
|
||||
{
|
||||
// INetCfgClassImpl *This = (INetCfgClassImpl *)iface;
|
||||
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static const INetCfgClassVtbl vt_NetCfgClass =
|
||||
{
|
||||
INetCfgClass_fnQueryInterface,
|
||||
INetCfgClass_fnAddRef,
|
||||
INetCfgClass_fnRelease,
|
||||
INetCfgClass_fnFindComponent,
|
||||
INetCfgClass_fnEnumComponents,
|
||||
};
|
||||
|
||||
HRESULT
|
||||
WINAPI
|
||||
INetCfgClass_Constructor(
|
||||
IUnknown *pUnkOuter,
|
||||
REFIID riid,
|
||||
LPVOID *ppv,
|
||||
const GUID *pguidClass,
|
||||
INetCfg *pNetCfg)
|
||||
{
|
||||
INetCfgClassImpl *This;
|
||||
|
||||
if (!ppv)
|
||||
return E_POINTER;
|
||||
|
||||
This = (INetCfgClassImpl *)CoTaskMemAlloc(sizeof(INetCfgClassImpl));
|
||||
if (!This)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
This->ref = 1;
|
||||
This->lpVtbl = (const INetCfgClass*)&vt_NetCfgClass;
|
||||
This->lpVtblSetup = (const INetCfgClassSetup*)&vt_NetCfgClassSetup;
|
||||
|
||||
memcpy(&This->ClassGuid, pguidClass, sizeof(GUID));
|
||||
This->pNetCfg = pNetCfg;
|
||||
|
||||
if (!SUCCEEDED(INetCfgClass_QueryInterface((INetCfgClass*)This, riid, ppv)))
|
||||
{
|
||||
INetCfgClass_Release((INetCfgClass*)This);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
INetCfgClass_Release((INetCfgClass*)This);
|
||||
return S_OK;
|
||||
}
|
|
@ -73,6 +73,9 @@ HRESULT WINAPI IEnumNetCfgBindingInterface_Constructor(IUnknown *pUnkOuter, REFI
|
|||
HRESULT WINAPI INetCfgBindingPath_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv);
|
||||
HRESULT WINAPI IEnumNetCfgBindingPath_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, DWORD dwFlags);
|
||||
|
||||
/* netcfgclass_iface.c */
|
||||
HRESULT WINAPI INetCfgClass_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, const GUID *pguidClass, INetCfg *pNetCfg);
|
||||
|
||||
/* tcpipconf_notify.c */
|
||||
HRESULT WINAPI TcpipConfigNotify_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
|
||||
|
||||
|
|
|
@ -314,5 +314,74 @@ EXTERN_C const IID IID_INetCfg;
|
|||
#define NETCFG_S_CAUSED_SETUP_CHANGE 0x8004A024
|
||||
#define NETCFG_S_COMMIT_NOW 0x8004A025
|
||||
|
||||
EXTERN_C const IID IID_INetCfgClass;
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE INetCfgClass
|
||||
DECLARE_INTERFACE_(INetCfgClass, IUnknown)
|
||||
{
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
STDMETHOD_(HRESULT,FindComponent) (THIS_ INetCfgComponent **ppnccItem) PURE;
|
||||
STDMETHOD_(HRESULT,EnumComponents) (THIS_ IEnumNetCfgComponent **ppenumComponent) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
/*** IUnknown methods ***/
|
||||
#define INetCfgClass_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define INetCfgClass_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define INetCfgClass_Release(p) (p)->lpVtbl->Release(p)
|
||||
#define INetCfgClass_FindComponent(p,a) (p)->lpVtbl->FindComponent(p,a)
|
||||
#define INetCfgClass_EnumComponents(p,a) (p)->lpVtbl->EnumComponents(p,a)
|
||||
#endif
|
||||
|
||||
typedef
|
||||
enum tagOBO_TOKEN_TYPE
|
||||
{
|
||||
OBO_USER = 1,
|
||||
OBO_COMPONENT = 2,
|
||||
OBO_SOFTWARE = 3
|
||||
} OBO_TOKEN_TYPE;
|
||||
|
||||
typedef struct tagOBO_TOKEN
|
||||
{
|
||||
OBO_TOKEN_TYPE Type;
|
||||
INetCfgComponent *pncc;
|
||||
LPCWSTR pszwManufacturer;
|
||||
LPCWSTR pszwProduct;
|
||||
LPCWSTR pszwDisplayName;
|
||||
BOOL fRegistered;
|
||||
} OBO_TOKEN;
|
||||
|
||||
#define NSF_PRIMARYINSTALL 1
|
||||
#define NSF_POSTSYSINSTALL 2
|
||||
|
||||
EXTERN_C const IID IID_INetCfgClassSetup;
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE INetCfgClassSetup
|
||||
DECLARE_INTERFACE_(INetCfgClassSetup, IUnknown)
|
||||
{
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
STDMETHOD_(HRESULT,SelectAndInstall)(THIS_ HWND hwndParent, OBO_TOKEN *pOboToken, INetCfgComponent **ppnccItem) PURE;
|
||||
STDMETHOD_(HRESULT,Install)(THIS_ LPCWSTR pszwInfId, OBO_TOKEN *pOboToken, DWORD dwSetupFlags, DWORD dwUpgradeFromBuildNo,
|
||||
LPCWSTR pszwAnswerFile, LPCWSTR pszwAnswerSections, INetCfgComponent **ppnccItem) PURE;
|
||||
STDMETHOD_(HRESULT,DeInstall)(THIS_ INetCfgComponent *pComponent, OBO_TOKEN *pOboToken, LPWSTR *pmszwRefs) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
/*** IUnknown methods ***/
|
||||
#define INetCfgClassSetup_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define INetCfgClassSetup_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define INetCfgClassSetup_Release(p) (p)->lpVtbl->Release(p)
|
||||
#define INetCfgClassSetup_SelectAndInstall(p,a,b,c) (p)->lpVtbl->SelectAndInstall(p,a,b,c)
|
||||
#define INetCfgClassSetup_Install(p,a,b,c,d,e,f,g) (p)->lpVtbl->Install(p,a,b,c,d,e,f,g)
|
||||
#define INetCfgClassSetup_DeInstall(p,a,b,c) (p)->lpVtbl->DeInstall(p,a,b,c)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue