Only return when there's no relocation to do
From: André Zwing nerv@dawncrow.de
--- dlls/ntdll/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 1a87f4d1f5e..12696e8dbcb 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2042,7 +2042,7 @@ static NTSTATUS perform_relocations( void *module, IMAGE_NT_HEADERS *nt, SIZE_T return STATUS_SUCCESS;
if (!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL) && - module != NtCurrentTeb()->Peb->ImageBaseAddress) + module == NtCurrentTeb()->Peb->ImageBaseAddress) return STATUS_SUCCESS;
relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
This will prevent relocating the main exe. What are you trying to do?
On Mon Oct 16 16:56:36 2023 +0000, Alexandre Julliard wrote:
This will prevent relocating the main exe. What are you trying to do?
My understanding is that the relocations should be done if (module != NtCurrentTeb()->Peb->ImageBaseAddress). But it currently returns early in that case. I had some issues with your change in Hangover, got a c0000018 and the application to be emulated didn't load. So after checking why, I found your commit and thought the logic should be inverted. You indicate that's wrong, so it seems I miss something.
On Mon Oct 16 16:56:35 2023 +0000, André Zwing wrote:
My understanding is that the relocations should be done if (module != NtCurrentTeb()->Peb->ImageBaseAddress). But it currently returns early in that case. I had some issues with your change in Hangover, got a c0000018 and the application to be emulated didn't load. So after checking why, I found your commit and thought the logic should be inverted. You indicate that's wrong, so it seems I miss something.
Relocations need to be done for the main exe, so for module == NtCurrentTeb()->Peb->ImageBaseAddress. Other exe modules are not relocated.
On Mon Oct 16 19:06:35 2023 +0000, Alexandre Julliard wrote:
Relocations need to be done for the main exe, so for module == NtCurrentTeb()->Peb->ImageBaseAddress. Other exe modules are not relocated.
I see, my mistake, I'll send an updated fix
This merge request was closed by André Zwing.