Commit 270d66ef authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

kernel32: Update VirtualAddress of resource section in write_raw_resources.

parent 3ccaad8b
...@@ -1554,6 +1554,7 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates ) ...@@ -1554,6 +1554,7 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates )
sec->SizeOfRawData = section_size; sec->SizeOfRawData = section_size;
sec->Misc.VirtualSize = virtual_section_size; sec->Misc.VirtualSize = virtual_section_size;
nt->OptionalHeader.SizeOfImage += rva_delta; nt->OptionalHeader.SizeOfImage += rva_delta;
nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress = sec->VirtualAddress;
nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = res_size.total_size; nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = res_size.total_size;
nt->OptionalHeader.SizeOfInitializedData = get_init_data_size( write_map->base, mapping_size ); nt->OptionalHeader.SizeOfInitializedData = get_init_data_size( write_map->base, mapping_size );
} }
......
...@@ -394,6 +394,7 @@ static void check_exe( const sec_verify *verify ) ...@@ -394,6 +394,7 @@ static void check_exe( const sec_verify *verify )
int i; int i;
IMAGE_DOS_HEADER *dos; IMAGE_DOS_HEADER *dos;
IMAGE_NT_HEADERS *nt; IMAGE_NT_HEADERS *nt;
IMAGE_OPTIONAL_HEADER *opt;
IMAGE_SECTION_HEADER *sec; IMAGE_SECTION_HEADER *sec;
IMAGE_RESOURCE_DIRECTORY *dir; IMAGE_RESOURCE_DIRECTORY *dir;
HANDLE file, mapping; HANDLE file, mapping;
...@@ -415,6 +416,7 @@ static void check_exe( const sec_verify *verify ) ...@@ -415,6 +416,7 @@ static void check_exe( const sec_verify *verify )
goto end; goto end;
nt = (void*) ((BYTE*) dos + dos->e_lfanew); nt = (void*) ((BYTE*) dos + dos->e_lfanew);
opt = &nt->OptionalHeader;
sec = (void*) &nt[1]; sec = (void*) &nt[1];
for(i = 0; i < max_sections; i++) for(i = 0; i < max_sections; i++)
...@@ -444,6 +446,10 @@ static void check_exe( const sec_verify *verify ) ...@@ -444,6 +446,10 @@ static void check_exe( const sec_verify *verify )
verify->NumberOfNamedEntries, dir->NumberOfNamedEntries); verify->NumberOfNamedEntries, dir->NumberOfNamedEntries);
ok( dir->NumberOfIdEntries == verify->NumberOfIdEntries, "NumberOfIdEntries should be %d instead of %d\n", ok( dir->NumberOfIdEntries == verify->NumberOfIdEntries, "NumberOfIdEntries should be %d instead of %d\n",
verify->NumberOfIdEntries, dir->NumberOfIdEntries); verify->NumberOfIdEntries, dir->NumberOfIdEntries);
ok(opt->DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY].VirtualAddress == sec[verify->rsrc_section].VirtualAddress,
"VirtualAddress in optional header should be %d instead of %d\n",
sec[verify->rsrc_section].VirtualAddress, opt->DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY].VirtualAddress);
} }
end: end:
......
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