~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/dbghelp/image_private.h

Version: ~ [ wine-1.5.31 ] ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * File elf_private.h - definitions for processing of ELF files
  3  *
  4  * Copyright (C) 1996, Eric Youngdale.
  5  *               1999-2007 Eric Pouech
  6  *
  7  * This library is free software; you can redistribute it and/or
  8  * modify it under the terms of the GNU Lesser General Public
  9  * License as published by the Free Software Foundation; either
 10  * version 2.1 of the License, or (at your option) any later version.
 11  *
 12  * This library is distributed in the hope that it will be useful,
 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 15  * Lesser General Public License for more details.
 16  *
 17  * You should have received a copy of the GNU Lesser General Public
 18  * License along with this library; if not, write to the Free Software
 19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 20  */
 21 
 22 #ifdef HAVE_ELF_H
 23 # include <elf.h>
 24 #endif
 25 #ifdef HAVE_SYS_ELF32_H
 26 # include <sys/elf32.h>
 27 #endif
 28 #ifdef HAVE_SYS_EXEC_ELF_H
 29 # include <sys/exec_elf.h>
 30 #endif
 31 #if !defined(DT_NUM)
 32 # if defined(DT_COUNT)
 33 #  define DT_NUM DT_COUNT
 34 # else
 35 /* this seems to be a satisfactory value on Solaris, which doesn't support this AFAICT */
 36 #  define DT_NUM 24
 37 # endif
 38 #endif
 39 #ifdef HAVE_LINK_H
 40 # include <link.h>
 41 #endif
 42 #ifdef HAVE_SYS_LINK_H
 43 # include <sys/link.h>
 44 #endif
 45 
 46 #define IMAGE_NO_MAP  ((void*)-1)
 47 
 48 #ifdef __ELF__
 49 
 50 #ifdef _WIN64
 51 #define         Elf_Ehdr        Elf64_Ehdr
 52 #define         Elf_Shdr        Elf64_Shdr
 53 #define         Elf_Phdr        Elf64_Phdr
 54 #define         Elf_Dyn         Elf64_Dyn
 55 #define         Elf_Sym         Elf64_Sym
 56 #else
 57 #define         Elf_Ehdr        Elf32_Ehdr
 58 #define         Elf_Shdr        Elf32_Shdr
 59 #define         Elf_Phdr        Elf32_Phdr
 60 #define         Elf_Dyn         Elf32_Dyn
 61 #define         Elf_Sym         Elf32_Sym
 62 #endif
 63 #else
 64 #ifndef SHT_NULL
 65 #define SHT_NULL        0
 66 #endif
 67 #endif
 68 
 69 /* structure holding information while handling an ELF image
 70  * allows one by one section mapping for memory savings
 71  */
 72 struct image_file_map
 73 {
 74     enum module_type            modtype;
 75     union
 76     {
 77         struct elf_file_map
 78         {
 79             size_t                      elf_size;
 80             size_t                      elf_start;
 81             int                         fd;
 82             const char*                 shstrtab;
 83             struct image_file_map*      alternate;      /* another ELF file (linked to this one) */
 84 #ifdef __ELF__
 85             Elf_Ehdr                    elfhdr;
 86             struct
 87             {
 88                 Elf_Shdr                        shdr;
 89                 const char*                     mapped;
 90             }*                          sect;
 91 #endif
 92         } elf;
 93         struct pe_file_map
 94         {
 95             HANDLE                      hMap;
 96             IMAGE_NT_HEADERS            ntheader;
 97             unsigned                    full_count;
 98             void*                       full_map;
 99             struct
100             {
101                 IMAGE_SECTION_HEADER            shdr;
102                 const char*                     mapped;
103             }*                          sect;
104             const char*                 strtable;
105         } pe;
106     } u;
107 };
108 
109 struct image_section_map
110 {
111     struct image_file_map*      fmap;
112     long                        sidx;
113 };
114 
115 extern BOOL         elf_find_section(struct image_file_map* fmap, const char* name,
116                                      unsigned sht, struct image_section_map* ism);
117 extern const char*  elf_map_section(struct image_section_map* ism);
118 extern void         elf_unmap_section(struct image_section_map* ism);
119 extern DWORD_PTR    elf_get_map_rva(const struct image_section_map* ism);
120 extern unsigned     elf_get_map_size(const struct image_section_map* ism);
121 
122 extern BOOL         pe_find_section(struct image_file_map* fmap, const char* name,
123                                     struct image_section_map* ism);
124 extern const char*  pe_map_section(struct image_section_map* psm);
125 extern void         pe_unmap_section(struct image_section_map* psm);
126 extern DWORD_PTR    pe_get_map_rva(const struct image_section_map* psm);
127 extern unsigned     pe_get_map_size(const struct image_section_map* psm);
128 
129 static inline BOOL image_find_section(struct image_file_map* fmap, const char* name,
130                                       struct image_section_map* ism)
131 {
132     switch (fmap->modtype)
133     {
134     case DMT_ELF: return elf_find_section(fmap, name, SHT_NULL, ism);
135     case DMT_PE:  return pe_find_section(fmap, name, ism);
136     default: assert(0); return FALSE;
137     }
138 }
139 
140 static inline const char* image_map_section(struct image_section_map* ism)
141 {
142     if (!ism->fmap) return NULL;
143     switch (ism->fmap->modtype)
144     {
145     case DMT_ELF: return elf_map_section(ism);
146     case DMT_PE:  return pe_map_section(ism);
147     default: assert(0); return NULL;
148     }
149 }
150 
151 static inline void image_unmap_section(struct image_section_map* ism)
152 {
153     if (!ism->fmap) return;
154     switch (ism->fmap->modtype)
155     {
156     case DMT_ELF: elf_unmap_section(ism); break;
157     case DMT_PE:  pe_unmap_section(ism);   break;
158     default: assert(0); return;
159     }
160 }
161 
162 static inline DWORD_PTR image_get_map_rva(struct image_section_map* ism)
163 {
164     if (!ism->fmap) return 0;
165     switch (ism->fmap->modtype)
166     {
167     case DMT_ELF: return elf_get_map_rva(ism);
168     case DMT_PE:  return pe_get_map_rva(ism);
169     default: assert(0); return 0;
170     }
171 }
172 
173 static inline unsigned image_get_map_size(struct image_section_map* ism)
174 {
175     if (!ism->fmap) return 0;
176     switch (ism->fmap->modtype)
177     {
178     case DMT_ELF: return elf_get_map_size(ism);
179     case DMT_PE:  return pe_get_map_size(ism);
180     default: assert(0); return 0;
181     }
182 }
183 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.