comparison src/ntheap.h @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents de805c49cfc1
children 11054d720c21
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
21 Geoff Voelker (voelker@cs.washington.edu) 7-29-94 */ 21 Geoff Voelker (voelker@cs.washington.edu) 7-29-94 */
22 22
23 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */ 23 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */
24 /* Synced with FSF Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */ 24 /* Synced with FSF Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */
25 25
26 #ifndef INCLUDED_ntheap_h_ 26 #ifndef NTHEAP_H_
27 #define INCLUDED_ntheap_h_ 27 #define NTHEAP_H_
28 28
29 #include "syswindows.h" 29 #include <windows.h>
30 30
31 /* 31 /*
32 * Heap related stuff. 32 * Heap related stuff.
33 */ 33 */
34 #define get_reserved_heap_size() reserved_heap_size 34 #define get_reserved_heap_size() reserved_heap_size
49 extern int nt_major_version; 49 extern int nt_major_version;
50 extern int nt_minor_version; 50 extern int nt_minor_version;
51 51
52 /* To prevent zero-initialized variables from being placed into the bss 52 /* To prevent zero-initialized variables from being placed into the bss
53 section, use non-zero values to represent an uninitialized state. */ 53 section, use non-zero values to represent an uninitialized state. */
54 #define UNINIT_PTR ((unsigned char*) 0xF0A0F0A0) 54 #define UNINIT_PTR ((void *) 0xF0A0F0A0)
55 #define UNINIT_LONG (0xF0A0F0A0L) 55 #define UNINIT_LONG (0xF0A0F0A0L)
56
57 enum {
58 OS_WIN95 = 1,
59 OS_NT
60 };
61
62 extern int os_subtype;
56 63
57 /* Emulation of Unix sbrk(). */ 64 /* Emulation of Unix sbrk(). */
58 extern void *sbrk (unsigned long size); 65 extern void *sbrk (unsigned long size);
59 66
60 /* Recreate the heap created during dumping. */ 67 /* Recreate the heap created during dumping. */
74 81
75 /* Round ADDRESS up to be aligned with ALIGN. */ 82 /* Round ADDRESS up to be aligned with ALIGN. */
76 extern unsigned char *round_to_next (unsigned char *address, 83 extern unsigned char *round_to_next (unsigned char *address,
77 unsigned long align); 84 unsigned long align);
78 85
79 #endif /* INCLUDED_ntheap_h_ */ 86 /* ----------------------------------------------------------------- */
87 /* Useful routines for manipulating memory-mapped files. */
88
89 typedef struct file_data {
90 char *name;
91 unsigned long size;
92 HANDLE file;
93 HANDLE file_mapping;
94 unsigned char *file_base;
95 } file_data;
96
97 #define OFFSET_TO_RVA(var,section) \
98 (section->VirtualAddress + ((DWORD)(var) - section->PointerToRawData))
99
100 #define RVA_TO_OFFSET(var,section) \
101 (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress))
102
103 #define RVA_TO_PTR(var,section,filedata) \
104 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base))
105
106 int open_input_file (file_data *p_file, CONST char *name);
107 int open_output_file (file_data *p_file, CONST char *name, unsigned long size);
108 void close_file_data (file_data *p_file);
109
110 #endif /* NTHEAP_H_ */