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 static HINSTANCE NETCFGX_hInstance
;
37 typedef HRESULT (*ClassFactoryCreateInstanceFunc
)(IUnknown
**);
39 typedef struct netcfgcf
41 IClassFactory IClassFactory_iface
;
42 ClassFactoryCreateInstanceFunc fnCreateInstance
;
45 static inline netcfgcf
*impl_from_IClassFactory( IClassFactory
*iface
)
47 return CONTAINING_RECORD(iface
, netcfgcf
, IClassFactory_iface
);
50 static HRESULT WINAPI
netcfgcf_QueryInterface(IClassFactory
*iface
, REFIID riid
, LPVOID
*ppobj
)
52 TRACE("%s %p\n", debugstr_guid(riid
), ppobj
);
54 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
55 IsEqualGUID(riid
, &IID_IClassFactory
))
57 IClassFactory_AddRef( iface
);
62 ERR("interface %s not implemented\n", debugstr_guid(riid
));
66 static ULONG WINAPI
netcfgcf_AddRef(IClassFactory
*iface
)
73 static ULONG WINAPI
netcfgcf_Release(IClassFactory
*iface
)
80 static HRESULT WINAPI
netcfgcf_CreateInstance(IClassFactory
*iface
,LPUNKNOWN pOuter
,
81 REFIID riid
, LPVOID
*ppobj
)
83 netcfgcf
*This
= impl_from_IClassFactory( iface
);
87 TRACE("%p %s %p\n", pOuter
, debugstr_guid(riid
), ppobj
);
92 return CLASS_E_NOAGGREGATION
;
94 hr
= This
->fnCreateInstance( &punk
);
97 hr
= IUnknown_QueryInterface( punk
, riid
, ppobj
);
99 IUnknown_Release( punk
);
103 WARN("Cannot create an instance object. 0x%08x\n", hr
);
108 static HRESULT WINAPI
netcfgcf_LockServer(IClassFactory
*iface
, BOOL dolock
)
110 FIXME("(%p)->(%d),stub!\n",iface
,dolock
);
114 static const struct IClassFactoryVtbl netcfgcf_vtbl
=
116 netcfgcf_QueryInterface
,
119 netcfgcf_CreateInstance
,
123 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
125 TRACE("(0x%p, %d, %p)\n", hinstDLL
, fdwReason
, lpvReserved
);
127 NETCFGX_hInstance
= hinstDLL
;
131 case DLL_WINE_PREATTACH
:
132 return FALSE
; /* prefer native version */
133 case DLL_PROCESS_ATTACH
:
134 DisableThreadLibraryCalls(hinstDLL
);
143 static netcfgcf netconfigcf
= { {&netcfgcf_vtbl
}, INetCfg_CreateInstance
};
145 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
)
147 IClassFactory
*cf
= NULL
;
149 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
151 if(IsEqualCLSID(rclsid
, &CLSID_CNetCfg
))
153 cf
= &netconfigcf
.IClassFactory_iface
;
157 return CLASS_E_CLASSNOTAVAILABLE
;
159 return IClassFactory_QueryInterface(cf
, riid
, ppv
);
162 HRESULT WINAPI
DllRegisterServer(void)
164 return __wine_register_resources( NETCFGX_hInstance
);
167 HRESULT WINAPI
DllUnregisterServer(void)
169 return __wine_unregister_resources( NETCFGX_hInstance
);
172 HRESULT WINAPI
DllCanUnloadNow(void)