118{
119#define CONST_STR_LEN(x) (sizeof(x)/sizeof(x[0]) - 1)
120
124
125 PSTR CommandLine, PortString, BaudString;
127
128
129 if (LoaderBlock)
130 {
131
132 CommandLine = LoaderBlock->LoadOptions;
133
134
136
137
138 PortString =
strstr(CommandLine,
"DEBUGPORT");
139 BaudString =
strstr(CommandLine,
"BAUDRATE");
140
141
142 if (PortString)
143 {
144
146 while (*PortString == ' ') ++PortString;
147
148 if (*PortString) ++PortString;
149
150
151
154 {
156 }
157
158
160 if (*PortString != ':')
161 {
165
166
167 ComPortNumber =
Value;
168 }
169 else
170 {
171
174 {
175 ComPortNumber = 0;
177 }
178 }
179 }
180
181
182 if (BaudString)
183 {
184
186 while (*BaudString == ' ') ++BaudString;
187
188
189 if (*BaudString)
190 {
191
194 }
195 }
196 }
197
198 if (!ComPortAddress)
199 ComPortAddress =
UlongToPtr(BaseArray[ComPortNumber]);
200
201#ifdef KDDEBUG
202
203
204
205
206 {
207
208
209
210
211
215 {
216
219 break;
220 }
223 }
224#endif
225
226
228}
NTSTATUS NTAPI CpInitialize(_Inout_ PCPPORT Port, _In_ PUCHAR Address, _In_ ULONG BaudRate)
BOOLEAN NTAPI CpDoesPortExist(_In_ PUCHAR Address)
#define _strnicmp(_String1, _String2, _MaxCount)
_ACRTIMP __msvcrt_long __cdecl atol(const char *)
_ACRTIMP __msvcrt_ulong __cdecl strtoul(const char *, char **, int)
_ACRTIMP char *__cdecl strstr(const char *, const char *)
NTSTATUS NTAPI KdpPortInitialize(_In_ PUCHAR PortAddress, _In_ ULONG BaudRate)
#define DEFAULT_DEBUG_PORT
#define DEFAULT_DEBUG_BAUD_RATE
#define DEFAULT_BAUD_RATE
#define STATUS_INVALID_PARAMETER
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value