ddraw/tests: Add another invalid arguments test for surface QI.
[wine.git] / dlls / objsel / objsel.c
blob83a845dc8ebe9821025c3f9b6b28cd33e6c64574
1 /*
2 * Object Picker Dialog
4 * Copyright 2005 Thomas Weidenmueller <w3seek@reactos.com>
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
21 #include "objsel_private.h"
22 #include "rpcproxy.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(objsel);
28 LONG dll_refs = 0;
29 static HINSTANCE hInstance;
31 /***********************************************************************
32 * DllEntryPoint
34 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
36 switch(fdwReason)
38 case DLL_PROCESS_ATTACH:
39 hInstance = hinstDLL;
40 DisableThreadLibraryCalls(hInstance);
41 break;
43 return TRUE;
47 /***********************************************************************
48 * DllGetClassObject (OBJSEL.@)
50 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
52 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
54 *ppv = NULL;
56 if (IsEqualGUID(rclsid, &CLSID_DsObjectPicker))
57 return IClassFactory_QueryInterface(&OBJSEL_ClassFactory.IClassFactory_iface, iid, ppv);
59 FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid));
60 return CLASS_E_CLASSNOTAVAILABLE;
64 /***********************************************************************
65 * DllCanUnloadNow (OBJSEL.@)
67 HRESULT WINAPI DllCanUnloadNow(void)
69 return dll_refs != 0 ? S_FALSE : S_OK;
73 /***********************************************************************
74 * DllRegisterServer (OBJSEL.@)
76 HRESULT WINAPI DllRegisterServer(void)
78 return __wine_register_resources( hInstance );
82 /***********************************************************************
83 * DllUnregisterServer (OBJSEL.@)
85 HRESULT WINAPI DllUnregisterServer(void)
87 return __wine_unregister_resources( hInstance );
91 /**********************************************************************
92 * OBJSEL_IDsObjectPicker_Destroy (also IUnknown)
94 static VOID OBJSEL_IDsObjectPicker_Destroy(IDsObjectPickerImpl *This)
96 HeapFree(GetProcessHeap(),
98 This);
102 static inline IDsObjectPickerImpl *impl_from_IDsObjectPicker(IDsObjectPicker *iface)
104 return CONTAINING_RECORD(iface, IDsObjectPickerImpl, IDsObjectPicker_iface);
107 /**********************************************************************
108 * OBJSEL_IDsObjectPicker_AddRef (also IUnknown)
110 static ULONG WINAPI OBJSEL_IDsObjectPicker_AddRef(IDsObjectPicker * iface)
112 IDsObjectPickerImpl *This = impl_from_IDsObjectPicker(iface);
113 ULONG ref;
115 TRACE("\n");
117 if (This == NULL) return E_POINTER;
119 ref = InterlockedIncrement(&This->ref);
121 if (ref == 1)
123 InterlockedIncrement(&dll_refs);
126 return ref;
130 /**********************************************************************
131 * OBJSEL_IDsObjectPicker_Release (also IUnknown)
133 static ULONG WINAPI OBJSEL_IDsObjectPicker_Release(IDsObjectPicker * iface)
135 IDsObjectPickerImpl *This = impl_from_IDsObjectPicker(iface);
136 ULONG ref;
138 TRACE("\n");
140 if (This == NULL) return E_POINTER;
142 ref = InterlockedDecrement(&This->ref);
144 if (ref == 0)
146 InterlockedDecrement(&dll_refs);
147 OBJSEL_IDsObjectPicker_Destroy(This);
150 return ref;
154 /**********************************************************************
155 * OBJSEL_IDsObjectPicker_QueryInterface (also IUnknown)
157 static HRESULT WINAPI OBJSEL_IDsObjectPicker_QueryInterface(
158 IDsObjectPicker * iface,
159 REFIID riid,
160 LPVOID *ppvObj)
162 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
164 if (ppvObj == NULL) return E_POINTER;
166 if (IsEqualGUID(riid, &IID_IUnknown) ||
167 IsEqualGUID(riid, &IID_IDsObjectPicker))
169 *ppvObj = iface;
170 OBJSEL_IDsObjectPicker_AddRef(iface);
171 return S_OK;
174 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
175 return E_NOINTERFACE;
179 /**********************************************************************
180 * OBJSEL_IDsObjectPicker_Initialize
182 static HRESULT WINAPI OBJSEL_IDsObjectPicker_Initialize(
183 IDsObjectPicker * iface,
184 PDSOP_INIT_INFO pInitInfo)
186 FIXME("stub!\n");
187 return S_OK;
191 /**********************************************************************
192 * OBJSEL_IDsObjectPicker_InvokeDialog
194 static HRESULT WINAPI OBJSEL_IDsObjectPicker_InvokeDialog(
195 IDsObjectPicker * iface,
196 HWND hwndParent,
197 IDataObject** ppdoSelections)
199 FIXME("stub!\n");
200 return S_FALSE;
204 /**********************************************************************
205 * IDsObjectPicker_Vtbl
207 static IDsObjectPickerVtbl IDsObjectPicker_Vtbl =
209 OBJSEL_IDsObjectPicker_QueryInterface,
210 OBJSEL_IDsObjectPicker_AddRef,
211 OBJSEL_IDsObjectPicker_Release,
212 OBJSEL_IDsObjectPicker_Initialize,
213 OBJSEL_IDsObjectPicker_InvokeDialog
217 /**********************************************************************
218 * OBJSEL_IDsObjectPicker_Create
220 HRESULT WINAPI OBJSEL_IDsObjectPicker_Create(LPVOID *ppvObj)
222 IDsObjectPickerImpl *Instance = HeapAlloc(GetProcessHeap(),
223 HEAP_ZERO_MEMORY,
224 sizeof(IDsObjectPickerImpl));
225 if (Instance != NULL)
227 Instance->IDsObjectPicker_iface.lpVtbl = &IDsObjectPicker_Vtbl;
228 OBJSEL_IDsObjectPicker_AddRef(&Instance->IDsObjectPicker_iface);
230 *ppvObj = Instance;
231 return S_OK;
233 else
234 return E_OUTOFMEMORY;