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.

88 lines
4.5 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: dbgext.h
  3. *
  4. * Created: 10-Sep-1993 08:36:42
  5. * Author: Eric Kutter [erick]
  6. *
  7. * Copyright (c) 1993-1999 Microsoft Corporation
  8. *
  9. * Dependencies:
  10. *
  11. * common macros for debugger extensions
  12. *
  13. *
  14. \**************************************************************************/
  15. /**************************************************************************\
  16. *
  17. * GetAddress - symbol of another module
  18. *
  19. \**************************************************************************/
  20. #define GetAddress(dst, src) \
  21. try { \
  22. char *pj = (char *)(src); \
  23. /* if it is NTSD, don't want the trailing & */ \
  24. if ((lpExtensionApis->nSize < sizeof(WINDBG_EXTENSION_APIS)) && \
  25. (*pj == '&')) \
  26. { \
  27. pj++; \
  28. } \
  29. *((ULONG *) &dst) = EvalExpression(pj); \
  30. } except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? \
  31. EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { \
  32. Print("NTSD: Access violation on \"%s\", switch to server context\n", src); \
  33. return; \
  34. }
  35. #define GetValue(dst,src) \
  36. GetAddress(dst,src) \
  37. if (TRUE || lpExtensionApis->nSize < sizeof(WINDBG_EXTENSION_APIS)) \
  38. { \
  39. move(dst,dst); \
  40. }
  41. /**************************************************************************\
  42. *
  43. * move(dst, src ptr)
  44. *
  45. \**************************************************************************/
  46. #define move(dst, src) \
  47. try { \
  48. if (lpExtensionApis->nSize >= sizeof(WINDBG_EXTENSION_APIS)) \
  49. { \
  50. (*lpExtensionApis->lpReadProcessMemoryRoutine)( \
  51. (DWORD) (src), &(dst), sizeof(dst), NULL); \
  52. } else \
  53. { \
  54. NtReadVirtualMemory(hCurrentProcess, (LPVOID) (src), &(dst), sizeof(dst), NULL);\
  55. } \
  56. \
  57. } except (EXCEPTION_EXECUTE_HANDLER) { \
  58. Print("exception in move()\n"); \
  59. return; \
  60. }
  61. /**************************************************************************\
  62. *
  63. * move2(dst ptr, src ptr, num bytes)
  64. *
  65. \**************************************************************************/
  66. #define move2(dst, src,bytes) \
  67. try { \
  68. if (lpExtensionApis->nSize >= sizeof(WINDBG_EXTENSION_APIS)) \
  69. { \
  70. (*lpExtensionApis->lpReadProcessMemoryRoutine)( \
  71. (DWORD) (src), (dst), (bytes), NULL); \
  72. } else \
  73. { \
  74. NtReadVirtualMemory(hCurrentProcess, (LPVOID) (src), (dst), (bytes), NULL);\
  75. } \
  76. \
  77. } except (EXCEPTION_EXECUTE_HANDLER) { \
  78. Print("exception in move2()\n"); \
  79. return; \
  80. }