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.

144 lines
5.1 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // File: cini.h
  4. //
  5. // Module: CMUTIL.DLL
  6. //
  7. // Synopsis: Definition of the CINIA and CINIW classes
  8. //
  9. // Copyright (c) 1997-1999 Microsoft Corporation
  10. //
  11. // Author: quintinb Created Header 08/19/99
  12. //
  13. //+----------------------------------------------------------------------------
  14. #ifndef _CM_INI_INC
  15. #define _CM_INI_INC
  16. #ifdef UNICODE
  17. #define CIni CIniW
  18. #else
  19. #define CIni CIniA
  20. #endif
  21. //
  22. // Ansi Version
  23. //
  24. class CMUTILAPI_CLASS CIniA {
  25. public:
  26. CIniA(HINSTANCE hInst=NULL, LPCSTR pszFile=NULL, LPCSTR pszRegPath = NULL, LPCSTR pszSection=NULL, LPCSTR pszEntry=NULL);
  27. ~CIniA();
  28. void Clear();
  29. void SetHInst(HINSTANCE hInst);
  30. void SetFile(LPCSTR pszFile);
  31. void SetEntry(LPCSTR pszEntry);
  32. void SetEntryFromIdx(DWORD dwEntry);
  33. void SetPrimaryFile(LPCSTR pszFile);
  34. void SetSection(LPCSTR pszSection);
  35. void SetRegPath(LPCSTR pszRegPath);
  36. void SetPrimaryRegPath(LPCSTR pszPrimaryRegPath);
  37. void SetICSDataPath(LPCSTR pszICSPath);
  38. void SetReadICSData(BOOL fValue);
  39. void SetWriteICSData(BOOL fValue);
  40. HINSTANCE GetHInst() const;
  41. LPCSTR GetFile() const;
  42. LPCSTR GetPrimaryFile() const;
  43. LPCSTR GetRegPath() const;
  44. LPCSTR GetPrimaryRegPath() const;
  45. LPSTR GPPS(LPCSTR pszSection, LPCSTR pszEntry, LPCSTR pszDefault=NULL) const;
  46. DWORD GPPI(LPCSTR pszSection, LPCSTR pszEntry, DWORD dwDefault=0) const;
  47. BOOL GPPB(LPCSTR pszSection, LPCSTR pszEntry, BOOL bDefault=0) const;
  48. void WPPS(LPCSTR pszSection, LPCSTR pszEntry, LPCSTR pszBuffer);
  49. void WPPI(LPCSTR pszSection, LPCSTR pszEntry, DWORD dwBuffer);
  50. void WPPB(LPCSTR pszSection, LPCSTR pszEntry, BOOL bBuffer);
  51. LPSTR LoadSection(LPCSTR pszSection) const;
  52. LPCSTR GetSection() const;
  53. protected:
  54. LPSTR LoadEntry(LPCSTR pszEntry) const;
  55. static void CIni_SetFile(LPSTR *ppszDest, LPCSTR pszSrc);
  56. BOOL CIniA_DeleteEntryFromReg(HKEY hKey, LPCSTR pszRegPathTmp, LPCSTR pszEntry) const;
  57. LPBYTE CIniA_GetEntryFromReg(HKEY hKey, LPCSTR pszRegPathTmp, LPCSTR pszEntry, DWORD dwType, DWORD dwSize) const;
  58. BOOL CIniA_WriteEntryToReg(HKEY hKey, LPCSTR pszRegPathTmp, LPCSTR pszEntry, CONST BYTE *lpData, DWORD dwType, DWORD dwSize) const;
  59. private:
  60. HINSTANCE m_hInst;
  61. LPSTR m_pszFile;
  62. LPSTR m_pszSection;
  63. LPSTR m_pszEntry;
  64. LPSTR m_pszPrimaryFile;
  65. LPTSTR m_pszRegPath;
  66. LPTSTR m_pszPrimaryRegPath;
  67. LPTSTR m_pszICSDataPath;
  68. BOOL m_fReadICSData;
  69. BOOL m_fWriteICSData;
  70. };
  71. //
  72. // UNICODE Version
  73. //
  74. class CMUTILAPI_CLASS CIniW {
  75. public:
  76. CIniW(HINSTANCE hInst=NULL, LPCWSTR pszFile=NULL, LPCWSTR pszRegPath = NULL, LPCWSTR pszSection=NULL, LPCWSTR pszEntry=NULL);
  77. ~CIniW();
  78. void Clear();
  79. void SetHInst(HINSTANCE hInst);
  80. void SetFile(LPCWSTR pszFile);
  81. void SetEntry(LPCWSTR pszEntry);
  82. void SetEntryFromIdx(DWORD dwEntry);
  83. void SetPrimaryFile(LPCWSTR pszFile);
  84. void SetSection(LPCWSTR pszSection);
  85. void SetRegPath(LPCWSTR pszRegPath);
  86. void SetPrimaryRegPath(LPCWSTR pszRegPath);
  87. void SetICSDataPath(LPCWSTR pszICSPath);
  88. void SetReadICSData(BOOL fValue);
  89. void SetWriteICSData(BOOL fValue);
  90. HINSTANCE GetHInst() const;
  91. LPCWSTR GetFile() const;
  92. LPCWSTR GetPrimaryFile() const;
  93. LPCWSTR GetRegPath() const;
  94. LPCWSTR GetPrimaryRegPath() const;
  95. LPWSTR GPPS(LPCWSTR pszSection, LPCWSTR pszEntry, LPCWSTR pszDefault=NULL) const;
  96. DWORD GPPI(LPCWSTR pszSection, LPCWSTR pszEntry, DWORD dwDefault=0) const;
  97. BOOL GPPB(LPCWSTR pszSection, LPCWSTR pszEntry, BOOL bDefault=0) const;
  98. void WPPS(LPCWSTR pszSection, LPCWSTR pszEntry, LPCWSTR pszBuffer);
  99. void WPPI(LPCWSTR pszSection, LPCWSTR pszEntry, DWORD dwBuffer);
  100. void WPPB(LPCWSTR pszSection, LPCWSTR pszEntry, BOOL bBuffer);
  101. LPWSTR LoadSection(UINT nSection) const;
  102. LPWSTR LoadSection(LPCWSTR pszSection) const;
  103. LPCWSTR GetSection() const;
  104. protected:
  105. LPWSTR LoadEntry(LPCWSTR pszEntry) const;
  106. static void CIni_SetFile(LPWSTR *ppszDest, LPCWSTR pszSrc);
  107. BOOL CIniW_DeleteEntryFromReg(HKEY hKey, LPCWSTR pszRegPathTmp, LPCWSTR pszEntry) const;
  108. LPBYTE CIniW_GetEntryFromReg(HKEY hKey, LPCWSTR pszRegPathTmp, LPCWSTR pszEntry, DWORD dwType, DWORD dwSize) const;
  109. BOOL CIniW_WriteEntryToReg(HKEY hKey, LPCWSTR pszRegPathTmp, LPCWSTR pszEntry, CONST BYTE *lpData, DWORD dwType, DWORD dwSize) const;
  110. private:
  111. HINSTANCE m_hInst;
  112. LPWSTR m_pszFile;
  113. LPWSTR m_pszSection;
  114. LPWSTR m_pszEntry;
  115. LPWSTR m_pszPrimaryFile;
  116. LPWSTR m_pszRegPath;
  117. LPWSTR m_pszPrimaryRegPath;
  118. LPWSTR m_pszICSDataPath;
  119. BOOL m_fReadICSData;
  120. BOOL m_fWriteICSData;
  121. };
  122. #endif