ReactOS 0.4.15-dev-8222-g9164419
pstorec.c
Go to the documentation of this file.
1/*
2 * Protected Storage (pstores)
3 *
4 * Copyright 2004 Mike McCormack for CodeWeavers
5 *
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.
10 *
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.
15 *
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
19 */
20
21#include <stdarg.h>
22
23#define COBJMACROS
24#include "windef.h"
25#include "winbase.h"
26#include "winuser.h"
27#include "initguid.h"
28#include "ole2.h"
29#include "pstore.h"
30
31#include "wine/debug.h"
32
34
35typedef struct
36{
40
41static inline PStore_impl *impl_from_IPStore(IPStore *iface)
42{
43 return CONTAINING_RECORD(iface, PStore_impl, IPStore_iface);
44}
45
47{
48 TRACE("%p %x %p\n", hinst, fdwReason, fImpLoad);
49
50 switch (fdwReason)
51 {
52 case DLL_WINE_PREATTACH:
53 return FALSE; /* prefer native version */
56 break;
57 }
58 return TRUE;
59}
60
61/**************************************************************************
62 * IPStore->QueryInterface
63 */
65 IPStore* iface,
67 LPVOID *ppvObj)
68{
70
71 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObj);
72
73 *ppvObj = NULL;
74
75 if (IsEqualIID(riid, &IID_IPStore) || IsEqualIID(riid, &IID_IUnknown))
76 {
77 *ppvObj = &This->IPStore_iface;
78 }
79
80 if (*ppvObj)
81 {
82 IUnknown_AddRef((IUnknown*)(*ppvObj));
83 return S_OK;
84 }
85 TRACE("-- Interface: E_NOINTERFACE\n");
86 return E_NOINTERFACE;
87}
88
89/******************************************************************************
90 * IPStore->AddRef
91 */
92static ULONG WINAPI PStore_fnAddRef(IPStore* iface)
93{
95
96 TRACE("%p %u\n", This, This->ref);
97
98 return InterlockedIncrement( &This->ref );
99}
100
101/******************************************************************************
102 * IPStore->Release
103 */
104static ULONG WINAPI PStore_fnRelease(IPStore* iface)
105{
107 LONG ref;
108
109 TRACE("%p %u\n", This, This->ref);
110
111 ref = InterlockedDecrement( &This->ref );
112 if( !ref )
114
115 return ref;
116}
117
118/******************************************************************************
119 * IPStore->GetInfo
120 */
121static HRESULT WINAPI PStore_fnGetInfo( IPStore* iface, PPST_PROVIDERINFO* ppProperties)
122{
123 FIXME("\n");
124 return E_NOTIMPL;
125}
126
127/******************************************************************************
128 * IPStore->GetProvParam
129 */
130static HRESULT WINAPI PStore_fnGetProvParam( IPStore* iface,
131 DWORD dwParam, DWORD* pcbData, BYTE** ppbData, DWORD dwFlags)
132{
133 FIXME("\n");
134 return E_NOTIMPL;
135}
136
137/******************************************************************************
138 * IPStore->SetProvParam
139 */
141 DWORD dwParam, DWORD cbData, BYTE* pbData, DWORD* dwFlags)
142{
143 FIXME("\n");
144 return E_NOTIMPL;
145}
146
147/******************************************************************************
148 * IPStore->CreateType
149 */
151 PST_KEY Key, const GUID* pType, PPST_TYPEINFO pInfo, DWORD dwFlags)
152{
153 FIXME("%p %08x %s %p(%d,%s) %08x\n", This, Key, debugstr_guid(pType),
154 pInfo, pInfo->cbSize, debugstr_w(pInfo->szDisplayName), dwFlags);
155
156 return E_NOTIMPL;
157}
158
159/******************************************************************************
160 * IPStore->GetTypeInfo
161 */
163 PST_KEY Key, const GUID* pType, PPST_TYPEINFO** ppInfo, DWORD dwFlags)
164{
165 FIXME("\n");
166 return E_NOTIMPL;
167}
168
169/******************************************************************************
170 * IPStore->DeleteType
171 */
173 PST_KEY Key, const GUID* pType, DWORD dwFlags)
174{
175 FIXME("%p %d %s %08x\n", This, Key, debugstr_guid(pType), dwFlags);
176 return E_NOTIMPL;
177}
178
179/******************************************************************************
180 * IPStore->CreateSubtype
181 */
183 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
184 PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
185{
186 FIXME("%p %08x %s %s %p %p %08x\n", This, Key, debugstr_guid(pType),
187 debugstr_guid(pSubtype), pInfo, pRules, dwFlags);
188 return E_NOTIMPL;
189}
190
191/******************************************************************************
192 * IPStore->GetSubtypeInfo
193 */
195 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
196 PPST_TYPEINFO** ppInfo, DWORD dwFlags)
197{
198 FIXME("\n");
199 return E_NOTIMPL;
200}
201
202/******************************************************************************
203 * IPStore->DeleteSubtype
204 */
206 PST_KEY Key, const GUID* pType, const GUID* pSubtype, DWORD dwFlags)
207{
208 FIXME("%p %u %s %s %08x\n", This, Key,
209 debugstr_guid(pType), debugstr_guid(pSubtype), dwFlags);
210 return E_NOTIMPL;
211}
212
213/******************************************************************************
214 * IPStore->ReadAccessRuleset
215 */
217 PST_KEY Key, const GUID* pType, const GUID* pSubtype, PPST_TYPEINFO pInfo,
218 PPST_ACCESSRULESET** ppRules, DWORD dwFlags)
219{
220 FIXME("\n");
221 return E_NOTIMPL;
222}
223
224/******************************************************************************
225 * IPStore->WriteAccessRuleSet
226 */
228 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
229 PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
230{
231 FIXME("\n");
232 return E_NOTIMPL;
233}
234
235/******************************************************************************
236 * IPStore->EnumTypes
237 */
239 DWORD dwFlags, IEnumPStoreTypes** ppenum)
240{
241 FIXME("\n");
242 return E_NOTIMPL;
243}
244
245/******************************************************************************
246 * IPStore->EnumSubtypes
247 */
249 const GUID* pType, DWORD dwFlags, IEnumPStoreTypes** ppenum)
250{
251 FIXME("\n");
252 return E_NOTIMPL;
253}
254
255/******************************************************************************
256 * IPStore->DeleteItem
257 */
259 const GUID* pItemType, const GUID* pItemSubType, LPCWSTR szItemName,
260 PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
261{
262 FIXME("\n");
263 return E_NOTIMPL;
264}
265
266/******************************************************************************
267 * IPStore->ReadItem
268 */
270 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
271 DWORD *cbData, BYTE** pbData, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
272{
273 FIXME("%p %08x %s %s %s %p %p %p %08x\n", This, Key,
274 debugstr_guid(pItemType), debugstr_guid(pItemSubtype),
275 debugstr_w(szItemName), cbData, pbData, pPromptInfo, dwFlags);
276 return E_NOTIMPL;
277}
278
279/******************************************************************************
280 * IPStore->WriteItem
281 */
283 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
284 DWORD cbData, BYTE* ppbData, PPST_PROMPTINFO pPromptInfo,
285 DWORD dwDefaultConfirmationStyle, DWORD dwFlags)
286{
287 FIXME("%p %08x %s %s %s %d %p %p %08x\n", This, Key,
288 debugstr_guid(pItemType), debugstr_guid(pItemSubtype),
289 debugstr_w(szItemName), cbData, ppbData, pPromptInfo, dwFlags);
290 return E_NOTIMPL;
291}
292
293/******************************************************************************
294 * IPStore->OpenItem
295 */
297 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
298 PST_ACCESSMODE ModeFlags, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags )
299{
300 FIXME("(%p,%08x,%s,%s,%s,%08x,%p,%08x) stub\n", This, Key, debugstr_guid(pItemType),
301 debugstr_guid(pItemSubtype), debugstr_w(szItemName), ModeFlags, pPromptInfo, dwFlags);
302 return E_NOTIMPL;
303}
304
305/******************************************************************************
306 * IPStore->CloseItem
307 */
309 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR* szItemName,
311{
312 FIXME("\n");
313 return E_NOTIMPL;
314}
315
316/******************************************************************************
317 * IPStore->EnumItems
318 */
320 const GUID* pItemType, const GUID* pItemSubtype, DWORD dwFlags,
321 IEnumPStoreItems** ppenum)
322{
323 FIXME("\n");
324 return E_NOTIMPL;
325}
326
327
328static const IPStoreVtbl pstores_vtbl =
329{
352};
353
354HRESULT WINAPI PStoreCreateInstance( IPStore** ppProvider,
355 PST_PROVIDERID* pProviderID, void* pReserved, DWORD dwFlags)
356{
357 PStore_impl *ips;
358
359 TRACE("%p %s %p %08x\n", ppProvider, debugstr_guid(pProviderID), pReserved, dwFlags);
360
361 ips = HeapAlloc( GetProcessHeap(), 0, sizeof (PStore_impl) );
362 if( !ips )
363 return E_OUTOFMEMORY;
364
365 ips->IPStore_iface.lpVtbl = &pstores_vtbl;
366 ips->ref = 1;
367
368 *ppProvider = &ips->IPStore_iface;
369
370 return S_OK;
371}
372
374{
375 FIXME("\n");
376 return S_OK;
377}
378
380{
381 FIXME("\n");
382 return S_OK;
383}
384
385/***********************************************************************
386 * DllGetClassObject (PSTOREC.@)
387 */
389{
390 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
392}
393
395{
396 return S_FALSE;
397}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
DWORD LPVOID fImpLoad
Definition: misc.cpp:155
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:114
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
static HINSTANCE hinst
Definition: edit.c:551
long LONG
Definition: pedump.c:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
DWORD PST_KEY
Definition: pstore.idl:33
DWORD PST_ACCESSMODE
Definition: pstore.idl:31
static HRESULT WINAPI PStore_fnGetInfo(IPStore *iface, PPST_PROVIDERINFO *ppProperties)
Definition: pstorec.c:121
HRESULT WINAPI DllRegisterServer(void)
Definition: pstorec.c:373
static HRESULT WINAPI PStore_fnGetTypeInfo(IPStore *This, PST_KEY Key, const GUID *pType, PPST_TYPEINFO **ppInfo, DWORD dwFlags)
Definition: pstorec.c:162
static HRESULT WINAPI PStore_fnCreateSubtype(IPStore *This, PST_KEY Key, const GUID *pType, const GUID *pSubtype, PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
Definition: pstorec.c:182
static HRESULT WINAPI PStore_fnEnumItems(IPStore *This, PST_KEY Key, const GUID *pItemType, const GUID *pItemSubtype, DWORD dwFlags, IEnumPStoreItems **ppenum)
Definition: pstorec.c:319
static ULONG WINAPI PStore_fnRelease(IPStore *iface)
Definition: pstorec.c:104
static HRESULT WINAPI PStore_fnQueryInterface(IPStore *iface, REFIID riid, LPVOID *ppvObj)
Definition: pstorec.c:64
static const IPStoreVtbl pstores_vtbl
Definition: pstorec.c:328
static HRESULT WINAPI PStore_fnDeleteItem(IPStore *This, PST_KEY Key, const GUID *pItemType, const GUID *pItemSubType, LPCWSTR szItemName, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
Definition: pstorec.c:258
static HRESULT WINAPI PStore_fnGetSubtypeInfo(IPStore *This, PST_KEY Key, const GUID *pType, const GUID *pSubtype, PPST_TYPEINFO **ppInfo, DWORD dwFlags)
Definition: pstorec.c:194
static HRESULT WINAPI PStore_fnReadItem(IPStore *This, PST_KEY Key, const GUID *pItemType, const GUID *pItemSubtype, LPCWSTR szItemName, DWORD *cbData, BYTE **pbData, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
Definition: pstorec.c:269
static HRESULT WINAPI PStore_fnReadAccessRuleset(IPStore *This, PST_KEY Key, const GUID *pType, const GUID *pSubtype, PPST_TYPEINFO pInfo, PPST_ACCESSRULESET **ppRules, DWORD dwFlags)
Definition: pstorec.c:216
HRESULT WINAPI DllUnregisterServer(void)
Definition: pstorec.c:379
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
Definition: pstorec.c:46
static HRESULT WINAPI PStore_fnGetProvParam(IPStore *iface, DWORD dwParam, DWORD *pcbData, BYTE **ppbData, DWORD dwFlags)
Definition: pstorec.c:130
static HRESULT WINAPI PStore_fnDeleteType(IPStore *This, PST_KEY Key, const GUID *pType, DWORD dwFlags)
Definition: pstorec.c:172
HRESULT WINAPI PStoreCreateInstance(IPStore **ppProvider, PST_PROVIDERID *pProviderID, void *pReserved, DWORD dwFlags)
Definition: pstorec.c:354
static HRESULT WINAPI PStore_fnOpenItem(IPStore *This, PST_KEY Key, const GUID *pItemType, const GUID *pItemSubtype, LPCWSTR szItemName, PST_ACCESSMODE ModeFlags, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
Definition: pstorec.c:296
static HRESULT WINAPI PStore_fnSetProvParam(IPStore *This, DWORD dwParam, DWORD cbData, BYTE *pbData, DWORD *dwFlags)
Definition: pstorec.c:140
static HRESULT WINAPI PStore_fnCloseItem(IPStore *This, PST_KEY Key, const GUID *pItemType, const GUID *pItemSubtype, LPCWSTR *szItemName, DWORD dwFlags)
Definition: pstorec.c:308
static ULONG WINAPI PStore_fnAddRef(IPStore *iface)
Definition: pstorec.c:92
static HRESULT WINAPI PStore_fnCreateType(IPStore *This, PST_KEY Key, const GUID *pType, PPST_TYPEINFO pInfo, DWORD dwFlags)
Definition: pstorec.c:150
static PStore_impl * impl_from_IPStore(IPStore *iface)
Definition: pstorec.c:41
HRESULT WINAPI DllCanUnloadNow(void)
Definition: pstorec.c:394
static HRESULT WINAPI PStore_fnEnumTypes(IPStore *This, PST_KEY Key, DWORD dwFlags, IEnumPStoreTypes **ppenum)
Definition: pstorec.c:238
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
Definition: pstorec.c:388
static HRESULT WINAPI PStore_fnEnumSubtypes(IPStore *This, PST_KEY Key, const GUID *pType, DWORD dwFlags, IEnumPStoreTypes **ppenum)
Definition: pstorec.c:248
static HRESULT WINAPI PStore_fnWriteAccessRuleset(IPStore *This, PST_KEY Key, const GUID *pType, const GUID *pSubtype, PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
Definition: pstorec.c:227
static HRESULT WINAPI PStore_fnDeleteSubtype(IPStore *This, PST_KEY Key, const GUID *pType, const GUID *pSubtype, DWORD dwFlags)
Definition: pstorec.c:205
static HRESULT WINAPI PStore_fnWriteItem(IPStore *This, PST_KEY Key, const GUID *pItemType, const GUID *pItemSubtype, LPCWSTR szItemName, DWORD cbData, BYTE *ppbData, PPST_PROMPTINFO pPromptInfo, DWORD dwDefaultConfirmationStyle, DWORD dwFlags)
Definition: pstorec.c:282
#define TRACE(s)
Definition: solgame.cpp:4
LONG ref
Definition: pstorec.c:38
IPStore IPStore_iface
Definition: pstorec.c:37
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_updates_bytes_to_ pdwDataLen BYTE * pbData
Definition: wincrypt.h:4201
_In_ DWORD _Out_writes_bytes_to_opt_ pcbData void _Inout_ DWORD * pcbData
Definition: wincrypt.h:4950
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193