From: Paul Gofman pgofman@codeweavers.com
--- dlls/ntdll/tests/info.c | 24 ++++++++++++++++++++++++ dlls/ntdll/unix/system.c | 5 ++++- include/winternl.h | 14 +++++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 68a9f165bfd..4118aae5e91 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -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 <= SysDbgSetKdBlockEnable; ++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(); } diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 879a5893758..f669b8d5a58 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -3461,7 +3461,10 @@ 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; + + if (is_wow64()) return STATUS_NOT_IMPLEMENTED; + + return STATUS_DEBUGGER_INACTIVE; }
diff --git a/include/winternl.h b/include/winternl.h index 40feadfb22f..6d4218effee 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3601,7 +3601,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