From: Benjamin Shefte support@neuwon.com
Fixes Regression from: Wine 6.21
https://bugs.winehq.org/show_bug.cgi?id=52446
Signed-off-by: Ben Shefte shefben@gmail.com --- dlls/ntdll/loader.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 362e1c66be5..ec1fc556250 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -627,8 +627,14 @@ static WCHAR *append_dll_ext( const WCHAR *name ) static BOOL is_import_dll_system( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_IMPORT_DESCRIPTOR *import ) { const char *name = get_rva( mod->DllBase, import->Name ); - - return !strcmp( name, "ntdll.dll" ) || !strcmp( name, "kernel32.dll" ); + WCHAR buffer[16]; + DWORD len = strlen(name); + + if (len * sizeof(WCHAR) >= sizeof(buffer)) + return 0; + ascii_to_unicode( buffer, name, len + 1 ); + + return !wcsicmp( buffer, L"ntdll.dll" ) || !wcsicmp( buffer, L"kernel32.dll" ); }
/**********************************************************************
I think you can just use _stricmp() instead of strcmp() to fix the bug. Or is there any reason why it is better to convert to Unicode for comparison which I am missing?
On 1/23/22 21:16, Ben Shefte wrote:
From: Benjamin Shefte support@neuwon.com
Fixes Regression from: Wine 6.21
https://bugs.winehq.org/show_bug.cgi?id=52446
Signed-off-by: Ben Shefte shefben@gmail.com
dlls/ntdll/loader.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 362e1c66be5..ec1fc556250 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -627,8 +627,14 @@ static WCHAR *append_dll_ext( const WCHAR *name ) static BOOL is_import_dll_system( LDR_DATA_TABLE_ENTRY *mod, const IMAGE_IMPORT_DESCRIPTOR *import ) { const char *name = get_rva( mod->DllBase, import->Name );
- return !strcmp( name, "ntdll.dll" ) || !strcmp( name, "kernel32.dll" );
WCHAR buffer[16];
DWORD len = strlen(name);
if (len * sizeof(WCHAR) >= sizeof(buffer))
return 0;
ascii_to_unicode( buffer, name, len + 1 );
return !wcsicmp( buffer, L"ntdll.dll" ) || !wcsicmp( buffer, L"kernel32.dll" ); }
/**********************************************************************