Ignore:
Timestamp:
Jul 19, 2007, 3:38:13 AM (17 years ago)
Author:
dai_9181
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/PESchedule.cpp

    r206 r223  
    2525    length=0;
    2626    NowPageRVAToReloc=0;
    27 
    28     pdwData_CodeSection=(DWORD *)HeapAlloc(hHeap,0,1);
    29     iNum_CodeSection=0;
    30     pdwData_DataSection=(DWORD *)HeapAlloc(hHeap,0,1);
    31     iNum_DataSection=0;
    3227}
    3328CReloc::~CReloc(){
     
    3934        buffer=0;
    4035    }
    41 
    42     HeapDefaultFree(pdwData_CodeSection);
    43     HeapDefaultFree(pdwData_DataSection);
    4436}
    4537void CReloc::copy(CReloc *por){
     
    5749    NowCountAddrToReloc=por->NowCountAddrToReloc;
    5850
    59     iNum_CodeSection=por->iNum_CodeSection;
    60     pdwData_CodeSection=(DWORD *)HeapAlloc(hHeap,0,iNum_CodeSection*sizeof(DWORD));
    61     memcpy(pdwData_CodeSection,por->pdwData_CodeSection,iNum_CodeSection*sizeof(DWORD));
    62 
    63     iNum_DataSection=por->iNum_DataSection;
    64     pdwData_DataSection=(DWORD *)HeapAlloc(hHeap,0,iNum_DataSection*sizeof(DWORD));
    65     memcpy(pdwData_DataSection,por->pdwData_DataSection,iNum_DataSection*sizeof(DWORD));
     51    codeSectionAddresses = por->codeSectionAddresses;
     52
     53    dataSectionAddresses = por->dataSectionAddresses;
    6654}
    6755
     
    7058    if(!bDll) return;
    7159
    72     pdwData_CodeSection=(DWORD *)HeapReAlloc(hHeap,0,pdwData_CodeSection,(iNum_CodeSection+1)*sizeof(DWORD));
    73     pdwData_CodeSection[iNum_CodeSection]=addr;
    74     iNum_CodeSection++;
     60    codeSectionAddresses.push_back( addr );
    7561}
    7662void CReloc::AddSchedule_DataSection(DWORD addr){
     
    7864    if(!bDll) return;
    7965
    80     pdwData_DataSection=(DWORD *)HeapReAlloc(hHeap,0,pdwData_DataSection,(iNum_DataSection+1)*sizeof(DWORD));
    81     pdwData_DataSection[iNum_DataSection]=addr;
    82     iNum_DataSection++;
     66    dataSectionAddresses.push_back( addr );
    8367}
    8468
     
    136120    NowPageRVAToReloc=0;
    137121
    138     int i;
    139     for(i=0;i<iNum_CodeSection;i++){
     122    BOOST_FOREACH( DWORD addr, codeSectionAddresses )
     123    {
    140124        extern int MemPos_CodeSection;
    141         __add(MemPos_CodeSection + pdwData_CodeSection[i]);
    142     }
    143 
    144     for(i=0;i<iNum_DataSection;i++){
     125        __add(MemPos_CodeSection + addr);
     126    }
     127
     128    BOOST_FOREACH( DWORD addr, dataSectionAddresses )
     129    {
    145130        extern int MemPos_DataSection;
    146         __add(MemPos_DataSection + pdwData_DataSection[i]);
     131        __add(MemPos_DataSection + addr);
    147132    }
    148133}
Note: See TracChangeset for help on using the changeset viewer.