makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / pstorec / pstorec.c
blob02cd803c116cebb96e5f7046b7cb5b561510eae9
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 "initguid.h"
28 #include "ole2.h"
29 #include "pstore.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(pstores);
35 typedef struct
37 IPStore IPStore_iface;
38 LONG ref;
39 } PStore_impl;
41 static inline PStore_impl *impl_from_IPStore(IPStore *iface)
43 return CONTAINING_RECORD(iface, PStore_impl, IPStore_iface);
46 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
48 TRACE("%p %x %p\n", hinst, fdwReason, fImpLoad);
50 switch (fdwReason)
52 case DLL_WINE_PREATTACH:
53 return FALSE; /* prefer native version */
54 case DLL_PROCESS_ATTACH:
55 DisableThreadLibraryCalls(hinst);
56 break;
58 return TRUE;
61 /**************************************************************************
62 * IPStore->QueryInterface
64 static HRESULT WINAPI PStore_fnQueryInterface(
65 IPStore* iface,
66 REFIID riid,
67 LPVOID *ppvObj)
69 PStore_impl *This = impl_from_IPStore(iface);
71 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObj);
73 *ppvObj = NULL;
75 if (IsEqualIID(riid, &IID_IPStore) || IsEqualIID(riid, &IID_IUnknown))
77 *ppvObj = &This->IPStore_iface;
80 if (*ppvObj)
82 IUnknown_AddRef((IUnknown*)(*ppvObj));
83 return S_OK;
85 TRACE("-- Interface: E_NOINTERFACE\n");
86 return E_NOINTERFACE;
89 /******************************************************************************
90 * IPStore->AddRef
92 static ULONG WINAPI PStore_fnAddRef(IPStore* iface)
94 PStore_impl *This = impl_from_IPStore(iface);
96 TRACE("%p %u\n", This, This->ref);
98 return InterlockedIncrement( &This->ref );
101 /******************************************************************************
102 * IPStore->Release
104 static ULONG WINAPI PStore_fnRelease(IPStore* iface)
106 PStore_impl *This = impl_from_IPStore(iface);
107 LONG ref;
109 TRACE("%p %u\n", This, This->ref);
111 ref = InterlockedDecrement( &This->ref );
112 if( !ref )
113 HeapFree( GetProcessHeap(), 0, This );
115 return ref;
118 /******************************************************************************
119 * IPStore->GetInfo
121 static HRESULT WINAPI PStore_fnGetInfo( IPStore* iface, PPST_PROVIDERINFO* ppProperties)
123 FIXME("\n");
124 return E_NOTIMPL;
127 /******************************************************************************
128 * IPStore->GetProvParam
130 static HRESULT WINAPI PStore_fnGetProvParam( IPStore* iface,
131 DWORD dwParam, DWORD* pcbData, BYTE** ppbData, DWORD dwFlags)
133 FIXME("\n");
134 return E_NOTIMPL;
137 /******************************************************************************
138 * IPStore->SetProvParam
140 static HRESULT WINAPI PStore_fnSetProvParam( IPStore* This,
141 DWORD dwParam, DWORD cbData, BYTE* pbData, DWORD* dwFlags)
143 FIXME("\n");
144 return E_NOTIMPL;
147 /******************************************************************************
148 * IPStore->CreateType
150 static HRESULT WINAPI PStore_fnCreateType( IPStore* This,
151 PST_KEY Key, const GUID* pType, PPST_TYPEINFO pInfo, DWORD dwFlags)
153 FIXME("%p %08x %s %p(%d,%s) %08x\n", This, Key, debugstr_guid(pType),
154 pInfo, pInfo->cbSize, debugstr_w(pInfo->szDisplayName), dwFlags);
156 return E_NOTIMPL;
159 /******************************************************************************
160 * IPStore->GetTypeInfo
162 static HRESULT WINAPI PStore_fnGetTypeInfo( IPStore* This,
163 PST_KEY Key, const GUID* pType, PPST_TYPEINFO** ppInfo, DWORD dwFlags)
165 FIXME("\n");
166 return E_NOTIMPL;
169 /******************************************************************************
170 * IPStore->DeleteType
172 static HRESULT WINAPI PStore_fnDeleteType( IPStore* This,
173 PST_KEY Key, const GUID* pType, DWORD dwFlags)
175 FIXME("%p %d %s %08x\n", This, Key, debugstr_guid(pType), dwFlags);
176 return E_NOTIMPL;
179 /******************************************************************************
180 * IPStore->CreateSubtype
182 static HRESULT WINAPI PStore_fnCreateSubtype( IPStore* This,
183 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
184 PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
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;
191 /******************************************************************************
192 * IPStore->GetSubtypeInfo
194 static HRESULT WINAPI PStore_fnGetSubtypeInfo( IPStore* This,
195 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
196 PPST_TYPEINFO** ppInfo, DWORD dwFlags)
198 FIXME("\n");
199 return E_NOTIMPL;
202 /******************************************************************************
203 * IPStore->DeleteSubtype
205 static HRESULT WINAPI PStore_fnDeleteSubtype( IPStore* This,
206 PST_KEY Key, const GUID* pType, const GUID* pSubtype, DWORD dwFlags)
208 FIXME("%p %u %s %s %08x\n", This, Key,
209 debugstr_guid(pType), debugstr_guid(pSubtype), dwFlags);
210 return E_NOTIMPL;
213 /******************************************************************************
214 * IPStore->ReadAccessRuleset
216 static HRESULT WINAPI PStore_fnReadAccessRuleset( IPStore* This,
217 PST_KEY Key, const GUID* pType, const GUID* pSubtype, PPST_TYPEINFO pInfo,
218 PPST_ACCESSRULESET** ppRules, DWORD dwFlags)
220 FIXME("\n");
221 return E_NOTIMPL;
224 /******************************************************************************
225 * IPStore->WriteAccessRuleSet
227 static HRESULT WINAPI PStore_fnWriteAccessRuleset( IPStore* This,
228 PST_KEY Key, const GUID* pType, const GUID* pSubtype,
229 PPST_TYPEINFO pInfo, PPST_ACCESSRULESET pRules, DWORD dwFlags)
231 FIXME("\n");
232 return E_NOTIMPL;
235 /******************************************************************************
236 * IPStore->EnumTypes
238 static HRESULT WINAPI PStore_fnEnumTypes( IPStore* This, PST_KEY Key,
239 DWORD dwFlags, IEnumPStoreTypes** ppenum)
241 FIXME("\n");
242 return E_NOTIMPL;
245 /******************************************************************************
246 * IPStore->EnumSubtypes
248 static HRESULT WINAPI PStore_fnEnumSubtypes( IPStore* This, PST_KEY Key,
249 const GUID* pType, DWORD dwFlags, IEnumPStoreTypes** ppenum)
251 FIXME("\n");
252 return E_NOTIMPL;
255 /******************************************************************************
256 * IPStore->DeleteItem
258 static HRESULT WINAPI PStore_fnDeleteItem( IPStore* This, PST_KEY Key,
259 const GUID* pItemType, const GUID* pItemSubType, LPCWSTR szItemName,
260 PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
262 FIXME("\n");
263 return E_NOTIMPL;
266 /******************************************************************************
267 * IPStore->ReadItem
269 static HRESULT WINAPI PStore_fnReadItem( IPStore* This, PST_KEY Key,
270 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
271 DWORD *cbData, BYTE** pbData, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags)
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;
279 /******************************************************************************
280 * IPStore->WriteItem
282 static HRESULT WINAPI PStore_fnWriteItem( IPStore* This, PST_KEY Key,
283 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
284 DWORD cbData, BYTE* ppbData, PPST_PROMPTINFO pPromptInfo,
285 DWORD dwDefaultConfirmationStyle, DWORD dwFlags)
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;
293 /******************************************************************************
294 * IPStore->OpenItem
296 static HRESULT WINAPI PStore_fnOpenItem( IPStore* This, PST_KEY Key,
297 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR szItemName,
298 PST_ACCESSMODE ModeFlags, PPST_PROMPTINFO pPromptInfo, DWORD dwFlags )
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;
305 /******************************************************************************
306 * IPStore->CloseItem
308 static HRESULT WINAPI PStore_fnCloseItem( IPStore* This, PST_KEY Key,
309 const GUID* pItemType, const GUID* pItemSubtype, LPCWSTR* szItemName,
310 DWORD dwFlags)
312 FIXME("\n");
313 return E_NOTIMPL;
316 /******************************************************************************
317 * IPStore->EnumItems
319 static HRESULT WINAPI PStore_fnEnumItems( IPStore* This, PST_KEY Key,
320 const GUID* pItemType, const GUID* pItemSubtype, DWORD dwFlags,
321 IEnumPStoreItems** ppenum)
323 FIXME("\n");
324 return E_NOTIMPL;
328 static const IPStoreVtbl pstores_vtbl =
330 PStore_fnQueryInterface,
331 PStore_fnAddRef,
332 PStore_fnRelease,
333 PStore_fnGetInfo,
334 PStore_fnGetProvParam,
335 PStore_fnSetProvParam,
336 PStore_fnCreateType,
337 PStore_fnGetTypeInfo,
338 PStore_fnDeleteType,
339 PStore_fnCreateSubtype,
340 PStore_fnGetSubtypeInfo,
341 PStore_fnDeleteSubtype,
342 PStore_fnReadAccessRuleset,
343 PStore_fnWriteAccessRuleset,
344 PStore_fnEnumTypes,
345 PStore_fnEnumSubtypes,
346 PStore_fnDeleteItem,
347 PStore_fnReadItem,
348 PStore_fnWriteItem,
349 PStore_fnOpenItem,
350 PStore_fnCloseItem,
351 PStore_fnEnumItems
354 HRESULT WINAPI PStoreCreateInstance( IPStore** ppProvider,
355 PST_PROVIDERID* pProviderID, void* pReserved, DWORD dwFlags)
357 PStore_impl *ips;
359 TRACE("%p %s %p %08x\n", ppProvider, debugstr_guid(pProviderID), pReserved, dwFlags);
361 ips = HeapAlloc( GetProcessHeap(), 0, sizeof (PStore_impl) );
362 if( !ips )
363 return E_OUTOFMEMORY;
365 ips->IPStore_iface.lpVtbl = &pstores_vtbl;
366 ips->ref = 1;
368 *ppProvider = &ips->IPStore_iface;
370 return S_OK;
373 HRESULT WINAPI DllRegisterServer(void)
375 FIXME("\n");
376 return S_OK;
379 HRESULT WINAPI DllUnregisterServer(void)
381 FIXME("\n");
382 return S_OK;
385 /***********************************************************************
386 * DllGetClassObject (PSTOREC.@)
388 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
390 FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
391 return CLASS_E_CLASSNOTAVAILABLE;
394 HRESULT WINAPI DllCanUnloadNow(void)
396 return S_FALSE;