[PATCH 0/1] MR4103: ntdll: Support relocating the main exe
Only return when there's no relocation to do -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4103
From: André Zwing <nerv(a)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]; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4103
This will prevent relocating the main exe. What are you trying to do? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4103#note_48770
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.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4103#note_48819
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.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4103#note_48833
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
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4103#note_49018
This merge request was closed by André Zwing. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4103
participants (2)
-
Alexandre Julliard (@julliard) -
André Zwing