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.

85 lines
4.3 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 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 ((ExtensionApis.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. }
  34. #define GetValue(dst,src) \
  35. GetAddress(dst,src) \
  36. if (TRUE || ExtensionApis.nSize < sizeof(WINDBG_EXTENSION_APIS)) \
  37. { \
  38. move(dst,dst); \
  39. }
  40. /**************************************************************************\
  41. *
  42. * move(dst, src ptr)
  43. *
  44. \**************************************************************************/
  45. #define move(dst, src) \
  46. __try { \
  47. if (ExtensionApis.nSize >= sizeof(WINDBG_EXTENSION_APIS)) \
  48. { \
  49. (*ExtensionApis.lpReadProcessMemoryRoutine)( \
  50. (ULONG_PTR) (src), &(dst), sizeof(dst), NULL); \
  51. } else \
  52. { \
  53. NtReadVirtualMemory(hCurrentProcess, (LPVOID) (src), &(dst), sizeof(dst), NULL);\
  54. } \
  55. \
  56. } __except (EXCEPTION_EXECUTE_HANDLER) { \
  57. Print("exception in move()\n"); \
  58. }
  59. /**************************************************************************\
  60. *
  61. * move2(dst ptr, src ptr, num bytes)
  62. *
  63. \**************************************************************************/
  64. #define move2(dst, src,bytes) \
  65. __try { \
  66. if (ExtensionApis.nSize >= sizeof(WINDBG_EXTENSION_APIS)) \
  67. { \
  68. (*ExtensionApis.lpReadProcessMemoryRoutine)( \
  69. (ULONG_PTR) (src), (dst), (bytes), NULL); \
  70. } else \
  71. { \
  72. NtReadVirtualMemory(hCurrentProcess, (LPVOID) (src), (dst), (bytes), NULL);\
  73. } \
  74. \
  75. } __except (EXCEPTION_EXECUTE_HANDLER) { \
  76. Print("exception in move2()\n"); \
  77. }