aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeoff Voelker1997-09-03 00:52:12 +0000
committerGeoff Voelker1997-09-03 00:52:12 +0000
commit3443b04a0993bfc008ab7c442ccaa1fda73d513a (patch)
tree7a5cfefe5b6bf1e08b8957c0001b1fb58e3755b1 /src
parent801f68b995bc026446109ac3fafd9af5f7816827 (diff)
downloademacs-3443b04a0993bfc008ab7c442ccaa1fda73d513a.tar.gz
emacs-3443b04a0993bfc008ab7c442ccaa1fda73d513a.zip
Enumerate operating system types.
Declare extern data and functions. Move file_data struct definition here. (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_PTR): New macros.
Diffstat (limited to 'src')
-rw-r--r--src/w32heap.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/w32heap.h b/src/w32heap.h
index 24ed080ff7f..d2b05ba6e7c 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -48,6 +48,13 @@ extern BOOL need_to_recreate_heap;
48extern int w32_major_version; 48extern int w32_major_version;
49extern int w32_minor_version; 49extern int w32_minor_version;
50 50
51enum {
52 OS_WIN95 = 1,
53 OS_NT
54};
55
56extern int os_subtype;
57
51/* Emulation of Unix sbrk(). */ 58/* Emulation of Unix sbrk(). */
52extern void *sbrk (unsigned long size); 59extern void *sbrk (unsigned long size);
53 60
@@ -70,4 +77,37 @@ extern void cache_system_info (void);
70extern unsigned char *round_to_next (unsigned char *address, 77extern unsigned char *round_to_next (unsigned char *address,
71 unsigned long align); 78 unsigned long align);
72 79
80/* ----------------------------------------------------------------- */
81/* Useful routines for manipulating memory-mapped files. */
82
83typedef struct file_data {
84 char *name;
85 unsigned long size;
86 HANDLE file;
87 HANDLE file_mapping;
88 unsigned char *file_base;
89} file_data;
90
91#define OFFSET_TO_RVA(var,section) \
92 (section->VirtualAddress + ((DWORD)(var) - section->PointerToRawData))
93
94#define RVA_TO_OFFSET(var,section) \
95 (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress))
96
97#define RVA_TO_PTR(var,section,filedata) \
98 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base))
99
100int open_input_file (file_data *p_file, char *name);
101int open_output_file (file_data *p_file, char *name, unsigned long size);
102void close_file_data (file_data *p_file);
103
104unsigned long get_section_size (PIMAGE_SECTION_HEADER p_section);
105
106/* Return pointer to section header for named section. */
107IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header);
108
109/* Return pointer to section header for section containing the given
110 relative virtual address. */
111IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header);
112
73#endif /* NTHEAP_H_ */ 113#endif /* NTHEAP_H_ */