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

Wine Cross Reference
wine/tools/winedump/winedump.h

Version: ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  *  Winedump - A Wine DLL tool
  3  *
  4  *  Copyright 2000 Jon Griffiths
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  *
 20  *  References:
 21  *  DLL symbol extraction based on file format from alib (anthonyw.cjb.net).
 22  *
 23  *  Option processing shamelessly cadged from winebuild.
 24  *
 25  *  All the cool functionality (prototyping, call tracing, forwarding)
 26  *  relies on Patrik Stridvall's 'function_grep.pl' script to work.
 27  *
 28  *  http://www.kegel.com/mangle.html
 29  *  Gives information on the name mangling scheme used by MS compilers,
 30  *  used as the starting point for the code here. Contains a few
 31  *  mistakes and some incorrect assumptions, but the lists of types
 32  *  are pure gold.
 33  */
 34 #ifndef __WINE_WINEDUMP_H
 35 #define __WINE_WINEDUMP_H
 36 
 37 #include <stdlib.h>
 38 #include <stdio.h>
 39 #include <string.h>
 40 #include <ctype.h>
 41 #include <errno.h>
 42 #include <assert.h>
 43 #include <stdarg.h>
 44 
 45 #define NONAMELESSUNION
 46 #define NONAMELESSSTRUCT
 47 #include "windef.h"
 48 #include "winbase.h"
 49 
 50 /* Argument type constants */
 51 #define MAX_FUNCTION_ARGS   32
 52 
 53 #define ARG_VOID            0x0
 54 #define ARG_STRING          0x1
 55 #define ARG_WIDE_STRING     0x2
 56 #define ARG_POINTER         0x3
 57 #define ARG_LONG            0x4
 58 #define ARG_DOUBLE          0x5
 59 #define ARG_STRUCT          0x6 /* By value */
 60 #define ARG_FLOAT           0x7
 61 #define ARG_VARARGS         0x8
 62 
 63 /* Compound type flags */
 64 #define CT_BY_REFERENCE     0x1
 65 #define CT_VOLATILE         0x2
 66 #define CT_CONST            0x4
 67 #define CT_EXTENDED         0x8
 68 
 69 /* symbol flags */
 70 #define SYM_CDECL           0x1
 71 #define SYM_STDCALL         0x2
 72 #define SYM_THISCALL        0x4
 73 #define SYM_DATA            0x8 /* Data, not a function */
 74 
 75 typedef enum {NONE, DMGL, SPEC, DUMP} Mode;
 76 
 77 /* Structure holding a parsed symbol */
 78 typedef struct __parsed_symbol
 79 {
 80   char *symbol;
 81   int   ordinal;
 82   char *return_text;
 83   char  return_type;
 84   char *function_name;
 85   int varargs;
 86   unsigned int argc;
 87   unsigned int flags;
 88   char  arg_type [MAX_FUNCTION_ARGS];
 89   char  arg_flag [MAX_FUNCTION_ARGS];
 90   char *arg_text [MAX_FUNCTION_ARGS];
 91   char *arg_name [MAX_FUNCTION_ARGS];
 92 } parsed_symbol;
 93 
 94 /* FIXME: Replace with some hash such as GHashTable */
 95 typedef struct __search_symbol
 96 {
 97   struct __search_symbol *next;
 98   int found;
 99   char symbolname[1];    /* static string, be ANSI C compliant by [1] */
100 } search_symbol;
101 
102 /* All globals */
103 typedef struct __globals
104 {
105   Mode  mode;              /* SPEC, DEMANGLE or DUMP */
106 
107   /* Options: generic */
108   int   do_quiet;          /* -q */
109   int   do_verbose;        /* -v */
110 
111   /* Option arguments: generic */
112   const char *input_name;  /* */
113   const char *input_module; /* input module name generated after input_name according mode */
114 
115   /* Options: spec mode */
116   int   do_code;           /* -c, -t, -f */
117   int   do_trace;          /* -t, -f */
118   int   do_cdecl;          /* -C */
119   int   do_documentation;  /* -D */
120 
121   /* Options: dump mode */
122   int   do_demangle;        /* -d */
123   int   do_dumpheader;      /* -f */
124   int   do_dump_rawdata;    /* -x */
125   int   do_debug;           /* -G == 1, -g == 2 */
126 
127   /* Option arguments: spec mode */
128   int   start_ordinal;     /* -s */
129   int   end_ordinal;       /* -e */
130   search_symbol *search_symbol; /* -S */
131   char *directory;         /* -I */
132   const char *forward_dll; /* -f */
133   const char *dll_name;    /* -o */
134   const char *uc_dll_name;       /* -o */
135 
136   /* Option arguments: dump mode */
137   const char *dumpsect;    /* -j */
138 
139   /* internal options */
140   int   do_ordinals;
141 } _globals;
142 
143 extern _globals globals;
144 
145 /* Names to use for output DLL */
146 #define OUTPUT_DLL_NAME \
147           (globals.dll_name ? globals.dll_name : (globals.input_module ? globals.input_module : globals.input_name))
148 #define OUTPUT_UC_DLL_NAME globals.uc_dll_name
149 
150 /* Verbosity levels */
151 #define QUIET   (globals.do_quiet)
152 #define NORMAL  (!QUIET)
153 #define VERBOSE (globals.do_verbose)
154 
155 /* Default calling convention */
156 #define CALLING_CONVENTION (globals.do_cdecl ? SYM_CDECL : SYM_STDCALL)
157 
158 /* Image functions */
159 void    dump_file(const char* name);
160 
161 /* DLL functions */
162 int   dll_open (const char *dll_name);
163 
164 int   dll_next_symbol (parsed_symbol * sym);
165 
166 /* Symbol functions */
167 int   symbol_init(parsed_symbol* symbol, const char* name);
168 
169 int   symbol_demangle (parsed_symbol *symbol);
170 
171 int   symbol_search (parsed_symbol *symbol);
172 
173 void  symbol_clear(parsed_symbol *sym);
174 
175 int   symbol_is_valid_c(const parsed_symbol *sym);
176 
177 const char *symbol_get_call_convention(const parsed_symbol *sym);
178 
179 const char *symbol_get_spec_type (const parsed_symbol *sym, size_t arg);
180 
181 void  symbol_clean_string (const char *string);
182 
183 int   symbol_get_type (const char *string);
184 
185 /* Output functions */
186 void  output_spec_preamble (void);
187 
188 void  output_spec_symbol (const parsed_symbol *sym);
189 
190 void  output_header_preamble (void);
191 
192 void  output_header_symbol (const parsed_symbol *sym);
193 
194 void  output_c_preamble (void);
195 
196 void  output_c_symbol (const parsed_symbol *sym);
197 
198 void  output_prototype (FILE *file, const parsed_symbol *sym);
199 
200 void  output_makefile (void);
201 
202 /* Misc functions */
203 char *str_create (size_t num_str, ...);
204 
205 char *str_create_num (size_t num_str, int num, ...);
206 
207 char *str_substring(const char *start, const char *end);
208 
209 char *str_replace (char *str, const char *oldstr, const char *newstr);
210 
211 const char *str_match (const char *str, const char *match, int *found);
212 
213 const char *str_find_set (const char *str, const char *findset);
214 
215 char *str_toupper (char *str);
216 
217 const char *get_machine_str(int mach);
218 
219 /* file dumping functions */
220 enum FileSig {SIG_UNKNOWN, SIG_DOS, SIG_PE, SIG_DBG, SIG_PDB, SIG_NE, SIG_LE, SIG_MDMP, SIG_COFFLIB, SIG_LNK, SIG_EMF};
221 
222 const void*     PRD(unsigned long prd, unsigned long len);
223 unsigned long   Offset(const void* ptr);
224 
225 typedef void (*file_dumper)(void);
226 int             dump_analysis(const char*, file_dumper, enum FileSig);
227 
228 void            dump_data( const unsigned char *ptr, unsigned int size, const char *prefix );
229 const char*     get_time_str( unsigned long );
230 unsigned int    strlenW( const unsigned short *str );
231 void            dump_unicode_str( const unsigned short *str, int len );
232 const char*     get_guid_str(const GUID* guid);
233 const char*     get_symbol_str(const char* symname);
234 void            dump_file_header(const IMAGE_FILE_HEADER *);
235 void            dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *, UINT);
236 void            dump_section(const IMAGE_SECTION_HEADER *);
237 
238 enum FileSig    get_kind_exec(void);
239 void            dos_dump( void );
240 void            pe_dump( void );
241 void            ne_dump( void );
242 void            le_dump( void );
243 enum FileSig    get_kind_mdmp(void);
244 void            mdmp_dump( void );
245 enum FileSig    get_kind_lib(void);
246 void            lib_dump( void );
247 enum FileSig    get_kind_dbg(void);
248 void            dbg_dump( void );
249 enum FileSig    get_kind_lnk(void);
250 void            lnk_dump( void );
251 enum FileSig    get_kind_emf(void);
252 void            emf_dump( void );
253 enum FileSig    get_kind_pdb(void);
254 void            pdb_dump(void);
255 int             codeview_dump_symbols(const void* root, unsigned long size);
256 int             codeview_dump_types_from_offsets(const void* table, const DWORD* offsets, unsigned num_types);
257 int             codeview_dump_types_from_block(const void* table, unsigned long len);
258 
259 void            dump_stabs(const void* pv_stabs, unsigned szstabs, const char* stabstr, unsigned szstr);
260 void            dump_codeview(unsigned long ptr, unsigned long len);
261 void            dump_coff(unsigned long coffbase, unsigned long len, const void* sect_map);
262 void            dump_frame_pointer_omission(unsigned long base, unsigned long len);
263 
264 FILE *open_file (const char *name, const char *ext, const char *mode);
265 
266 #ifdef __GNUC__
267 void  do_usage (void) __attribute__ ((noreturn));
268 void  fatal (const char *message)  __attribute__ ((noreturn));
269 #else
270 void  do_usage (void);
271 void  fatal (const char *message);
272 #endif
273 
274 
275 
276 #endif /* __WINE_WINEDUMP_H */
277 

~ [ 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.