3164{
 3166    ULONG                     ExitInstructionLength = 0;
 
 3167    RFLAGS                    Rflags                = {0};
 3168    UINT64                    LastVmexitRip         = 0;
 
 3169 
 3170    
 3171    
 3172    
 3174 
 3175StartAgain:
 3176 
 3177    
 3178    
 3179    
 3180    
 3182    {
 3183        
 3184        
 3185        
 3187 
 3188        
 3189        
 3190        
 3192 
 3193        
 3194        
 3195        
 3197 
 3198        
 3199        
 3200        
 3202 
 3203        
 3204        
 3205        
 3206        PausePacket.
Rip                    = LastVmexitRip;
 
 3208 
 3209        
 3210        
 3211        
 3214 
 3215        
 3216        
 3217        
 3219        PausePacket.
Rflags = Rflags.AsUInt;
 
 3220 
 3221        
 3222        
 3223        
 3224        if (EventDetails != NULL)
 3225        {
 3228        }
 3229 
 3230        
 3231        
 3232        
 3234        {
 3236        }
 3237        else
 3238        {
 3239            
 3240            
 3241            
 3242            
 3243 
 3244            
 3245            
 3246            
 3248        }
 3249 
 3250        
 3251        
 3252        
 3254 
 3255        
 3256        
 3257        
 3260                                                  ExitInstructionLength);
 3261 
 3262        
 3263        
 3264        
 3265        
 3268                                   (
CHAR *)&PausePacket,
 
 3270 
 3271        
 3272        
 3273        
 3275 
 3276        
 3277        
 3278        
 3279        
 3281        {
 3282            
 3283            
 3284            
 3285            goto StartAgain;
 3286        }
 3287    }
 3288    else
 3289    {
 3290        
 3291        
 3292        
 3293 
 3294        
 3295        
 3296        
 3297        
 3299 
 3302 
 3303            
 3304            
 3305            
 3307                
 3308                
 3309                
 3310                g_DebuggeeHaltReason = DEBUGGEE_PAUSING_REASON_DEBUGGEE_CORE_SWITCHED;
 3311 
 3312                goto StartAgain;
 3313            }
 3314 
 3315        );
 3316 
 3317        
 3318        
 3319        
 3321        {
 3322            
 3323            
 3324            
 3325            
 3327 
 3328            
 3329            
 3330            
 3334 
 3335            
 3336            
 3337            
 3339            {
 3340                
 3341                
 3342                
 3344 
 3345                goto StartAgain;
 3346            }
 3347        }
 3348    }
 3349 
 3350    
 3351    
 3352    
 3354}
UINT32 CheckAddressMaximumInstructionLength(PVOID Address)
This function returns the maximum instruction length that can be read from this address.
Definition AddressCheck.c:306
unsigned short UINT16
Definition BasicTypes.h:47
char CHAR
Definition BasicTypes.h:31
unsigned long ULONG
Definition BasicTypes.h:37
@ DEBUGGER_REMOTE_PACKET_TYPE_DEBUGGEE_TO_DEBUGGER
Definition Connection.h:164
@ DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION_DEBUGGEE_PAUSED_AND_CURRENT_INSTRUCTION
Definition Connection.h:106
UINT64 VmFuncGetRflags()
Read guest's RFLAGS.
Definition Export.c:352
UINT64 VmFuncGetRip()
Read guest's RIP.
Definition Export.c:375
VOID HaltedCorePerformTargetTask(PROCESSOR_DEBUGGING_STATE *DbgState, UINT64 TargetTask, PVOID Context)
Perform the task on halted core.
Definition HaltedCore.c:45
VOID KdApplyTasksPreHaltCore(PROCESSOR_DEBUGGING_STATE *DbgState)
before halting any core, all the tasks will be applied to all cores including the main core
Definition Kd.c:517
BOOLEAN KdIsGuestOnUsermode32Bit()
determines if the guest was in 32-bit user-mode or 64-bit (long mode)
Definition Kd.c:3107
VOID KdDispatchAndPerformCommandsFromDebugger(PROCESSOR_DEBUGGING_STATE *DbgState)
This function applies commands from the debugger to the debuggee.
Definition Kd.c:2292
VOID KdApplyTasksPostContinueCore(PROCESSOR_DEBUGGING_STATE *DbgState)
before continue any core, all the tasks will be applied to all cores including the main core
Definition Kd.c:556
_Use_decl_annotations_ BOOLEAN KdResponsePacketToDebugger(DEBUGGER_REMOTE_PACKET_TYPE PacketType, DEBUGGER_REMOTE_PACKET_REQUESTED_ACTION Response, CHAR *OptionalBuffer, UINT32 OptionalBufferLength)
Sends a HyperDbg response packet to the debugger.
Definition Kd.c:294
_Use_decl_annotations_ BOOLEAN MemoryMapperReadMemorySafeOnTargetProcess(UINT64 VaAddressToRead, PVOID BufferToSaveMemory, SIZE_T SizeToRead)
Read memory safely by mapping the buffer on the target process memory (It's a wrapper)
Definition MemoryMapper.c:1120
void SpinlockLock(volatile LONG *Lock)
Tries to get the lock and won't return until successfully get the lock.
Definition Spinlock.c:52
#define ScopedSpinlock(LockObject, CodeToRun)
Definition Spinlock.h:39
if(.test_var==4)
Definition script_conditional_statement_global_var.txt:5
BOOLEAN LockAgainAfterTask
Definition State.h:139
PVOID Context
Definition State.h:141
BOOLEAN PerformHaltedTask
Definition State.h:138
UINT64 TargetTask
Definition State.h:140
The structure of pausing packet in kHyperDbg.
Definition DataTypes.h:207
UINT16 ReadInstructionLen
Definition DataTypes.h:217
UINT64 Rip
Definition DataTypes.h:208
UINT64 Rflags
Definition DataTypes.h:215
BYTE InstructionBytesOnRip[MAXIMUM_INSTR_SIZE]
Definition DataTypes.h:216
BOOLEAN IsProcessorOn32BitMode
Definition DataTypes.h:209
DEBUGGEE_PAUSING_REASON PausingReason
Definition DataTypes.h:211
UINT64 EventTag
Definition DataTypes.h:213
ULONG CurrentCore
Definition DataTypes.h:212
BOOLEAN IgnoreDisassembling
Definition DataTypes.h:210
VMM_CALLBACK_EVENT_CALLING_STAGE_TYPE EventCallingStage
Definition DataTypes.h:214
UINT64 Tag
Definition DataTypes.h:193
VMM_CALLBACK_EVENT_CALLING_STAGE_TYPE Stage
Definition DataTypes.h:195
BOOLEAN IgnoreDisasmInNextPacket
Definition State.h:171
volatile BOOLEAN MainDebuggingCore
Definition State.h:167
UINT16 InstructionLengthHint
Definition State.h:182
DEBUGGEE_HALTED_CORE_TASK HaltedCoreTask
Definition State.h:180