[NTOS:KE/x64] Fix exception information on page faults

Pass a proper write/execute flag in the ExceptionInformation[0] field of the exception record instead of the raw fault code. This fixes comdlg:filedlg wine test, which writes to a write protected resource section, which needs to be handled by kernel32 UnhandledExceptionFilter, which relies on this parameter to be correct.
This commit is contained in:
Timo Kreuzer 2024-09-07 23:33:48 +03:00
parent 5eab2ddb2e
commit 2913ef5c93

View File

@ -461,8 +461,11 @@ IntsDisabled:
PageFaultError:
/* Set parameter 1 to error code */
/* Set parameter 1 to write/execute flag.
See https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-exception_record */
mov r9d, [rbp + KTRAP_FRAME_ErrorCode]
shr r9d, 1
and r9d, 9
/* Set parameter 2 to faulting address */
mov r10, cr2 // Param2 = faulting address