00001 /* 00002 * See the dyninst/COPYRIGHT file for copyright information. 00003 * 00004 * We provide the Paradyn Tools (below described as "Paradyn") 00005 * on an AS IS basis, and do not warrant its validity or performance. 00006 * We reserve the right to update, modify, or discontinue this 00007 * software at any time. We shall have no obligation to supply such 00008 * updates or modifications or any other form of support to you. 00009 * 00010 * By your use of Paradyn, you understand and agree that we (or any 00011 * other person or entity with proprietary rights in Paradyn) are 00012 * under no obligation to provide either maintenance services, 00013 * update services, notices of latent defects, or correction of 00014 * defects for Paradyn. 00015 * 00016 * This library is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU Lesser General Public 00018 * License as published by the Free Software Foundation; either 00019 * version 2.1 of the License, or (at your option) any later version. 00020 * 00021 * This library is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 * Lesser General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU Lesser General Public 00027 * License along with this library; if not, write to the Free Software 00028 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00029 */ 00030 00031 00032 #if !defined(_emit_Win_h_) 00033 #define _emit_Win_h_ 00034 00035 #include "symtabAPI/src/Object.h" 00036 #include "symtabAPI/src/Object-nt.h" 00037 #include <string> 00038 #include <cstdio> 00039 #include <cstdlib> 00040 #include <windows.h> 00041 00042 namespace Dyninst{ 00043 namespace SymtabAPI{ 00044 00045 class emitWin{ 00046 public: 00047 emitWin(PCHAR baseaddress, Object* o_nt, void (*)(const char *) = log_msg); 00048 ~emitWin(); 00049 bool driver(Symtab *obj, std::string fName); 00050 00051 private: 00052 00053 const static unsigned int SizeOfSecHeader = 40; //size of section header entry is 40 bytes 00054 PCHAR base_addr; //the base address of the mapped image file 00055 Offset bit_addr; //the offset of bound import table 00056 unsigned int bit_size; //the size of bound import table 00057 Object* obj_nt; 00058 Offset PEAlign(Offset dwAddr,Offset dwAlign); 00059 unsigned int NumOfTotalAllowedSec(); 00060 unsigned int NumOfAllowedSecInSectionTable(); 00061 unsigned int NumOfAllowedSecInDosHeader(); 00062 PIMAGE_SECTION_HEADER CreateSecHeader(unsigned int size,PIMAGE_SECTION_HEADER preSecHdr); 00063 bool AlignSection(PIMAGE_SECTION_HEADER p); 00064 bool writeImpTable(Symtab*); 00065 bool isMoveAhead;//variable indicating whether or not we need to move things ahead to Dos Stub Area 00066 00067 void (*err_func_)(const char*); 00068 void log_winerror(void (*err_func)(const char *), const char* msg); 00069 }; 00070 00071 } // namespace SymtabAPI 00072 } // namespace Dyninst 00073 00074 #endif
1.6.1