ReactOS 0.4.15-dev-7788-g1ad9096
kdio.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/kd/kdio.c
5 * PURPOSE: NT Kernel Debugger Input/Output Functions
6 *
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
8 */
9
10/* INCLUDES ******************************************************************/
11
12#include <ntoskrnl.h>
13#include <reactos/buildno.h>
14#include "kd.h"
15#include "kdterminal.h"
16#ifdef KDBG
17#include "../kdbg/kdb.h"
18#endif
19
20#define NDEBUG
21#include <debug.h>
22
23#undef KdSendPacket
24#undef KdReceivePacket
25
26/* GLOBALS *******************************************************************/
27
28#define KdpBufferSize (1024 * 512)
31static volatile ULONG KdpCurrentPosition = 0;
32static volatile ULONG KdpFreeBytes = 0;
36ANSI_STRING KdpLogFileName = RTL_CONSTANT_STRING("\\SystemRoot\\debug.log");
37
41
42#define KdpScreenLineLengthDefault 80
45
49
51{
55#ifdef KDBG // See kdb_cli.c
56 KdpKdbgInit
57#endif
58};
59
60/* LOCKING FUNCTIONS *********************************************************/
61
66{
68
69 /* Acquire the spinlock without waiting at raised IRQL */
70 while (TRUE)
71 {
72 /* Loop until the spinlock becomes available */
73 while (!KeTestSpinLock(SpinLock));
74
75 /* Spinlock is free, raise IRQL to high level */
77
78 /* Try to get the spinlock */
80 break;
81
82 /* Someone else got the spinlock, lower IRQL back */
84 }
85
86 return OldIrql;
87}
88
89VOID
94{
95 /* Release the spinlock */
97 // KeReleaseSpinLockFromDpcLevel(SpinLock);
98
99 /* Restore the old IRQL */
101}
102
103/* FILE DEBUG LOG FUNCTIONS **************************************************/
104
105static VOID
106NTAPI
108{
109 ULONG beg, end, num;
111
113
115
116 while (TRUE)
117 {
119
120 /* Bug */
121 /* Keep KdpCurrentPosition and KdpFreeBytes values in local
122 * variables to avoid their possible change from Producer part,
123 * KdpPrintToLogFile function
124 */
127
128 /* Now securely calculate values, based on local variables */
129 beg = (end + num) % KdpBufferSize;
131
132 /* Nothing to do? */
133 if (num == 0)
134 continue;
135
136 if (end > beg)
137 {
139 KdpDebugBuffer + beg, num, NULL, NULL);
140 }
141 else
142 {
144 KdpDebugBuffer + beg, KdpBufferSize - beg, NULL, NULL);
145
148 }
149
151 }
152}
153
154static VOID
155NTAPI
159{
161 ULONG beg, end, num;
162
163 if (KdpDebugBuffer == NULL) return;
164
165 /* Acquire the printing spinlock without waiting at raised IRQL */
167
168 beg = KdpCurrentPosition;
170 if (num != 0)
171 {
172 end = (beg + num) % KdpBufferSize;
174 KdpFreeBytes -= num;
175
176 if (end > beg)
177 {
179 }
180 else
181 {
184 }
185 }
186
187 /* Release the spinlock */
189
190 /* Signal the logger thread */
193}
194
196NTAPI
199 _In_ ULONG BootPhase)
200{
202
203 if (!KdpDebugMode.File)
205
206 if (BootPhase == 0)
207 {
208 /* Write out the functions that we support for now */
209 DispatchTable->KdpPrintRoutine = KdpPrintToLogFile;
210
211 /* Register for BootPhase 1 initialization and as a Provider */
212 DispatchTable->KdpInitRoutine = KdpDebugLogInit;
213 InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
214 }
215 else if (BootPhase == 1)
216 {
217 /* Allocate a buffer for debug log */
218 KdpDebugBuffer = ExAllocatePoolZero(NonPagedPool,
220 TAG_KDBG);
221 if (!KdpDebugBuffer)
222 {
224 RemoveEntryList(&DispatchTable->KdProvidersList);
225 return STATUS_NO_MEMORY;
226 }
228
229 /* Initialize spinlock */
231
232 /* Register for later BootPhase 2 reinitialization */
233 DispatchTable->KdpInitRoutine = KdpDebugLogInit;
234
235 /* Announce ourselves */
236 HalDisplayString(" File log debugging enabled\r\n");
237 }
238 else if (BootPhase >= 2)
239 {
243 HANDLE ThreadHandle;
245
246 /* If we have already successfully opened the log file, bail out */
247 if (KdpLogFileHandle != NULL)
248 return STATUS_SUCCESS;
249
250 /* Setup the log name */
252 if (!NT_SUCCESS(Status))
253 goto Failure;
254
256 &FileName,
258 NULL,
259 NULL);
260
261 /* Create the log file */
262 Status = ZwCreateFile(&KdpLogFileHandle,
265 &Iosb,
266 NULL,
272 NULL,
273 0);
274
276
277 if (!NT_SUCCESS(Status))
278 {
279 DPRINT1("Failed to open log file: 0x%08lx\n", Status);
280
281 /* Schedule an I/O reinitialization if needed */
284 {
285 DispatchTable->KdpInitRoutine = KdpDebugLogInit;
286 return Status;
287 }
288 goto Failure;
289 }
290
294 {
296 FILE_POSITION_INFORMATION FilePosInfo;
297
298 Status = ZwQueryInformationFile(KdpLogFileHandle,
299 &Iosb,
300 &FileInfo,
301 sizeof(FileInfo),
303 DPRINT("Status: 0x%08lx - EOF offset: %I64d\n",
304 Status, FileInfo.EndOfFile.QuadPart);
305
306 Status = ZwQueryInformationFile(KdpLogFileHandle,
307 &Iosb,
308 &FilePosInfo,
309 sizeof(FilePosInfo),
311 DPRINT("Status: 0x%08lx - Position: %I64d\n",
312 Status, FilePosInfo.CurrentByteOffset.QuadPart);
313
314 FilePosInfo.CurrentByteOffset.QuadPart = FileInfo.EndOfFile.QuadPart;
315 Status = ZwSetInformationFile(KdpLogFileHandle,
316 &Iosb,
317 &FilePosInfo,
318 sizeof(FilePosInfo),
320 DPRINT("ZwSetInformationFile(FilePositionInfo) returned: 0x%08lx\n", Status);
321 }
325
326 /* Create the logger thread */
327 Status = PsCreateSystemThread(&ThreadHandle,
329 NULL,
330 NULL,
331 NULL,
333 NULL);
334 if (!NT_SUCCESS(Status))
335 {
336 DPRINT1("Failed to create log file thread: 0x%08lx\n", Status);
338 goto Failure;
339 }
340
342 ZwSetInformationThread(ThreadHandle,
344 &Priority,
345 sizeof(Priority));
346
347 ZwClose(ThreadHandle);
348 return Status;
349
350Failure:
351 KdpFreeBytes = 0;
355 RemoveEntryList(&DispatchTable->KdProvidersList);
356 }
357
358 return Status;
359}
360
361/* SERIAL FUNCTIONS **********************************************************/
362
363static VOID
364NTAPI
368{
369 PCCH pch = String;
371
372 /* Acquire the printing spinlock without waiting at raised IRQL */
374
375 /* Output the string */
376 while (pch < String + Length && *pch)
377 {
378 if (*pch == '\n')
379 {
381 }
383 ++pch;
384 }
385
386 /* Release the spinlock */
388}
389
391NTAPI
394 _In_ ULONG BootPhase)
395{
396 if (!KdpDebugMode.Serial)
398
399 if (BootPhase == 0)
400 {
401 /* Write out the functions that we support for now */
402 DispatchTable->KdpPrintRoutine = KdpSerialPrint;
403
404 /* Initialize the Port */
406 {
409 }
411
412 /* Initialize spinlock */
414
415 /* Register for BootPhase 1 initialization and as a Provider */
416 DispatchTable->KdpInitRoutine = KdpSerialInit;
417 InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
418 }
419 else if (BootPhase == 1)
420 {
421 /* Announce ourselves */
422 HalDisplayString(" Serial debugging enabled\r\n");
423 }
424
425 return STATUS_SUCCESS;
426}
427
428/* SCREEN FUNCTIONS **********************************************************/
429
430VOID
432{
433 if (InbvIsBootDriverInstalled() /* &&
434 !InbvCheckDisplayOwnership() */)
435 {
436 /* Acquire ownership and reset the display */
444 }
445}
446
447// extern VOID NTAPI InbvSetDisplayOwnership(IN BOOLEAN DisplayOwned);
448
449VOID
451{
454 {
455 /* Release the display */
456 // InbvSetDisplayOwnership(FALSE);
458 }
459}
460
461static VOID
462NTAPI
466{
467 PCCH pch = String;
468
469 while (pch < String + Length && *pch)
470 {
471 if (*pch == '\b')
472 {
473 /* HalDisplayString does not support '\b'. Workaround it and use '\r' */
474 if (KdpScreenLineLength > 0)
475 {
476 /* Remove last character from buffer */
479
480 /* Clear row and print line again */
481 HalDisplayString("\r");
483 }
484 }
485 else
486 {
489 }
490
492 {
493 /* Print buffered characters */
496
497 /* Clear line buffer */
498 KdpScreenLineBuffer[0] = '\0';
500 }
501
502 ++pch;
503 }
504
505 /* Print buffered characters */
507 {
510 }
511}
512
514NTAPI
517 _In_ ULONG BootPhase)
518{
519 if (!KdpDebugMode.Screen)
521
522 if (BootPhase == 0)
523 {
524 /* Write out the functions that we support for now */
525 DispatchTable->KdpPrintRoutine = KdpScreenPrint;
526
527 /* Register for BootPhase 1 initialization and as a Provider */
528 DispatchTable->KdpInitRoutine = KdpScreenInit;
529 InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
530 }
531 else if (BootPhase == 1)
532 {
533 /* Take control of the display */
535
536 /* Announce ourselves */
537 HalDisplayString(" Screen debugging enabled\r\n");
538 }
539
540 return STATUS_SUCCESS;
541}
542
543
544/* GENERAL FUNCTIONS *********************************************************/
545
546static VOID
550{
551 PLIST_ENTRY CurrentEntry;
552 PKD_DISPATCH_TABLE CurrentTable;
553
554 /* Call the registered providers */
555 for (CurrentEntry = KdProviders.Flink;
556 CurrentEntry != &KdProviders;
557 CurrentEntry = CurrentEntry->Flink)
558 {
559 CurrentTable = CONTAINING_RECORD(CurrentEntry,
561 KdProvidersList);
562
563 CurrentTable->KdpPrintRoutine(String, Length);
564 }
565}
566
567VOID
570{
572}
573
574VOID
578 ...)
579{
580 va_list ap;
582 CHAR Buffer[512];
583
584 /* Format the string */
587 sizeof(Buffer),
588 Format,
589 ap);
590 va_end(ap);
591
592 /* Send it to the display providers */
594}
595
596#ifdef KDBG
597extern const CSTRING KdbPromptStr;
598#endif
599
600VOID
601NTAPI
603 _In_ ULONG PacketType,
604 _In_ PSTRING MessageHeader,
605 _In_opt_ PSTRING MessageData,
607{
608 PDBGKD_DEBUG_IO DebugIo;
609
610 if (PacketType != PACKET_TYPE_KD_DEBUG_IO)
611 {
612 KdIoPrintf("%s: PacketType %d is UNIMPLEMENTED\n", __FUNCTION__, PacketType);
613 return;
614 }
615
616 DebugIo = (PDBGKD_DEBUG_IO)MessageHeader->Buffer;
617
618 /* Validate API call */
619 if (MessageHeader->Length != sizeof(DBGKD_DEBUG_IO))
620 return;
621 if ((DebugIo->ApiNumber != DbgKdPrintStringApi) &&
622 (DebugIo->ApiNumber != DbgKdGetStringApi))
623 {
624 return;
625 }
626 if (!MessageData)
627 return;
628
629 /* NOTE: MessageData->Length should be equal to
630 * DebugIo.u.PrintString.LengthOfString, or to
631 * DebugIo.u.GetString.LengthOfPromptString */
632
633 if (!KdpDebugMode.Value)
634 return;
635
636 /* Print the string proper */
637 KdIoPrintString(MessageData->Buffer, MessageData->Length);
638}
639
641NTAPI
643 _In_ ULONG PacketType,
644 _Out_ PSTRING MessageHeader,
645 _Out_ PSTRING MessageData,
648{
649#ifdef KDBG
650 PDBGKD_DEBUG_IO DebugIo;
651 STRING ResponseString;
652 CHAR MessageBuffer[512];
653#endif
654
655 if (PacketType != PACKET_TYPE_KD_DEBUG_IO)
656 {
657 KdIoPrintf("%s: PacketType %d is UNIMPLEMENTED\n", __FUNCTION__, PacketType);
658 return KdPacketTimedOut;
659 }
660
661#ifdef KDBG
662 DebugIo = (PDBGKD_DEBUG_IO)MessageHeader->Buffer;
663
664 /* Validate API call */
665 if (MessageHeader->MaximumLength != sizeof(DBGKD_DEBUG_IO))
666 return KdPacketNeedsResend;
667 if (DebugIo->ApiNumber != DbgKdGetStringApi)
668 return KdPacketNeedsResend;
669
670 /* NOTE: We cannot use directly MessageData->Buffer here as it points
671 * to the temporary KdpMessageBuffer scratch buffer that is being
672 * shared with all the possible I/O KD operations that may happen. */
673 ResponseString.Buffer = MessageBuffer;
674 ResponseString.Length = 0;
675 ResponseString.MaximumLength = min(sizeof(MessageBuffer),
676 MessageData->MaximumLength);
677 ResponseString.MaximumLength = min(ResponseString.MaximumLength,
679
680 /* The prompt string has been printed by KdSendPacket; go to
681 * new line and print the kdb prompt -- for SYSREG2 support. */
682 KdIoPrintString("\n", 1);
683 KdIoPuts(KdbPromptStr.Buffer); // Alternatively, use "Input> "
684
687
688 /*
689 * Read a NULL-terminated line of user input and retrieve its length.
690 * Official documentation states that DbgPrompt() includes a terminating
691 * newline character but does not NULL-terminate. However, experiments
692 * show that this behaviour is left at the discretion of WinDbg itself.
693 * WinDbg NULL-terminates the string unless its buffer is too short,
694 * in which case the string is simply truncated without NULL-termination.
695 */
696 ResponseString.Length =
697 (USHORT)KdIoReadLine(ResponseString.Buffer,
698 ResponseString.MaximumLength);
699
702
703 /* Adjust and return the string length */
704 *DataLength = min(ResponseString.Length + sizeof(ANSI_NULL),
706 MessageData->Length = DebugIo->u.GetString.LengthOfStringRead = *DataLength;
707
708 /* Only now we can copy back the data into MessageData->Buffer */
709 RtlCopyMemory(MessageData->Buffer, ResponseString.Buffer, *DataLength);
710#endif
711
712 return KdPacketReceived;
713}
714
715/* EOF */
unsigned char BOOLEAN
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define __cdecl
Definition: accygwin.h:79
#define VOID
Definition: acefi.h:82
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define DPRINT1
Definition: precomp.h:8
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
Definition: bufpool.h:45
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
@ ThreadPriority
Definition: compat.h:937
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
LONG KPRIORITY
Definition: compat.h:803
#define FILE_SHARE_READ
Definition: compat.h:136
#define __FUNCTION__
Definition: types.h:116
return Iosb
Definition: create.c:4402
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
KSPIN_LOCK * PKSPIN_LOCK
Definition: env_spec_w32.h:73
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define NonPagedPool
Definition: env_spec_w32.h:307
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define ExGetPreviousMode
Definition: ex.h:140
#define InterlockedExchangeAddUL(Addend, Value)
Definition: ex.h:1533
struct _FileName FileName
Definition: fatprocs.h:896
std::wstring STRING
Definition: fontsub.cpp:33
@ FilePositionInformation
Definition: from_kernel.h:75
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define FILE_WRITE_THROUGH
Definition: from_kernel.h:26
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_SEQUENTIAL_ONLY
Definition: from_kernel.h:27
Status
Definition: gdiplustypes.h:25
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint num
Definition: glext.h:9618
PUCHAR KdComPortInUse
Definition: usage.c:17
NTHALAPI VOID NTAPI HalDisplayString(PUCHAR String)
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:289
VOID NTAPI InbvInstallDisplayStringFilter(_In_ INBV_DISPLAY_STRING_FILTER DisplayFilter)
Definition: inbv.c:386
VOID NTAPI InbvNotifyDisplayOwnershipLost(_In_ INBV_RESET_DISPLAY_PARAMETERS Callback)
Definition: inbv.c:403
BOOLEAN NTAPI InbvCheckDisplayOwnership(VOID)
Definition: inbv.c:315
VOID NTAPI InbvSetTextColor(_In_ ULONG Color)
Definition: inbv.c:459
BOOLEAN NTAPI InbvEnableDisplayString(_In_ BOOLEAN Enable)
Definition: inbv.c:369
BOOLEAN NTAPI InbvResetDisplay(VOID)
Definition: inbv.c:430
VOID NTAPI InbvSetScrollRegion(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom)
Definition: inbv.c:447
VOID NTAPI InbvSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ ULONG Color)
Definition: inbv.c:484
BOOLEAN NTAPI InbvIsBootDriverInstalled(VOID)
Definition: inbv.c:395
BOOLEAN NTAPI KdPortInitializeEx(PCPPORT PortInformation, ULONG ComPortNumber)
VOID NTAPI KdPortPutByteEx(PCPPORT PortInformation, UCHAR ByteToSend)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define HIGH_PRIORITY
SIZE_T KdIoReadLine(_Out_ PCHAR Buffer, _In_ SIZE_T Size)
Reads a line of user input from the terminal.
Definition: kdprompt.c:51
#define KdMax
Definition: kd.h:90
NTSTATUS(NTAPI * PKDP_INIT_ROUTINE)(_In_ struct _KD_DISPATCH_TABLE *DispatchTable, _In_ ULONG BootPhase)
Definition: kd.h:9
const CSTRING KdbPromptStr
Definition: kdb_cli.c:148
#define DEFAULT_DEBUG_PORT
Definition: kdcom.c:25
#define DEFAULT_DEBUG_BAUD_RATE
Definition: kdcom.c:28
static VOID NTAPI KdpLoggerThread(PVOID Context)
Definition: kdio.c:107
static volatile ULONG KdpFreeBytes
Definition: kdio.c:32
ULONG SerialPortNumber
Definition: kdio.c:39
VOID __cdecl KdIoPrintf(_In_ PCSTR Format,...)
Definition: kdio.c:576
NTSTATUS NTAPI KdpSerialInit(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Definition: kdio.c:392
static HANDLE KdpLogFileHandle
Definition: kdio.c:35
VOID NTAPI KdbpReleaseLock(_In_ PKSPIN_LOCK SpinLock, _In_ KIRQL OldIrql)
Definition: kdio.c:91
LIST_ENTRY KdProviders
Definition: kdio.c:47
static ULONG KdpScreenLineBufferPos
Definition: kdio.c:44
VOID NTAPI KdSendPacket(_In_ ULONG PacketType, _In_ PSTRING MessageHeader, _In_opt_ PSTRING MessageData, _Inout_ PKD_CONTEXT Context)
Definition: kdio.c:602
KDP_DEBUG_MODE KdpDebugMode
Definition: kdio.c:46
#define KdpBufferSize
Definition: kdio.c:28
KDSTATUS NTAPI KdReceivePacket(_In_ ULONG PacketType, _Out_ PSTRING MessageHeader, _Out_ PSTRING MessageData, _Out_ PULONG DataLength, _Inout_ PKD_CONTEXT Context)
Definition: kdio.c:642
VOID KdpScreenRelease(VOID)
Definition: kdio.c:450
KIRQL NTAPI KdbpAcquireLock(_In_ PKSPIN_LOCK SpinLock)
Definition: kdio.c:64
static PCHAR KdpDebugBuffer
Definition: kdio.c:30
static CHAR KdpScreenLineBuffer[KdpScreenLineLengthDefault+1]
Definition: kdio.c:43
static VOID KdIoPrintString(_In_ PCCH String, _In_ ULONG Length)
Definition: kdio.c:547
PKDP_INIT_ROUTINE InitRoutines[KdMax]
Definition: kdio.c:50
static KSPIN_LOCK KdpSerialSpinLock
Definition: kdio.c:38
NTSTATUS NTAPI KdpScreenInit(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Definition: kdio.c:515
NTSTATUS NTAPI KdpDebugLogInit(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Definition: kdio.c:197
static KSPIN_LOCK KdpDebugLogSpinLock
Definition: kdio.c:33
static KEVENT KdpLoggerThreadEvent
Definition: kdio.c:34
static ULONG KdpScreenLineLength
Definition: kdio.c:44
VOID KdpScreenAcquire(VOID)
Definition: kdio.c:431
ANSI_STRING KdpLogFileName
Definition: kdio.c:36
static BOOLEAN KdpLoggingEnabled
Definition: kdio.c:29
CPPORT SerialPortInfo
Definition: kdio.c:40
static VOID NTAPI KdpScreenPrint(_In_ PCCH String, _In_ ULONG Length)
Definition: kdio.c:463
VOID KdIoPuts(_In_ PCSTR String)
Definition: kdio.c:568
static VOID NTAPI KdpPrintToLogFile(_In_ PCCH String, _In_ ULONG Length)
Definition: kdio.c:156
static volatile ULONG KdpCurrentPosition
Definition: kdio.c:31
static VOID NTAPI KdpSerialPrint(_In_ PCCH String, _In_ ULONG Length)
Definition: kdio.c:365
#define KdpScreenLineLengthDefault
Definition: kdio.c:42
VOID KbdDisableMouse(VOID)
Definition: kdps2kbd.c:98
VOID KbdEnableMouse(VOID)
Definition: kdps2kbd.c:93
ULONG KdbDebugState
Definition: kdterminal.c:32
@ KD_DEBUG_KDSERIAL
Definition: kdterminal.h:36
if(dx< 0)
Definition: linetemp.h:194
#define pch(ap)
Definition: match.c:418
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define min(a, b)
Definition: monoChain.cc:55
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define KernelMode
Definition: asm.h:34
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FILE_APPEND_DATA
Definition: nt_native.h:634
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define ANSI_NULL
CONST CHAR * PCCH
Definition: ntbasedef.h:392
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ SynchronizationEvent
BOOLEAN FASTCALL KeTestSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:475
BOOLEAN FASTCALL KeTryToAcquireSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK SpinLock)
Definition: spinlock.c:309
VOID FASTCALL KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:298
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_PORT_DISCONNECTED
Definition: ntstatus.h:291
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define SCREEN_WIDTH
Definition: pc98video.c:27
#define SCREEN_HEIGHT
Definition: pc98video.c:28
unsigned short USHORT
Definition: pedump.c:61
#define FileStandardInformation
Definition: propsheet.cpp:61
#define BV_COLOR_WHITE
Definition: display.h:30
#define BV_COLOR_BLACK
Definition: display.h:15
#define KdPacketReceived
Definition: kddll.h:5
#define KdPacketNeedsResend
Definition: kddll.h:7
ULONG KDSTATUS
Definition: kddll.h:4
#define KdPacketTimedOut
Definition: kddll.h:6
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
PUCHAR Address
Definition: cportlib.h:29
CONST CHAR * Buffer
Definition: umtypes.h:159
union _DBGKD_DEBUG_IO::@3541 u
DBGKD_GET_STRING GetString
Definition: windbgkd.h:427
ULONG ApiNumber
Definition: windbgkd.h:421
ULONG LengthOfStringRead
Definition: windbgkd.h:413
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
UCHAR File
Definition: kd.h:102
UCHAR Screen
Definition: kd.h:100
UCHAR Serial
Definition: kd.h:101
ULONG Value
Definition: kd.h:106
PKDP_PRINT_ROUTINE KdpPrintRoutine
Definition: kd.h:115
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define TAG_KDBG
Definition: tag.h:38
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:248
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228
#define DbgKdPrintStringApi
Definition: windbgkd.h:122
#define DbgKdGetStringApi
Definition: windbgkd.h:123
struct _DBGKD_DEBUG_IO * PDBGKD_DEBUG_IO
#define PACKET_TYPE_KD_DEBUG_IO
Definition: windbgkd.h:44
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
#define IO_NO_INCREMENT
Definition: iotypes.h:598
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ Executive
Definition: ketypes.h:415
#define _vsnprintf
Definition: xmlstorage.h:202
char CHAR
Definition: xmlstorage.h:175