Source code of Windows XP (NT5)
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.

267 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. ini.h
  5. Abstract:
  6. Declares interface for INI wrapper routines. These routines simplify
  7. access of INIs by wrapping the Win32 APIs with routines that use pools.
  8. Author:
  9. 04-Nov-1999 Ovidiu Temereanca (ovidiut) - File creation.
  10. Revision History:
  11. <alias> <date> <comments>
  12. --*/
  13. //
  14. // Types
  15. //
  16. typedef struct {
  17. PCSTR IniFilePath;
  18. DWORD OriginalAttributes;
  19. } INIFILEA, *PINIFILEA;
  20. typedef struct {
  21. PCWSTR IniFilePath;
  22. DWORD OriginalAttributes;
  23. } INIFILEW, *PINIFILEW;
  24. typedef struct {
  25. PCSTR CurrentSection;
  26. PCSTR Sections;
  27. } INISECT_ENUMA, *PINISECT_ENUMA;
  28. typedef struct {
  29. PCWSTR CurrentSection;
  30. PCWSTR Sections;
  31. } INISECT_ENUMW, *PINISECT_ENUMW;
  32. typedef struct {
  33. PCSTR CurrentKeyValuePair;
  34. PCSTR KeyValuePairs;
  35. PCSTR CurrentKey;
  36. PCSTR CurrentValue;
  37. PSTR Private;
  38. } INIKEYVALUE_ENUMA, *PINIKEYVALUE_ENUMA;
  39. typedef struct {
  40. PCWSTR CurrentKeyValuePair;
  41. PCWSTR KeyValuePairs;
  42. PCWSTR CurrentKey;
  43. PCWSTR CurrentValue;
  44. PWSTR Private;
  45. } INIKEYVALUE_ENUMW, *PINIKEYVALUE_ENUMW;
  46. //
  47. // Public function prototypes
  48. //
  49. BOOL
  50. Ini_Init (
  51. VOID
  52. );
  53. VOID
  54. Ini_Exit (
  55. VOID
  56. );
  57. BOOL
  58. RealIniFileOpenA (
  59. OUT PINIFILEA IniFile,
  60. IN PCSTR IniFileSpec,
  61. IN BOOL FileMustExist /*,*/
  62. ALLOCATION_TRACKING_DEF /* , PCSTR File, UINT Line */
  63. );
  64. #define IniFileOpenA(i,path,b) TRACK_BEGIN(BOOL, IniFileOpenA)\
  65. RealIniFileOpenA((i),(path),(b)/*,*/ ALLOCATION_TRACKING_CALL)\
  66. TRACK_END()
  67. BOOL
  68. RealIniFileOpenW (
  69. OUT PINIFILEW IniFile,
  70. IN PCWSTR IniFileSpec,
  71. IN BOOL FileMustExist /*,*/
  72. ALLOCATION_TRACKING_DEF /* , PCSTR File, UINT Line */
  73. );
  74. #define IniFileOpenW(i,path,b) TRACK_BEGIN(BOOL, IniFileOpenW)\
  75. RealIniFileOpenW((i),(path),(b)/*,*/ ALLOCATION_TRACKING_CALL)\
  76. TRACK_END()
  77. VOID
  78. IniFileCloseA (
  79. IN PINIFILEA IniFile
  80. );
  81. VOID
  82. IniFileCloseW (
  83. IN PINIFILEW IniFile
  84. );
  85. BOOL
  86. EnumFirstIniSectionA (
  87. OUT PINISECT_ENUMA IniSectEnum,
  88. IN PINIFILEA IniFile
  89. );
  90. BOOL
  91. EnumFirstIniSectionW (
  92. OUT PINISECT_ENUMW IniSectEnum,
  93. IN PINIFILEW IniFile
  94. );
  95. BOOL
  96. EnumNextIniSectionA (
  97. IN OUT PINISECT_ENUMA IniSectEnum
  98. );
  99. BOOL
  100. EnumNextIniSectionW (
  101. IN OUT PINISECT_ENUMW IniSectEnum
  102. );
  103. VOID
  104. AbortIniSectionEnumA (
  105. IN OUT PINISECT_ENUMA IniSectEnum
  106. );
  107. VOID
  108. AbortIniSectionEnumW (
  109. IN OUT PINISECT_ENUMW IniSectEnum
  110. );
  111. BOOL
  112. EnumFirstIniKeyValueA (
  113. OUT PINIKEYVALUE_ENUMA IniKeyValueEnum,
  114. IN PINIFILEA IniFile,
  115. IN PCSTR Section
  116. );
  117. BOOL
  118. EnumFirstIniKeyValueW (
  119. OUT PINIKEYVALUE_ENUMW IniKeyValueEnum,
  120. IN PINIFILEW IniFile,
  121. IN PCWSTR Section
  122. );
  123. BOOL
  124. EnumNextIniKeyValueA (
  125. IN OUT PINIKEYVALUE_ENUMA IniKeyValueEnum
  126. );
  127. BOOL
  128. EnumNextIniKeyValueW (
  129. IN OUT PINIKEYVALUE_ENUMW IniKeyValueEnum
  130. );
  131. VOID
  132. AbortIniKeyValueEnumA (
  133. IN OUT PINIKEYVALUE_ENUMA IniKeyValueEnum
  134. );
  135. VOID
  136. AbortIniKeyValueEnumW (
  137. IN OUT PINIKEYVALUE_ENUMW IniKeyValueEnum
  138. );
  139. BOOL
  140. IniReadValueA (
  141. IN PINIFILEA IniFile,
  142. IN PCSTR Section,
  143. IN PCSTR Key,
  144. OUT PSTR* Value, OPTIONAL
  145. OUT PDWORD Chars OPTIONAL
  146. );
  147. BOOL
  148. IniReadValueW (
  149. IN PINIFILEW IniFile,
  150. IN PCWSTR Section,
  151. IN PCWSTR Key,
  152. OUT PWSTR* Value, OPTIONAL
  153. OUT PDWORD Chars OPTIONAL
  154. );
  155. VOID
  156. IniFreeReadValueA (
  157. IN PCSTR Value
  158. );
  159. VOID
  160. IniFreeReadValueW (
  161. IN PCWSTR Value
  162. );
  163. BOOL
  164. IniWriteValueA (
  165. IN PINIFILEA IniFile,
  166. IN PCSTR Section,
  167. IN PCSTR Key,
  168. IN PCSTR Value
  169. );
  170. BOOL
  171. IniWriteValueW (
  172. IN PINIFILEW IniFile,
  173. IN PCWSTR Section,
  174. IN PCWSTR Key,
  175. IN PCWSTR Value
  176. );
  177. //
  178. // ANSI/UNICODE mappings.
  179. //
  180. #ifdef UNICODE
  181. #define INIFILE INIFILEW
  182. #define INISECT_ENUM INISECT_ENUMW
  183. #define INIKEYVALUE_ENUM INIKEYVALUE_ENUMW
  184. #define IniFileOpen IniFileOpenW
  185. #define IniFileClose IniFileCloseW
  186. #define EnumFirstIniSection EnumFirstIniSectionW
  187. #define EnumNextIniSection EnumNextIniSectionW
  188. #define AbortIniSectionEnum AbortIniSectionEnumW
  189. #define EnumFirstIniKeyValue EnumFirstIniKeyValueW
  190. #define EnumNextIniKeyValue EnumNextIniKeyValueW
  191. #define AbortIniKeyValueEnum AbortIniKeyValueEnumW
  192. #define IniReadValue IniReadValueW
  193. #define IniFreeReadValue IniFreeReadValueW
  194. #define IniWriteValue IniWriteValueW
  195. #else
  196. #define INIFILE INIFILEA
  197. #define INISECT_ENUM INISECT_ENUMA
  198. #define INIKEYVALUE_ENUM INIKEYVALUE_ENUMA
  199. #define IniFileOpen IniFileOpenA
  200. #define IniFileClose IniFileCloseA
  201. #define EnumFirstIniSection EnumFirstIniSectionA
  202. #define EnumNextIniSection EnumNextIniSectionA
  203. #define AbortIniSectionEnum AbortIniSectionEnumA
  204. #define EnumFirstIniKeyValue EnumFirstIniKeyValueA
  205. #define EnumNextIniKeyValue EnumNextIniKeyValueA
  206. #define AbortIniKeyValueEnum AbortIniKeyValueEnumA
  207. #define IniReadValue IniReadValueA
  208. #define IniFreeReadValue IniFreeReadValueA
  209. #define IniWriteValue IniWriteValueA
  210. #endif