Skip to content

Commit 0589c17

Browse files
hpoussinHBelusca
authored andcommitted
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadControlSpace/SysDbgWriteControlSpace
1 parent 42e038f commit 0589c17

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

ntoskrnl/kd64/kdapi.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,7 +2365,63 @@ KdSystemDebugControl(
23652365
break;
23662366

23672367
case SysDbgReadControlSpace:
2368+
if (InputBufferLength != sizeof(SYSDBG_CONTROL_SPACE))
2369+
{
2370+
Status = STATUS_INFO_LENGTH_MISMATCH;
2371+
}
2372+
else
2373+
{
2374+
SYSDBG_CONTROL_SPACE Request = *(PSYSDBG_CONTROL_SPACE)InputBuffer;
2375+
PVOID LockedBuffer;
2376+
PMDL LockVariable;
2377+
2378+
Status = ExLockUserBuffer(Request.Buffer,
2379+
Request.Request,
2380+
PreviousMode,
2381+
IoWriteAccess,
2382+
&LockedBuffer,
2383+
&LockVariable);
2384+
if (NT_SUCCESS(Status))
2385+
{
2386+
Status = KdpSysReadControlSpace(Request.Processor,
2387+
Request.Address,
2388+
LockedBuffer,
2389+
Request.Request,
2390+
&Length);
2391+
ExUnlockUserBuffer(LockVariable);
2392+
}
2393+
}
2394+
break;
2395+
23682396
case SysDbgWriteControlSpace:
2397+
if (InputBufferLength != sizeof(SYSDBG_CONTROL_SPACE))
2398+
{
2399+
Status = STATUS_INFO_LENGTH_MISMATCH;
2400+
}
2401+
else
2402+
{
2403+
SYSDBG_CONTROL_SPACE Request = *(PSYSDBG_CONTROL_SPACE)InputBuffer;
2404+
PVOID LockedBuffer;
2405+
PMDL LockVariable;
2406+
2407+
Status = ExLockUserBuffer(Request.Buffer,
2408+
Request.Request,
2409+
PreviousMode,
2410+
IoReadAccess,
2411+
&LockedBuffer,
2412+
&LockVariable);
2413+
if (NT_SUCCESS(Status))
2414+
{
2415+
Status = KdpSysWriteControlSpace(Request.Processor,
2416+
Request.Address,
2417+
LockedBuffer,
2418+
Request.Request,
2419+
&Length);
2420+
ExUnlockUserBuffer(LockVariable);
2421+
}
2422+
}
2423+
break;
2424+
23692425
case SysDbgReadIoSpace:
23702426
case SysDbgWriteIoSpace:
23712427
case SysDbgReadMsr:

0 commit comments

Comments
 (0)