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.

210 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1991-1993 Microsoft Corporation
  3. Module Name:
  4. Config.h
  5. Abstract:
  6. This header file defines the function prototypes of the temporary
  7. helper routines to get configuration information from the NT
  8. configuration files.
  9. Author:
  10. Rita Wong (ritaw) 22-May-1991
  11. Environment:
  12. Only runs under NT.
  13. Notes:
  14. You must include the following before this file:
  15. windef.h OR windows.h // Win32 type definitions
  16. Revision History:
  17. 22-May-1991 RitaW
  18. Created.
  19. 27-Nov-1991 JohnRo
  20. Prepare for revised config handlers. Added revision history.
  21. 08-Jan-1992 JohnRo
  22. Added SECT_NT_REPLICATOR.
  23. 13-Feb-1992 JohnRo
  24. Moved section name equates to <confname.h>.
  25. Include <netdebug.h> and <lmcons.h> here instead of everywhere else.
  26. Added NetpDbgDisplayConfigSection().
  27. Added NetpDeleteConfigKeyword() and NetpNumberOfConfigKeywords().
  28. Added Netp{Get,Set}Config{Bool,Dword}.
  29. 14-Mar-1992 JohnRo
  30. Get rid of old config helper callers.
  31. 23-Mar-1992 JohnRo
  32. Get rid of old config helpers.
  33. 08-May-1992 JohnRo
  34. Add LPTSTR array routines.
  35. 08-Jul-1992 JohnRo
  36. RAID 10503: srv mgr: repl dialog doesn't come up.
  37. 25-Feb-1993 JohnRo
  38. RAID 12914: avoid double close and free mem in NetpCloseConfigData().
  39. 07-Apr-1993 JohnRo
  40. RAID 5483: server manager: wrong path given in repl dialog.
  41. --*/
  42. #ifndef CONFIG_H
  43. #define CONFIG_H
  44. #include <lmcons.h> // NET_API_STATUS.
  45. #include <netdebug.h> // LPDEBUG_STRING.
  46. #include <strarray.h> // LPTSTR_ARRAY.
  47. //
  48. // Opaque pointer for net config handles. (The real structure is in ConfigP.h,
  49. // and should only be used by NetLib routines.)
  50. //
  51. typedef LPVOID LPNET_CONFIG_HANDLE;
  52. //
  53. // Note that the routines in this file only accept the SECT_NT_ versions.
  54. // See <confname.h> for more details.
  55. //
  56. // NetpOpenConfigData opens the Paramaters section of a given service.
  57. NET_API_STATUS
  58. NetpOpenConfigData(
  59. OUT LPNET_CONFIG_HANDLE *ConfigHandle,
  60. IN LPTSTR UncServerName OPTIONAL,
  61. IN LPTSTR SectionName, // Must be a SECT_NT_ name.
  62. IN BOOL ReadOnly
  63. );
  64. // NetpOpenConfigDataEx opens any area of a given service.
  65. NET_API_STATUS
  66. NetpOpenConfigDataEx(
  67. OUT LPNET_CONFIG_HANDLE *ConfigHandle,
  68. IN LPTSTR UncServerName OPTIONAL,
  69. IN LPTSTR SectionName, // Must be a SECT_NT_ name.
  70. IN LPTSTR AreaUnderSection OPTIONAL,
  71. IN BOOL ReadOnly
  72. );
  73. // NetpOpenConfigData opens the Paramaters section of a given service.
  74. NET_API_STATUS
  75. NetpOpenConfigDataWithPath(
  76. OUT LPNET_CONFIG_HANDLE *ConfigHandle,
  77. IN LPTSTR UncServerName OPTIONAL,
  78. IN LPTSTR SectionName, // Must be a SECT_NT_ name.
  79. IN BOOL ReadOnly
  80. );
  81. // NetpOpenConfigDataEx opens any area of a given service.
  82. NET_API_STATUS
  83. NetpOpenConfigDataWithPathEx(
  84. OUT LPNET_CONFIG_HANDLE *ConfigHandle,
  85. IN LPTSTR UncServerName OPTIONAL,
  86. IN LPTSTR SectionName, // Must be a SECT_NT_ name.
  87. IN LPTSTR AreaUnderSection OPTIONAL,
  88. IN BOOL ReadOnly
  89. );
  90. // Delete a keyword and its value.
  91. // Return NERR_CfgParamNotFound if the keyword isn't present.
  92. NET_API_STATUS
  93. NetpDeleteConfigKeyword (
  94. IN LPNET_CONFIG_HANDLE ConfigHandle,
  95. IN LPTSTR Keyword
  96. );
  97. NET_API_STATUS
  98. NetpExpandConfigString(
  99. IN LPCTSTR UncServerName OPTIONAL,
  100. IN LPCTSTR UnexpandedString,
  101. OUT LPTSTR * ValueBufferPtr // Must be freed by NetApiBufferFree().
  102. );
  103. // If NetpOpenConfigData fails, try calling NetpHandleConfigFailure to decide
  104. // what to do about it.
  105. NET_API_STATUS
  106. NetpHandleConfigFailure(
  107. IN LPDEBUG_STRING DebugName, // Name of routine.
  108. IN NET_API_STATUS ApiStatus, // NetpOpenConfigData's error code.
  109. IN LPTSTR ServerNameValue OPTIONAL,
  110. OUT LPBOOL TryDownlevel
  111. );
  112. // Get a boolean value. Return ERROR_INVALID_DATA if value isn't boolean.
  113. // Return NERR_CfgParamNotFound if the keyword isn't present.
  114. NET_API_STATUS
  115. NetpGetConfigBool (
  116. IN LPNET_CONFIG_HANDLE ConfigHandle,
  117. IN LPTSTR Keyword,
  118. IN BOOL DefaultValue,
  119. OUT LPBOOL ValueBuffer
  120. );
  121. // Get an unsigned numeric value. Return ERROR_INVALID_DATA if value isn't
  122. // numeric.
  123. // Return NERR_CfgParamNotFound if the keyword isn't present.
  124. NET_API_STATUS
  125. NetpGetConfigDword (
  126. IN LPNET_CONFIG_HANDLE ConfigHandle,
  127. IN LPTSTR Keyword,
  128. IN DWORD DefaultValue,
  129. OUT LPDWORD ValueBuffer
  130. );
  131. // Return null-null array of strings.
  132. // Return NERR_CfgParamNotFound if the keyword isn't present.
  133. NET_API_STATUS
  134. NetpGetConfigTStrArray(
  135. IN LPNET_CONFIG_HANDLE ConfigHandle,
  136. IN LPTSTR Keyword,
  137. OUT LPTSTR_ARRAY * ValueBuffer // Must be freed by NetApiBufferFree().
  138. );
  139. // Return string value for a given keyword.
  140. // Return NERR_CfgParamNotFound if the keyword isn't present.
  141. NET_API_STATUS
  142. NetpGetConfigValue (
  143. IN LPNET_CONFIG_HANDLE ConfigHandle,
  144. IN LPTSTR Keyword,
  145. OUT LPTSTR * ValueBuffer // Must be freed by NetApiBufferFree().
  146. );
  147. NET_API_STATUS
  148. NetpEnumConfigSectionValues(
  149. IN LPNET_CONFIG_HANDLE ConfigHandle,
  150. OUT LPTSTR * KeywordBuffer, // Must be freed by NetApiBufferFree().
  151. OUT LPTSTR * ValueBuffer, // Must be freed by NetApiBufferFree().
  152. IN BOOL FirstTime
  153. );
  154. NET_API_STATUS
  155. NetpNumberOfConfigKeywords (
  156. IN LPNET_CONFIG_HANDLE ConfigHandle,
  157. OUT LPDWORD Count
  158. );
  159. NET_API_STATUS
  160. NetpSetConfigValue(
  161. IN LPNET_CONFIG_HANDLE ConfigHandle,
  162. IN LPTSTR Keyword,
  163. IN LPTSTR Value
  164. );
  165. NET_API_STATUS
  166. NetpCloseConfigData(
  167. IN OUT LPNET_CONFIG_HANDLE ConfigHandle
  168. );
  169. #endif // ndef CONFIG_H