From 795f69c63fa83b751aed7d7aa3cb845b49759f1c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 14 Jul 2026 22:12:13 +0300 Subject: [PATCH] [APPHELP] SdbGetFileAttributes: skip NT prefix for GetFileVersionInfoSizeW SdbGetFileAttributes supports NT paths (at least on Windows 10), but GetFileVersionInfoSizeW does not. --- dll/appcompat/apphelp/sdbfileattr.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dll/appcompat/apphelp/sdbfileattr.c b/dll/appcompat/apphelp/sdbfileattr.c index 1635df5e920..9fc29ab84ed 100644 --- a/dll/appcompat/apphelp/sdbfileattr.c +++ b/dll/appcompat/apphelp/sdbfileattr.c @@ -1,4 +1,4 @@ -/* +/* * PROJECT: ReactOS Application compatibility module * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) * PURPOSE: Query file attributes used to match exe's @@ -288,13 +288,25 @@ BOOL WINAPI SdbGetFileAttributes(LPCWSTR path, PATTRINFO *attr_info_ret, LPDWORD DWORD info_size; ULONG export_dir_size; PIMAGE_EXPORT_DIRECTORY export_dir; + LPCWSTR dos_path; - info_size = GetFileVersionInfoSizeW(path, NULL); + /* Check if the caller passed an NT style path (full path, prefixed wih "\\??\\") */ + if (!wcsncmp(path, L"\\??\\", 4) && (path[4] != UNICODE_NULL) && (path[5] == L':')) + { + /* Skip NT prefix, if it is present (GetFileVersionInfoSizeW doesn't handle NT paths) */ + dos_path = path + 4; + } + else + { + dos_path = path; + } + + info_size = GetFileVersionInfoSizeW(dos_path, NULL); if (info_size != 0) { UINT page_size = 0; file_info = SdbAlloc(info_size); - GetFileVersionInfoW(path, 0, info_size, file_info); + GetFileVersionInfoW(dos_path, 0, info_size, file_info); VerQueryValueW(file_info, str_tinfo, (LPVOID)&lang_page, &page_size); StringCchPrintfW(translation, ARRAYSIZE(translation), str_trans, lang_page->language, lang_page->code_page); }