Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.4 KiB

  1. //
  2. // setstore.h
  3. //
  4. // Interface definition for an abstract settings store
  5. //
  6. // This abstraction is meant to allow different store types
  7. // to be plugged in to update the persistence model
  8. //
  9. // Copyright(C) Microsoft Corporation 2000
  10. // Author: Nadim Abdo (nadima)
  11. //
  12. #ifndef _SETSTORE_H_
  13. #define _SETSTORE_H_
  14. class ISettingsStore : public IUnknown
  15. {
  16. public:
  17. typedef enum {
  18. storeOpenReadOnly = 0,
  19. storeOpenWriteOnly = 1,
  20. storeOpenRW = 2,
  21. } storeOpenState;
  22. //
  23. // Open a store..Moniker is store specific info that points to the store
  24. //
  25. virtual BOOL OpenStore(LPCTSTR szStoreMoniker, BOOL bReadOnly=FALSE) = 0;
  26. //
  27. // Commit the current in-memory contents of the store
  28. //
  29. virtual BOOL CommitStore() = 0;
  30. //
  31. // Close the store
  32. //
  33. virtual BOOL CloseStore() = 0;
  34. //
  35. // State access functions
  36. //
  37. virtual BOOL IsOpenForRead() = 0;
  38. virtual BOOL IsOpenForWrite() = 0;
  39. virtual BOOL IsDirty() = 0;
  40. virtual BOOL SetDirtyFlag(BOOL bIsDirty) = 0;
  41. //
  42. // Typed read and write functions, writes are not commited until a ComitStore()
  43. // Values equal to the default are not persisted out
  44. // On read error (e.g if Name key is not found, the specified default value is returned)
  45. //
  46. virtual BOOL ReadString(LPCTSTR szName, LPTSTR szDefault,
  47. LPTSTR szOutBuf, UINT strLen) = 0;
  48. virtual BOOL WriteString(LPCTSTR szName, LPTSTR szDefault,
  49. LPTSTR szValue, BOOL fIgnoreDefault=FALSE) = 0;
  50. virtual BOOL ReadBinary(LPCTSTR szName, PBYTE pOutuf, UINT cbBufLen) = 0;
  51. virtual BOOL WriteBinary(LPCTSTR szName,PBYTE pBuf, UINT cbBufLen) = 0;
  52. virtual BOOL ReadInt(LPCTSTR szName, UINT defaultVal, PUINT pval) = 0;
  53. virtual BOOL WriteInt(LPCTSTR szName, UINT defaultVal, UINT val,
  54. BOOL fIgnoreDefault=FALSE) = 0;
  55. virtual BOOL ReadBool(LPCTSTR szName, UINT defaultVal, PBOOL pbVal) = 0;
  56. virtual BOOL WriteBool(LPCTSTR szName, UINT defaultVal, BOOL bVal,
  57. BOOL fIgnoreDefault=FALSE) = 0;
  58. virtual BOOL DeleteValueIfPresent(LPCTSTR szName) = 0;
  59. virtual BOOL IsValuePresent(LPTSTR szName) = 0;
  60. virtual DWORD GetDataLength(LPCTSTR szName) = 0;
  61. };
  62. #endif //_SETSTORE_H_