Module: wine Branch: master Commit: af01944a8ce742fb0a1696ea51d91d8ec3da6607 URL: https://gitlab.winehq.org/wine/wine/-/commit/af01944a8ce742fb0a1696ea51d91d8...
Author: Alexandre Julliard julliard@winehq.org Date: Tue May 23 11:13:05 2023 +0200
ntdll: Use STATUS_NOT_SUPPORTED for internal machine mismatch errors.
It corresponds to what NtMapViewOfSectionEx() returns with an explicitly specified machine.
---
dlls/ntdll/loader.c | 12 ++++++------ dlls/ntdll/unix/loader.c | 10 +++++----- dlls/ntdll/unix/virtual.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 0d8d3b16c70..feaacea83e7 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -2580,7 +2580,7 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm, HANDL if (!is_valid_binary( handle, image_info )) { TRACE( "%s is for arch %x, continuing search\n", debugstr_us(nt_name), image_info->Machine ); - status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; + status = STATUS_NOT_SUPPORTED; NtClose( *mapping ); *mapping = NULL; } @@ -3004,11 +3004,11 @@ static NTSTATUS find_builtin_without_file( const WCHAR *name, UNICODE_STRING *ne RtlAppendUnicodeToString( new_name, L"\" ); RtlAppendUnicodeToString( new_name, name ); status = open_dll_file( new_name, pwm, mapping, image_info, id ); - if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) found_image = TRUE; + if (status == STATUS_NOT_SUPPORTED) found_image = TRUE; else if (status != STATUS_DLL_NOT_FOUND) goto done; RtlFreeUnicodeString( new_name ); } - if (found_image) status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; + if (found_image) status = STATUS_NOT_SUPPORTED;
done: RtlFreeUnicodeString( new_name ); @@ -3062,13 +3062,13 @@ static NTSTATUS search_dll_file( LPCWSTR paths, LPCWSTR search, UNICODE_STRING * if ((status = RtlDosPathNameToNtPathName_U_WithStatus( name, nt_name, NULL, NULL ))) goto done;
status = open_dll_file( nt_name, pwm, mapping, image_info, id ); - if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) found_image = TRUE; + if (status == STATUS_NOT_SUPPORTED) found_image = TRUE; else if (status != STATUS_DLL_NOT_FOUND) goto done; RtlFreeUnicodeString( nt_name ); paths = ptr; }
- if (found_image) status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; + if (found_image) status = STATUS_NOT_SUPPORTED;
done: RtlFreeHeap( GetProcessHeap(), 0, name ); @@ -3127,7 +3127,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI else if (!(status = RtlDosPathNameToNtPathName_U_WithStatus( libname, nt_name, NULL, NULL ))) status = open_dll_file( nt_name, pwm, mapping, image_info, id );
- if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) status = STATUS_INVALID_IMAGE_FORMAT; + if (status == STATUS_NOT_SUPPORTED) status = STATUS_INVALID_IMAGE_FORMAT;
done: RtlFreeHeap( GetProcessHeap(), 0, fullname ); diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 61743df7556..27fd974f966 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1440,7 +1440,7 @@ static NTSTATUS open_builtin_so_file( const char *name, OBJECT_ATTRIBUTES *attr, status = STATUS_PROCEDURE_NOT_FOUND; } } - else status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; + else status = STATUS_NOT_SUPPORTED;
close( fd ); return status; @@ -1525,7 +1525,7 @@ static NTSTATUS find_builtin_dll( UNICODE_STRING *nt_name, void **module, SIZE_T file[pos + len + 1] = 0; ptr = prepend( file + pos, dll_paths[i], strlen(dll_paths[i]) ); status = open_builtin_pe_file( ptr, &attr, module, size_ptr, image_info, limit, machine, prefer_native ); - if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) + if (status == STATUS_NOT_SUPPORTED) { found_image = TRUE; continue; @@ -1533,11 +1533,11 @@ static NTSTATUS find_builtin_dll( UNICODE_STRING *nt_name, void **module, SIZE_T if (status != STATUS_DLL_NOT_FOUND) goto done; strcpy( file + pos + len + 1, ".so" ); status = open_builtin_so_file( ptr, &attr, module, image_info, machine, prefer_native ); - if (status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) found_image = TRUE; + if (status == STATUS_NOT_SUPPORTED) found_image = TRUE; else if (status != STATUS_DLL_NOT_FOUND) goto done; }
- if (found_image) status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; + if (found_image) status = STATUS_NOT_SUPPORTED; WARN( "cannot find builtin library for %s\n", debugstr_us(nt_name) ); done: if (status >= 0 && ext) @@ -1591,7 +1591,7 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename, return find_builtin_dll( &nt_name, module, size, &info, limit, machine, FALSE ); default: status = find_builtin_dll( &nt_name, module, size, &info, limit, machine, (loadorder == LO_DEFAULT) ); - if (status == STATUS_DLL_NOT_FOUND || status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) + if (status == STATUS_DLL_NOT_FOUND || status == STATUS_NOT_SUPPORTED) return STATUS_IMAGE_ALREADY_LOADED; return status; } diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 2255061ec75..a46c27a6b71 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3050,7 +3050,7 @@ NTSTATUS virtual_map_builtin_module( HANDLE mapping, void **module, SIZE_T *size else if (machine && image_info->machine != machine) { TRACE( "%s is for arch %04x, continuing search\n", debugstr_w(filename), image_info->machine ); - status = STATUS_IMAGE_MACHINE_TYPE_MISMATCH; + status = STATUS_NOT_SUPPORTED; } else if (prefer_native && (image_info->dll_charact & IMAGE_DLLCHARACTERISTICS_PREFER_NATIVE)) {