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.

83 lines
2.5 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1992 - 1999
  3. Module Name:
  4. certextp.h
  5. Abstract:
  6. Common header file for NTSDEXTS component source files.
  7. Modified version of ntsdextp.h
  8. Author:
  9. Steve Wood (stevewo) 21-Feb-1995 (original ntsdextp.h)
  10. Phil Hallin (philh) 08-Jun-1998 (modified for certextp.h)
  11. Revision History:
  12. --*/
  13. #include <windows.h>
  14. //#include <ntsdexts.h>
  15. #define NOEXTAPI
  16. #include <wdbgexts.h>
  17. #undef DECLARE_API
  18. #define move(dst, src)\
  19. __try {\
  20. ReadMemory((LPVOID) (src), &(dst), sizeof(dst), NULL);\
  21. } __except (EXCEPTION_EXECUTE_HANDLER) {\
  22. return;\
  23. }
  24. #define moveBlock(dst, src, size)\
  25. __try {\
  26. ReadMemory((LPVOID) (src), &(dst), (size), NULL);\
  27. } __except (EXCEPTION_EXECUTE_HANDLER) {\
  28. return;\
  29. }
  30. #ifdef __cplusplus
  31. #define CPPMOD extern "C"
  32. #else
  33. #define CPPMOD
  34. #endif
  35. #define DECLARE_API(s) \
  36. CPPMOD VOID \
  37. s( \
  38. HANDLE hCurrentProcess, \
  39. HANDLE hCurrentThread, \
  40. DWORD dwCurrentPc, \
  41. PWINDBG_EXTENSION_APIS lpExtensionApis, \
  42. LPSTR lpArgumentString \
  43. )
  44. #define INIT_API() { \
  45. ExtensionApis = *lpExtensionApis; \
  46. ExtensionCurrentProcess = hCurrentProcess; \
  47. }
  48. #define dprintf (ExtensionApis.lpOutputRoutine)
  49. #define GetExpression (ExtensionApis.lpGetExpressionRoutine)
  50. #define GetSymbol (ExtensionApis.lpGetSymbolRoutine)
  51. #define Disassm (ExtensionApis.lpDisasmRoutine)
  52. #define CheckControlC (ExtensionApis.lpCheckControlCRoutine)
  53. //#define ReadMemory(a,b,c,d) ReadProcessMemory( ExtensionCurrentProcess, (LPCVOID)(a), (b), (c), (d) )
  54. #define ReadMemory(a,b,c,d) \
  55. ((ExtensionApis.nSize == sizeof(WINDBG_OLD_EXTENSION_APIS)) ? \
  56. ReadProcessMemory( ExtensionCurrentProcess, (LPCVOID)(a), (b), (c), (d) ) \
  57. : ExtensionApis.lpReadProcessMemoryRoutine( (ULONG)(ULONG_PTR)(a), (b), (c), (d) ))
  58. //#define WriteMemory(a,b,c,d) WriteProcessMemory( ExtensionCurrentProcess, (LPVOID)(a), (LPVOID)(b), (c), (d) )
  59. #define WriteMemory(a,b,c,d) \
  60. ((ExtensionApis.nSize == sizeof(WINDBG_OLD_EXTENSION_APIS)) ? \
  61. WriteProcessMemory( ExtensionCurrentProcess, (LPVOID)(a), (LPVOID)(b), (c), (d) ) \
  62. : ExtensionApis.lpWriteProcessMemoryRoutine( (ULONG)(a), (LPVOID)(b), (c), (d) ))
  63. extern WINDBG_EXTENSION_APIS ExtensionApis;
  64. extern HANDLE ExtensionCurrentProcess;