Changeset 276 in dev for trunk/abdev/BasicCompiler32/MakePeHdr.cpp
- Timestamp:
- Aug 12, 2007, 1:25:20 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r273 r276 122 122 extern BOOL bDebugCompile; 123 123 extern DWORD ImageBase; 124 extern int obp_AllocSize;125 124 extern char *basbuf; 126 125 extern char OutputFileName[MAX_PATH]; … … 355 354 356 355 357 358 359 //データテーブルスケジュール360 pobj_DataTableSchedule=new CSchedule();361 pobj_DataTableSchedule->SetFlag(SCHEDULE_FLAG_RELOC);362 363 //インポートテーブルスケジュール364 pobj_ImportAddrSchedule=new CImportAddrSchedule();365 pobj_ImportAddrSchedule->SetFlag(SCHEDULE_FLAG_RELOC);366 367 //プロシージャポインタスケジュール368 pobj_SubAddrSchedule=new CSubAddrSchedule();369 370 //グローバル変数アドレススケジュール371 pobj_GlobalVarSchedule=new CSchedule();372 pobj_GlobalVarSchedule->SetFlag(SCHEDULE_FLAG_RELOC);373 374 356 //グローバル変数の初期バッファ 375 357 extern BYTE *initGlobalBuf; … … 379 361 pobj_Reloc=new CReloc(); 380 362 381 extern char *OpBuffer;382 extern int obp;383 obp_AllocSize=8192*2;384 OpBuffer=(char *)malloc(obp_AllocSize);385 obp=0;386 387 363 //レキシカルスコープ情報を初期化 388 compiler.codeGenerator.lexicalScopes.Init(obp); 364 compiler.codeGenerator.lexicalScopes.Init( 0 ); 365 //compiler.codeGenerator.lexicalScopes.Init( compiler.codeGenerator.GetNativeCodeSize() ); 389 366 390 367 … … 702 679 703 680 if( pUserProc->GetName() == "DllMain" ){ 704 // TODO: 未完成 705 DllMain_EntryPoint=pUserProc->_beginOpAddressOld; 681 DllMain_EntryPoint = pUserProc->GetBeginOpAddress(); 706 682 } 707 683 708 684 lpdwExportAddressTable=(DWORD *)HeapReAlloc(hHeap,0,lpdwExportAddressTable,(ExportNum+1)*sizeof(DWORD)); 709 lpdwExportAddressTable[ExportNum] =pUserProc->_beginOpAddressOld;685 lpdwExportAddressTable[ExportNum] = pUserProc->GetBeginOpAddress(); 710 686 711 687 lpdwExportNamePointerTable=(DWORD *)HeapReAlloc(hHeap,0,lpdwExportNamePointerTable,(ExportNum+1)*sizeof(DWORD)); … … 1143 1119 1144 1120 1145 //////////////////////////////1146 // データテーブルスケジュール1147 for(i=0;i<pobj_DataTableSchedule->num;i++){1148 *((long *)(OpBuffer+pobj_DataTableSchedule->pObpValues[i]))+=ImageBase+MemPos_DataSection;1149 }1150 delete pobj_DataTableSchedule;1151 1152 1153 //////////////////////////////////1154 // インポートテーブルスケジュール(インポート アドレス テーブルを指し示させる)1155 for(i=0;i<pobj_ImportAddrSchedule->num;i++){1156 const DllProc *pDllProc=pobj_ImportAddrSchedule->ppdi[i];1157 *((long *)(OpBuffer+pobj_ImportAddrSchedule->pObpValues[i]))=1158 ImageBase+1159 MemPos_ImportSection+1160 LookupSize+ //ルックアップテーブル1161 HintSize+ //ヒント名(関数名)テーブル1162 pDllProc->GetLookupAddress();1163 }1164 delete pobj_ImportAddrSchedule;1165 1166 1167 ////////////////////////////////////1168 // プロシージャポインタスケジュール1169 for(i=0;i<pobj_SubAddrSchedule->num;i++){1170 if(pobj_SubAddrSchedule->ppsi[i]->_beginOpAddressOld==01171 &&pobj_SubAddrSchedule->ppsi[i]->_endOpAddressOld==0){1172 SetError(300,NULL,-1);1173 }1174 1175 if(pobj_SubAddrSchedule->pbCall[i]){1176 *((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))=1177 pobj_SubAddrSchedule->ppsi[i]->_beginOpAddressOld-(pobj_SubAddrSchedule->pObpValues[i]+sizeof(long));1178 }1179 else{1180 *((long *)(OpBuffer+pobj_SubAddrSchedule->pObpValues[i]))=1181 pobj_SubAddrSchedule->ppsi[i]->_beginOpAddressOld+ImageBase+MemPos_CodeSection;1182 }1183 }1184 delete pobj_SubAddrSchedule;1185 1186 1187 1121 if( compiler.IsDll() ){ 1188 1122 //DLLの場合はリロケーション情報を生成 1189 1123 pobj_Reloc->ResetRelocBuffer(); 1190 1124 } 1191 1192 1193 1194 //////////////////////////////////////1195 // グローバル変数アドレススケジュール1196 //////////////////////////////////////1197 1198 /*1199 GlobalArea1 - 初期バッファあり1200 GlobalArea2 - 初期バッファなし1201 */1202 for(i=0;i<pobj_GlobalVarSchedule->num;i++){1203 if(*((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i])) & 0x80000000){1204 //初期バッファなし1205 *((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i]))=1206 compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize() +1207 (*((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i])) & 0x7FFFFFFF)+1208 ImageBase+MemPos_RWSection;1209 }1210 else{1211 //初期バッファあり1212 *((long *)(OpBuffer+pobj_GlobalVarSchedule->pObpValues[i]))+=1213 ImageBase+MemPos_RWSection;1214 }1215 }1216 delete pobj_GlobalVarSchedule;1217 1125 1218 1126 … … 1784 1692 HeapDefaultFree(initGlobalBuf); 1785 1693 1786 //コードバッファを解放1787 free(OpBuffer);1788 OpBuffer=0;1789 1790 1694 //リソースセクションバッファを解放 1791 1695 HeapDefaultFree(RSrcSectionBuffer);
Note:
See TracChangeset
for help on using the changeset viewer.