comctl32: Use SetRect() instead of open coding it.
[wine.git] / dlls / pstorec / pstorec.c
blobb100a08fb2b018a5005c48721a9f5eb86d1c6361
1 /*
2 * Protected Storage (pstores)
4 * Copyright 2004 Mike McCormack for CodeWeavers
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 <stdarg.h>
23 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28 #include "pstore.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(pstores);
34 typedef struct
36 IPStore IPStore_iface;
37 LONG ref;
38 } PStore_impl;
40 static inline PStore_impl *impl_from_IPStore(IPStore *iface)
42 return CONTAINING_RECORD(iface, PStore_impl, IPStore_iface);
45 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
47 TRACE("%p %x %p\n", hinst, fdwReason, fImpLoad);
49 switch (fdwReason)
51 case DLL_WINE_PREATTACH:
52 return FALSE; /* prefer native version */
53 case DLL_PROCESS_ATTACH:
54 DisableThreadLibraryCalls(hinst);
55 break;
57 return TRUE;
60 /**************************************************************************
61 * IPStore->QueryInterface
63 static HRESULT WINAPI PStore_fnQueryInterface(
64 IPStore* iface,
65 REFIID riid,
66 LPVOID *ppvObj)
68 PStore_impl *This = impl_from_IPStore(iface);
70 TRACE("%p %s\n",This,debugstr_guid(riid));
72 *ppvObj = NULL;
74 if (IsEqualIID(riid, &IID_IUnknown))
76 *ppvObj = This;
79 if (*ppvObj)
81 IUnknown_AddRef((IUnknown*)(*ppvObj));
82 return S_OK;
84 TRACE("-- Interface: E_NOINTERFACE\n");
85 return E_NOINTERFACE;
88 /******************************************************************************
89 * IPStore->AddRef
91 static ULONG WINAPI PStore_fnAddRef(IPStore* iface)
93 PStore_impl *This = impl_from_IPStore(iface);
95 TRACE("%p %u\n", This, This->ref);
97 return InterlockedIncrement( &This->ref );
100 /******************************************************************************
101 * IPStore->Release
103 static ULONG WINAPI PStore_fnRelease(IPStore* iface)
105 PStore_impl *This = impl_from_IPStore(iface);
106 LONG ref;
108 TRACE("%p %u\n", This, This->ref);
110 ref = InterlockedDecrement( &This->ref );
111 if( !ref )
112 HeapFree( GetProcessHeap(), 0, This );
114 return ref;
117 /******************************************************************************
118 * IPStore->GetInfo
120 static HRESULT WINAPI PStore_fnGetInfo( IPStore* iface, PPST_PROVIDERINFO* ppProperties)
122 FIXME("\n");
123 return E_NOTIMPL;
126 /******************************************************************************
127 * IPStore->GetProvParam
129 static HRESULT WINAPI PStore_fnGetProvParam( IPStore* iface,
130 DWORD dwParam, DWORD* pcbData, BYTE** ppbData, DWORD dwFlags)
132 FIXME("\n");
133 return E_NOTIMPL;
136 /******************************************************************************
137 * IPStore->SetProvParam
139 static HRESULT WINAPI PStore_fnSetProvParam( IPStore* This,
140 DWORD dwParam, DWORD cbData, BYTE* pbData, DWORD* dwFlags)
142 FIXME("\n");
143 return E_NOTIMPL;
146 /******************************************************************************
147 * IPStore->CreateType
149 static HRESULT WINAPI PStore_fnCreateType( IPStore* This,
150 PST_KEY Key, const GUID* pType, PPST_TYPEINFO pInfo, DWORD dwFlags)
152 FIXME("%p %08x %s %p(%d,%s) %08x\n", This, Key, debugstr_guid(pType),
153 pInfo, pInfo->cbSize, debugstr_w(pInfo->szDisplayName), dwFlags);
155 return E_NOTIMPL;
158 /******************************************************************************
159 * IPStore->GetTypeInfo
161 static HRESULT WINAPI PStore_fnGetTypeInfo( IPStore* This,
162 PST_KEY Key, const GUID* pType, PPST_TYPEINFO** ppInfo, DWORD dwFlags)
164 FIXME("\n");
165 return E_NOTIMPL;
168 /******************************************************************************
169 * IPStore->DeleteType
171 static HRESULT WINAPI PStore_fnDeleteType( IPStore* This,
172 PST_KEY Key, const GUID* pType, DWORD dwFlags)
174 FIXME("%p %d %s %08x\n", This, Key, debugstr_guid(pType), dwFlags);
175 return E_NOTIMPL;
178 /******************************************************************************
179 * IPStore->CreateSubtype
181 static HRESULT WINAPI PStore_fnCreateSubtype( IPStore* This,
182 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
183 PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
185 FIXME("%p %08x %s %s %p %p %08x\n", This, Key, debugstr_guid(pType),
186 debugstr_guid(pSubtype), pInfo, pRules, dwFlags);
187 return E_NOTIMPL;
190 /******************************************************************************
191 * IPStore->GetSubtypeInfo
193 static HRESULT WINAPI PStore_fnGetSubtypeInfo( IPStore* This,
194 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
195 PPST_TYPEINFO** ppInfo, DWORD dwFlags)
197 FIXME("\n");
198 return E_NOTIMPL;
201 /******************************************************************************
202 * IPStore->DeleteSubtype
204 static HRESULT WINAPI PStore_fnDeleteSubtype( IPStore* This,
205 PST_KEY Key, const GUID* pType, const GUID* pSubtype, DWORD dwFlags)
207 FIXME("%p %u %s %s %08x\n", This, Key,
208 debugstr_guid(pType), debugstr_guid(pSubtype), dwFlags);
209 return E_NOTIMPL;
212 /******************************************************************************
213 * IPStore->ReadAccessRuleset
215 static HRESULT WINAPI PStore_fnReadAccessRuleset( IPStore* This,
216 PST_KEY Key, const GUID* pType, const GUID* pSubtype, PPST_TYPEINFO pInfo,
217 PPST_ACCESSRULESET** ppRules, DWORD dwFlags)
219 FIXME("\n");
220 return E_NOTIMPL;
223 /******************************************************************************
224 * IPStore->WriteAccessRuleSet
226 static HRESULT WINAPI PStore_fnWriteAccessRuleset( IPStore* This,
227 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
228 PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
230 FIXME("\n");
231 return E_NOTIMPL;
234 /******************************************************************************
235 * IPStore->EnumTypes
237 static HRESULT WINAPI PStore_fnEnumTypes( IPStore* This, PST_KEY Key,
238 DWORD dwFlags, IEnumPStoreTypes** ppenum)
240 FIXME("\n");
241 return E_NOTIMPL;
244 /******************************************************************************
245 * IPStore->EnumSubtypes
247 static HRESULT WINAPI PStore_fnEnumSubtypes( IPStore* This, PST_KEY Key,
248 const GUID* pType, DWORD dwFlags, IEnumPStoreTypes** ppenum)
250 FIXME("\n");
251 return E_NOTIMPL;
254 /******************************************************************************
255 * IPStore->DeleteItem
257 static HRESULT WINAPI PStore_fnDeleteItem( IPStore* This, PST_KEY Key,
258 const GUID* pItemType, const GUID* pItemSubType, LPCWSTR szItemName,
259 PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
261 FIXME("\n");
262 return E_NOTIMPL;
265 /******************************************************************************
266 * IPStore->ReadItem
268 static HRESULT WINAPI PStore_fnReadItem( IPStore* This, PST_KEY Key,
269 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
270 DWORD *cbData, BYTE** pbData, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
272 FIXME("%p %08x %s %s %s %p %p %p %08x\n", This, Key,
273 debugstr_guid(pItemType), debugstr_guid(pItemSubtype),
274 debugstr_w(szItemName), cbData, pbData, pPromptInfo, dwFlags);
275 return E_NOTIMPL;
278 /******************************************************************************
279 * IPStore->WriteItem
281 static HRESULT WINAPI PStore_fnWriteItem( IPStore* This, PST_KEY Key,
282 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
283 DWORD cbData, BYTE* ppbData, PPST_PROMPTINFO pPromptInfo,
284 DWORD dwDefaultConfirmationStyle, DWORD dwFlags)
286 FIXME("%p %08x %s %s %s %d %p %p %08x\n", This, Key,
287 debugstr_guid(pItemType), debugstr_guid(pItemSubtype),
288 debugstr_w(szItemName), cbData, ppbData, pPromptInfo, dwFlags);
289 return E_NOTIMPL;
292 /******************************************************************************
293 * IPStore->OpenItem
295 static HRESULT WINAPI PStore_fnOpenItem( IPStore* This, PST_KEY Key,
296 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
297 PST_ACCESSMODE ModeFlags, PPST_PROMPTINFO pProomptInfo, DWORD dwFlags )
299 FIXME("(%p,%08x,%s,%s,%s,%08x,%p,%08x) stub\n", This, Key, debugstr_guid(pItemType),
300 debugstr_guid(pItemSubtype), debugstr_w(szItemName), ModeFlags, pProomptInfo, dwFlags);
301 return E_NOTIMPL;
304 /******************************************************************************
305 * IPStore->CloseItem
307 static HRESULT WINAPI PStore_fnCloseItem( IPStore* This, PST_KEY Key,
308 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR* szItemName,
309 DWORD dwFlags)
311 FIXME("\n");
312 return E_NOTIMPL;
315 /******************************************************************************
316 * IPStore->EnumItems
318 static HRESULT WINAPI PStore_fnEnumItems( IPStore* This, PST_KEY Key,
319 const GUID* pItemType, const GUID* pItemSubtype, DWORD dwFlags,
320 IEnumPStoreItems** ppenum)
322 FIXME("\n");
323 return E_NOTIMPL;
327 static const IPStoreVtbl pstores_vtbl =
329 PStore_fnQueryInterface,
330 PStore_fnAddRef,
331 PStore_fnRelease,
332 PStore_fnGetInfo,
333 PStore_fnGetProvParam,
334 PStore_fnSetProvParam,
335 PStore_fnCreateType,
336 PStore_fnGetTypeInfo,
337 PStore_fnDeleteType,
338 PStore_fnCreateSubtype,
339 PStore_fnGetSubtypeInfo,
340 PStore_fnDeleteSubtype,
341 PStore_fnReadAccessRuleset,
342 PStore_fnWriteAccessRuleset,
343 PStore_fnEnumTypes,
344 PStore_fnEnumSubtypes,
345 PStore_fnDeleteItem,
346 PStore_fnReadItem,
347 PStore_fnWriteItem,
348 PStore_fnOpenItem,
349 PStore_fnCloseItem,
350 PStore_fnEnumItems
353 HRESULT WINAPI PStoreCreateInstance( IPStore** ppProvider,
354 PST_PROVIDERID* pProviderID, void* pReserved, DWORD dwFlags)
356 PStore_impl *ips;
358 TRACE("%p %s %p %08x\n", ppProvider, debugstr_guid(pProviderID), pReserved, dwFlags);
360 ips = HeapAlloc( GetProcessHeap(), 0, sizeof (PStore_impl) );
361 if( !ips )
362 return E_OUTOFMEMORY;
364 ips->IPStore_iface.lpVtbl = &pstores_vtbl;
365 ips->ref = 1;
367 *ppProvider = (IPStore*) ips;
369 return S_OK;
372 HRESULT WINAPI DllRegisterServer(void)
374 FIXME("\n");
375 return S_OK;
378 HRESULT WINAPI DllUnregisterServer(void)
380 FIXME("\n");
381 return S_OK;
384 /***********************************************************************
385 * DllGetClassObject (PSTOREC.@)
387 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
389 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
390 return CLASS_E_CLASSNOTAVAILABLE;
393 HRESULT WINAPI DllCanUnloadNow(void)
395 return S_FALSE;