2013-08-27 01:09:01 +02:00
|
|
|
/*
|
|
|
|
* Network Configuration Objects implementation
|
|
|
|
*
|
|
|
|
* Copyright 2013 Austin English
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2014-03-20 11:00:28 +01:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2013-08-27 01:09:01 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2014-03-20 00:10:14 +01:00
|
|
|
#include "ole2.h"
|
|
|
|
#include "rpcproxy.h"
|
2013-08-27 01:09:01 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2014-03-20 11:00:28 +01:00
|
|
|
#include "netcfgx.h"
|
|
|
|
#include "netcfg_private.h"
|
|
|
|
|
2013-08-27 01:09:01 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(netcfgx);
|
|
|
|
|
2014-03-20 11:00:28 +01:00
|
|
|
typedef HRESULT (*ClassFactoryCreateInstanceFunc)(IUnknown **);
|
|
|
|
|
|
|
|
typedef struct netcfgcf
|
|
|
|
{
|
|
|
|
IClassFactory IClassFactory_iface;
|
|
|
|
ClassFactoryCreateInstanceFunc fnCreateInstance;
|
|
|
|
} netcfgcf;
|
|
|
|
|
|
|
|
static inline netcfgcf *impl_from_IClassFactory( IClassFactory *iface )
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, netcfgcf, IClassFactory_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI netcfgcf_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppobj )
|
|
|
|
{
|
|
|
|
TRACE("%s %p\n", debugstr_guid(riid), ppobj);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualGUID(riid, &IID_IClassFactory))
|
|
|
|
{
|
|
|
|
IClassFactory_AddRef( iface );
|
|
|
|
*ppobj = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ERR("interface %s not implemented\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI netcfgcf_AddRef(IClassFactory *iface )
|
|
|
|
{
|
|
|
|
TRACE("%p\n", iface);
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI netcfgcf_Release(IClassFactory *iface )
|
|
|
|
{
|
|
|
|
TRACE("%p\n", iface);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI netcfgcf_CreateInstance(IClassFactory *iface,LPUNKNOWN pOuter,
|
|
|
|
REFIID riid, LPVOID *ppobj )
|
|
|
|
{
|
|
|
|
netcfgcf *This = impl_from_IClassFactory( iface );
|
|
|
|
HRESULT hr;
|
|
|
|
IUnknown *punk;
|
|
|
|
|
|
|
|
TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
|
|
|
|
|
|
|
|
*ppobj = NULL;
|
|
|
|
|
|
|
|
if (pOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
hr = This->fnCreateInstance( &punk );
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = IUnknown_QueryInterface( punk, riid, ppobj );
|
|
|
|
|
|
|
|
IUnknown_Release( punk );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WARN("Cannot create an instance object. 0x%08x\n", hr);
|
|
|
|
}
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI netcfgcf_LockServer(IClassFactory *iface, BOOL dolock)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%d),stub!\n",iface,dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IClassFactoryVtbl netcfgcf_vtbl =
|
|
|
|
{
|
|
|
|
netcfgcf_QueryInterface,
|
|
|
|
netcfgcf_AddRef,
|
|
|
|
netcfgcf_Release,
|
|
|
|
netcfgcf_CreateInstance,
|
|
|
|
netcfgcf_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static netcfgcf netconfigcf = { {&netcfgcf_vtbl}, INetCfg_CreateInstance };
|
|
|
|
|
2014-03-20 00:10:14 +01:00
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
|
|
|
{
|
2014-03-20 11:00:28 +01:00
|
|
|
IClassFactory *cf = NULL;
|
|
|
|
|
|
|
|
TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if(IsEqualCLSID(rclsid, &CLSID_CNetCfg))
|
|
|
|
{
|
|
|
|
cf = &netconfigcf.IClassFactory_iface;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!cf)
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
2014-03-20 00:10:14 +01:00
|
|
|
|
2014-03-20 11:00:28 +01:00
|
|
|
return IClassFactory_QueryInterface(cf, riid, ppv);
|
2014-03-20 00:10:14 +01:00
|
|
|
}
|