ReactOS  0.4.15-dev-3163-gf17c2c0
kdmain.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for kdmain.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI PspDumpThreads (BOOLEAN SystemThreads)
 
static PCHAR NTAPI KdpGetDebugMode (PCHAR Currentp2)
 
NTSTATUS NTAPI KdDebuggerInitialize0 (IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
 
NTSTATUS NTAPI KdDebuggerInitialize1 (IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
 

Variables

ANSI_STRING KdpLogFileName
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file kdmain.c.

Function Documentation

◆ KdDebuggerInitialize0()

NTSTATUS NTAPI KdDebuggerInitialize0 ( IN PLOADER_PARAMETER_BLOCK LoaderBlock  OPTIONAL)

Definition at line 85 of file kdmain.c.

87 {
88  ULONG i;
89  PCHAR CommandLine, Port = NULL;
90 
91  if (LoaderBlock)
92  {
93  /* Check if we have a command line */
94  CommandLine = LoaderBlock->LoadOptions;
95  if (CommandLine)
96  {
97  /* Upcase it */
98  _strupr(CommandLine);
99 
100 #ifdef KDBG
101  /* Get the KDBG Settings */
102  KdbpGetCommandLineSettings(CommandLine);
103 #endif
104 
105  /* Get the port */
106  Port = strstr(CommandLine, "DEBUGPORT");
107  }
108  }
109 
110  /* Check if we got the /DEBUGPORT parameter(s) */
111  while (Port)
112  {
113  /* Move past the actual string, to reach the port*/
114  Port += sizeof("DEBUGPORT") - 1;
115 
116  /* Now get past any spaces and skip the equal sign */
117  while (*Port == ' ') Port++;
118  Port++;
119 
120  /* Get the debug mode and wrapper */
122  Port = strstr(Port, "DEBUGPORT");
123  }
124 
125  /* Use serial port then */
126  if (KdpDebugMode.Value == 0)
127  KdpDebugMode.Serial = TRUE;
128 
129  /* Call Providers at Phase 0 */
130  for (i = 0; i < KdMax; i++)
131  {
132  InitRoutines[i](&DispatchTable[i], 0);
133  }
134 
135  return STATUS_SUCCESS;
136 }
signed char * PCHAR
Definition: retypes.h:7
CPPORT Port[4]
Definition: headless.c:35
#define TRUE
Definition: types.h:120
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
KDP_DEBUG_MODE KdpDebugMode
Definition: kdio.c:48
VOID NTAPI KdbpGetCommandLineSettings(PCHAR p1)
Definition: kdb.c:1653
static PCHAR NTAPI KdpGetDebugMode(PCHAR Currentp2)
Definition: kdmain.c:24
_CRTIMP char *__cdecl _strupr(_Inout_z_ char *_String)
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
PKDP_INIT_ROUTINE InitRoutines[KdMax]
Definition: kdio.c:52
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:245

◆ KdDebuggerInitialize1()

NTSTATUS NTAPI KdDebuggerInitialize1 ( IN PLOADER_PARAMETER_BLOCK LoaderBlock  OPTIONAL)

Definition at line 140 of file kdmain.c.

142 {
143  PLIST_ENTRY CurrentEntry;
144  PKD_DISPATCH_TABLE CurrentTable;
145 
146  /* Call the registered handlers */
147  CurrentEntry = KdProviders.Flink;
148  while (CurrentEntry != &KdProviders)
149  {
150  /* Get the current table */
151  CurrentTable = CONTAINING_RECORD(CurrentEntry,
152  KD_DISPATCH_TABLE,
153  KdProvidersList);
154 
155  /* Call it */
156  CurrentTable->KdpInitRoutine(CurrentTable, 1);
157 
158  /* Next Table */
159  CurrentEntry = CurrentEntry->Flink;
160  }
161 
163 
164  return STATUS_SUCCESS;
165 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
#define FLG_STOP_ON_EXCEPTION
Definition: pstypes.h:56
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG NtGlobalFlag
Definition: init.c:52
LIST_ENTRY KdProviders
Definition: kdio.c:49

◆ KdpGetDebugMode()

static PCHAR NTAPI KdpGetDebugMode ( PCHAR  Currentp2)
static

Definition at line 24 of file kdmain.c.

25 {
26  PCHAR p1, p2 = Currentp2;
27  ULONG Value;
28 
29  /* Check for Screen Debugging */
30  if (!_strnicmp(p2, "SCREEN", 6))
31  {
32  /* Enable It */
33  p2 += 6;
34  KdpDebugMode.Screen = TRUE;
35  }
36  /* Check for Serial Debugging */
37  else if (!_strnicmp(p2, "COM", 3))
38  {
39  /* Gheck for a valid Serial Port */
40  p2 += 3;
41  if (*p2 != ':')
42  {
43  Value = (ULONG)atol(p2);
44  if (Value > 0 && Value < 5)
45  {
46  /* Valid port found, enable Serial Debugging */
47  KdpDebugMode.Serial = TRUE;
48 
49  /* Set the port to use */
51  }
52  }
53  else
54  {
55  Value = strtoul(p2 + 1, NULL, 0);
56  if (Value)
57  {
58  KdpDebugMode.Serial = TRUE;
60  SerialPortNumber = 0;
61  }
62  }
63  }
64  /* Check for Debug Log Debugging */
65  else if (!_strnicmp(p2, "FILE", 4))
66  {
67  /* Enable It */
68  p2 += 4;
69  KdpDebugMode.File = TRUE;
70  if (*p2 == ':')
71  {
72  p2++;
73  p1 = p2;
74  while (*p2 != '\0' && *p2 != ' ') p2++;
77  }
78  }
79 
80  return p2;
81 }
signed char * PCHAR
Definition: retypes.h:7
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
#define TRUE
Definition: types.h:120
KDP_DEBUG_MODE KdpDebugMode
Definition: kdio.c:48
#define UlongToPtr(u)
Definition: config.h:106
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
USHORT MaximumLength
Definition: env_spec_w32.h:377
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
PUCHAR Address
Definition: cportlib.h:29
CPPORT SerialPortInfo
Definition: kdio.c:34
#define NULL
Definition: types.h:112
ULONG SerialPortNumber
Definition: kdio.c:33
ANSI_STRING KdpLogFileName
Definition: kdio.c:29
unsigned int ULONG
Definition: retypes.h:1

Referenced by KdDebuggerInitialize0().

◆ PspDumpThreads()

VOID NTAPI PspDumpThreads ( BOOLEAN  SystemThreads)

Variable Documentation

◆ KdpLogFileName

ANSI_STRING KdpLogFileName

Definition at line 29 of file kdio.c.

Referenced by KdpDebugLogInit(), and KdpGetDebugMode().