winemine: Load main icon in the about window.
[wine.git] / dlls / netcfgx / main.c
blob0a3102a81fc6e95c36684d8640e210a243e11029
1 /*
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
20 #include <stdarg.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "ole2.h"
27 #include "rpcproxy.h"
28 #include "wine/debug.h"
30 #include "netcfgx.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;
43 } netcfgcf;
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 );
58 *ppobj = iface;
59 return S_OK;
62 ERR("interface %s not implemented\n", debugstr_guid(riid));
63 return E_NOINTERFACE;
66 static ULONG WINAPI netcfgcf_AddRef(IClassFactory *iface )
68 TRACE("%p\n", iface);
70 return 2;
73 static ULONG WINAPI netcfgcf_Release(IClassFactory *iface )
75 TRACE("%p\n", iface);
77 return 1;
80 static HRESULT WINAPI netcfgcf_CreateInstance(IClassFactory *iface,LPUNKNOWN pOuter,
81 REFIID riid, LPVOID *ppobj )
83 netcfgcf *This = impl_from_IClassFactory( iface );
84 HRESULT hr;
85 IUnknown *punk;
87 TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
89 *ppobj = NULL;
91 if (pOuter)
92 return CLASS_E_NOAGGREGATION;
94 hr = This->fnCreateInstance( &punk );
95 if (SUCCEEDED(hr))
97 hr = IUnknown_QueryInterface( punk, riid, ppobj );
99 IUnknown_Release( punk );
101 else
103 WARN("Cannot create an instance object. 0x%08x\n", hr);
105 return hr;
108 static HRESULT WINAPI netcfgcf_LockServer(IClassFactory *iface, BOOL dolock)
110 FIXME("(%p)->(%d),stub!\n",iface,dolock);
111 return S_OK;
114 static const struct IClassFactoryVtbl netcfgcf_vtbl =
116 netcfgcf_QueryInterface,
117 netcfgcf_AddRef,
118 netcfgcf_Release,
119 netcfgcf_CreateInstance,
120 netcfgcf_LockServer
123 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
125 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
127 NETCFGX_hInstance = hinstDLL;
129 switch (fdwReason)
131 case DLL_WINE_PREATTACH:
132 return FALSE; /* prefer native version */
133 case DLL_PROCESS_ATTACH:
134 DisableThreadLibraryCalls(hinstDLL);
135 break;
136 default:
137 break;
140 return TRUE;
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;
156 if(!cf)
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)
174 return S_FALSE;