ntdll: Return STATUS_DEBUGGER_INACTIVE from NtSystemDebugControl() stub.

This commit is contained in:
Paul Gofman 2024-01-08 17:54:30 -06:00 committed by Alexandre Julliard
parent 9dc1ddf801
commit 7bd070ae86
4 changed files with 71 additions and 3 deletions

View file

@ -46,6 +46,7 @@ static NTSTATUS (WINAPI * pNtSetInformationDebugObject)(HANDLE,DEBUGOBJECTINFOCL
static NTSTATUS (WINAPI * pDbgUiConvertStateChangeStructure)(DBGUI_WAIT_STATE_CHANGE*,DEBUG_EVENT*);
static HANDLE (WINAPI * pDbgUiGetThreadDebugObject)(void);
static void (WINAPI * pDbgUiSetThreadDebugObject)(HANDLE);
static NTSTATUS (WINAPI * pNtSystemDebugControl)(SYSDBG_COMMAND,PVOID,ULONG,PVOID,ULONG,PULONG);
static BOOL is_wow64;
static BOOL old_wow64;
@ -101,6 +102,7 @@ static void InitFunctionPtrs(void)
NTDLL_GET_PROC(DbgUiConvertStateChangeStructure);
NTDLL_GET_PROC(DbgUiGetThreadDebugObject);
NTDLL_GET_PROC(DbgUiSetThreadDebugObject);
NTDLL_GET_PROC(NtSystemDebugControl);
if (!IsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
@ -3735,6 +3737,27 @@ static void test_ThreadIsTerminated(void)
ok( status == STATUS_INVALID_HANDLE, "got %#lx.\n", status );
}
static void test_system_debug_control(void)
{
NTSTATUS status;
int class;
for (class = 0; class < SysDbgMaxInfoClass; ++class)
{
status = pNtSystemDebugControl( class, NULL, 0, NULL, 0, NULL );
if (is_wow64)
{
/* Most of the calls return STATUS_NOT_IMPLEMENTED on wow64. */
ok( status == STATUS_DEBUGGER_INACTIVE || status == STATUS_NOT_IMPLEMENTED || status == STATUS_INFO_LENGTH_MISMATCH,
"class %d, got %#lx.\n", class, status );
}
else
{
ok( status == STATUS_DEBUGGER_INACTIVE || status == STATUS_ACCESS_DENIED, "class %d, got %#lx.\n", class, status );
}
}
}
START_TEST(info)
{
char **argv;
@ -3810,4 +3833,5 @@ START_TEST(info)
test_ThreadEnableAlignmentFaultFixup();
test_process_instrumentation_callback();
test_system_debug_control();
}

View file

@ -3461,7 +3461,8 @@ NTSTATUS WINAPI NtSystemDebugControl( SYSDBG_COMMAND command, void *in_buff, ULO
{
FIXME( "(%d, %p, %d, %p, %d, %p), stub\n",
command, in_buff, (int)in_len, out_buff, (int)out_len, retlen );
return STATUS_NOT_IMPLEMENTED;
return STATUS_DEBUGGER_INACTIVE;
}

View file

@ -755,7 +755,30 @@ NTSTATUS WINAPI wow64_NtSystemDebugControl( UINT *args )
ULONG out_len = get_ulong( &args );
ULONG *retlen = get_ptr( &args );
return NtSystemDebugControl( command, in_buf, in_len, out_buf, out_len, retlen );
switch (command)
{
case SysDbgBreakPoint:
case SysDbgEnableKernelDebugger:
case SysDbgDisableKernelDebugger:
case SysDbgGetAutoKdEnable:
case SysDbgSetAutoKdEnable:
case SysDbgGetPrintBufferSize:
case SysDbgSetPrintBufferSize:
case SysDbgGetKdUmExceptionEnable:
case SysDbgSetKdUmExceptionEnable:
case SysDbgGetTriageDump:
case SysDbgGetKdBlockEnable:
case SysDbgSetKdBlockEnable:
case SysDbgRegisterForUmBreakInfo:
case SysDbgGetUmBreakPid:
case SysDbgClearUmBreakPid:
case SysDbgGetUmAttachPid:
case SysDbgClearUmAttachPid:
return NtSystemDebugControl( command, in_buf, in_len, out_buf, out_len, retlen );
default:
return STATUS_NOT_IMPLEMENTED; /* not implemented on Windows either */
}
}

View file

@ -3603,7 +3603,27 @@ typedef enum _SYSDBG_COMMAND {
SysDbgReadMsr,
SysDbgWriteMsr,
SysDbgReadBusData,
SysDbgWriteBusData
SysDbgWriteBusData,
SysDbgCheckLowMemory,
SysDbgEnableKernelDebugger,
SysDbgDisableKernelDebugger,
SysDbgGetAutoKdEnable,
SysDbgSetAutoKdEnable,
SysDbgGetPrintBufferSize,
SysDbgSetPrintBufferSize,
SysDbgGetKdUmExceptionEnable,
SysDbgSetKdUmExceptionEnable,
SysDbgGetTriageDump,
SysDbgGetKdBlockEnable,
SysDbgSetKdBlockEnable,
SysDbgRegisterForUmBreakInfo,
SysDbgGetUmBreakPid,
SysDbgClearUmBreakPid,
SysDbgGetUmAttachPid,
SysDbgClearUmAttachPid,
SysDbgGetLiveKernelDump,
SysDbgKdPullRemoteFile,
SysDbgMaxInfoClass
} SYSDBG_COMMAND, *PSYSDBG_COMMAND;
typedef struct _CPTABLEINFO