Changeset 622 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/RSrcSection.cpp
- Timestamp:
- May 21, 2008, 1:16:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/RSrcSection.cpp
r467 r622 61 61 62 62 //カーソルリソース 63 extern RESOURCEDATAINFO *pCursorResourceInfo;64 extern int CursorResourceNum;65 63 int CursorNum; 66 64 CURSORDIR *pCursorDir; … … 69 67 CursorNum=0; 70 68 71 //ビットマップリソース72 extern RESOURCEDATAINFO *pBitmapResourceInfo;73 extern int BitmapResourceNum;74 75 69 //アイコンリソース 76 extern RESOURCEDATAINFO *pIconResourceInfo;77 extern int IconResourceNum;78 70 int IconNum; 79 71 ICONDIR *pIconDir; … … 82 74 IconNum=0; 83 75 84 //XPManifestリソース85 extern char szManifestPath[MAX_PATH];86 extern int XPManiResourceNum;87 88 76 BufSize=8192*2; 89 77 buffer=(char *)HeapAlloc(hHeap,0,BufSize); … … 97 85 *pLen=0; 98 86 99 if(CursorResourceNum==0&& 100 BitmapResourceNum==0&& 101 IconResourceNum==0&& 102 XPManiResourceNum==0) return buffer; 87 if( compiler.resourceManager.cursorResources.empty() 88 && compiler.resourceManager.bitmapResources.empty() 89 && compiler.resourceManager.iconResources.empty() 90 && compiler.resourceManager.manifestFilePath.empty() ) 91 { 92 return buffer; 93 } 103 94 104 95 sw=0; 105 96 106 97 //カーソルの枚数を計算(CursorNumに格納) 107 for(i3=0;i3< CursorResourceNum;i3++){108 hFile=CreateFile( pCursorResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);98 for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){ 99 hFile=CreateFile(compiler.resourceManager.cursorResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 109 100 if(hFile==INVALID_HANDLE_VALUE){ 110 compiler.errorMessenger.Output(23, pCursorResourceInfo[i3].FileName,-1);101 compiler.errorMessenger.Output(23,compiler.resourceManager.cursorResources[i3].filepath.c_str(),-1); 111 102 sw=1; 112 103 continue; … … 124 115 125 116 //ビットマップのファイルの有無を確認 126 for(i3=0;i3< BitmapResourceNum;i3++){127 hFile=CreateFile( pBitmapResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);117 for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){ 118 hFile=CreateFile(compiler.resourceManager.bitmapResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 128 119 if(hFile==INVALID_HANDLE_VALUE){ 129 compiler.errorMessenger.Output(23, pBitmapResourceInfo[i3].FileName,-1);120 compiler.errorMessenger.Output(23,compiler.resourceManager.bitmapResources[i3].filepath.c_str(),-1); 130 121 sw=1; 131 122 continue; … … 135 126 136 127 //アイコンの枚数を計算(IconNumに格納) 137 for(i3=0;i3< IconResourceNum;i3++){138 hFile=CreateFile( pIconResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);128 for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){ 129 hFile=CreateFile(compiler.resourceManager.iconResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 139 130 if(hFile==INVALID_HANDLE_VALUE){ 140 compiler.errorMessenger.Output(23, pIconResourceInfo[i3].FileName,-1);131 compiler.errorMessenger.Output(23,compiler.resourceManager.iconResources[i3].filepath.c_str(),-1); 141 132 sw=1; 142 133 continue; … … 161 152 ///////////////////////// 162 153 TypeNum=0; 163 if( CursorResourceNum) TypeNum+=2;164 if( BitmapResourceNum) TypeNum++;165 if( IconResourceNum) TypeNum+=2;166 if( XPManiResourceNum) TypeNum++;154 if( !compiler.resourceManager.cursorResources.empty() ) TypeNum+=2; 155 if( !compiler.resourceManager.bitmapResources.empty() ) TypeNum++; 156 if( !compiler.resourceManager.iconResources.empty() ) TypeNum+=2; 157 if( !compiler.resourceManager.manifestFilePath.empty() ) TypeNum++; 167 158 168 159 NextBase=sizeof(IMAGE_RESOURCE_DIRECTORY)+ … … 193 184 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*CursorNum; 194 185 } 195 if( BitmapResourceNum){186 if( !compiler.resourceManager.bitmapResources.empty() ){ 196 187 //RT_BITMAP 197 188 ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_BITMAP; … … 202 193 //2階層のサイズ 203 194 i6+= sizeof(IMAGE_RESOURCE_DIRECTORY)+ 204 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) *BitmapResourceNum;195 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) * compiler.resourceManager.bitmapResources.size(); 205 196 } 206 197 if(IconNum){ … … 215 206 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*IconNum; 216 207 } 217 if(CursorResourceNum){ 208 if( !compiler.resourceManager.cursorResources.empty() ) 209 { 218 210 //RT_GROUP_CURSOR 219 211 ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_GROUP_CURSOR; … … 226 218 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*CursorNum; 227 219 } 228 if(IconResourceNum){ 220 if( !compiler.resourceManager.iconResources.empty() ) 221 { 229 222 //RT_GROUP_ICON 230 223 ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_GROUP_ICON; … … 235 228 //2階層のサイズ 236 229 i6+= sizeof(IMAGE_RESOURCE_DIRECTORY)+ 237 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)*IconResourceNum; 238 } 239 if(XPManiResourceNum){ 230 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) * compiler.resourceManager.iconResources.size(); 231 } 232 if( !compiler.resourceManager.manifestFilePath.empty() ) 233 { 240 234 //RT_MANIFEST 241 235 ImgDirEntry.Name=(DWORD)(LONG_PTR)RT_MANIFEST; … … 246 240 //2階層のサイズ 247 241 i6+= sizeof(IMAGE_RESOURCE_DIRECTORY)+ 248 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) *XPManiResourceNum;242 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY) * 1/*XPManiResourceNum*/ ; 249 243 } 250 244 … … 279 273 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*CursorNum; 280 274 } 281 if( BitmapResourceNum){275 if( !compiler.resourceManager.bitmapResources.empty() ){ 282 276 //RT_BITMAP 283 277 ImgResDir.Characteristics=0; … … 286 280 ImgResDir.MinorVersion=0; 287 281 ImgResDir.NumberOfNamedEntries=0; 288 ImgResDir.NumberOfIdEntries =BitmapResourceNum;282 ImgResDir.NumberOfIdEntries = compiler.resourceManager.bitmapResources.size(); 289 283 memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY)); 290 284 i2+=sizeof(IMAGE_RESOURCE_DIRECTORY); 291 285 292 for(i3=0;i3<BitmapResourceNum;i3++){ 293 ImgDirEntry.Name=pBitmapResourceInfo[i3].dwId; 286 for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++) 287 { 288 ImgDirEntry.Name = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData( 289 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( 290 compiler.resourceManager.bitmapResources[i3].idName 291 ) 292 ); 294 293 ImgDirEntry.OffsetToData=(NextBase+i6+ 295 294 (sizeof(IMAGE_RESOURCE_DIRECTORY)+ … … 301 300 302 301 i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+ 303 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) *BitmapResourceNum;302 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * compiler.resourceManager.bitmapResources.size(); 304 303 } 305 304 if(IconNum){ … … 328 327 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*IconNum; 329 328 } 330 if(CursorResourceNum){ 329 if( !compiler.resourceManager.cursorResources.empty() ) 330 { 331 331 //RT_GROUP_CURSOR 332 332 ImgResDir.Characteristics=0; … … 335 335 ImgResDir.MinorVersion=0; 336 336 ImgResDir.NumberOfNamedEntries=0; 337 ImgResDir.NumberOfIdEntries =CursorResourceNum;337 ImgResDir.NumberOfIdEntries = compiler.resourceManager.cursorResources.size(); 338 338 memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY)); 339 339 i2+=sizeof(IMAGE_RESOURCE_DIRECTORY); 340 340 341 for(i3=0;i3<CursorResourceNum;i3++){ 342 ImgDirEntry.Name=pCursorResourceInfo[i3].dwId; 341 for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){ 342 ImgDirEntry.Name = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData( 343 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( 344 compiler.resourceManager.cursorResources[i3].idName 345 ) 346 ); 343 347 ImgDirEntry.OffsetToData=(NextBase+i6+ 344 348 (sizeof(IMAGE_RESOURCE_DIRECTORY)+ … … 351 355 //3階層のサイズ 352 356 i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+ 353 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*CursorResourceNum; 354 } 355 if(IconResourceNum){ 357 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * compiler.resourceManager.cursorResources.size(); 358 } 359 if( !compiler.resourceManager.iconResources.empty() ) 360 { 356 361 //RT_GROUP_ICON 357 362 ImgResDir.Characteristics=0; … … 360 365 ImgResDir.MinorVersion=0; 361 366 ImgResDir.NumberOfNamedEntries=0; 362 ImgResDir.NumberOfIdEntries =IconResourceNum;367 ImgResDir.NumberOfIdEntries = compiler.resourceManager.iconResources.size(); 363 368 memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY)); 364 369 i2+=sizeof(IMAGE_RESOURCE_DIRECTORY); 365 370 366 for(i3=0;i3<IconResourceNum;i3++){ 367 ImgDirEntry.Name=pIconResourceInfo[i3].dwId; 371 for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){ 372 ImgDirEntry.Name = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData( 373 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( 374 compiler.resourceManager.iconResources[i3].idName 375 ) 376 ); 368 377 ImgDirEntry.OffsetToData=(NextBase+i6+ 369 378 (sizeof(IMAGE_RESOURCE_DIRECTORY)+ … … 376 385 //3階層のサイズ 377 386 i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+ 378 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))*IconResourceNum; 379 } 380 if(XPManiResourceNum){ 387 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * compiler.resourceManager.iconResources.size(); 388 } 389 if( !compiler.resourceManager.manifestFilePath.empty() ) 390 { 381 391 //RT_MANIFEST 382 392 ImgResDir.Characteristics=0; … … 385 395 ImgResDir.MinorVersion=0; 386 396 ImgResDir.NumberOfNamedEntries=0; 387 ImgResDir.NumberOfIdEntries =XPManiResourceNum;397 ImgResDir.NumberOfIdEntries = 1 /*XPManiResourceNum*/ ; 388 398 memcpy(buffer+i2,&ImgResDir,sizeof(IMAGE_RESOURCE_DIRECTORY)); 389 399 i2+=sizeof(IMAGE_RESOURCE_DIRECTORY); 390 400 391 for(i3=0;i3<XPManiResourceNum;i3++){ 401 i3 = 0; 402 { 392 403 ImgDirEntry.Name=i3+1; 393 404 ImgDirEntry.OffsetToData=(NextBase+i6+ … … 400 411 401 412 i6+=(sizeof(IMAGE_RESOURCE_DIRECTORY)+ 402 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) *XPManiResourceNum;413 sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY)) * 1 /*XPManiResourceNum*/ ; 403 414 } 404 415 … … 434 445 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*CursorNum; 435 446 } 436 if( BitmapResourceNum){447 if( !compiler.resourceManager.bitmapResources.empty() ){ 437 448 //RT_BITMAP 438 for(i3=0;i3< BitmapResourceNum;i3++){449 for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){ 439 450 ImgResDir.Characteristics=0; 440 451 ImgResDir.TimeDateStamp=0; … … 453 464 } 454 465 455 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) *BitmapResourceNum;466 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) * compiler.resourceManager.bitmapResources.size(); 456 467 } 457 468 if(IconNum){ … … 476 487 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*IconNum; 477 488 } 478 if(CursorResourceNum){ 489 if( !compiler.resourceManager.cursorResources.empty() ) 490 { 479 491 //RT_GROUP_CURSOR 480 for(i3=0;i3< CursorResourceNum;i3++){492 for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){ 481 493 ImgResDir.Characteristics=0; 482 494 ImgResDir.TimeDateStamp=0; … … 495 507 } 496 508 497 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*CursorResourceNum; 498 } 499 if(IconResourceNum){ 509 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) * compiler.resourceManager.cursorResources.size(); 510 } 511 if( !compiler.resourceManager.iconResources.empty() ) 512 { 500 513 //RT_GROUP_ICON 501 for(i3=0;i3< IconResourceNum;i3++){514 for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){ 502 515 ImgResDir.Characteristics=0; 503 516 ImgResDir.TimeDateStamp=0; … … 516 529 } 517 530 518 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)* IconResourceNum;519 } 520 if( XPManiResourceNum){531 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY)*compiler.resourceManager.iconResources.size(); 532 } 533 if( !compiler.resourceManager.manifestFilePath.empty() ){ 521 534 //RT_MANIFEST 522 for(i3=0;i3<XPManiResourceNum;i3++){ 535 i3 = 0; 536 { 523 537 ImgResDir.Characteristics=0; 524 538 ImgResDir.TimeDateStamp=0; … … 537 551 } 538 552 539 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) *XPManiResourceNum;553 i6+=sizeof(IMAGE_RESOURCE_DATA_ENTRY) * 1 /*XPManiResourceNum*/ ; 540 554 } 541 555 … … 576 590 //RT_BITMAP 577 591 BitmapEntryBase=DataEntryScheduleNum; 578 for(i3=0;i3< BitmapResourceNum;i3++){592 for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){ 579 593 dwDataEntrySchedule[DataEntryScheduleNum]=i2; 580 594 DataEntryScheduleNum++; … … 594 608 //RT_GROUP_CURSOR 595 609 CursorGroupEntryBase=DataEntryScheduleNum; 596 for(i3=0;i3< CursorResourceNum;i3++){610 for(i3=0;i3<compiler.resourceManager.cursorResources.size();i3++){ 597 611 dwDataEntrySchedule[DataEntryScheduleNum]=i2; 598 612 DataEntryScheduleNum++; … … 603 617 //RT_GROUP_ICON 604 618 IconGroupEntryBase=DataEntryScheduleNum; 605 for(i3=0;i3< IconResourceNum;i3++){619 for(i3=0;i3<compiler.resourceManager.iconResources.size();i3++){ 606 620 dwDataEntrySchedule[DataEntryScheduleNum]=i2; 607 621 DataEntryScheduleNum++; … … 613 627 int XPManiEntryBase; 614 628 XPManiEntryBase=DataEntryScheduleNum; 615 for(i3=0;i3<XPManiResourceNum;i3++){ 629 i3 = 0; 630 { 616 631 dwDataEntrySchedule[DataEntryScheduleNum]=i2; 617 632 DataEntryScheduleNum++; … … 642 657 643 658 //カーソルリソース 644 for(i3=0,i6=0;i3< CursorResourceNum;i3++){645 hFile=CreateFile( pCursorResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);659 for(i3=0,i6=0;i3<compiler.resourceManager.cursorResources.size();i3++){ 660 hFile=CreateFile(compiler.resourceManager.cursorResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 646 661 if(hFile==INVALID_HANDLE_VALUE){ 647 compiler.errorMessenger.Output(23, pCursorResourceInfo[i3].FileName,-1);662 compiler.errorMessenger.Output(23,compiler.resourceManager.cursorResources[i3].filepath.c_str(),-1); 648 663 return buffer; 649 664 } … … 722 737 723 738 //ビットマップリソース 724 for(i3=0;i3< BitmapResourceNum;i3++){725 hFile=CreateFile( pBitmapResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);739 for(i3=0;i3<compiler.resourceManager.bitmapResources.size();i3++){ 740 hFile=CreateFile(compiler.resourceManager.bitmapResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 726 741 if(hFile==INVALID_HANDLE_VALUE){ 727 compiler.errorMessenger.Output(23, pBitmapResourceInfo[i3].FileName,-1);742 compiler.errorMessenger.Output(23,compiler.resourceManager.bitmapResources[i3].filepath.c_str(),-1); 728 743 return buffer; 729 744 } … … 750 765 751 766 //アイコンリソース 752 for(i3=0,i6=0;i3< IconResourceNum;i3++){753 hFile=CreateFile( pIconResourceInfo[i3].FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);767 for(i3=0,i6=0;i3<compiler.resourceManager.iconResources.size();i3++){ 768 hFile=CreateFile(compiler.resourceManager.iconResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 754 769 if(hFile==INVALID_HANDLE_VALUE){ 755 compiler.errorMessenger.Output(23, pIconResourceInfo[i3].FileName,-1);770 compiler.errorMessenger.Output(23,compiler.resourceManager.iconResources[i3].filepath.c_str(),-1); 756 771 return buffer; 757 772 } … … 831 846 832 847 //XPManifestリソース 833 for(i3=0;i3<XPManiResourceNum;i3++){ 834 extern char BasicCurDir[MAX_PATH]; 835 extern char szManifestPath[MAX_PATH]; 836 char temp2[MAX_PATH]; 837 lstrcpy(temp2,szManifestPath); 838 GetFullPath(temp2,BasicCurDir); 839 hFile=CreateFile(temp2,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 848 i3 = 0; 849 if( !compiler.resourceManager.manifestFilePath.empty() ) 850 { 851 hFile=CreateFile(compiler.resourceManager.manifestFilePath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 840 852 if(hFile==INVALID_HANDLE_VALUE){ 841 compiler.errorMessenger.Output(59, temp2,-1);853 compiler.errorMessenger.Output(59,compiler.resourceManager.manifestFilePath.c_str(),-1); 842 854 return buffer; 843 855 } … … 857 869 //アプリケーション名をセット 858 870 char szAppliName[MAX_PATH]; 871 char temp2[MAX_PATH]; 859 872 _splitpath( program.GetOutputFilePath().c_str(),NULL,NULL,szAppliName,temp2); 860 873 lstrcat(szAppliName,temp2);
Note:
See TracChangeset
for help on using the changeset viewer.