HyperDbg/hyperdbg/include/SDK/headers/ErrorCodes.h

660 lines
16 KiB
C

/**
* @file ErrorCodes.h
* @author Sina Karvandi (sina@hyperdbg.org)
* @brief HyperDbg's SDK Error codes
* @details This file contains definitions of error codes used in HyperDbg
* @version 0.2
* @date 2022-06-24
*
* @copyright This project is released under the GNU Public License v3.
*
*/
#pragma once
//////////////////////////////////////////////////
// Success Codes //
//////////////////////////////////////////////////
/**
* @brief General value to indicate that the operation or
* request was successful
*
*/
#define DEBUGGER_OPERATION_WAS_SUCCESSFUL 0xFFFFFFFF
//////////////////////////////////////////////////
// Error Codes //
//////////////////////////////////////////////////
/**
* @brief error, the tag not exist
*
*/
#define DEBUGGER_ERROR_TAG_NOT_EXISTS 0xc0000000
/**
* @brief error, invalid type of action
*
*/
#define DEBUGGER_ERROR_INVALID_ACTION_TYPE 0xc0000001
/**
* @brief error, the action buffer size is invalid
*
*/
#define DEBUGGER_ERROR_ACTION_BUFFER_SIZE_IS_ZERO 0xc0000002
/**
* @brief error, the event type is unknown
*
*/
#define DEBUGGER_ERROR_EVENT_TYPE_IS_INVALID 0xc0000003
/**
* @brief error, enable to create event
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_CREATE_EVENT 0xc0000004
/**
* @brief error, invalid address specified for debugger
*
*/
#define DEBUGGER_ERROR_INVALID_ADDRESS 0xc0000005
/**
* @brief error, the core id is invalid
*
*/
#define DEBUGGER_ERROR_INVALID_CORE_ID 0xc0000006
/**
* @brief error, the index is greater than 32 in !exception command
*
*/
#define DEBUGGER_ERROR_EXCEPTION_INDEX_EXCEED_FIRST_32_ENTRIES 0xc0000007
/**
* @brief error, the index for !interrupt command is not between 32 to 256
*
*/
#define DEBUGGER_ERROR_INTERRUPT_INDEX_IS_NOT_VALID 0xc0000008
/**
* @brief error, unable to hide the debugger and enter to transparent-mode
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_HIDE_OR_UNHIDE_DEBUGGER 0xc0000009
/**
* @brief error, the debugger is already in transparent-mode
*
*/
#define DEBUGGER_ERROR_DEBUGGER_ALREADY_HIDE 0xc000000a
/**
* @brief error, invalid parameters in !e* e* commands
*
*/
#define DEBUGGER_ERROR_EDIT_MEMORY_STATUS_INVALID_PARAMETER 0xc000000b
/**
* @brief error, an invalid address is specified based on current cr3
* in !e* or e* commands
*
*/
#define DEBUGGER_ERROR_EDIT_MEMORY_STATUS_INVALID_ADDRESS_BASED_ON_CURRENT_PROCESS \
0xc000000c
/**
* @brief error, an invalid address is specified based on another process's cr3
* in !e* or e* commands
*
*/
#define DEBUGGER_ERROR_EDIT_MEMORY_STATUS_INVALID_ADDRESS_BASED_ON_OTHER_PROCESS \
0xc000000d
/**
* @brief error, invalid tag for 'events' command (tag id is unknown for kernel)
*
*/
#define DEBUGGER_ERROR_MODIFY_EVENTS_INVALID_TAG 0xc000000e
/**
* @brief error, type of action (enable/disable/clear) is wrong
*
*/
#define DEBUGGER_ERROR_MODIFY_EVENTS_INVALID_TYPE_OF_ACTION 0xc000000f
/**
* @brief error, invalid parameters steppings actions
*
*/
#define DEBUGGER_ERROR_STEPPING_INVALID_PARAMETER 0xc0000010
/**
* @brief error, thread is invalid (not found) or disabled in
* stepping (step-in & step-out) requests
*
*/
#define DEBUGGER_ERROR_STEPPINGS_EITHER_THREAD_NOT_FOUND_OR_DISABLED 0xc0000011
/**
* @brief error, baud rate is invalid
*
*/
#define DEBUGGER_ERROR_PREPARING_DEBUGGEE_INVALID_BAUDRATE 0xc0000012
/**
* @brief error, serial port address is invalid
*
*/
#define DEBUGGER_ERROR_PREPARING_DEBUGGEE_INVALID_SERIAL_PORT 0xc0000013
/**
* @brief error, invalid core selected in changing core in remote debuggee
*
*/
#define DEBUGGER_ERROR_PREPARING_DEBUGGEE_INVALID_CORE_IN_REMOTE_DEBUGGE \
0xc0000014
/**
* @brief error, invalid process selected in changing process in remote debuggee
*
*/
#define DEBUGGER_ERROR_PREPARING_DEBUGGEE_UNABLE_TO_SWITCH_TO_NEW_PROCESS \
0xc0000015
/**
* @brief error, unable to run script in remote debuggee
*
*/
#define DEBUGGER_ERROR_PREPARING_DEBUGGEE_TO_RUN_SCRIPT 0xc0000016
/**
* @brief error, invalid register number
*
*/
#define DEBUGGER_ERROR_INVALID_REGISTER_NUMBER 0xc0000017
/**
* @brief error, maximum pools were used without continuing debuggee
*
*/
#define DEBUGGER_ERROR_MAXIMUM_BREAKPOINT_WITHOUT_CONTINUE 0xc0000018
/**
* @brief error, breakpoint already exists on the target address
*
*/
#define DEBUGGER_ERROR_BREAKPOINT_ALREADY_EXISTS_ON_THE_ADDRESS 0xc0000019
/**
* @brief error, breakpoint id not found
*
*/
#define DEBUGGER_ERROR_BREAKPOINT_ID_NOT_FOUND 0xc000001a
/**
* @brief error, breakpoint already disabled
*
*/
#define DEBUGGER_ERROR_BREAKPOINT_ALREADY_DISABLED 0xc000001b
/**
* @brief error, breakpoint already enabled
*
*/
#define DEBUGGER_ERROR_BREAKPOINT_ALREADY_ENABLED 0xc000001c
/**
* @brief error, memory type is invalid
*
*/
#define DEBUGGER_ERROR_MEMORY_TYPE_INVALID 0xc000001d
/**
* @brief error, the process id is invalid
*
*/
#define DEBUGGER_ERROR_INVALID_PROCESS_ID 0xc000001e
/**
* @brief error, for event specific reasons the event is not
* applied
*
*/
#define DEBUGGER_ERROR_EVENT_IS_NOT_APPLIED 0xc000001f
/**
* @brief error, for process switch or process details, invalid parameter
*
*/
#define DEBUGGER_ERROR_DETAILS_OR_SWITCH_PROCESS_INVALID_PARAMETER 0xc0000020
/**
* @brief error, for thread switch or thread details, invalid parameter
*
*/
#define DEBUGGER_ERROR_DETAILS_OR_SWITCH_THREAD_INVALID_PARAMETER 0xc0000021
/**
* @brief error, maximum breakpoint for a single page is hit
*
*/
#define DEBUGGER_ERROR_MAXIMUM_BREAKPOINT_FOR_A_SINGLE_PAGE_IS_HIT 0xc0000022
/**
* @brief error, there is no pre-allocated buffer
*
*/
#define DEBUGGER_ERROR_PRE_ALLOCATED_BUFFER_IS_EMPTY 0xc0000023
/**
* @brief error, in the EPT handler, it could not split the 2MB pages to
* 512 entries of 4 KB pages
*
*/
#define DEBUGGER_ERROR_EPT_COULD_NOT_SPLIT_THE_LARGE_PAGE_TO_4KB_PAGES 0xc0000024
/**
* @brief error, failed to get PML1 entry of the target address
*
*/
#define DEBUGGER_ERROR_EPT_FAILED_TO_GET_PML1_ENTRY_OF_TARGET_ADDRESS 0xc0000025
/**
* @brief error, multiple EPT Hooks or Monitors are applied on a single page
*
*/
#define DEBUGGER_ERROR_EPT_MULTIPLE_HOOKS_IN_A_SINGLE_PAGE 0xc0000026
/**
* @brief error, could not build the EPT Hook
*
*/
#define DEBUGGER_ERROR_COULD_NOT_BUILD_THE_EPT_HOOK 0xc0000027
/**
* @brief error, could not find the type of allocation
*
*/
#define DEBUGGER_ERROR_COULD_NOT_FIND_ALLOCATION_TYPE 0xc0000028
/**
* @brief error, could not find the index of test query
*
*/
#define DEBUGGER_ERROR_INVALID_TEST_QUERY_INDEX 0xc0000029
/**
* @brief error, failed to attach to the target user-mode process
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_ATTACH_TO_TARGET_USER_MODE_PROCESS 0xc000002a
/**
* @brief error, failed to remove hooks as entrypoint is not reached yet
* @details The caller of this functionality should keep sending the previous
* IOCTL until the hook is remove successfully
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_REMOVE_HOOKS_ENTRYPOINT_NOT_REACHED 0xc000002b
/**
* @brief error, could not remove the previous hook
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_REMOVE_HOOKS 0xc000002c
/**
* @brief error, the needed routines for debugging is not initialized
*
*/
#define DEBUGGER_ERROR_FUNCTIONS_FOR_INITIALIZING_PEB_ADDRESSES_ARE_NOT_INITIALIZED 0xc000002d
/**
* @brief error, unable to get 32-bit or 64-bit of the target process
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_DETECT_32_BIT_OR_64_BIT_PROCESS 0xc000002e
/**
* @brief error, unable to kill the target process
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_KILL_THE_PROCESS 0xc000002f
/**
* @brief error, invalid thread debugging token
*
*/
#define DEBUGGER_ERROR_INVALID_THREAD_DEBUGGING_TOKEN 0xc0000030
/**
* @brief error, unable to pause the process's threads
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_PAUSE_THE_PROCESS_THREADS 0xc0000031
/**
* @brief error, user debugger already attached to this process
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_ATTACH_TO_AN_ALREADY_ATTACHED_PROCESS 0xc0000032
/**
* @brief error, the user debugger is not attached to the target process
*
*/
#define DEBUGGER_ERROR_THE_USER_DEBUGGER_NOT_ATTACHED_TO_THE_PROCESS 0xc0000033
/**
* @brief error, cannot detach from the process as there are paused threads
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_DETACH_AS_THERE_ARE_PAUSED_THREADS 0xc0000034
/**
* @brief error, cannot switch to new thread as the process id or thread id is not found
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_SWITCH_PROCESS_ID_OR_THREAD_ID_IS_INVALID 0xc0000035
/**
* @brief error, cannot switch to new thread the process doesn't contain an active thread
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_SWITCH_THERE_IS_NO_THREAD_ON_THE_PROCESS 0xc0000036
/**
* @brief error, unable to get modules
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_GET_MODULES_OF_THE_PROCESS 0xc0000037
/**
* @brief error, unable to get the callstack
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_GET_CALLSTACK 0xc0000038
/**
* @brief error, unable to query count of processes or threads
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_QUERY_COUNT_OF_PROCESSES_OR_THREADS 0xc0000039
/**
* @brief error, using short-circuiting event with post-event mode is
* not supported in HyperDbg
*
*/
#define DEBUGGER_ERROR_USING_SHORT_CIRCUITING_EVENT_WITH_POST_EVENT_MODE_IS_FORBIDDEDN 0xc000003a
/**
* @brief error, unknown test query is received
*
*/
#define DEBUGGER_ERROR_UNKNOWN_TEST_QUERY_RECEIVED 0xc000003b
/**
* @brief error, for reading from memory in case of invalid parameters
*
*/
#define DEBUGGER_ERROR_READING_MEMORY_INVALID_PARAMETER 0xc000003c
/**
* @brief error, the list of threads/process trap flag is full
*
*/
#define DEBUGGER_ERROR_THE_TRAP_FLAG_LIST_IS_FULL 0xc000003d
/**
* @brief error, unable to kill the target process. process does not exists
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_KILL_THE_PROCESS_DOES_NOT_EXISTS 0xc000003e
/**
* @brief error, the execution mode is incorrect
*
*/
#define DEBUGGER_ERROR_MODE_EXECUTION_IS_INVALID 0xc000003f
/**
* @brief error, the process id cannot be specified while the debugger is in VMX-root mode
*
*/
#define DEBUGGER_ERROR_PROCESS_ID_CANNOT_BE_SPECIFIED_WHILE_APPLYING_EVENT_FROM_VMX_ROOT_MODE 0xc0000040
/**
* @brief error, the preallocated buffer is not enough for storing event+conditional buffer
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_PREALLOCATED_BUFFER_IS_NOT_ENOUGH_FOR_EVENT_AND_CONDITIONALS 0xc0000041
/**
* @brief error, the regular preallocated buffer not found
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_REGULAR_PREALLOCATED_BUFFER_NOT_FOUND 0xc0000042
/**
* @brief error, the big preallocated buffer not found
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_BIG_PREALLOCATED_BUFFER_NOT_FOUND 0xc0000043
/**
* @brief error, enable to create action (cannot allocate buffer)
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_CREATE_ACTION_CANNOT_ALLOCATE_BUFFER 0xc0000044
/**
* @brief error, the regular preallocated buffer not found (for action)
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_ACTION_REGULAR_PREALLOCATED_BUFFER_NOT_FOUND 0xc0000045
/**
* @brief error, the big preallocated buffer not found (for action)
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_ACTION_BIG_PREALLOCATED_BUFFER_NOT_FOUND 0xc0000046
/**
* @brief error, the preallocated buffer is not enough for storing action buffer
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_PREALLOCATED_BUFFER_IS_NOT_ENOUGH_FOR_ACTION_BUFFER 0xc0000047
/**
* @brief error, the requested optional buffer is bigger than send/receive stack of the debugger
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_REQUESTED_OPTIONAL_BUFFER_IS_BIGGER_THAN_DEBUGGERS_SEND_RECEIVE_STACK 0xc0000048
/**
* @brief error, the requested safe buffer does not exist (regular)
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_REGULAR_REQUESTED_SAFE_BUFFER_NOT_FOUND 0xc0000049
/**
* @brief error, the requested safe buffer does not exists (big)
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_BIG_REQUESTED_SAFE_BUFFER_NOT_FOUND 0xc000004a
/**
* @brief error, the preallocated buffer is not enough for storing safe requested buffer
*
*/
#define DEBUGGER_ERROR_INSTANT_EVENT_PREALLOCATED_BUFFER_IS_NOT_ENOUGH_FOR_REQUESTED_SAFE_BUFFER 0xc000004b
/**
* @brief error, enable to create requested safe buffer (cannot allocate buffer)
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_ALLOCATE_REQUESTED_SAFE_BUFFER 0xc000004c
/**
* @brief error, could not find the type of preactivation
*
*/
#define DEBUGGER_ERROR_COULD_NOT_FIND_PREACTIVATION_TYPE 0xc000004d
/**
* @brief error, the mode exec trap is not already initialized
*
*/
#define DEBUGGER_ERROR_THE_MODE_EXEC_TRAP_IS_NOT_INITIALIZED 0xc000004e
/**
* @brief error, the target event(s) is/are disabled but cannot clear them because the buffer of the user-mode
* priority is full
*
*/
#define DEBUGGER_ERROR_THE_TARGET_EVENT_IS_DISABLED_BUT_CANNOT_BE_CLEARED_PRIRITY_BUFFER_IS_FULL 0xc000004f
/**
* @brief error, not all cores are locked (probably due to a race condition in HyperDbg) in
* instant-event mechanism
*
*/
#define DEBUGGER_ERROR_NOT_ALL_CORES_ARE_LOCKED_FOR_APPLYING_INSTANT_EVENT 0xc0000050
/**
* @brief error, switching to the target core is not possible because core is not locked
* (probably due to a race condition in HyperDbg)
*
*/
#define DEBUGGER_ERROR_TARGET_SWITCHING_CORE_IS_NOT_LOCKED 0xc0000051
/**
* @brief error, invalid physical address
*
*/
#define DEBUGGER_ERROR_INVALID_PHYSICAL_ADDRESS 0xc0000052
/**
* @brief error, could not perform APIC actions
*
*/
#define DEBUGGER_ERROR_APIC_ACTIONS_ERROR 0xc0000053
/**
* @brief error, debugger is already not in the transparent-mode
*
*/
#define DEBUGGER_ERROR_DEBUGGER_ALREADY_UNHIDE 0xc0000054
/**
* @brief error, the user debugger cannot be initialized
*
*/
#define DEBUGGER_ERROR_DEBUGGER_NOT_INITIALIZED 0xc0000055
/**
* @brief error, cannot put EPT hooks on addresses above 512 GB
*
*/
#define DEBUGGER_ERROR_CANNOT_PUT_EPT_HOOKS_ON_PHYSICAL_ADDRESS_ABOVE_512_GB 0xc0000056
/**
* @brief error, invalid parameters for SMI operation request
*
*/
#define DEBUGGER_ERROR_INVALID_SMI_OPERATION_PARAMETERS 0xc0000057
/**
* @brief error, unable to trigger SMI
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_TRIGGER_SMI 0xc0000058
/**
* @brief error, unable to apply the command to the target thread
*
*/
#define DEBUGGER_ERROR_UNABLE_TO_APPLY_COMMAND_TO_THE_TARGET_THREAD 0xc0000059
/**
* @brief error, HyperTrace is not initialized
*
*/
#define DEBUGGER_ERROR_HYPERTRACE_NOT_INITIALIZED 0xc000005a
/**
* @brief error, invalid HyperTrace operation type is specified in the request
*
*/
#define DEBUGGER_ERROR_INVALID_HYPERTRACE_OPERATION_TYPE 0xc000005b
/**
* @brief error, LBR is already enabled
*
*/
#define DEBUGGER_ERROR_LBR_ALREADY_ENABLED 0xc000005c
/**
* @brief error, LBR is already disabled
*
*/
#define DEBUGGER_ERROR_LBR_ALREADY_DISABLED 0xc000005d
/**
* @brief error, LBR is not supported by the processor
*
*/
#define DEBUGGER_ERROR_LBR_NOT_SUPPORTED 0xc000005e
/**
* @brief error, LBR not supported on VMCS
*
*/
#define DEBUGGER_ERROR_LBR_NOT_SUPPORTED_ON_VMCS 0xc000005f
/**
* @brief error, PT is already enabled
*
*/
#define DEBUGGER_ERROR_PT_ALREADY_ENABLED 0xc0000060
/**
* @brief error, PT is already disabled
*
*/
#define DEBUGGER_ERROR_PT_ALREADY_DISABLED 0xc0000061
/**
* @brief error, PT is not supported by the processor
*
*/
#define DEBUGGER_ERROR_PT_NOT_SUPPORTED 0xc0000062
/**
* @brief error, VMM cannot be initialized while HyperTrace module is already loaded
*
*/
#define DEBUGGER_ERROR_VMM_CANNOT_BE_INITIALIZED_IF_HYPERTRACE_IS_LOADED 0xc0000063
/**
* @brief error, VMM cannot be initialized if the debugger is not loaded
*
*/
#define DEBUGGER_ERROR_VMM_CANNOT_BE_INITIALIZED_IF_DEBUGGER_IS_NOT_LOADED 0xc0000064
/**
* @brief error, cannot initialize the debugger
*
*/
#define DEBUGGER_ERROR_CANNOT_INITIALIZE_DEBUGGER 0xc0000065
//
// WHEN YOU ADD ANYTHING TO THIS LIST OF ERRORS, THEN
// MAKE SURE TO ADD AN ERROR MESSAGE TO ShowErrorMessage(UINT32 Error)
// FUNCTION
//