3
0
mirror of https://github.com/XboxDev/nxdk.git synced 2026-04-03 05:43:26 +00:00
Files
nxdk/lib/winapi/errhandlingapi.c
2024-09-11 06:17:06 +09:30

31 lines
1008 B
C

// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2019 Stefan Schmidt
#include <string.h>
#include <windows.h>
#include <xboxkrnl/xboxkrnl.h>
VOID RaiseException (DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments, const ULONG_PTR *lpArguments)
{
EXCEPTION_RECORD exception_record;
exception_record.ExceptionCode = dwExceptionCode;
exception_record.ExceptionRecord = NULL;
exception_record.ExceptionAddress = (PVOID)RaiseException;
exception_record.ExceptionFlags = dwExceptionFlags & EXCEPTION_NONCONTINUABLE;
if (!lpArguments) {
exception_record.NumberParameters = 0;
} else {
if (nNumberOfArguments > EXCEPTION_MAXIMUM_PARAMETERS) {
nNumberOfArguments = EXCEPTION_MAXIMUM_PARAMETERS;
}
exception_record.NumberParameters = nNumberOfArguments;
memcpy(exception_record.ExceptionInformation, lpArguments, nNumberOfArguments * sizeof(ULONG));
}
RtlRaiseException(&exception_record);
}