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.

167 lines
5.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000
  5. //
  6. // File: parserutil.h
  7. //
  8. // Contents: Helpful functions for manipulating and validating
  9. // generic command line arguments
  10. //
  11. // History: 07-Sep-2000 JeffJon Created
  12. //
  13. //
  14. //--------------------------------------------------------------------------
  15. #ifndef _PARSERUTIL_H_
  16. #define _PARSERUTIL_H_
  17. //
  18. // Common switches
  19. //
  20. typedef enum COMMON_COMMAND_ENUM
  21. {
  22. eCommUnicodeAll,
  23. eCommUnicodeInput,
  24. eCommUnicodeOutput,
  25. #ifdef DBG
  26. eCommDebug,
  27. #endif
  28. eCommHelp,
  29. eCommServer,
  30. eCommDomain,
  31. eCommUserName,
  32. eCommPassword,
  33. eCommQuiet,
  34. eCommLast = eCommQuiet
  35. };
  36. #define UNICODE_COMMANDS \
  37. 0,(LPWSTR)c_sz_arg1_com_unicode, \
  38. 0,NULL, \
  39. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL, \
  40. (CMD_TYPE)FALSE, \
  41. 0, NULL, \
  42. \
  43. 0,(LPWSTR)c_sz_arg1_com_unicodeinput, \
  44. 0,NULL, \
  45. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL, \
  46. (CMD_TYPE)FALSE, \
  47. 0, NULL, \
  48. \
  49. 0,(LPWSTR)c_sz_arg1_com_unicodeoutput, \
  50. 0,NULL, \
  51. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL, \
  52. (CMD_TYPE)FALSE, \
  53. 0, NULL,
  54. #ifdef DBG
  55. #define DEBUG_COMMAND \
  56. 0,(LPWSTR)c_sz_arg1_com_debug, \
  57. ID_ARG2_NULL,NULL, \
  58. ARG_TYPE_DEBUG, ARG_FLAG_OPTIONAL|ARG_FLAG_HIDDEN, \
  59. (CMD_TYPE)0, \
  60. 0, NULL,
  61. #else
  62. #define DEBUG_COMMAND
  63. #endif
  64. #define COMMON_COMMANDS \
  65. \
  66. UNICODE_COMMANDS \
  67. \
  68. DEBUG_COMMAND \
  69. \
  70. 0,(LPWSTR)c_sz_arg1_com_help, \
  71. 0,(LPWSTR)c_sz_arg2_com_help, \
  72. ARG_TYPE_HELP, ARG_FLAG_OPTIONAL, \
  73. (CMD_TYPE)FALSE, \
  74. 0, NULL, \
  75. \
  76. 0,(LPWSTR)c_sz_arg1_com_server, \
  77. 0,(LPWSTR)c_sz_arg2_com_server, \
  78. ARG_TYPE_STR, ARG_FLAG_OPTIONAL, \
  79. NULL, \
  80. 0, NULL, \
  81. \
  82. 0,(LPWSTR)c_sz_arg1_com_domain, \
  83. 0,(LPWSTR)c_sz_arg2_com_domain, \
  84. ARG_TYPE_STR, ARG_FLAG_OPTIONAL, \
  85. NULL, \
  86. 0, NULL, \
  87. \
  88. 0,(LPWSTR)c_sz_arg1_com_username, \
  89. 0,(LPWSTR)c_sz_arg2_com_username, \
  90. ARG_TYPE_STR, ARG_FLAG_OPTIONAL, \
  91. NULL, \
  92. 0, NULL, \
  93. \
  94. 0,(LPWSTR)c_sz_arg1_com_password, \
  95. 0,(LPWSTR)c_sz_arg2_com_password, \
  96. ARG_TYPE_PASSWORD, ARG_FLAG_OPTIONAL, \
  97. (CMD_TYPE)_T(""), \
  98. 0, ValidateAdminPassword, \
  99. \
  100. 0,(LPWSTR)c_sz_arg1_com_quiet, \
  101. ID_ARG2_NULL,NULL, \
  102. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL, \
  103. (CMD_TYPE)_T(""), \
  104. 0, NULL,
  105. HRESULT MergeArgCommand(PARG_RECORD pCommand1,
  106. PARG_RECORD pCommand2,
  107. PARG_RECORD *ppOutCommand);
  108. DWORD GetPasswdStr(LPTSTR buf,
  109. DWORD buflen,
  110. PDWORD len);
  111. DWORD ValidateAdminPassword(PVOID pArg);
  112. DWORD ValidateUserPassword(PVOID pArg);
  113. DWORD ValidateYesNo(PVOID pArg);
  114. DWORD ValidateGroupScope(PVOID pArg);
  115. DWORD ValidateNever(PVOID pArg);
  116. //+--------------------------------------------------------------------------
  117. //
  118. // Function: ParseNullSeparatedString
  119. //
  120. // Synopsis: Parses a '\0' separated list that ends in "\0\0" into a string
  121. // array
  122. //
  123. // Arguments: [psz - IN] : '\0' separated string to be parsed
  124. // [pszArr - OUT] : the array to receive the parsed strings
  125. // [pnArrEntries - OUT] : the number of strings parsed from the list
  126. //
  127. // Returns:
  128. //
  129. // History: 18-Sep-2000 JeffJon Created
  130. //
  131. //---------------------------------------------------------------------------
  132. void ParseNullSeparatedString(PTSTR psz,
  133. PTSTR** ppszArr,
  134. UINT* pnArrEntries);
  135. //+--------------------------------------------------------------------------
  136. //
  137. // Function: ParseSemicolonSeparatedString
  138. //
  139. // Synopsis: Parses a ';' separated list
  140. //
  141. // Arguments: [psz - IN] : ';' separated string to be parsed
  142. // [pszArr - OUT] : the array to receive the parsed strings
  143. // [pnArrEntries - OUT] : the number of strings parsed from the list
  144. //
  145. // Returns:
  146. //
  147. // History: 14-Apr-2001 JeffJon Created
  148. //
  149. //---------------------------------------------------------------------------
  150. void ParseSemicolonSeparatedString(PTSTR psz,
  151. PTSTR** ppszArr,
  152. UINT* pnArrEntries);
  153. #endif // _PARSERUTIL_H_