oleaut32/tests: Test more return values.
[wine.git] / dlls / wpc / wpc.c
blobef2d6dd7d1c5dbe50320ca74d01bc11544c893c7
1 /*
2 * Copyright 2016 Jacek Caban 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 #define COBJMACROS
21 #include "initguid.h"
22 #include "wpcapi.h"
23 #include "rpcproxy.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(wpc);
29 static HINSTANCE wpc_instance;
31 static HRESULT WINAPI WindowsParentalControls_QueryInterface(IWindowsParentalControls *iface, REFIID riid, void **ppv)
33 if(IsEqualGUID(riid, &IID_IUnknown)) {
34 TRACE("(IID_IUnknown %p)\n", ppv);
35 *ppv = iface;
36 }else if(IsEqualGUID(riid, &IID_IWindowsParentalControlsCore)) {
37 TRACE("(IID_IWindowsParentalControlsCore %p)\n", ppv);
38 *ppv = iface;
39 }else if(IsEqualGUID(riid, &IID_IWindowsParentalControls)) {
40 TRACE("(IID_IWindowsParentalControls %p)\n", ppv);
41 *ppv = iface;
42 }else {
43 FIXME("unsupported iface %s\n", debugstr_guid(riid));
44 *ppv = NULL;
45 return E_NOINTERFACE;
48 IUnknown_AddRef((IUnknown*)*ppv);
49 return S_OK;
52 static ULONG WINAPI WindowsParentalControls_AddRef(IWindowsParentalControls *iface)
54 return 2;
57 static ULONG WINAPI WindowsParentalControls_Release(IWindowsParentalControls *iface)
59 return 1;
62 static HRESULT WINAPI WindowsParentalControls_GetVisibility(IWindowsParentalControls *iface, WPCFLAG_VISIBILITY *visibility)
64 FIXME("(%p)\n", visibility);
65 return E_NOTIMPL;
68 static HRESULT WINAPI WindowsParentalControls_GetUserSettings(IWindowsParentalControls *iface, const WCHAR *sid, IWPCSettings **settings)
70 FIXME("(%s %p)\n", debugstr_w(sid), settings);
71 return E_NOTIMPL;
74 static HRESULT WINAPI WindowsParentalControls_GetWebSettings(IWindowsParentalControls *iface, const WCHAR *sid, IWPCWebSettings **settings)
76 FIXME("(%s %p)\n", debugstr_w(sid), settings);
77 return E_NOTIMPL;
80 static HRESULT WINAPI WindowsParentalControls_GetWebFilterInfo(IWindowsParentalControls *iface, GUID *id, WCHAR **name)
82 FIXME("(%p %p)\n", id, name);
83 return E_NOTIMPL;
86 static HRESULT WINAPI WindowsParentalControls_GetGamesSettings(IWindowsParentalControls *iface, const WCHAR *sid, IWPCGamesSettings **settings)
88 FIXME("(%s %p)\n", debugstr_w(sid), settings);
89 return E_NOTIMPL;
92 static const IWindowsParentalControlsVtbl WindowsParentalControlsVtbl = {
93 WindowsParentalControls_QueryInterface,
94 WindowsParentalControls_AddRef,
95 WindowsParentalControls_Release,
96 WindowsParentalControls_GetVisibility,
97 WindowsParentalControls_GetUserSettings,
98 WindowsParentalControls_GetWebSettings,
99 WindowsParentalControls_GetWebFilterInfo,
100 WindowsParentalControls_GetGamesSettings
103 static HRESULT WINAPI WindowsParentalControls_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
105 static IWindowsParentalControls wpc = { &WindowsParentalControlsVtbl };
107 TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
109 return IWindowsParentalControls_QueryInterface(&wpc, riid, ppv);
112 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
114 *ppv = NULL;
116 if(IsEqualGUID(&IID_IUnknown, riid)) {
117 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
118 *ppv = iface;
119 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
120 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
121 *ppv = iface;
124 if(*ppv) {
125 IUnknown_AddRef((IUnknown*)*ppv);
126 return S_OK;
129 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
130 return E_NOINTERFACE;
133 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
135 TRACE("(%p)\n", iface);
136 return 2;
139 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
141 TRACE("(%p)\n", iface);
142 return 1;
145 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
147 TRACE("(%p)->(%x)\n", iface, fLock);
148 return S_OK;
151 static const IClassFactoryVtbl WPCFactoryVtbl = {
152 ClassFactory_QueryInterface,
153 ClassFactory_AddRef,
154 ClassFactory_Release,
155 WindowsParentalControls_CreateInstance,
156 ClassFactory_LockServer
159 static IClassFactory WPCFactory = { &WPCFactoryVtbl };
161 /******************************************************************
162 * DllMain
164 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
166 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpv);
168 switch(fdwReason) {
169 case DLL_WINE_PREATTACH:
170 return FALSE; /* prefer native version */
171 case DLL_PROCESS_ATTACH:
172 DisableThreadLibraryCalls(hInstDLL);
173 wpc_instance = hInstDLL;
174 break;
177 return TRUE;
180 /***********************************************************************
181 * DllGetClassObject (wpc.@)
183 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
185 if(IsEqualGUID(&CLSID_WindowsParentalControls, rclsid)) {
186 TRACE("(CLSID_WindowsParentalControls %s %p)\n", debugstr_guid(riid), ppv);
187 return IClassFactory_QueryInterface(&WPCFactory, riid, ppv);
190 FIXME("Unknown object %s (iface %s)\n", debugstr_guid(rclsid), debugstr_guid(riid));
191 return CLASS_E_CLASSNOTAVAILABLE;
194 /***********************************************************************
195 * DllCanUnloadNow (wpc.@)
197 HRESULT WINAPI DllCanUnloadNow(void)
199 TRACE("\n");
200 return S_FALSE;
203 /***********************************************************************
204 * DllRegisterServer (wpc.@)
206 HRESULT WINAPI DllRegisterServer(void)
208 TRACE("()\n");
209 return __wine_register_resources(wpc_instance);
212 /***********************************************************************
213 * DllUnregisterServer (wpc.@)
215 HRESULT WINAPI DllUnregisterServer(void)
217 TRACE("()\n");
218 return __wine_unregister_resources(wpc_instance);