WvStreams
unipstoregen.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2003 Net Integration Technologies, Inc.
4  *
5  * A generator that exposes Windows protected storage.
6  *
7  * When linking statically, use the following #pragma to ensure this
8  * generator gets registered:
9  * #pragma comment(linker, "/include:?UniPStoreGenMoniker@@3V?$WvMoniker@VUniConfGen@@@@A")
10  */
11 
12 #ifndef __UNICONFPSTORE_H
13 #define __UNICONFPSTORE_H
14 
15 #include "uniconfgen.h"
16 #include "wvlog.h"
17 #include "windows.h"
18 
19 #include "pstorec.tlh"
20 
21 #define PST_KEY_CURRENT_USER 0x00000000 // Specifies that the storage is maintained in the current user section of the registry.
22 #define PST_KEY_LOCAL_MACHINE 0x00000001 // Specifies that the storage is maintained in the local machine section of the registry.
23 
24 #define PST_E_OK 0x00000000L // The operation was successful.
25 #define PST_E_TYPE_EXISTS 0x800C0004L // The data item already exists in the protected storage.
26 #define PST_E_UNKNOWN_TYPE 0x800C0005L
27 #define PST_E_NOT_FOUND 0x800C0010L
28 
29 #define PST_PF_ALWAYS_SHOW 0x00000001 // Requests that the provider show the prompt dialog to the user even if not required for this access.
30 #define PST_PF_NEVER_SHOW 0x00000002 // Do not show the prompt dialog to the user.
31 
32 #define PST_CF_DEFAULT 0x00000000 // Allows user to choose confirmation style.
33 #define PST_CF_NONE 0x00000001 // Forces silent item creation.
34 
42 class UniPStoreGen : public UniConfGen
43 {
44 private:
45  WvLog m_log;
46  HMODULE m_hPstoreDLL;
47  PSTORECLib::IPStorePtr m_spPStore;
48  GUID m_type, m_subtype;
49  DWORD m_key;
50 
51  HRESULT create_types(WvString type_name, WvString subtype_name);
52 
53 protected:
54  virtual void flush_buffers() { }
55 
56 public:
57  UniPStoreGen(WvString _base);
58  virtual ~UniPStoreGen();
59 
60  /***** Overridden methods *****/
61 
62  virtual bool isok();
63  virtual WvString get(const UniConfKey &key);
64  virtual void set(const UniConfKey &key, WvStringParm value);
65  virtual void setv(const UniConfPairList &pairs);
66  virtual bool exists(const UniConfKey &key);
67  virtual bool haschildren(const UniConfKey &key);
68  virtual Iter *iterator(const UniConfKey &key);
69 };
70 
71 
72 #endif // __UNICONFPSTORE_H