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"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(objsel
);
30 /***********************************************************************
31 * DllGetClassObject (OBJSEL.@)
33 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
35 TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
39 if (IsEqualGUID(rclsid
, &CLSID_DsObjectPicker
))
40 return IClassFactory_QueryInterface(&OBJSEL_ClassFactory
.IClassFactory_iface
, iid
, ppv
);
42 FIXME("CLSID: %s, IID: %s\n", debugstr_guid(rclsid
), debugstr_guid(iid
));
43 return CLASS_E_CLASSNOTAVAILABLE
;
47 /***********************************************************************
48 * DllCanUnloadNow (OBJSEL.@)
50 HRESULT WINAPI
DllCanUnloadNow(void)
52 return dll_refs
!= 0 ? S_FALSE
: S_OK
;
56 /**********************************************************************
57 * OBJSEL_IDsObjectPicker_Destroy (also IUnknown)
59 static VOID
OBJSEL_IDsObjectPicker_Destroy(IDsObjectPickerImpl
*This
)
61 HeapFree(GetProcessHeap(),
67 static inline IDsObjectPickerImpl
*impl_from_IDsObjectPicker(IDsObjectPicker
*iface
)
69 return CONTAINING_RECORD(iface
, IDsObjectPickerImpl
, IDsObjectPicker_iface
);
72 /**********************************************************************
73 * OBJSEL_IDsObjectPicker_AddRef (also IUnknown)
75 static ULONG WINAPI
OBJSEL_IDsObjectPicker_AddRef(IDsObjectPicker
* iface
)
77 IDsObjectPickerImpl
*This
= impl_from_IDsObjectPicker(iface
);
82 if (This
== NULL
) return E_POINTER
;
84 ref
= InterlockedIncrement(&This
->ref
);
88 InterlockedIncrement(&dll_refs
);
95 /**********************************************************************
96 * OBJSEL_IDsObjectPicker_Release (also IUnknown)
98 static ULONG WINAPI
OBJSEL_IDsObjectPicker_Release(IDsObjectPicker
* iface
)
100 IDsObjectPickerImpl
*This
= impl_from_IDsObjectPicker(iface
);
105 if (This
== NULL
) return E_POINTER
;
107 ref
= InterlockedDecrement(&This
->ref
);
111 InterlockedDecrement(&dll_refs
);
112 OBJSEL_IDsObjectPicker_Destroy(This
);
119 /**********************************************************************
120 * OBJSEL_IDsObjectPicker_QueryInterface (also IUnknown)
122 static HRESULT WINAPI
OBJSEL_IDsObjectPicker_QueryInterface(
123 IDsObjectPicker
* iface
,
127 TRACE("\n\tIID:\t%s\n",debugstr_guid(riid
));
129 if (ppvObj
== NULL
) return E_POINTER
;
131 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
132 IsEqualGUID(riid
, &IID_IDsObjectPicker
))
135 OBJSEL_IDsObjectPicker_AddRef(iface
);
139 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
140 return E_NOINTERFACE
;
144 /**********************************************************************
145 * OBJSEL_IDsObjectPicker_Initialize
147 static HRESULT WINAPI
OBJSEL_IDsObjectPicker_Initialize(
148 IDsObjectPicker
* iface
,
149 PDSOP_INIT_INFO pInitInfo
)
156 /**********************************************************************
157 * OBJSEL_IDsObjectPicker_InvokeDialog
159 static HRESULT WINAPI
OBJSEL_IDsObjectPicker_InvokeDialog(
160 IDsObjectPicker
* iface
,
162 IDataObject
** ppdoSelections
)
169 /**********************************************************************
170 * IDsObjectPicker_Vtbl
172 static IDsObjectPickerVtbl IDsObjectPicker_Vtbl
=
174 OBJSEL_IDsObjectPicker_QueryInterface
,
175 OBJSEL_IDsObjectPicker_AddRef
,
176 OBJSEL_IDsObjectPicker_Release
,
177 OBJSEL_IDsObjectPicker_Initialize
,
178 OBJSEL_IDsObjectPicker_InvokeDialog
182 /**********************************************************************
183 * OBJSEL_IDsObjectPicker_Create
185 HRESULT WINAPI
OBJSEL_IDsObjectPicker_Create(LPVOID
*ppvObj
)
187 IDsObjectPickerImpl
*Instance
= HeapAlloc(GetProcessHeap(),
189 sizeof(IDsObjectPickerImpl
));
190 if (Instance
!= NULL
)
192 Instance
->IDsObjectPicker_iface
.lpVtbl
= &IDsObjectPicker_Vtbl
;
193 OBJSEL_IDsObjectPicker_AddRef(&Instance
->IDsObjectPicker_iface
);
199 return E_OUTOFMEMORY
;