ReactOS 0.4.15-dev-7897-g78dc504
kdvm.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: GPL, see COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: drivers/base/kdvm/kdvm.c
5 * PURPOSE: VM independent function for kdvbox/kd
6 * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
7 */
8
9#include "kdvm.h"
10
11static CHAR KdVmCmdMagic[] = "~kdVMvA ";
12static CHAR KdVmReplyMagic[] = "++kdVMvA ";
13static const UCHAR KDVM_CMD_TestConnection = 't';
14static const UCHAR KDVM_CMD_ReceivePacket = 'r';
15static const UCHAR KDVM_CMD_SendPacket = 's';
16static const UCHAR KDVM_CMD_VersionReport = 'v';
17
21
23
24
25/* PRIVATE FUNCTIONS **********************************************************/
26
27static
28VOID
32{
33 ULONG i;
34 for (i = 0;i < Size; i++)
35 {
36 KdpDbgPrint("%02x ", Buffer[i]);
37 }
38 KdpDbgPrint("\n");
39}
40
41VOID
46{
47 PUCHAR CurrentRow;
48 ULONG i;
49
50 CurrentRow = Buffer;
51 for (i = 0; i < (Size / 16); i++)
52 {
53 KdVmDbgDumpRow(CurrentRow, 16);
54 CurrentRow += 16;
55 }
56 KdVmDbgDumpRow(CurrentRow, (Size % 16));
57}
58
59static
64{
67 {
68 KDDBGPRINT("KdVmAddToBuffer: Buffer overflow! Need %lu, remaining: %lu\n",
70 return FALSE;
71 }
72
75 return TRUE;
76}
77
78static
84{
86
87 RtlCopyMemory(&Header.Magic, KdVmCmdMagic, sizeof(Header.Magic));
88 Header.Command = Command;
89
90 if (!KdVmAddToBuffer(&Header, sizeof(Header)))
91 return FALSE;
92
94 return FALSE;
95
96 return TRUE;
97}
98
99static
100PVOID
102 _Out_ PULONG ReceiveDataSize)
103{
105 PKDVM_RECEIVE_HEADER ReceiveHeader;
106
107 KdVmKdVmExchangeData(&ReceiveData, ReceiveDataSize);
108 ReceiveHeader = ReceiveData;
109
110 if (*ReceiveDataSize < sizeof(*ReceiveHeader))
111 {
112 KDDBGPRINT("KdVmSendReceive: received data too small: 0x%x\n", *ReceiveDataSize);
113 *ReceiveDataSize = 0;
114 return NULL;
115 }
116
117 if (ReceiveHeader->Id != 0x2031 /* '01' */)
118 {
119 KDDBGPRINT("KdVmSendReceive: got invalid Id: 0x%x\n", ReceiveHeader->Id);
120 *ReceiveDataSize = 0;
121 return NULL;
122 }
123
124 if (RtlEqualMemory(ReceiveHeader->Magic, KdVmReplyMagic, 9))
125 {
126 KDDBGPRINT("KdVmSendReceive: got invalid Magic: '%*s'\n",
127 sizeof(KdVmReplyMagic), ReceiveHeader->Magic);
128 *ReceiveDataSize = 0;
129 return NULL;
130 }
131
132 *ReceiveDataSize -= sizeof(*ReceiveHeader);
133 return (PVOID)(ReceiveHeader + 1);
134}
135
136static
139{
141 ULONG ReceivedSize;
142 PULONG ReceivedVersion;
143 KDDBGPRINT("KdVmNegotiateProtocolVersions()\n");
144
145 /* Prepare the buffer */
147
149 {
150 KDDBGPRINT("Failed to do VersionReport\n");
152 }
153
154 ReceivedVersion = KdVmSendReceive(&ReceivedSize);
155 if (ReceivedSize != sizeof(ULONG))
156 {
157 KDDBGPRINT("Invalid size for VersionReport: %lx\n", ReceivedSize);
159 }
160
161 if (*ReceivedVersion != KDRPC_PROTOCOL_VERSION)
162 {
163 KDDBGPRINT("Invalid Version: %lx\n", *ReceivedVersion);
164 return STATUS_CONNECTION_REFUSED; //STATUS_PROTOCOL_NOT_SUPPORTED;
165 }
166
167 return STATUS_SUCCESS;
168}
169
170static
173{
174 UCHAR TestBuffer[KDRPC_TEST_BUFFER_SIZE];
175 PUCHAR ReceivedBuffer;
176 ULONG i, ReceivedSize;
177
178 /* Prepare the buffer */
180
181 for (i = 0; i < sizeof(TestBuffer); i++)
182 TestBuffer[i] = (UCHAR)i;
183
184 if (!KdVmAddCommandToBuffer(KDVM_CMD_TestConnection, TestBuffer, sizeof(TestBuffer)))
185 {
186 KDDBGPRINT("Failed to do TestConnection\n");
187 return FALSE;
188 }
189
190 ReceivedBuffer = KdVmSendReceive(&ReceivedSize);
191 if (ReceivedSize != sizeof(TestBuffer))
192 {
193 KDDBGPRINT("Invalid size for TestConnection: %lx\n", ReceivedSize);
194 return FALSE;
195 }
196
197 for (i = 0; i < sizeof(TestBuffer); i++)
198 {
199 if (ReceivedBuffer[i] != (UCHAR)(i ^ 0x55))
200 {
201 KDDBGPRINT("Wrong test data @ %lx, expected %x, got %x\n",
202 i, (UCHAR)(i ^ 0x55), TestBuffer[i]);
203 return FALSE;
204 }
205 }
206
207 KDDBGPRINT("TestConnectionOnChannel: success\n");
208 return TRUE;
209}
210
211static
214{
215 ULONG i, j;
216 KDDBGPRINT("KdVmTestConnectionWithHost()\n");
217
218 for (j = 0; j < 2; j++)
219 {
220 //VMWareRPC::OpenChannel
221 for (i = 0; i < CONNECTION_TEST_ROUNDS / 2; i++)
222 {
224 {
225 return FALSE;
226 }
227 }
228 }
229
230 return TRUE;
231}
232
233/* PUBLIC FUNCTIONS ***********************************************************/
234
236NTAPI
238{
239 /* Nothing to do */
240 return STATUS_SUCCESS;
241}
242
244NTAPI
246{
247 /* Nothing to do */
248 return STATUS_SUCCESS;
249}
250
252NTAPI
254 _In_ BOOLEAN SleepTransition)
255{
256 /* Nothing to do */
257 return STATUS_SUCCESS;
258}
259
261NTAPI
263 _In_ BOOLEAN SleepTransition)
264{
265 /* Nothing to do */
266 return STATUS_SUCCESS;
267}
268
269/******************************************************************************
270 * \name KdDebuggerInitialize0
271 * \brief Phase 0 initialization.
272 * \param [opt] LoaderBlock Pointer to the Loader parameter block. Can be NULL.
273 * \return Status
274 */
276NTAPI
279{
280 PCHAR CommandLine, PortString;
282
283 /* Check if we have a LoaderBlock */
284 if (LoaderBlock != NULL)
285 {
286 /* HACK */
287 KdpDbgPrint = LoaderBlock->u.I386.CommonDataArea;
288 KDDBGPRINT("KdDebuggerInitialize0\n");
289
290 /* Get the Command Line */
291 CommandLine = LoaderBlock->LoadOptions;
292
293 /* Upcase it */
294 _strupr(CommandLine);
295
296 /* Check if we got the /DEBUGPORT parameter */
297 PortString = strstr(CommandLine, "DEBUGPORT");
298 if (PortString)
299 {
300 /* Move past the actual string, to reach the port*/
301 PortString += strlen("DEBUGPORT");
302
303 /* Now get past any spaces and skip the equal sign */
304 while (*PortString == ' ') PortString++;
305 PortString++;
306
307 /* Do we have a serial port? */
308 if (strncmp(PortString, "VBOX", 4) != 0)
309 {
310 KDDBGPRINT("Invalid debugport: '%s'\n", CommandLine);
312 }
313 }
314 }
315
316 /* Get the physical address of the data buffer */
318 KDDBGPRINT("KdVmBufferPhysicalAddress = %llx\n", KdVmBufferPhysicalAddress.QuadPart);
319
321 if (!NT_SUCCESS(Status))
322 return Status;
323
326
327 return STATUS_SUCCESS;
328}
329
330/******************************************************************************
331 * \name KdDebuggerInitialize1
332 * \brief Phase 1 initialization.
333 * \param [opt] LoaderBlock Pointer to the Loader parameter block. Can be NULL.
334 * \return Status
335 */
337NTAPI
340{
341 /* Nothing to do */
342 KDDBGPRINT("KdDebuggerInitialize1()\n");
343 return STATUS_SUCCESS;
344}
345
346VOID
347NTAPI
349 _In_ ULONG PacketType,
350 _In_ PSTRING MessageHeader,
351 _In_ PSTRING MessageData,
352 _Inout_ PKD_CONTEXT KdContext)
353{
354 KDVM_SEND_PKT_REQUEST SendPktRequest;
355 PKDVM_SEND_PKT_RESULT SendPktResult;
356 ULONG ReceivedSize;
357 KDDBGPRINT("KdSendPacket(0x%lx, ...)\n", PacketType);
358
359 do
360 {
361
362 RtlZeroMemory(&SendPktRequest, sizeof(SendPktRequest));
363
364 SendPktRequest.PacketType = PacketType;
366 SendPktRequest.Info.KdDebuggerEnabledAvailable = 1;
367 SendPktRequest.Info.KdDebuggerEnabled = SharedUserData->KdDebuggerEnabled;
368
369 if (MessageHeader != NULL)
370 {
371 SendPktRequest.MessageHeader.Length = MessageHeader->Length;
372 SendPktRequest.MessageHeader.MaximumLength = MessageHeader->MaximumLength;
373 SendPktRequest.HeaderSize = MessageHeader->Length;
374 }
375
376 if (MessageData != NULL)
377 {
378 SendPktRequest.MessageData.Length = MessageData->Length;
379 SendPktRequest.MessageData.MaximumLength = MessageData->MaximumLength;
380 SendPktRequest.DataSize = MessageData->Length;
381 }
382
383 if (KdContext != NULL)
384 {
385 RtlCopyMemory(&SendPktRequest.KdContext,
386 KdContext,
387 sizeof(SendPktRequest.KdContext));
388 }
389
390
391 /* Prepare the buffer */
393
394 if (!KdVmAddCommandToBuffer(KDVM_CMD_SendPacket, &SendPktRequest, sizeof(SendPktRequest)))
395 {
396 KDDBGPRINT("KdSendPacket: Failed to add SendPacket command\n");
397 return;
398 }
399
400 if (MessageHeader != NULL)
401 {
402 if (!KdVmAddToBuffer(MessageHeader->Buffer, MessageHeader->Length))
403 {
404 KDDBGPRINT("KdSendPacket: Failed to add MessageHeader\n");
405 return;
406 }
407 }
408
409 if (MessageData != NULL)
410 {
411 if (!KdVmAddToBuffer(MessageData->Buffer, MessageData->Length))
412 {
413 KDDBGPRINT("KdSendPacket: Failed to add MessageData\n");
414 return;
415 }
416 }
417
418 SendPktResult = KdVmSendReceive(&ReceivedSize);
419 if (ReceivedSize != sizeof(*SendPktResult))
420 {
421 KDDBGPRINT("KdSendPacket: Invalid size for SendPktResult: %lx\n", ReceivedSize);
422 return;
423 }
424
425 if (KdContext != NULL)
426 {
427 RtlCopyMemory(KdContext,
428 &SendPktResult->KdContext,
429 sizeof(SendPktResult->KdContext));
430 }
431
433 if (SendPktResult->Info.KdDebuggerEnabledAvailable)
434 SharedUserData->KdDebuggerEnabled = SendPktResult->Info.KdDebuggerEnabled != 0;
435
436 if (SendPktResult->Info.RetryKdSendPacket)
437 {
438 KDDBGPRINT("KdSendPacket: RetryKdSendPacket!\n");
439 }
440
441 } while (SendPktResult->Info.RetryKdSendPacket);
442
443 KDDBGPRINT("KdSendPacket: Success!\n");
444}
445
446
448NTAPI
450 _In_ ULONG PacketType,
451 _Out_ PSTRING MessageHeader,
452 _Out_ PSTRING MessageData,
454 _Inout_opt_ PKD_CONTEXT KdContext)
455{
456 KDVM_RECV_PKT_REQUEST RecvPktRequest;
457 PKDVM_RECV_PKT_RESULT RecvPktResult;
458 ULONG ReceivedSize, ExpectedSize;
460 KDDBGPRINT("KdReceivePacket(0x%lx, ...)\n", PacketType);
461
462 /* Prepare the buffer */
464
465 RtlZeroMemory(&RecvPktRequest, sizeof(RecvPktRequest));
466
467 RecvPktRequest.PacketType = PacketType;
469 RecvPktRequest.Info.KdDebuggerEnabledAvailable = 1;
470 RecvPktRequest.Info.KdDebuggerEnabled = SharedUserData->KdDebuggerEnabled;
471
472 if (MessageHeader != NULL)
473 {
474 RecvPktRequest.MessageHeader.Length = MessageHeader->Length;
475 RecvPktRequest.MessageHeader.MaximumLength = MessageHeader->MaximumLength;
476 }
477
478 if (MessageData != NULL)
479 {
480 RecvPktRequest.MessageData.Length = MessageData->Length;
481 RecvPktRequest.MessageData.MaximumLength = MessageData->MaximumLength;
482 }
483
484 if (KdContext != NULL)
485 {
486 RtlCopyMemory(&RecvPktRequest.KdContext,
487 KdContext,
488 sizeof(RecvPktRequest.KdContext));
489 }
490
491 if (!KdVmAddCommandToBuffer(KDVM_CMD_ReceivePacket, &RecvPktRequest, sizeof(RecvPktRequest)))
492 {
493 KDDBGPRINT("KdReceivePacket: Failed to add SendPacket command\n");
494 return KDP_PACKET_RESEND;
495 }
496
497 RecvPktResult = KdVmSendReceive(&ReceivedSize);
498 if (ReceivedSize < sizeof(*RecvPktResult))
499 {
500 KDDBGPRINT("KdReceivePacket: Invalid size for RecvPktResult: %lx\n", ReceivedSize);
501 return KDP_PACKET_RESEND;
502 }
503
504 ExpectedSize = sizeof(*RecvPktResult) +
505 RecvPktResult->HeaderSize +
506 RecvPktResult->DataSize;
507 if (ReceivedSize != ExpectedSize)
508 {
509 KDDBGPRINT("KdReceivePacket: Invalid size for RecvPktResult: %lu, expected %lu\n",
510 ReceivedSize, ExpectedSize);
511 return KDP_PACKET_RESEND;
512 }
513
514 if (KdContext != NULL)
515 {
516 RtlCopyMemory(KdContext,
517 &RecvPktResult->KdContext,
518 sizeof(RecvPktResult->KdContext));
519 }
520
521 Buffer = (PUCHAR)(RecvPktResult + 1);
522 if (MessageHeader != NULL)
523 {
524 MessageHeader->Length = RecvPktResult->MessageHeader.Length;
525 if ((MessageHeader->Buffer != NULL) &&
526 (MessageHeader->MaximumLength >= RecvPktResult->HeaderSize))
527 {
528 RtlCopyMemory(MessageHeader->Buffer,
529 Buffer,
530 RecvPktResult->HeaderSize);
531 }
532 else
533 {
534 KDDBGPRINT("MessageHeader not good\n");
535 }
536 }
537
538 Buffer += RecvPktResult->HeaderSize;
539 if (MessageData != NULL)
540 {
541 MessageData->Length = RecvPktResult->MessageData.Length;
542 if ((MessageData->Buffer != NULL) &&
543 (MessageData->MaximumLength >= RecvPktResult->DataSize))
544 {
545 RtlCopyMemory(MessageData->Buffer,
546 Buffer,
547 RecvPktResult->DataSize);
548 }
549 else
550 {
551 KDDBGPRINT("MessageData not good\n");
552 }
553 }
554
555 if (DataLength != NULL)
556 *DataLength = RecvPktResult->FullSize;
557
558 KDDBGPRINT("KdReceivePacket: returning status %u\n", RecvPktResult->KdStatus);
559 return RecvPktResult->KdStatus;
560}
561
unsigned char BOOLEAN
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
LONG NTSTATUS
Definition: precomp.h:26
_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
Definition: Header.h:9
#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
#define KDDBGPRINT(...)
Definition: kddll.h:19
KDP_STATUS
Definition: kddll.h:26
@ KDP_PACKET_RESEND
Definition: kddll.h:29
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
VOID NTAPI KdVmKdVmExchangeData(_Out_ PVOID *ReceiveData, _Out_ PULONG ReceiveDataSize)
Definition: kdvbox.c:31
VOID NTAPI KdVmPrepareBuffer(VOID)
Definition: kdvbox.c:24
static BOOLEAN KdVmAddToBuffer(_In_ PVOID Data, _In_ ULONG DataSize)
Definition: kdvm.c:61
NTSTATUS NTAPI KdD0Transition(VOID)
Definition: kdvm.c:237
VOID NTAPI KdVmDbgDumpBuffer(_In_ PVOID Buffer, _In_ ULONG Size)
Definition: kdvm.c:43
static BOOLEAN KdVmTestConnectionWithHost(VOID)
Definition: kdvm.c:213
static const UCHAR KDVM_CMD_VersionReport
Definition: kdvm.c:16
NTSTATUS NTAPI KdD3Transition(VOID)
Definition: kdvm.c:245
NTSTATUS NTAPI KdDebuggerInitialize0(_In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdvm.c:277
VOID NTAPI KdSendPacket(_In_ ULONG PacketType, _In_ PSTRING MessageHeader, _In_ PSTRING MessageData, _Inout_ PKD_CONTEXT KdContext)
Definition: kdvm.c:348
NTSTATUS NTAPI KdRestore(_In_ BOOLEAN SleepTransition)
Definition: kdvm.c:262
static BOOLEAN KdVmAddCommandToBuffer(_In_ UCHAR Command, _In_ PVOID Buffer, _In_ SIZE_T BufferSize)
Definition: kdvm.c:80
ULONG KdVmBufferPos
Definition: kdvm.c:20
static CHAR KdVmReplyMagic[]
Definition: kdvm.c:12
UCHAR KdVmDataBuffer[KDVM_BUFFER_SIZE]
Definition: kdvm.c:18
static BOOLEAN TestConnectionOnChannel(VOID)
Definition: kdvm.c:172
static const UCHAR KDVM_CMD_SendPacket
Definition: kdvm.c:15
NTSTATUS NTAPI KdSave(_In_ BOOLEAN SleepTransition)
Definition: kdvm.c:253
PHYSICAL_ADDRESS KdVmBufferPhysicalAddress
Definition: kdvm.c:19
PFNDBGPRNT KdpDbgPrint
Definition: kdvm.c:22
static const UCHAR KDVM_CMD_TestConnection
Definition: kdvm.c:13
NTSTATUS NTAPI KdDebuggerInitialize1(_In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdvm.c:338
static const UCHAR KDVM_CMD_ReceivePacket
Definition: kdvm.c:14
static CHAR KdVmCmdMagic[]
Definition: kdvm.c:11
static PVOID KdVmSendReceive(_Out_ PULONG ReceiveDataSize)
Definition: kdvm.c:101
KDP_STATUS NTAPI KdReceivePacket(_In_ ULONG PacketType, _Out_ PSTRING MessageHeader, _Out_ PSTRING MessageData, _Out_ PULONG DataLength, _Inout_opt_ PKD_CONTEXT KdContext)
Definition: kdvm.c:449
static NTSTATUS KdVmNegotiateProtocolVersions(VOID)
Definition: kdvm.c:138
static VOID KdVmDbgDumpRow(_In_ PUCHAR Buffer, _In_ ULONG Size)
Definition: kdvm.c:29
#define KDVM_BUFFER_SIZE
Definition: kdvm.h:33
#define KDRPC_TEST_BUFFER_SIZE
Definition: kdvm.h:34
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
#define CONNECTION_TEST_ROUNDS
Definition: kdvm.h:32
#define KDRPC_PROTOCOL_VERSION
Definition: kdvm.h:31
ULONG(* PFNDBGPRNT)(const char *Format,...)
Definition: kdvm.h:22
#define _Inout_
Definition: ms_sal.h:378
#define _Inout_opt_
Definition: ms_sal.h:379
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
static ULONG ReceiveData(PINFO pInfo)
Definition: ntpclient.c:102
#define STATUS_CONNECTION_REFUSED
Definition: ntstatus.h:698
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
#define SharedUserData
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: shell.h:41
CHAR Magic[9]
Definition: kdvm.h:63
KDVM_CONTEXT KdContext
Definition: kdvm.h:109
KDVM_SENDPACKET_INFO Info
Definition: kdvm.h:106
KDVM_MARSHAL_STRING MessageHeader
Definition: kdvm.h:107
KDVM_MARSHAL_STRING MessageData
Definition: kdvm.h:108
KDVM_MARSHAL_STRING MessageData
Definition: kdvm.h:116
KDP_STATUS KdStatus
Definition: kdvm.h:118
KDVM_CONTEXT KdContext
Definition: kdvm.h:117
KDVM_MARSHAL_STRING MessageHeader
Definition: kdvm.h:115
ULONG HeaderSize
Definition: kdvm.h:120
UCHAR RetryKdSendPacket
Definition: kdvm.h:78
UCHAR KdDebuggerEnabledAvailable
Definition: kdvm.h:79
BOOLEAN KdDebuggerEnabled
Definition: kdvm.h:81
UCHAR KdDebuggerNotPresent
Definition: kdvm.h:77
USHORT MaximumLength
Definition: kdvm.h:50
USHORT Length
Definition: kdvm.h:49
KDVM_MARSHAL_STRING MessageData
Definition: kdvm.h:88
KDVM_CONTEXT KdContext
Definition: kdvm.h:89
KDVM_SENDPACKET_INFO Info
Definition: kdvm.h:93
KDVM_MARSHAL_STRING MessageHeader
Definition: kdvm.h:87
KDVM_CONTEXT KdContext
Definition: kdvm.h:99
KDVM_SENDPACKET_INFO Info
Definition: kdvm.h:100
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
#define KD_DEBUGGER_NOT_PRESENT
Definition: kdfuncs.h:133
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175