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.

169 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. kdextlib.h
  5. Abstract:
  6. Kernel Debugger extension
  7. Author:
  8. Balan Sethu Raman (SethuR) 11-May-1994
  9. Revision History:
  10. 11-Nov-1994 SethuR Created
  11. 21-Aug-1995 Milans Copied for use in Mup Kernel Extensions
  12. --*/
  13. #ifndef _KDEXTLIB_H_
  14. #define _KDEXTLIB_H_
  15. #include <windef.h>
  16. //
  17. // The help strings printed out
  18. //
  19. extern LPSTR ExtensionNames[];
  20. extern LPSTR Extensions[];
  21. //
  22. // The FIELD_DESCRIPTOR data structure is used to describe the field in a structure sufficiently
  23. // for displaying information during debugging. The three pieces of information that are required
  24. // are 1) the name of the field, 2) the offset in the corresponding structure and 3) a type descriptor.
  25. // The type descriptor covers most primitive types.
  26. //
  27. // The task of generating these descriptors by augmenting the front end, but that will have to
  28. // wait till we play around with these extensions and modify the data structures to meet most
  29. // of the requirements.
  30. //
  31. // There are some types that can benefit from some auxillary information in the descriptors. A
  32. // case in point is the "enum" defeinition. Merely printing out a numerical value for an enum
  33. // type will invariably force the person using these extensions to refer to the corresponding
  34. // include file. In order to avoid this we will accept an additional array for enum types that
  35. // contains a textual description of the numerical value.
  36. //
  37. // There are certain conventions that have been adopted to ease the definition of the macros
  38. // as well as facilitate the automation of the generation of these descriptors.
  39. // These are as follows ....
  40. //
  41. // 1) All ENUM_VALUE_DESCRIPTOR definitions are named EnumValueDescrsOf_ENUMTYPENAME, where
  42. // ENUMTYPENAME defines the corresponding enumerated type.
  43. //
  44. typedef struct _ENUM_VALUE_DESCRIPTOR {
  45. ULONG EnumValue;
  46. LPSTR EnumName;
  47. } ENUM_VALUE_DESCRIPTOR;
  48. typedef struct _BIT_MASK_DESCRIPTOR {
  49. ULONG BitmaskValue;
  50. LPSTR BitmaskName;
  51. } BIT_MASK_DESCRIPTOR;
  52. typedef enum _FIELD_TYPE_CLASS {
  53. FieldTypeByte,
  54. FieldTypeChar,
  55. FieldTypeBoolean,
  56. FieldTypeBool,
  57. FieldTypeULong,
  58. FieldTypeLong,
  59. FieldTypeUShort,
  60. FieldTypeShort,
  61. FieldTypeGuid,
  62. FieldTypePointer,
  63. FieldTypePWStr,
  64. FieldTypeUnicodeString,
  65. FieldTypeAnsiString,
  66. FieldTypeSymbol,
  67. FieldTypeEnum,
  68. FieldTypeByteBitMask,
  69. FieldTypeWordBitMask,
  70. FieldTypeDWordBitMask,
  71. FieldTypeFloat,
  72. FieldTypeDouble,
  73. FieldTypeStruct,
  74. FieldTypeLargeInteger,
  75. FieldTypeFileTime
  76. } FIELD_TYPE_CLASS, *PFIELD_TYPE_CLASS;
  77. typedef struct _FIELD_DESCRIPTOR_ {
  78. FIELD_TYPE_CLASS FieldType; // The type of variable to be printed
  79. LPSTR Name; // The name of the field
  80. USHORT Offset; // The offset of the field in the structure
  81. union {
  82. VOID *pDescriptor; // Generic Auxillary information - used by Field4 macro
  83. ENUM_VALUE_DESCRIPTOR *pEnumValueDescriptor; // Auxillary information for enumerated types.
  84. BIT_MASK_DESCRIPTOR *pBitMaskDescriptor; // Auxillary information for bitmasks.
  85. } AuxillaryInfo;
  86. } FIELD_DESCRIPTOR;
  87. #define FIELD3(FieldType,StructureName, FieldName) \
  88. {FieldType, #FieldName , (USHORT) FIELD_OFFSET(StructureName,FieldName) ,NULL}
  89. #define FIELD4(FieldType, StructureName, FieldName, AuxInfo) \
  90. {FieldType, #FieldName , FIELD_OFFSET(StructureName,FieldName) ,(VOID *) AuxInfo}
  91. //
  92. // The structs that are displayed by the debugger extensions are further
  93. // described in another array. Each entry in the array contains the name of
  94. // the structure and the associated Field descriptor list.
  95. //
  96. typedef struct _STRUCT_DESCRITOR_ {
  97. LPSTR StructName;
  98. ULONG StructSize;
  99. FIELD_DESCRIPTOR *FieldDescriptors;
  100. } STRUCT_DESCRIPTOR;
  101. #define STRUCT(StructTypeName,FieldDescriptors) \
  102. { #StructTypeName,sizeof(StructTypeName),FieldDescriptors}
  103. //
  104. // The array of structs handled by the debugger extension.
  105. //
  106. extern STRUCT_DESCRIPTOR Structs[];
  107. #define SETCALLBACKS() \
  108. lpOutputRoutine = lpExtensionApis->lpOutputRoutine; \
  109. lpGetExpressionRoutine = lpExtensionApis->lpGetExpressionRoutine; \
  110. lpGetSymbolRoutine = lpExtensionApis->lpGetSymbolRoutine; \
  111. lpReadMemoryRoutine = lpExtensionApis->lpReadVirtualMemRoutine;
  112. VOID
  113. PrintStructFields(
  114. ULONG_PTR dwAddress,
  115. VOID *ptr,
  116. FIELD_DESCRIPTOR *pFieldDescriptors
  117. );
  118. BOOL
  119. PrintStringW(
  120. LPSTR msg,
  121. PUNICODE_STRING puStr,
  122. BOOL nl
  123. );
  124. BOOLEAN
  125. GetData(
  126. ULONG_PTR dwAddress,
  127. PVOID ptr,
  128. ULONG size
  129. );
  130. BOOL
  131. PrintGuid(
  132. GUID *pguid);
  133. extern ULONG s_NoOfColumns;
  134. #endif // _KDEXTLIB_H_