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.

79 lines
2.5 KiB

  1. /*** cmdarg.h - Command argument parsing Definitions
  2. *
  3. * Copyright (c) 1996,1997 Microsoft Corporation
  4. * Author: Michael Tsang (MikeTs)
  5. * Created 09/18/96
  6. *
  7. * MODIFICATION HISTORY
  8. */
  9. #ifndef _CMDARG_H
  10. #define _CMDARG_H
  11. #ifdef DEBUGGER
  12. /*** Macros
  13. */
  14. #define ARG_ERROR(x) ConPrintf(MODNAME "_ARGERR: "); \
  15. ConPrintf x; \
  16. ConPrintf("\n");
  17. /*** Constants
  18. */
  19. // Error codes
  20. #define ARGERR_NONE 0
  21. #define ARGERR_SEP_NOT_FOUND -1
  22. #define ARGERR_INVALID_NUMBER -2
  23. #define ARGERR_INVALID_ARG -3
  24. #define ARGERR_ASSERT_FAILED -4
  25. // Command argument flags
  26. #define AF_NOI 0x00000001 //NoIgnoreCase
  27. #define AF_SEP 0x00000002 //require separator
  28. // Command argument types
  29. #define AT_END 0 //end marker of arg table
  30. #define AT_STRING 1
  31. #define AT_NUM 2
  32. #define AT_ENABLE 3
  33. #define AT_DISABLE 4
  34. #define AT_ACTION 5
  35. /*** Type definitions
  36. */
  37. typedef struct _cmdarg CMDARG;
  38. typedef CMDARG *PCMDARG;
  39. typedef LONG (LOCAL *PFNARG)(PCMDARG, PSZ, ULONG, ULONG);
  40. struct _cmdarg
  41. {
  42. PSZ pszArgID; //argument ID string
  43. ULONG dwArgType; //AT_*
  44. ULONG dwfArg; //AF_*
  45. PVOID pvArgData; //AT_END: none
  46. //AT_STRING: PPSZ - ptr. to string ptr.
  47. //AT_NUM: PLONG - ptr. to number
  48. //AT_ENABLE: PULONG - ptr. to flags
  49. //AT_DISABLE: PULONG - ptr. to flags
  50. //AT_ACTION: none
  51. ULONG dwArgParam; //AT_END: none
  52. //AT_STRING: none
  53. //AT_NUM: base
  54. //AT_ENABLE: flag bit mask
  55. //AT_DISABLE: flag bit mask
  56. //AT_ACTION: none
  57. PFNARG pfnArg; //ptr. to argument verification function or
  58. // action function if AT_ACTION
  59. };
  60. /*** Exported function prototypes
  61. */
  62. LONG LOCAL DbgParseArgs(PCMDARG ArgTable, PULONG pdwNumArgs,
  63. PULONG pdwNonSWArgs, PSZ pszTokenSeps);
  64. #endif //ifdef DEBUGGER
  65. #endif //ifndef _CMDARG_H