comparison src/ntheap.h @ 408:501cfd01ee6d r21-2-34

Import from CVS: tag r21-2-34
author cvs
date Mon, 13 Aug 2007 11:18:11 +0200
parents a86b2b5e0111
children de805c49cfc1
comparison
equal deleted inserted replaced
407:ed6218a7d4d3 408:501cfd01ee6d
74 74
75 /* Round ADDRESS up to be aligned with ALIGN. */ 75 /* Round ADDRESS up to be aligned with ALIGN. */
76 extern unsigned char *round_to_next (unsigned char *address, 76 extern unsigned char *round_to_next (unsigned char *address,
77 unsigned long align); 77 unsigned long align);
78 78
79 /* ----------------------------------------------------------------- */
80 /* Useful routines for manipulating memory-mapped files. */
81
82 typedef struct file_data {
83 const char *name;
84 unsigned long size;
85 HANDLE file;
86 HANDLE file_mapping;
87 char *file_base;
88 } file_data;
89
90 #define OFFSET_TO_RVA(var,section) \
91 (section->VirtualAddress + ((DWORD)(var) - section->PointerToRawData))
92
93 #define RVA_TO_OFFSET(var,section) \
94 (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress))
95
96 #define RVA_TO_PTR(var,section,filedata) \
97 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base))
98
99 int open_input_file (file_data *p_file, const char *name);
100 int open_output_file (file_data *p_file, const char *name, unsigned long size);
101 void close_file_data (file_data *p_file);
102
103 #endif /* INCLUDED_ntheap_h_ */ 79 #endif /* INCLUDED_ntheap_h_ */