event_inject_error_code | HyperDbg Documentation

event_inject_error_code

Description of the 'event_inject_error_code' function in HyperDbg Scripts

event_inject_error_code

event_inject_error_code( InterruptionType, Vector, ErrorCode);

[ Expression (InterruptionType)]

Type of the target interrupt/exception/fault (see the Remarks section for more information). Can be selected from the following table:

Non-maskable interrupt (NMI)

Hardware exception (e.g,. #PF)

Software interrupt (INT n)

Privileged software exception (INT1)

Software exception (INT3 or INTO)

[ Expression (Vector)]

The vector number (interrupt IDT vector number) of the target interrupt/exception/fault. Can be selected from the following table:

Coprocessor Segment Overrun

x87 Floating-Point Exception

SIMD Floating-Point Exception

[ Expression (ErrorCode)]

The target error code number of the interrupt/exception/fault.

Injects an interrupt/exception/fault with an error code which will be delivered once you continue the debuggee.

event_inject_error_code(3, e, 2);

Injects a page-fault (Hardware Exception = 3 and Vector equal to Page-fault = 0xe, and Error codearrow-up-right equal to Write Access = 2) to the target debuggee.

This function will set the error code. If the target interrupt/exception/fault doesn't need an error code (see the table above), you should use the event_injectarrow-up-right.

The interruption type determines the details of how the injection is performed. In general, you should use the type hardware exception for all exceptions other than the following:

  • breakpoint exceptions (#BP; a VMM should use the type software exception);

  • overflow exceptions (#OF a VMM should use the use type software exception); and

  • those debug exceptions (#DB) that are generated by INT1 (a VMM should use the use type privileged software exception).

  • The type of other event is used for the injection of events that are not delivered through the IDT.

Starting from v0.6, this function was added to the HyperDbg debugger.

event_injectarrow-up-right