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);
28 static HINSTANCE hInstance;
30 /***********************************************************************
33 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
37 case DLL_PROCESS_ATTACH:
39 DisableThreadLibraryCalls(hInstance);
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);
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 OBJSEL_IDsObjectPicker_Destroy(IDsObjectPickerImpl *This)
77 HeapFree(GetProcessHeap(),
83 /**********************************************************************
84 * OBJSEL_IDsObjectPicker_AddRef (also IUnknown)
86 static ULONG WINAPI OBJSEL_IDsObjectPicker_AddRef(IDsObjectPicker * iface)
88 IDsObjectPickerImpl *This = (IDsObjectPickerImpl *)iface;
93 if (This == NULL) return E_POINTER;
95 ref = InterlockedIncrement(&This->ref);
99 InterlockedIncrement(&dll_refs);
106 /**********************************************************************
107 * OBJSEL_IDsObjectPicker_Release (also IUnknown)
109 static ULONG WINAPI OBJSEL_IDsObjectPicker_Release(IDsObjectPicker * iface)
111 IDsObjectPickerImpl *This = (IDsObjectPickerImpl *)iface;
116 if (This == NULL) return E_POINTER;
118 ref = InterlockedDecrement(&This->ref);
122 InterlockedDecrement(&dll_refs);
123 OBJSEL_IDsObjectPicker_Destroy(This);
130 /**********************************************************************
131 * OBJSEL_IDsObjectPicker_QueryInterface (also IUnknown)
133 static HRESULT WINAPI OBJSEL_IDsObjectPicker_QueryInterface(
134 IDsObjectPicker * iface,
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);
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)
167 /**********************************************************************
168 * OBJSEL_IDsObjectPicker_InvokeDialog
170 static HRESULT WINAPI OBJSEL_IDsObjectPicker_InvokeDialog(
171 IDsObjectPicker * iface,
173 IDataObject** ppdoSelections)
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(),
200 sizeof(IDsObjectPickerImpl));
201 if (Instance != NULL)
203 Instance->lpVtbl = &IDsObjectPicker_Vtbl;
204 OBJSEL_IDsObjectPicker_AddRef((IDsObjectPicker *)Instance);
210 return E_OUTOFMEMORY;