rtinfo.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the mingw-w64 runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  5. */
  6. #ifndef __ROUTING_RTINFO_H__
  7. #define __ROUTING_RTINFO_H__
  8. #define ALIGN_SIZE 0x00000008
  9. #define ALIGN_SHIFT (ALIGN_SIZE - 0x00000001)
  10. #define ALIGN_MASK_POINTER (~(UINT_PTR)ALIGN_SHIFT)
  11. #define ALIGN_MASK_LENGTH (~ALIGN_SHIFT)
  12. #define ALIGN_MASK (~ALIGN_SHIFT)
  13. #define ALIGN_POINTER(ptr) { (ptr) = (PVOID)((DWORD_PTR)(ptr) + ALIGN_SHIFT); (ptr) = (PVOID)((DWORD_PTR)(ptr) & ALIGN_MASK_POINTER); }
  14. #define ALIGN_LENGTH(length) { (length) = (DWORD)((length) + ALIGN_SHIFT); (length) = (DWORD)((length) & ALIGN_MASK_LENGTH); }
  15. #define IS_ALIGNED(ptr) (((UINT_PTR)(ptr) & ALIGN_SHIFT)==0x00000000)
  16. typedef struct _RTR_TOC_ENTRY {
  17. ULONG InfoType;
  18. ULONG InfoSize;
  19. ULONG Count;
  20. ULONG Offset;
  21. } RTR_TOC_ENTRY,*PRTR_TOC_ENTRY;
  22. #define RTR_INFO_BLOCK_VERSION 1
  23. typedef struct _RTR_INFO_BLOCK_HEADER {
  24. ULONG Version;
  25. ULONG Size;
  26. ULONG TocEntriesCount;
  27. RTR_TOC_ENTRY TocEntry[1];
  28. } RTR_INFO_BLOCK_HEADER,*PRTR_INFO_BLOCK_HEADER;
  29. #define GetInfoFromTocEntry(hdr,toc) (((toc)->Offset < (hdr)->Size) ? ((PVOID)(((PBYTE)(hdr)) + (toc)->Offset)) : NULL)
  30. #endif