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.

95 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. cons.h
  5. Abstract:
  6. Global constant definitions for the UL.SYS Kernel Debugger
  7. Extensions.
  8. Author:
  9. Keith Moore (keithmo) 17-Jun-1998.
  10. Environment:
  11. User Mode.
  12. --*/
  13. #ifndef _CONS_H_
  14. #define _CONS_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define DIM(x) (sizeof(x) / sizeof(x[0]))
  19. #define MAX_TRANSPORT_ADDRESS_LENGTH 128
  20. #define MAX_SYMBOL_LENGTH 256
  21. #define MAX_RESOURCE_STATE_LENGTH 80
  22. #define MAX_SIGNATURE_LENGTH 20
  23. #define Address00 Address[0].Address[0]
  24. #define UC(x) ((UINT)((x) & 0xFF))
  25. #define NTOHS(x) ( (UC(x) * 256) + UC((x) >> 8) )
  26. #define IS_LIST_EMPTY( localaddr, remoteaddr, type, fieldname ) \
  27. ( ((type *)(localaddr))->fieldname.Flink == \
  28. (PLIST_ENTRY)( (remoteaddr) + \
  29. FIELD_OFFSET( type, fieldname ) ) )
  30. #define REMOTE_OFFSET( remoteaddr, type, fieldname ) \
  31. ( (PUCHAR)(remoteaddr) + FIELD_OFFSET( type, fieldname ) )
  32. #define READ_REMOTE_STRING( localaddr, locallen, remoteaddr, remotelen ) \
  33. if( TRUE ) \
  34. { \
  35. ULONG _len; \
  36. ULONG _res; \
  37. RtlZeroMemory( (localaddr), (locallen) ); \
  38. _len = min( (locallen), (remotelen) ); \
  39. if (_len > 0) \
  40. { \
  41. ReadMemory( \
  42. (ULONG_PTR)(remoteaddr), \
  43. (PVOID)(localaddr), \
  44. _len, \
  45. &_res \
  46. ); \
  47. } \
  48. } else
  49. #ifdef _WIN64
  50. // Hack: the Next and Depth fields are no longer accessible
  51. // This definition allows us to compile and link.
  52. # define SLIST_HEADER_NEXT(psh) ((PSINGLE_LIST_ENTRY) NULL)
  53. # define SLIST_HEADER_DEPTH(psh) ((USHORT) -1)
  54. #else // !_WIN64
  55. # define SLIST_HEADER_NEXT(psh) ((psh)->Next.Next)
  56. # define SLIST_HEADER_DEPTH(psh) ((psh)->Depth)
  57. #endif // !_WIN64
  58. #define SNAPSHOT_EXTENSION_DATA() \
  59. do \
  60. { \
  61. g_hCurrentProcess = hCurrentProcess; \
  62. g_hCurrentThread = hCurrentThread; \
  63. g_dwCurrentPc = dwCurrentPc; \
  64. g_dwProcessor = g_dwProcessor; \
  65. } while (FALSE)
  66. #ifdef __cplusplus
  67. }; // extern "C"
  68. #endif
  69. #endif // _CONS_H_