From: <in...@us...> - 2002-05-26 10:14:05
|
Update of /cvsroot/mingw/utils/pexports In directory usw-pr-cvs1:/tmp/cvs-serv2405/pexports Modified Files: README hparse.h pexports.h Log Message: Convert some text files to Unix format Index: README =================================================================== RCS file: /cvsroot/mingw/utils/pexports/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README 10 Apr 2002 13:39:06 -0000 1.1 --- README 26 May 2002 10:13:58 -0000 1.2 *************** *** 1,83 **** ! PEXPORTS 0.43 README ! ============================================ ! ! Anders Norlander <ano...@he...> ! URL: hem2.passagen.se/anorland/ ! Hacked by Pau...@te... ! URL: http://www.is.lg.ua/~paul/devel/binutils.html ! ! ============================================ ! ! PEXPORTS is a program to extract exported symbols from a PE image ! (executable). It can perform a simple check on the size of the ! arguments of the exported functions, provided there is a header with ! prototypes for the functions. This is useful when you want the ! decorated function names for functions using the stdcall calling ! convention. GCC is used to do the preprocessing so it must be in your ! path. ! ! /*A binary for Cygwin b19 is in the cygbin directory.*/ ! A binary for mingw32 is in the /*mingw*/bin directory. ! ! Note that the mingw32 version uses ';' as path separator, ! while the cygwin version uses ':'. ! ! Command line options: ! ===================== ! -h <header> parse header ! -o print function ordinals ! -p <preprocessor> set preprocessor ! -v verbose mode ! ! Header files are searched for in the following directories: ! 1. Current directory ! 2. Directories in C_INCLUDE_PATH ! 3. Directories in CPLUS_INCLUDE_PATH ! 4. Directories in PATH ! ! NOTE: The header parser is *very* primitive, it only tries to find ! function prototypes and check the number of arguments a function ! expects. It is NOT a complete C parser, there are probably many ! conditions when it will fail (especially complex parameter types), ! although I it works fine for me. Please report bugs or send me a ! patch. ! ! CHANGES FROM 0.42: ! ================= ! * There were bug which led to wrong subcategorizing of symbols as ! code/data. I thought it was fixed in version on the site, but it turns ! out that almost year there was wrong version. I greatly apologize to ! everyone whom it cause problems and confusion. ! ! CHANGES FROM 0.41: ! ================= ! * Data/non-data symbols are now distinguished. ! ! CHANGES FROM 0.4: ! ================= ! * The header parser now accepts all kinds of parameters. ! ! CHANGES FROM 0.3: ! ================= ! * Function pointer parameters are now handled ! * Handling of function attributes improved ! * It is no longer always necessary to include windows.h for headers ! that required it but did not include it themselves. ! ! CHANGES FROM 0.2: ! ================= ! * Completely rewritten parser (the previous one was *very* bad). ! It is now possible to generate .DEF files for windows system ! dlls (kernel32,user32,gdi32,shell32 etc) ! * Enhanced symbol handling (symbols are sorted in a tree). ! ! CHANGES FROM 0.1: ! ================= ! * Fixed bug with unnamed parameters that are pointers. ! * Extra whitespace is no longer printed ! * Binary versions available for mingw32 and cygwin32 ! ! Pexports, Copyright (C) 1998 Anders Norlander ! This program has ABSOLUTELY NO WARRANTY; This is free software, and you are ! welcome to redistribute it under certain conditions; see COPYING ! for details. --- 1,83 ---- ! PEXPORTS 0.43 README ! ============================================ ! ! Anders Norlander <ano...@he...> ! URL: hem2.passagen.se/anorland/ ! Hacked by Pau...@te... ! URL: http://www.is.lg.ua/~paul/devel/binutils.html ! ! ============================================ ! ! PEXPORTS is a program to extract exported symbols from a PE image ! (executable). It can perform a simple check on the size of the ! arguments of the exported functions, provided there is a header with ! prototypes for the functions. This is useful when you want the ! decorated function names for functions using the stdcall calling ! convention. GCC is used to do the preprocessing so it must be in your ! path. ! ! /*A binary for Cygwin b19 is in the cygbin directory.*/ ! A binary for mingw32 is in the /*mingw*/bin directory. ! ! Note that the mingw32 version uses ';' as path separator, ! while the cygwin version uses ':'. ! ! Command line options: ! ===================== ! -h <header> parse header ! -o print function ordinals ! -p <preprocessor> set preprocessor ! -v verbose mode ! ! Header files are searched for in the following directories: ! 1. Current directory ! 2. Directories in C_INCLUDE_PATH ! 3. Directories in CPLUS_INCLUDE_PATH ! 4. Directories in PATH ! ! NOTE: The header parser is *very* primitive, it only tries to find ! function prototypes and check the number of arguments a function ! expects. It is NOT a complete C parser, there are probably many ! conditions when it will fail (especially complex parameter types), ! although I it works fine for me. Please report bugs or send me a ! patch. ! ! CHANGES FROM 0.42: ! ================= ! * There were bug which led to wrong subcategorizing of symbols as ! code/data. I thought it was fixed in version on the site, but it turns ! out that almost year there was wrong version. I greatly apologize to ! everyone whom it cause problems and confusion. ! ! CHANGES FROM 0.41: ! ================= ! * Data/non-data symbols are now distinguished. ! ! CHANGES FROM 0.4: ! ================= ! * The header parser now accepts all kinds of parameters. ! ! CHANGES FROM 0.3: ! ================= ! * Function pointer parameters are now handled ! * Handling of function attributes improved ! * It is no longer always necessary to include windows.h for headers ! that required it but did not include it themselves. ! ! CHANGES FROM 0.2: ! ================= ! * Completely rewritten parser (the previous one was *very* bad). ! It is now possible to generate .DEF files for windows system ! dlls (kernel32,user32,gdi32,shell32 etc) ! * Enhanced symbol handling (symbols are sorted in a tree). ! ! CHANGES FROM 0.1: ! ================= ! * Fixed bug with unnamed parameters that are pointers. ! * Extra whitespace is no longer printed ! * Binary versions available for mingw32 and cygwin32 ! ! Pexports, Copyright (C) 1998 Anders Norlander ! This program has ABSOLUTELY NO WARRANTY; This is free software, and you are ! welcome to redistribute it under certain conditions; see COPYING ! for details. Index: hparse.h =================================================================== RCS file: /cvsroot/mingw/utils/pexports/hparse.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hparse.h 10 Apr 2002 13:39:06 -0000 1.1 --- hparse.h 26 May 2002 10:13:58 -0000 1.2 *************** *** 1,7 **** ! typedef union { ! char *s; ! } YYSTYPE; ! #define ID 258 ! ! ! extern YYSTYPE yylval; --- 1,7 ---- ! typedef union { ! char *s; ! } YYSTYPE; ! #define ID 258 ! ! ! extern YYSTYPE yylval; Index: pexports.h =================================================================== RCS file: /cvsroot/mingw/utils/pexports/pexports.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pexports.h 10 Apr 2002 13:39:06 -0000 1.1 --- pexports.h 26 May 2002 10:13:58 -0000 1.2 *************** *** 1,163 **** ! /* ! pexports - a program to extract exported symbols from a Portable ! Executable (PE) file. ! ! Copyright (C) 1998 Anders Norlander ! ! pexports is distributed under the GNU General Public License and ! has absolutely NO WARRANTY. ! ! pexports will work only on intel machines. ! */ ! ! #ifndef _pexports_h ! #define _pexports_h ! ! #include <stdio.h> ! ! #include "str_tree.h" ! ! #define VER_MAJOR 0 ! #define VER_MINOR 43 ! ! /* These are needed */ ! typedef unsigned short WORD; ! typedef unsigned int DWORD; ! typedef unsigned char BYTE; ! typedef long LONG; ! typedef WORD *PWORD; ! typedef DWORD *PDWORD; ! ! /* PE structures */ ! typedef struct _IMAGE_DATA_DIRECTORY { ! DWORD VirtualAddress; ! DWORD Size; ! } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; ! ! typedef struct _IMAGE_FILE_HEADER { ! WORD Machine; ! WORD NumberOfSections; ! DWORD TimeDateStamp; ! DWORD PointerToSymbolTable; ! DWORD NumberOfSymbols; ! WORD SizeOfOptionalHeader; ! WORD Characteristics; ! } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; ! ! typedef struct _IMAGE_OPTIONAL_HEADER { ! WORD Magic; ! BYTE MajorLinkerVersion; ! BYTE MinorLinkerVersion; ! DWORD SizeOfCode; ! DWORD SizeOfInitializedData; ! DWORD SizeOfUninitializedData; ! DWORD AddressOfEntryPoint; ! DWORD BaseOfCode; ! DWORD BaseOfData; ! ! DWORD ImageBase; ! DWORD SectionAlignment; ! DWORD FileAlignment; ! WORD MajorOperatingSystemVersion; ! WORD MinorOperatingSystemVersion; ! WORD MajorImageVersion; ! WORD MinorImageVersion; ! WORD MajorSubsystemVersion; ! WORD MinorSubsystemVersion; ! DWORD Reserved1; ! DWORD SizeOfImage; ! DWORD SizeOfHeaders; ! DWORD CheckSum; ! WORD Subsystem; ! WORD DllCharacteristics; ! DWORD SizeOfStackReserve; ! DWORD SizeOfStackCommit; ! DWORD SizeOfHeapReserve; ! DWORD SizeOfHeapCommit; ! DWORD LoaderFlags; ! DWORD NumberOfRvaAndSizes; ! IMAGE_DATA_DIRECTORY DataDirectory[16]; ! } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; ! ! ! typedef struct _IMAGE_NT_HEADERS { ! char Signature[4]; ! IMAGE_FILE_HEADER FileHeader; ! IMAGE_OPTIONAL_HEADER OptionalHeader; ! } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; ! ! typedef struct _IMAGE_SECTION_HEADER { ! BYTE Name[8]; ! union { ! DWORD PhysicalAddress; ! DWORD VirtualSize; ! } Misc; ! DWORD VirtualAddress; ! DWORD SizeOfRawData; ! DWORD PointerToRawData; ! DWORD PointerToRelocations; ! DWORD PointerToLinenumbers; ! WORD NumberOfRelocations; ! WORD NumberOfLinenumbers; ! DWORD Characteristics; ! } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; ! ! typedef struct _IMAGE_EXPORT_DIRECTORY { ! DWORD Characteristics; ! DWORD TimeDateStamp; ! WORD MajorVersion; ! WORD MinorVersion; ! DWORD Name; ! DWORD Base; ! DWORD NumberOfFunctions; ! DWORD NumberOfNames; ! PDWORD *AddressOfFunctions; ! PDWORD *AddressOfNames; ! PWORD *AddressOfNameOrdinals; ! } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; ! ! typedef struct _IMAGE_DOS_HEADER { ! WORD e_magic; ! WORD e_cblp; ! WORD e_cp; ! WORD e_crlc; ! WORD e_cparhdr; ! WORD e_minalloc; ! WORD e_maxalloc; ! WORD e_ss; ! WORD e_sp; ! WORD e_csum; ! WORD e_ip; ! WORD e_cs; ! WORD e_lfarlc; ! WORD e_ovno; ! WORD e_res[4]; ! WORD e_oemid; ! WORD e_oeminfo; ! WORD e_res2[10]; ! LONG e_lfanew; ! } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; ! ! PIMAGE_SECTION_HEADER ! find_section(DWORD rva); ! ! PIMAGE_DOS_HEADER ! load_pe_image(const char *filename); ! ! DWORD ! rva_to_ptr(DWORD rva); ! ! void ! dump_exports(DWORD exports_rva); ! ! #define ADD_FUNCTION(nm,n) str_tree_add(&symbols, nm, (void*)n) ! extern str_tree *symbols; ! ! /* pe.h from bfd */ ! ! /* dirty! */ ! #define AOUTHDR int ! ! #include "pe.h" ! ! #endif /* _pexports_h */ --- 1,163 ---- ! /* ! pexports - a program to extract exported symbols from a Portable ! Executable (PE) file. ! ! Copyright (C) 1998 Anders Norlander ! ! pexports is distributed under the GNU General Public License and ! has absolutely NO WARRANTY. ! ! pexports will work only on intel machines. ! */ ! ! #ifndef _pexports_h ! #define _pexports_h ! ! #include <stdio.h> ! ! #include "str_tree.h" ! ! #define VER_MAJOR 0 ! #define VER_MINOR 43 ! ! /* These are needed */ ! typedef unsigned short WORD; ! typedef unsigned int DWORD; ! typedef unsigned char BYTE; ! typedef long LONG; ! typedef WORD *PWORD; ! typedef DWORD *PDWORD; ! ! /* PE structures */ ! typedef struct _IMAGE_DATA_DIRECTORY { ! DWORD VirtualAddress; ! DWORD Size; ! } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; ! ! typedef struct _IMAGE_FILE_HEADER { ! WORD Machine; ! WORD NumberOfSections; ! DWORD TimeDateStamp; ! DWORD PointerToSymbolTable; ! DWORD NumberOfSymbols; ! WORD SizeOfOptionalHeader; ! WORD Characteristics; ! } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; ! ! typedef struct _IMAGE_OPTIONAL_HEADER { ! WORD Magic; ! BYTE MajorLinkerVersion; ! BYTE MinorLinkerVersion; ! DWORD SizeOfCode; ! DWORD SizeOfInitializedData; ! DWORD SizeOfUninitializedData; ! DWORD AddressOfEntryPoint; ! DWORD BaseOfCode; ! DWORD BaseOfData; ! ! DWORD ImageBase; ! DWORD SectionAlignment; ! DWORD FileAlignment; ! WORD MajorOperatingSystemVersion; ! WORD MinorOperatingSystemVersion; ! WORD MajorImageVersion; ! WORD MinorImageVersion; ! WORD MajorSubsystemVersion; ! WORD MinorSubsystemVersion; ! DWORD Reserved1; ! DWORD SizeOfImage; ! DWORD SizeOfHeaders; ! DWORD CheckSum; ! WORD Subsystem; ! WORD DllCharacteristics; ! DWORD SizeOfStackReserve; ! DWORD SizeOfStackCommit; ! DWORD SizeOfHeapReserve; ! DWORD SizeOfHeapCommit; ! DWORD LoaderFlags; ! DWORD NumberOfRvaAndSizes; ! IMAGE_DATA_DIRECTORY DataDirectory[16]; ! } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; ! ! ! typedef struct _IMAGE_NT_HEADERS { ! char Signature[4]; ! IMAGE_FILE_HEADER FileHeader; ! IMAGE_OPTIONAL_HEADER OptionalHeader; ! } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; ! ! typedef struct _IMAGE_SECTION_HEADER { ! BYTE Name[8]; ! union { ! DWORD PhysicalAddress; ! DWORD VirtualSize; ! } Misc; ! DWORD VirtualAddress; ! DWORD SizeOfRawData; ! DWORD PointerToRawData; ! DWORD PointerToRelocations; ! DWORD PointerToLinenumbers; ! WORD NumberOfRelocations; ! WORD NumberOfLinenumbers; ! DWORD Characteristics; ! } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; ! ! typedef struct _IMAGE_EXPORT_DIRECTORY { ! DWORD Characteristics; ! DWORD TimeDateStamp; ! WORD MajorVersion; ! WORD MinorVersion; ! DWORD Name; ! DWORD Base; ! DWORD NumberOfFunctions; ! DWORD NumberOfNames; ! PDWORD *AddressOfFunctions; ! PDWORD *AddressOfNames; ! PWORD *AddressOfNameOrdinals; ! } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; ! ! typedef struct _IMAGE_DOS_HEADER { ! WORD e_magic; ! WORD e_cblp; ! WORD e_cp; ! WORD e_crlc; ! WORD e_cparhdr; ! WORD e_minalloc; ! WORD e_maxalloc; ! WORD e_ss; ! WORD e_sp; ! WORD e_csum; ! WORD e_ip; ! WORD e_cs; ! WORD e_lfarlc; ! WORD e_ovno; ! WORD e_res[4]; ! WORD e_oemid; ! WORD e_oeminfo; ! WORD e_res2[10]; ! LONG e_lfanew; ! } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; ! ! PIMAGE_SECTION_HEADER ! find_section(DWORD rva); ! ! PIMAGE_DOS_HEADER ! load_pe_image(const char *filename); ! ! DWORD ! rva_to_ptr(DWORD rva); ! ! void ! dump_exports(DWORD exports_rva); ! ! #define ADD_FUNCTION(nm,n) str_tree_add(&symbols, nm, (void*)n) ! extern str_tree *symbols; ! ! /* pe.h from bfd */ ! ! /* dirty! */ ! #define AOUTHDR int ! ! #include "pe.h" ! ! #endif /* _pexports_h */ |