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
);
29 static HINSTANCE hInstance
;
31 /***********************************************************************
34 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
38 case DLL_PROCESS_ATTACH
:
40 DisableThreadLibraryCalls(hInstance
);
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
);
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(),
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
);
117 if (This
== NULL
) return E_POINTER
;
119 ref
= InterlockedIncrement(&This
->ref
);
123 InterlockedIncrement(&dll_refs
);
130 /**********************************************************************
131 * OBJSEL_IDsObjectPicker_Release (also IUnknown)
133 static ULONG WINAPI
OBJSEL_IDsObjectPicker_Release(IDsObjectPicker
* iface
)
135 IDsObjectPickerImpl
*This
= impl_from_IDsObjectPicker(iface
);
140 if (This
== NULL
) return E_POINTER
;
142 ref
= InterlockedDecrement(&This
->ref
);
146 InterlockedDecrement(&dll_refs
);
147 OBJSEL_IDsObjectPicker_Destroy(This
);
154 /**********************************************************************
155 * OBJSEL_IDsObjectPicker_QueryInterface (also IUnknown)
157 static HRESULT WINAPI
OBJSEL_IDsObjectPicker_QueryInterface(
158 IDsObjectPicker
* iface
,
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
))
170 OBJSEL_IDsObjectPicker_AddRef(iface
);
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
)
191 /**********************************************************************
192 * OBJSEL_IDsObjectPicker_InvokeDialog
194 static HRESULT WINAPI
OBJSEL_IDsObjectPicker_InvokeDialog(
195 IDsObjectPicker
* iface
,
197 IDataObject
** ppdoSelections
)
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(),
224 sizeof(IDsObjectPickerImpl
));
225 if (Instance
!= NULL
)
227 Instance
->IDsObjectPicker_iface
.lpVtbl
= &IDsObjectPicker_Vtbl
;
228 OBJSEL_IDsObjectPicker_AddRef(&Instance
->IDsObjectPicker_iface
);
234 return E_OUTOFMEMORY
;