comparison src/ntheap.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 70ad99077275
children a86b2b5e0111
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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 NTHEAP_H_ 26 #ifndef INCLUDED_ntheap_h_
27 #define NTHEAP_H_ 27 #define INCLUDED_ntheap_h_
28 28
29 #include <windows.h> 29 #include <windows.h>
30 30
31 /* 31 /*
32 * Heap related stuff. 32 * Heap related stuff.
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 ((void *) 0xF0A0F0A0) 54 #define UNINIT_PTR ((void *) 0xF0A0F0A0)
55 #define UNINIT_LONG (0xF0A0F0A0L) 55 #define UNINIT_LONG (0xF0A0F0A0L)
56 56
57 enum {
58 OS_WIN95 = 1,
59 OS_NT
60 };
61
62 extern int os_subtype;
63
64 /* Emulation of Unix sbrk(). */ 57 /* Emulation of Unix sbrk(). */
65 extern void *sbrk (unsigned long size); 58 extern void *sbrk (unsigned long size);
66 59
67 /* Recreate the heap created during dumping. */ 60 /* Recreate the heap created during dumping. */
68 extern void recreate_heap (char *executable_path); 61 extern void recreate_heap (char *executable_path);
85 78
86 /* ----------------------------------------------------------------- */ 79 /* ----------------------------------------------------------------- */
87 /* Useful routines for manipulating memory-mapped files. */ 80 /* Useful routines for manipulating memory-mapped files. */
88 81
89 typedef struct file_data { 82 typedef struct file_data {
90 char *name; 83 const char *name;
91 unsigned long size; 84 unsigned long size;
92 HANDLE file; 85 HANDLE file;
93 HANDLE file_mapping; 86 HANDLE file_mapping;
94 unsigned char *file_base; 87 unsigned char *file_base;
95 } file_data; 88 } file_data;
101 (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress)) 94 (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress))
102 95
103 #define RVA_TO_PTR(var,section,filedata) \ 96 #define RVA_TO_PTR(var,section,filedata) \
104 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base)) 97 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base))
105 98
106 int open_input_file (file_data *p_file, char *name); 99 int open_input_file (file_data *p_file, const char *name);
107 int open_output_file (file_data *p_file, char *name, unsigned long size); 100 int open_output_file (file_data *p_file, const char *name, unsigned long size);
108 void close_file_data (file_data *p_file); 101 void close_file_data (file_data *p_file);
109 102
110 /* Return pointer to section header for section containing the given 103 #endif /* INCLUDED_ntheap_h_ */
111 relative virtual address. */
112 IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header);
113
114 #endif /* NTHEAP_H_ */