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 9 #define ALIGN_SIZE 0x00000008 10 #define ALIGN_SHIFT (ALIGN_SIZE - 0x00000001) 11 #define ALIGN_MASK_POINTER (~(UINT_PTR)ALIGN_SHIFT) 12 #define ALIGN_MASK_LENGTH (~ALIGN_SHIFT) 13 #define ALIGN_MASK (~ALIGN_SHIFT) 14 15 #define ALIGN_POINTER(ptr) { (ptr) = (PVOID)((DWORD_PTR)(ptr) + ALIGN_SHIFT); (ptr) = (PVOID)((DWORD_PTR)(ptr) & ALIGN_MASK_POINTER); } 16 #define ALIGN_LENGTH(length) { (length) = (DWORD)((length) + ALIGN_SHIFT); (length) = (DWORD)((length) & ALIGN_MASK_LENGTH); } 17 #define IS_ALIGNED(ptr) (((UINT_PTR)(ptr) & ALIGN_SHIFT)==0x00000000) 18 19 typedef struct _RTR_TOC_ENTRY { 20 ULONG InfoType; 21 ULONG InfoSize; 22 ULONG Count; 23 ULONG Offset; 24 } RTR_TOC_ENTRY,*PRTR_TOC_ENTRY; 25 26 #define RTR_INFO_BLOCK_VERSION 1 27 28 typedef struct _RTR_INFO_BLOCK_HEADER { 29 ULONG Version; 30 ULONG Size; 31 ULONG TocEntriesCount; 32 RTR_TOC_ENTRY TocEntry[1]; 33 } RTR_INFO_BLOCK_HEADER,*PRTR_INFO_BLOCK_HEADER; 34 35 #define GetInfoFromTocEntry(hdr,toc) (((toc)->Offset < (hdr)->Size) ? ((PVOID)(((PBYTE)(hdr)) + (toc)->Offset)) : NULL) 36 #endif 37