Skip to content

Commit

Permalink
Return previously seen input reports even if neutralization fails, bu…
Browse files Browse the repository at this point in the history
…t return 0 bytes read.
  • Loading branch information
Kaldaien committed Dec 29, 2024
1 parent 8eb17d4 commit a540db1
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/input/hid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,16 +1699,16 @@ GetOverlappedResultEx_Detour (HANDLE hFile,
{
if (hid_file->neutralizeHidInput (report_id, dwSize))
{
SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
neutralized = true;
}

SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
}

if (! neutralized)
{
memset (overlapped_request.lpBuffer, 0, dwSize);
*lpNumberOfBytesTransferred = 0;
}
}
Expand Down Expand Up @@ -1765,16 +1765,16 @@ GetOverlappedResultEx_Detour (HANDLE hFile,
{
if (hid_file->neutralizeHidInput (report_id, dwSize))
{
SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
neutralized = true;
}

SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
}

if (! neutralized)
{
memset (overlapped_request.lpBuffer, 0, dwSize);
dwSize = 0;
}
}
Expand Down Expand Up @@ -1865,16 +1865,16 @@ GetOverlappedResult_Detour (HANDLE hFile,
{
if (hid_file->neutralizeHidInput (report_id, dwSize))
{
SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
neutralized = true;
}

SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
}

if (! neutralized)
{
memset (overlapped_request.lpBuffer, 0, dwSize);
*lpNumberOfBytesTransferred = 0;
}
}
Expand Down Expand Up @@ -1931,16 +1931,16 @@ GetOverlappedResult_Detour (HANDLE hFile,
{
if (hid_file->neutralizeHidInput (report_id, dwSize))
{
SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
neutralized = true;
}

SK_UNTRUSTED_memcpy (
overlapped_request.lpBuffer, hid_file->_cachedInputReportsByReportId [report_id].data (), dwSize
);
}

if (! neutralized)
{
memset (overlapped_request.lpBuffer, 0, dwSize);
dwSize = 0;
}
}
Expand Down

0 comments on commit a540db1

Please sign in to comment.