[APPHELP] SdbGetFileAttributes: skip NT prefix for GetFileVersionInfoSizeW

SdbGetFileAttributes supports NT paths (at least on Windows 10), but GetFileVersionInfoSizeW does not.
This commit is contained in:
Timo Kreuzer
2026-07-20 19:27:31 +00:00
parent 5437e77c62
commit 795f69c63f
+15 -3
View File
@@ -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);
}