kernel32: Fix writing resource section as a last section in UpdateResource().

This commit is contained in:
Nikolay Sivov 2015-01-28 16:46:31 +03:00 committed by Alexandre Julliard
parent 8f2b5653a7
commit fdda480df5
1 changed files with 2 additions and 1 deletions

View File

@ -1545,7 +1545,8 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates )
int delta = section_size - (sec->SizeOfRawData + (-sec->SizeOfRawData) % PeFileAlignment);
int rva_delta = virtual_section_size -
(sec->Misc.VirtualSize + (-sec->Misc.VirtualSize) % PeSectionAlignment);
BOOL rsrc_is_last = sec->PointerToRawData + sec->SizeOfRawData == old_size;
/* when new section is added it could end past current mapping size */
BOOL rsrc_is_last = sec->PointerToRawData + sec->SizeOfRawData >= old_size;
/* align .rsrc size when possible */
DWORD mapping_size = rsrc_is_last ? sec->PointerToRawData + section_size : old_size + delta;