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
UniPStoreGen::haschildren
virtual bool haschildren(const UniConfKey &key)
Returns true if a key has children.
Definition: unipstoregen.cc:192
UniPStoreGen::flush_buffers
virtual void flush_buffers()
Flushes any commitment/notification buffers .
Definition: unipstoregen.h:54
UniPStoreGen::setv
virtual void setv(const UniConfPairList &pairs)
Stores multiple key-value pairs into the registry.
Definition: unipstoregen.cc:181
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
WvLog
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition: wvlog.h:56
UniPStoreGen::get
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
Definition: unipstoregen.cc:121
UniPStoreGen::set
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
Definition: unipstoregen.cc:154
UniConfKey
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
Definition: uniconfkey.h:38
UniPStoreGen::iterator
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
Definition: unipstoregen.cc:197
UniConfGen
A default implementation of IUniConfGen, providing various handy features that save trouble when impl...
Definition: uniconfgen.h:199
UniPStoreGen::exists
virtual bool exists(const UniConfKey &key)
Without fetching its value, returns true if a key exists.
Definition: unipstoregen.cc:187
_GUID
The structure underlying UUIDs.
Definition: uuid.h:94
UniPStoreGen
A generator that exposes Windows protected storage.
Definition: unipstoregen.h:42
UniPStoreGen::isok
virtual bool isok()
Determines if the generator is usable and working properly.
Definition: unipstoregen.cc:115