private://私有实现函数
NTSTATUS NTAPI PrivateDbgkpPostFakeProcessCreateMessages(
IN PEPROCESS Process,
IN PDEBUG_OBJECT DebugObject,
IN PETHREAD *pLastThread);
NTSTATUS NTAPI PrivateDbgkpPostFakeThreadMessages(
IN PEPROCESS Process,
IN PDEBUG_OBJECT DebugObject,
IN PETHREAD StartThread,
OUT PETHREAD *pFirstThread,
OUT PETHREAD *pLastThread);
NTSTATUS NTAPI PrivateDbgkpQueueMessage(
IN PEPROCESS Process,
IN PETHREAD Thread,
IN OUT PDBGKM_APIMSG ApiMsg,
IN ULONG Flags,
IN PDEBUG_OBJECT TargetDebugObject);
NTSTATUS NTAPI PrivateDbgkpPostFakeModuleMessages(
IN PEPROCESS Process,
IN PETHREAD Thread,
IN PDEBUG_OBJECT DebugObject);
NTSTATUS NTAPI PrivateDbgkpSetProcessDebugObject(
IN PEPROCESS Process,
IN PDEBUG_OBJECT DebugObject,
IN NTSTATUS MsgStatus,
IN PETHREAD LastThread);
NTSTATUS NTAPI PrivateDbgkpSendApiMessage(
IN OUT PDBGKM_APIMSG ApiMsg,
IN BOOLEAN SuspendProcess);
为了支持异常处理,异常分发 绕反调试主动异常以及支持调试器创建进程 这些函数也是必不可少的
[C++] 纯文本查看复制代码
static VOID NTAPI NewKiDispatchException(
IN PEXCEPTION_RECORD ExceptionRecord,
IN PKEXCEPTION_FRAME ExceptionFrame,
IN PKTRAP_FRAME TrapFrame,
IN KPROCESSOR_MODE PreviousMode,
IN BOOLEAN FirstChance);
static BOOLEAN NTAPI NewDbgkForwardException(
IN PEXCEPTION_RECORD ExceptionRecord,
IN BOOLEAN DebugException,
IN BOOLEAN SecondChance);
static VOID NTAPI NewDbgkCreateThread(PVOID StartAddress);
static VOID NTAPI NewDbgkMapViewOfSection(
IN PVOID SectionObject,
IN PVOID BaseAddress,
IN ULONG SectionOffset,
IN ULONG_PTR ViewSize);
static VOID NTAPI NewDbgkUnMapViewOfSection(IN PVOID BaseAddress);
/*static NTSTATUS NTAPI NewPspCreateProcess(
OUT PHANDLE ProcessHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN HANDLE ParentProcess OPTIONAL,
IN ULONG Flags,
IN HANDLE SectionHandle OPTIONAL,
IN HANDLE DebugPort OPTIONAL,
IN HANDLE ExceptionPort OPTIONAL,
IN ULONG JobMemberLevel);*/
static NTSTATUS NTAPI NewNtCreateUserProcess(
PHANDLE ProcessHandle,
PETHREAD ThreadHandle,
ACCESS_MASK ProcessDesiredAccess,
ACCESS_MASK ThreadDesiredAccess,
_OBJECT_ATTRIBUTES *ProcessObjectAttributes,
_OBJECT_ATTRIBUTES *ThreadObjectAttributes,
ULONG ProcessFlags,
ULONG ThreadFlags,
_RTL_USER_PROCESS_PARAMETERS *ProcessParameters,
void *CreateInfo,
void *AttributeList);