Commit fdda480d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 8f2b5653
...@@ -1545,7 +1545,8 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates ) ...@@ -1545,7 +1545,8 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates )
int delta = section_size - (sec->SizeOfRawData + (-sec->SizeOfRawData) % PeFileAlignment); int delta = section_size - (sec->SizeOfRawData + (-sec->SizeOfRawData) % PeFileAlignment);
int rva_delta = virtual_section_size - int rva_delta = virtual_section_size -
(sec->Misc.VirtualSize + (-sec->Misc.VirtualSize) % PeSectionAlignment); (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 */ /* align .rsrc size when possible */
DWORD mapping_size = rsrc_is_last ? sec->PointerToRawData + section_size : old_size + delta; DWORD mapping_size = rsrc_is_last ? sec->PointerToRawData + section_size : old_size + delta;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment