2 * Network Configuration Objects implementation
4 * Copyright 2013 Austin English
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
31 #include "netcfg_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(netcfgx
);
35 typedef HRESULT (*ClassFactoryCreateInstanceFunc
)(IUnknown
**);
37 typedef struct netcfgcf
39 IClassFactory IClassFactory_iface
;
40 ClassFactoryCreateInstanceFunc fnCreateInstance
;
43 static inline netcfgcf
*impl_from_IClassFactory( IClassFactory
*iface
)
45 return CONTAINING_RECORD(iface
, netcfgcf
, IClassFactory_iface
);
48 static HRESULT WINAPI
netcfgcf_QueryInterface(IClassFactory
*iface
, REFIID riid
, LPVOID
*ppobj
)
50 TRACE("%s %p\n", debugstr_guid(riid
), ppobj
);
52 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
53 IsEqualGUID(riid
, &IID_IClassFactory
))
55 IClassFactory_AddRef( iface
);
60 ERR("interface %s not implemented\n", debugstr_guid(riid
));
64 static ULONG WINAPI
netcfgcf_AddRef(IClassFactory
*iface
)
71 static ULONG WINAPI
netcfgcf_Release(IClassFactory
*iface
)
78 static HRESULT WINAPI
netcfgcf_CreateInstance(IClassFactory
*iface
,LPUNKNOWN pOuter
,
79 REFIID riid
, LPVOID
*ppobj
)
81 netcfgcf
*This
= impl_from_IClassFactory( iface
);
85 TRACE("%p %s %p\n", pOuter
, debugstr_guid(riid
), ppobj
);
90 return CLASS_E_NOAGGREGATION
;
92 hr
= This
->fnCreateInstance( &punk
);
95 hr
= IUnknown_QueryInterface( punk
, riid
, ppobj
);
97 IUnknown_Release( punk
);
101 WARN("Cannot create an instance object. 0x%08lx\n", hr
);
106 static HRESULT WINAPI
netcfgcf_LockServer(IClassFactory
*iface
, BOOL dolock
)
108 FIXME("(%p)->(%d),stub!\n",iface
,dolock
);
112 static const struct IClassFactoryVtbl netcfgcf_vtbl
=
114 netcfgcf_QueryInterface
,
117 netcfgcf_CreateInstance
,
121 static netcfgcf netconfigcf
= { {&netcfgcf_vtbl
}, INetCfg_CreateInstance
};
123 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
)
125 IClassFactory
*cf
= NULL
;
127 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
129 if(IsEqualCLSID(rclsid
, &CLSID_CNetCfg
))
131 cf
= &netconfigcf
.IClassFactory_iface
;
135 return CLASS_E_CLASSNOTAVAILABLE
;
137 return IClassFactory_QueryInterface(cf
, riid
, ppv
);