Skip to content

Latest commit

 

History

History
58 lines (32 loc) · 5.01 KB

event_inject_error_code.md

File metadata and controls

58 lines (32 loc) · 5.01 KB
description
Description of the 'event_inject_error_code' function in HyperDbg Scripts

event_inject_error_code

Function

event_inject_error_code

Syntax

event_inject_error_code( InterruptionType, Vector, ErrorCode);

Parameters

[ Expression (InterruptionType)]

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

Interruption TypeDescription
0External interrupt
1Reserved
2Non-maskable interrupt (NMI)
3Hardware exception (e.g,. #PF)
4Software interrupt (INT n)
5Privileged software exception (INT1)
6Software exception (INT3 or INTO)
7Other event

[ Expression (Vector)]

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

NameVector nr.TypeMnemonicError code?
Divide-by-zero Error0 (0x0)Fault#DENo
Debug1 (0x1)Fault/Trap#DBNo
Non-maskable Interrupt2 (0x2)Interrupt-No
Breakpoint3 (0x3)Trap#BPNo
Overflow4 (0x4)Trap#OFNo
Bound Range Exceeded5 (0x5)Fault#BRNo
Invalid Opcode6 (0x6)Fault#UDNo
Device Not Available7 (0x7)Fault#NMNo
Double Fault8 (0x8)Abort#DFYes (Zero)
Coprocessor Segment Overrun9 (0x9)Fault-No
Invalid TSS10 (0xA)Fault#TSYes
Segment Not Present11 (0xB)Fault#NPYes
Stack-Segment Fault12 (0xC)Fault#SSYes
General Protection Fault13 (0xD)Fault#GPYes
Page Fault14 (0xE)Fault#PFYes
Reserved15 (0xF)--No
x87 Floating-Point Exception16 (0x10)Fault#MFNo
Alignment Check17 (0x11)Fault#ACYes
Machine Check18 (0x12)Abort#MCNo
SIMD Floating-Point Exception19 (0x13)Fault#XM/#XFNo
Virtualization Exception20 (0x14)Fault#VENo
Reserved21-29 (0x15-0x1D)--No
Security Exception30 (0x1E)-#SXYes
Reserved31 (0x1F)--No
Triple Fault---No
FPU Error InterruptIRQ 13Interrupt#FERRNo

[ Expression (ErrorCode)]

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

Description

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

Examples

event_inject_error_code(3, e, 2);

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

Remarks

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_inject.

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.

Related

event_inject