Skip to content

Commit

Permalink
ntdll: Return STATUS_DEBUGGER_INACTIVE from NtSystemDebugControl() stub.
Browse files Browse the repository at this point in the history
CW-Bug-Id: #23198
  • Loading branch information
Paul Gofman committed Jan 9, 2024
1 parent 57bb537 commit ed44de9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
15 changes: 15 additions & 0 deletions dlls/ntdll/tests/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,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;

Expand Down Expand Up @@ -101,6 +102,7 @@ static void InitFunctionPtrs(void)
NTDLL_GET_PROC(DbgUiConvertStateChangeStructure);
NTDLL_GET_PROC(DbgUiGetThreadDebugObject);
NTDLL_GET_PROC(DbgUiSetThreadDebugObject);
NTDLL_GET_PROC(NtSystemDebugControl);

pIsWow64Process = (void *)GetProcAddress(hkernel32, "IsWow64Process");
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
Expand Down Expand Up @@ -3601,6 +3603,18 @@ static void test_debuggee_dbgport(int argc, char **argv)
winetest_pop_context();
}

static void test_system_debug_control(void)
{
NTSTATUS status;
int class;

for (class = 0; class <= SysDbgSetKdBlockEnable; ++class)
{
status = pNtSystemDebugControl( class, NULL, 0, NULL, 0, NULL );
ok( status == STATUS_DEBUGGER_INACTIVE || status == STATUS_ACCESS_DENIED, "class %d, got %#lx.\n", class, status );
}
}

START_TEST(info)
{
char **argv;
Expand Down Expand Up @@ -3675,4 +3689,5 @@ START_TEST(info)

test_ThreadEnableAlignmentFaultFixup();
test_process_instrumentation_callback();
test_system_debug_control();
}
2 changes: 1 addition & 1 deletion dlls/ntdll/unix/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -3509,7 +3509,7 @@ 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;
}


Expand Down
14 changes: 13 additions & 1 deletion include/winternl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3299,7 +3299,19 @@ typedef enum _SYSDBG_COMMAND {
SysDbgReadMsr,
SysDbgWriteMsr,
SysDbgReadBusData,
SysDbgWriteBusData
SysDbgWriteBusData,
SysDbgCheckLowMemory,
SysDbgEnableKernelDebugger,
SysDbgDisableKernelDebugger,
SysDbgGetAutoKdEnable,
SysDbgSetAutoKdEnable,
SysDbgGetPrintBufferSize,
SysDbgSetPrintBufferSize,
SysDbgGetKdUmExceptionEnable,
SysDbgSetKdUmExceptionEnable,
SysDbgGetTriageDump,
SysDbgGetKdBlockEnable,
SysDbgSetKdBlockEnable,
} SYSDBG_COMMAND, *PSYSDBG_COMMAND;

typedef struct _CPTABLEINFO
Expand Down

0 comments on commit ed44de9

Please sign in to comment.