Skip to content

Commit

Permalink
krnl386.exe16: Fix handling of DBCS characters in FINDNEXT.
Browse files Browse the repository at this point in the history
Fixes: 6e22d12
  • Loading branch information
otya128 committed Dec 29, 2023
1 parent 8ea7eb2 commit cf4c32b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions krnl386/int21.c
Original file line number Diff line number Diff line change
Expand Up @@ -4067,13 +4067,20 @@ static BOOL INT21_FindNext( CONTEXT *context )
FileTimeToDosDateTime( entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? &entry.ftCreationTime : &entry.ftLastWriteTime, &dta->filedate, &dta->filetime );
memset(dta->filename, 0, 13);
if (entry.cAlternateFileName[0])
{
/* shoud be UPPER CASE */
for (int i = 0; i < 13; i++)
entry.cAlternateFileName[i] = toupperW(entry.cAlternateFileName[i]);
WideCharToMultiByte(CP_OEMCP, 0, entry.cAlternateFileName, -1,
dta->filename, 13, NULL, NULL);
}
else
{
/* shoud be UPPER CASE */
for (int i = 0; i < 13; i++)
entry.cFileName[i] = toupperW(entry.cFileName[i]);
WideCharToMultiByte(CP_OEMCP, 0, entry.cFileName, -1, dta->filename, 13, NULL, NULL);
/* shoud be UPPER CASE */
for (int i = 0; i < 13; i++)
dta->filename[i] = toupper(dta->filename[i]);
}

if (!memchr(dta->mask,'?',11))
{
Expand Down

0 comments on commit cf4c32b

Please sign in to comment.