Release 5.0-rc1.
[wine.git] / dlls / netprofm / main.c
blobd1e622f0878d865d84e90840c307e9409cec6dd3
1 /*
2 * Copyright 2014 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
20 #include "windef.h"
21 #include "winbase.h"
22 #define COBJMACROS
23 #include "objbase.h"
24 #include "rpcproxy.h"
25 #include "netlistmgr.h"
27 #include "wine/debug.h"
28 #include "netprofm_private.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(netprofm);
32 static HINSTANCE instance;
34 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
36 switch (reason)
38 case DLL_WINE_PREATTACH:
39 return FALSE; /* prefer native version */
40 case DLL_PROCESS_ATTACH:
41 instance = hinst;
42 DisableThreadLibraryCalls( hinst );
43 break;
45 return TRUE;
48 struct netprofm_cf
50 IClassFactory IClassFactory_iface;
51 HRESULT (*create_instance)(void **);
54 static inline struct netprofm_cf *impl_from_IClassFactory( IClassFactory *iface )
56 return CONTAINING_RECORD( iface, struct netprofm_cf, IClassFactory_iface );
59 static HRESULT WINAPI netprofm_cf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj )
61 if (IsEqualGUID( riid, &IID_IUnknown ) || IsEqualGUID( riid, &IID_IClassFactory ))
63 IClassFactory_AddRef( iface );
64 *ppobj = iface;
65 return S_OK;
67 FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
68 return E_NOINTERFACE;
71 static ULONG WINAPI netprofm_cf_AddRef( IClassFactory *iface )
73 return 2;
76 static ULONG WINAPI netprofm_cf_Release( IClassFactory *iface )
78 return 1;
81 static HRESULT WINAPI netprofm_cf_CreateInstance( IClassFactory *iface, LPUNKNOWN outer,
82 REFIID riid, LPVOID *obj )
84 struct netprofm_cf *factory = impl_from_IClassFactory( iface );
85 IUnknown *unk;
86 HRESULT r;
88 TRACE( "%p %s %p\n", outer, debugstr_guid(riid), obj );
90 *obj = NULL;
91 if (outer) return CLASS_E_NOAGGREGATION;
93 r = factory->create_instance( (void **)&unk );
94 if (FAILED( r ))
95 return r;
97 r = IUnknown_QueryInterface( unk, riid, obj );
98 IUnknown_Release( unk );
99 return r;
102 static HRESULT WINAPI netprofm_cf_LockServer( IClassFactory *iface, BOOL dolock )
104 FIXME( "%p, %d\n", iface, dolock );
105 return S_OK;
108 static const struct IClassFactoryVtbl netprofm_cf_vtbl =
110 netprofm_cf_QueryInterface,
111 netprofm_cf_AddRef,
112 netprofm_cf_Release,
113 netprofm_cf_CreateInstance,
114 netprofm_cf_LockServer
117 static struct netprofm_cf list_manager_cf = { { &netprofm_cf_vtbl }, list_manager_create };
119 /***********************************************************************
120 * DllGetClassObject (NETPROFM.@)
122 HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
124 IClassFactory *cf = NULL;
126 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
128 if (IsEqualGUID( rclsid, &CLSID_NetworkListManager ))
130 cf = &list_manager_cf.IClassFactory_iface;
132 if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
133 return IClassFactory_QueryInterface( cf, iid, ppv );
136 /***********************************************************************
137 * DllCanUnloadNow (NETPROFM.@)
139 HRESULT WINAPI DllCanUnloadNow( void )
141 return S_FALSE;
144 /***********************************************************************
145 * DllRegisterServer (NETPROFM.@)
147 HRESULT WINAPI DllRegisterServer( void )
149 return __wine_register_resources( instance );
152 /***********************************************************************
153 * DllUnregisterServer (NETPROFM.@)
155 HRESULT WINAPI DllUnregisterServer( void )
157 return __wine_unregister_resources( instance );