Subversion Repositories filter_foundry

Rev

Rev 433 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 433 Rev 444
Line 1693... Line 1693...
1693
            // Fix by Daniel Marschall: Added this calculation of "SizeOfImage".
1693
            // Fix by Daniel Marschall: Added this calculation of "SizeOfImage".
1694
            // With the original implementation, Windows won't load some images!
1694
            // With the original implementation, Windows won't load some images!
1695
            // https://stackoverflow.com/questions/39022853/how-is-sizeofimage-in-the-pe-optional-header-computed
1695
            // https://stackoverflow.com/questions/39022853/how-is-sizeofimage-in-the-pe-optional-header-computed
1696
            // Reported Wine bug here: https://bugs.winehq.org/show_bug.cgi?id=52119
1696
            // Reported Wine bug here: https://bugs.winehq.org/show_bug.cgi?id=52119
1697
            lastsec = get_last_section(write_map->base, mapping_size);
1697
            lastsec = get_last_section(write_map->base, mapping_size);
1698
            pEndOfLastSection = lastsec->VirtualAddress + lastsec->Misc.VirtualSize + nt64->OptionalHeader.ImageBase;
1698
            pEndOfLastSection = (ULONGLONG)lastsec->VirtualAddress + (ULONGLONG)lastsec->Misc.VirtualSize + nt64->OptionalHeader.ImageBase;
1699
            //NOTE: we are rounding to memory section alignment, not file
1699
            //NOTE: we are rounding to memory section alignment, not file
1700
            pEndOfLastSectionMem = peRoundUpToAlignment64(nt64->OptionalHeader.SectionAlignment, pEndOfLastSection);
1700
            pEndOfLastSectionMem = peRoundUpToAlignment64(nt64->OptionalHeader.SectionAlignment, pEndOfLastSection);
1701
            uCalcSizeOfFile = pEndOfLastSectionMem - nt64->OptionalHeader.ImageBase;
1701
            uCalcSizeOfFile = pEndOfLastSectionMem - nt64->OptionalHeader.ImageBase;
1702
            nt64->OptionalHeader.SizeOfImage = (DWORD)uCalcSizeOfFile;
1702
            nt64->OptionalHeader.SizeOfImage = (DWORD)uCalcSizeOfFile;
1703
        }
1703
        }