msxml/tests: Use VariantInit, not VariantClear, to initialize new variants.
[wine/multimedia.git] / dlls / objsel / objsel.c
blobe99aaefbee4407fe87b80f73466de3048309ba30
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"
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(objsel);
27 LONG dll_refs = 0;
28 static HINSTANCE hInstance;
30 /***********************************************************************
31 * DllEntryPoint
33 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
35 switch(fdwReason)
37 case DLL_PROCESS_ATTACH:
38 hInstance = hinstDLL;
39 DisableThreadLibraryCalls(hInstance);
40 break;
42 return TRUE;
46 /***********************************************************************
47 * DllGetClassObject (OBJSEL.@)
49 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
51 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
53 *ppv = NULL;
55 if (IsEqualGUID(rclsid, &CLSID_DsObjectPicker))
56 return IClassFactory_QueryInterface((IClassFactory*)&OBJSEL_ClassFactory, iid, ppv);
58 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
59 return CLASS_E_CLASSNOTAVAILABLE;
63 /***********************************************************************
64 * DllCanUnloadNow (OBJSEL.@)
66 HRESULT WINAPI DllCanUnloadNow(void)
68 return dll_refs != 0 ? S_FALSE : S_OK;
72 /**********************************************************************
73 * OBJSEL_IDsObjectPicker_Destroy (also IUnknown)
75 static VOID WINAPI OBJSEL_IDsObjectPicker_Destroy(IDsObjectPickerImpl *This)
77 HeapFree(GetProcessHeap(),
79 This);
83 /**********************************************************************
84 * OBJSEL_IDsObjectPicker_AddRef (also IUnknown)
86 static ULONG WINAPI OBJSEL_IDsObjectPicker_AddRef(IDsObjectPicker * iface)
88 IDsObjectPickerImpl *This = (IDsObjectPickerImpl *)iface;
89 ULONG ref;
91 TRACE("\n");
93 if (This == NULL) return E_POINTER;
95 ref = InterlockedIncrement(&This->ref);
97 if (ref == 1)
99 InterlockedIncrement(&dll_refs);
102 return ref;
106 /**********************************************************************
107 * OBJSEL_IDsObjectPicker_Release (also IUnknown)
109 static ULONG WINAPI OBJSEL_IDsObjectPicker_Release(IDsObjectPicker * iface)
111 IDsObjectPickerImpl *This = (IDsObjectPickerImpl *)iface;
112 ULONG ref;
114 TRACE("\n");
116 if (This == NULL) return E_POINTER;
118 ref = InterlockedDecrement(&This->ref);
120 if (ref == 0)
122 InterlockedDecrement(&dll_refs);
123 OBJSEL_IDsObjectPicker_Destroy(This);
126 return ref;
130 /**********************************************************************
131 * OBJSEL_IDsObjectPicker_QueryInterface (also IUnknown)
133 static HRESULT WINAPI OBJSEL_IDsObjectPicker_QueryInterface(
134 IDsObjectPicker * iface,
135 REFIID riid,
136 LPVOID *ppvObj)
138 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
140 if (ppvObj == NULL) return E_POINTER;
142 if (IsEqualGUID(riid, &IID_IUnknown) ||
143 IsEqualGUID(riid, &IID_IDsObjectPicker))
145 *ppvObj = (LPVOID)iface;
146 OBJSEL_IDsObjectPicker_AddRef(iface);
147 return S_OK;
150 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
151 return E_NOINTERFACE;
155 /**********************************************************************
156 * OBJSEL_IDsObjectPicker_Initialize
158 static HRESULT WINAPI OBJSEL_IDsObjectPicker_Initialize(
159 IDsObjectPicker * iface,
160 PDSOP_INIT_INFO pInitInfo)
162 FIXME("stub!\n");
163 return S_OK;
167 /**********************************************************************
168 * OBJSEL_IDsObjectPicker_InvokeDialog
170 static HRESULT WINAPI OBJSEL_IDsObjectPicker_InvokeDialog(
171 IDsObjectPicker * iface,
172 HWND hwndParent,
173 IDataObject** ppdoSelections)
175 FIXME("stub!\n");
176 return S_FALSE;
180 /**********************************************************************
181 * IDsObjectPicker_Vtbl
183 static IDsObjectPickerVtbl IDsObjectPicker_Vtbl =
185 OBJSEL_IDsObjectPicker_QueryInterface,
186 OBJSEL_IDsObjectPicker_AddRef,
187 OBJSEL_IDsObjectPicker_Release,
188 OBJSEL_IDsObjectPicker_Initialize,
189 OBJSEL_IDsObjectPicker_InvokeDialog
193 /**********************************************************************
194 * OBJSEL_IDsObjectPicker_Create
196 HRESULT WINAPI OBJSEL_IDsObjectPicker_Create(LPVOID *ppvObj)
198 IDsObjectPickerImpl *Instance = HeapAlloc(GetProcessHeap(),
199 HEAP_ZERO_MEMORY,
200 sizeof(IDsObjectPickerImpl));
201 if (Instance != NULL)
203 Instance->lpVtbl = &IDsObjectPicker_Vtbl;
204 OBJSEL_IDsObjectPicker_AddRef((IDsObjectPicker *)Instance);
206 *ppvObj = Instance;
207 return S_OK;
209 else
210 return E_OUTOFMEMORY;