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.

87 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. ximagdef.h
  5. Abstract:
  6. This file contains image definitions and for both 32-bit and 64-bit
  7. images.
  8. Author:
  9. Forrest C. Foltz (forrestf) 23-May-2000
  10. Revision History:
  11. --*/
  12. #if defined(_X86AMD64_)
  13. #undef IMAGE_ORDINAL_FLAG
  14. #undef IMAGE_ORDINAL
  15. #undef IMAGE_THUNK_DATA
  16. #undef PIMAGE_THUNK_DATA
  17. #undef IMAGE_SNAP_BY_ORDINAL
  18. #undef IMAGE_TLS_DIRECTORY
  19. #undef PIMAGE_TLS_DIRECTORY
  20. #undef IMAGE_NT_HEADERS
  21. #undef PIMAGE_NT_HEADERS
  22. #if IMAGE_DEFINITIONS == 32
  23. #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
  24. #define IMAGE_ORDINAL(x) IMAGE_ORDINAL32(x)
  25. #define IMAGE_THUNK_DATA IMAGE_THUNK_DATA32
  26. #define PIMAGE_THUNK_DATA PIMAGE_THUNK_DATA32
  27. #define IMAGE_SNAP_BY_ORDINAL(x) IMAGE_SNAP_BY_ORDINAL32(x)
  28. #define IMAGE_TLS_DIRECTORY IMAGE_TLS_DIRECTORY32
  29. #define PIMAGE_TLS_DIRECTORY PIMAGE_TLS_DIRECTORY32
  30. #define IMAGE_NT_HEADERS IMAGE_NT_HEADERS32
  31. #define PIMAGE_NT_HEADERS PIMAGE_NT_HEADERS32
  32. #elif IMAGE_DEFINITIONS == 64
  33. #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
  34. #define IMAGE_ORDINAL(x) IMAGE_ORDINAL64(x)
  35. #define IMAGE_THUNK_DATA IMAGE_THUNK_DATA64
  36. #define PIMAGE_THUNK_DATA PIMAGE_THUNK_DATA64
  37. #define IMAGE_SNAP_BY_ORDINAL(x) IMAGE_SNAP_BY_ORDINAL64(x)
  38. #define IMAGE_TLS_DIRECTORY IMAGE_TLS_DIRECTORY64
  39. #define PIMAGE_TLS_DIRECTORY PIMAGE_TLS_DIRECTORY64
  40. #define IMAGE_NT_HEADERS IMAGE_NT_HEADERS64
  41. #define PIMAGE_NT_HEADERS PIMAGE_NT_HEADERS64
  42. #endif
  43. #define IMAGE_NT_HEADER(x) ((PIMAGE_NT_HEADERS)RtlImageNtHeader(x))
  44. #ifndef _XIMAGDEF_H_
  45. #define _XIMAGDEF_H_
  46. //
  47. // Macros used to determine whether an image is 32-bit or 64-bit, and an
  48. // assert to make sure the Magic field has the same offset in both.
  49. //
  50. #define IMAGE_64BIT( ntheader ) \
  51. (((PIMAGE_NT_HEADERS32)(ntheader))->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
  52. #define IMAGE_32BIT( ntheader ) \
  53. (((PIMAGE_NT_HEADERS32)(ntheader))->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
  54. C_ASSERT( FIELD_OFFSET(IMAGE_NT_HEADERS32, OptionalHeader.Magic) ==
  55. FIELD_OFFSET(IMAGE_NT_HEADERS64, OptionalHeader.Magic) );
  56. #endif // _XIMAGDEF_H_
  57. #endif // _X86AMD64_