WvStreams
unipstoregen.h
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2003 Net Integration Technologies, Inc.
00004  *
00005  * A generator that exposes Windows protected storage.
00006  *
00007  * When linking statically, use the following #pragma to ensure this 
00008  * generator gets registered:
00009  * #pragma comment(linker, "/include:?UniPStoreGenMoniker@@3V?$WvMoniker@VUniConfGen@@@@A")
00010  */
00011 
00012 #ifndef __UNICONFPSTORE_H
00013 #define __UNICONFPSTORE_H
00014 
00015 #include "uniconfgen.h"
00016 #include "wvlog.h"
00017 #include "windows.h"
00018 
00019 #include "pstorec.tlh"
00020 
00021 #define PST_KEY_CURRENT_USER 0x00000000 // Specifies that the storage is maintained in the current user section of the registry.
00022 #define PST_KEY_LOCAL_MACHINE 0x00000001 // Specifies that the storage is maintained in the local machine section of the registry.
00023 
00024 #define PST_E_OK 0x00000000L // The operation was successful.
00025 #define PST_E_TYPE_EXISTS 0x800C0004L // The data item already exists in the protected storage.
00026 #define PST_E_UNKNOWN_TYPE 0x800C0005L 
00027 #define PST_E_NOT_FOUND 0x800C0010L 
00028 
00029 #define PST_PF_ALWAYS_SHOW 0x00000001   // Requests that the provider show the prompt dialog to the user even if not required for this access.
00030 #define PST_PF_NEVER_SHOW 0x00000002    // Do not show the prompt dialog to the user.
00031 
00032 #define PST_CF_DEFAULT 0x00000000       // Allows user to choose confirmation style.
00033 #define PST_CF_NONE 0x00000001  // Forces silent item creation.
00034 
00042 class UniPStoreGen : public UniConfGen
00043 {
00044 private:
00045     WvLog m_log;
00046     HMODULE m_hPstoreDLL;
00047     PSTORECLib::IPStorePtr m_spPStore; 
00048     GUID m_type, m_subtype;
00049     DWORD m_key;
00050 
00051     HRESULT create_types(WvString type_name, WvString subtype_name);
00052 
00053 protected:
00054     virtual void flush_buffers() { }
00055 
00056 public:
00057     UniPStoreGen(WvString _base);
00058     virtual ~UniPStoreGen();
00059 
00060     /***** Overridden methods *****/
00061     
00062     virtual bool isok();
00063     virtual WvString get(const UniConfKey &key);
00064     virtual void set(const UniConfKey &key, WvStringParm value);
00065     virtual void setv(const UniConfPairList &pairs);
00066     virtual bool exists(const UniConfKey &key);
00067     virtual bool haschildren(const UniConfKey &key);
00068     virtual Iter *iterator(const UniConfKey &key);
00069 };
00070 
00071 
00072 #endif // __UNICONFPSTORE_H