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.

176 lines
2.9 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. cmdhelp.h
  5. Abstract:
  6. Command line helper library
  7. Environment:
  8. User mode only
  9. Revision History:
  10. 04/04/2001 - created
  11. --*/
  12. #ifndef __CMDHELP_H__
  13. #define __CMDHELP_H__
  14. #pragma warning(push)
  15. #pragma warning(disable:4200) // array[0] is not a warning for this file
  16. #include <windows.h> // sdk
  17. /*++
  18. Routine Description:
  19. Validates a string contains only valid octal characters (and spaces)
  20. Arguments:
  21. String - string to be verified
  22. Return Value:
  23. TRUE if the string is valid
  24. --*/
  25. BOOL
  26. CmdHelpValidateStringOctal(
  27. IN PCHAR String
  28. );
  29. /*++
  30. Routine Description:
  31. Validates a string contains only valid decimal characters (and spaces)
  32. Arguments:
  33. String - string to be verified
  34. Return Value:
  35. TRUE if the string is valid
  36. --*/
  37. BOOL
  38. CmdHelpValidateStringDecimal(
  39. IN PCHAR String
  40. );
  41. /*++
  42. Routine Description:
  43. Validates a string contains only valid hex characters (and spaces)
  44. Arguments:
  45. String - string to be verified
  46. Return Value:
  47. TRUE if the string is valid
  48. --*/
  49. BOOL
  50. CmdHelpValidateStringHex(
  51. IN PCHAR String
  52. );
  53. /*++
  54. Routine Description:
  55. Validates a string is formatted properly for use in
  56. SptUtilScanQuotedHexString(). The required format is as follows:
  57. x <= { 0..9, A..F, a..f }
  58. "(xx )*(xx)"
  59. i.e. the following strings are valid:
  60. "00 01 02 03"
  61. "00"
  62. "ff Fa Bc Ed 08 8f"
  63. i.e. the following strings are invalid:
  64. "" // zero-length string
  65. " 00 01 02 03" // space at beginning
  66. "00 01 02 03 " // space at end
  67. Arguments:
  68. String - string to be verified
  69. Return Value:
  70. TRUE if the string is valid
  71. --*/
  72. BOOL
  73. CmdHelpValidateStringHexQuoted(
  74. IN PCHAR String
  75. );
  76. /*++
  77. Routine Description:
  78. Scans in a quoted hex string of the form "xx xx xx" into
  79. a pre-allocated buffer.
  80. Also can be used to determine the required buffer size.
  81. Arguments:
  82. Return Value:
  83. TRUE && *DataSize != 0 if everything was successful.
  84. (*DataSize contains the size of the data scanned)
  85. FALSE && *DataSize == 0 if failed to validate string
  86. FALSE && *DataSize != 0 if buffer too small
  87. --*/
  88. BOOLEAN
  89. CmdHelpScanQuotedHexString(
  90. IN PUCHAR QuotedHexString,
  91. OUT PUCHAR Data,
  92. OUT PDWORD DataSize
  93. );
  94. /*++
  95. Routine Description:
  96. Prints out the buffer specified in HEX format.
  97. Simplistic, but very useful, esp. for debugging.
  98. Arguments:
  99. Buffer - the data to print
  100. Size - how many bytes are to be printed
  101. Return Value:
  102. --*/
  103. VOID
  104. CmdHelpPrintBuffer(
  105. IN PUCHAR Buffer,
  106. IN SIZE_T Size
  107. );
  108. #pragma warning(pop)
  109. #endif // __CMDHELP_H__