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.

224 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. parseini.h
  5. Abstract:
  6. Common header file for parsing .ini files
  7. Author:
  8. John Vert (jvert) 6-Oct-1993
  9. Environment:
  10. ARC environment
  11. Revision History:
  12. --*/
  13. #include "bldr.h"
  14. #include "setupblk.h"
  15. #include "stdio.h"
  16. #include "stdarg.h"
  17. //
  18. // Defines for *externally* fulfilled error handling routines. setupldr and osloader each
  19. // have different versions of these routines.
  20. //
  21. #if DEVL
  22. #define SlError(x) SlErrorBox(x , __LINE__, __FILE__ )
  23. #else
  24. #define SlError(x)
  25. #endif
  26. #define SlNoMemoryError() SlNoMemError(__LINE__, __FILE__ )
  27. VOID
  28. SlNoMemError(
  29. IN ULONG Line,
  30. IN PCHAR File
  31. );
  32. VOID
  33. SlBadInfLineError(
  34. IN ULONG Line,
  35. IN PCHAR INFFile
  36. );
  37. VOID
  38. SlErrorBox(
  39. IN ULONG MessageId,
  40. IN ULONG Line,
  41. IN PCHAR File
  42. );
  43. VOID
  44. SlFatalError(
  45. IN ULONG MessageId,
  46. ...
  47. );
  48. VOID
  49. SlFriendlyError(
  50. IN ULONG uStatus,
  51. IN PCHAR pchBadFile,
  52. IN ULONG uLine,
  53. IN PCHAR pchCodeFile
  54. );
  55. //
  56. // Routines for parsing the setupldr.ini file
  57. //
  58. #define SIF_FILENAME_INDEX 0
  59. extern PVOID InfFile;
  60. extern PVOID WinntSifHandle;
  61. ARC_STATUS
  62. SlInitIniFile(
  63. IN PCHAR DevicePath,
  64. IN ULONG DeviceId,
  65. IN PCHAR INFFile,
  66. OUT PVOID *pINFHandle,
  67. OUT PVOID *pINFBuffer OPTIONAL,
  68. OUT PULONG INFBufferSize OPTIONAL,
  69. OUT PULONG ErrorLine
  70. );
  71. PCHAR
  72. SlGetIniValue(
  73. IN PVOID InfHandle,
  74. IN PCHAR SectionName,
  75. IN PCHAR KeyName,
  76. IN PCHAR Default
  77. );
  78. #ifdef UNICODE
  79. PWCHAR
  80. SlGetIniValueW(
  81. IN PVOID InfHandle,
  82. IN PCHAR SectionName,
  83. IN PCHAR KeyName,
  84. IN PWCHAR Default
  85. );
  86. #endif
  87. PCHAR
  88. SlGetKeyName(
  89. IN PVOID INFHandle,
  90. IN PCHAR SectionName,
  91. IN ULONG LineIndex
  92. );
  93. #ifdef UNICODE
  94. PWCHAR
  95. SlGetKeyNameW(
  96. IN PVOID INFHandle,
  97. IN PCHAR SectionName,
  98. IN ULONG LineIndex
  99. );
  100. #endif
  101. ULONG
  102. SlGetSectionKeyOrdinal(
  103. IN PVOID INFHandle,
  104. IN PCHAR SectionName,
  105. IN PCHAR Key
  106. );
  107. PCHAR
  108. SlGetSectionKeyIndex (
  109. IN PVOID INFHandle,
  110. IN PCHAR SectionName,
  111. IN PCHAR Key,
  112. IN ULONG ValueIndex
  113. );
  114. #ifdef UNICODE
  115. PWCHAR
  116. SlGetSectionKeyIndexW (
  117. IN PVOID INFHandle,
  118. IN PCHAR SectionName,
  119. IN PCHAR Key,
  120. IN ULONG ValueIndex
  121. );
  122. #endif
  123. PTCHAR
  124. SlCopyString(
  125. IN PTCHAR String
  126. );
  127. PCHAR
  128. SlCopyStringA(
  129. IN PCSTR String
  130. );
  131. PWCHAR
  132. SlCopyStringAW(
  133. IN PCHAR String
  134. );
  135. #ifdef UNICODE
  136. #define SlCopyStringAT SlCopyStringAW
  137. #else
  138. #define SlCopyStringAT SlCopyStringA
  139. #endif
  140. PCHAR
  141. SlGetSectionLineIndex (
  142. IN PVOID INFHandle,
  143. IN PCHAR SectionName,
  144. IN ULONG LineIndex,
  145. IN ULONG ValueIndex
  146. );
  147. #ifdef UNICODE
  148. PWCHAR
  149. SlGetSectionLineIndexW (
  150. IN PVOID INFHandle,
  151. IN PCHAR SectionName,
  152. IN ULONG LineIndex,
  153. IN ULONG ValueIndex
  154. );
  155. #endif
  156. ULONG
  157. SlCountLinesInSection(
  158. IN PVOID INFHandle,
  159. IN PCHAR SectionName
  160. );
  161. BOOLEAN
  162. SpSearchINFSection (
  163. IN PVOID INFHandle,
  164. IN PCHAR SectionName
  165. );
  166. PCHAR
  167. SlSearchSection(
  168. IN PCHAR SectionName,
  169. IN PCHAR TargetName
  170. );
  171. ARC_STATUS
  172. SpFreeINFBuffer (
  173. IN PVOID INFHandle
  174. );
  175.