ReactOS 0.4.15-dev-7953-g1f49173
linuxboot.c
Go to the documentation of this file.
1/*
2 * FreeLoader
3 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20/*
21 * The x86 Linux Boot Protocol is explained at:
22 * https://www.kernel.org/doc/Documentation/x86/boot.txt
23 * https://www.linux.it/~rubini/docs/boot/boot.html
24 */
25
26#if defined(_M_IX86) || defined(_M_AMD64)
27
28/* INCLUDES *******************************************************************/
29
30#include <freeldr.h>
31
32#include <debug.h>
34
35/* GLOBALS ********************************************************************/
36
37#define LINUX_READ_CHUNK_SIZE 0x20000 // Read 128k at a time
38
39PLINUX_BOOTSECTOR LinuxBootSector = NULL;
40PLINUX_SETUPSECTOR LinuxSetupSector = NULL;
41ULONG SetupSectorSize = 0;
42BOOLEAN NewStyleLinuxKernel = FALSE;
43ULONG LinuxKernelSize = 0;
44ULONG LinuxInitrdSize = 0;
45PCSTR LinuxKernelName = NULL;
46PCSTR LinuxInitrdName = NULL;
47PSTR LinuxCommandLine = NULL;
48ULONG LinuxCommandLineSize = 0;
49PVOID LinuxKernelLoadAddress = NULL;
50PVOID LinuxInitrdLoadAddress = NULL;
51CHAR LinuxBootDescription[80];
52
53/* FUNCTIONS ******************************************************************/
54
55static BOOLEAN LinuxReadBootSector(ULONG LinuxKernelFile);
56static BOOLEAN LinuxReadSetupSector(ULONG LinuxKernelFile);
57static BOOLEAN LinuxReadKernel(ULONG LinuxKernelFile);
58static BOOLEAN LinuxCheckKernelVersion(VOID);
59static BOOLEAN LinuxReadInitrd(ULONG LinuxInitrdFile);
60
61static VOID
63 IN OUT PSTR QuotedString)
64{
65 PCHAR p;
66 PSTR Start;
68
69 /* Skip spaces up to " */
70 p = QuotedString;
71 while (*p == ' ' || *p == '\t' || *p == '"')
72 ++p;
73 Start = p;
74
75 /* Go up to next " */
76 while (*p != ANSI_NULL && *p != '"')
77 ++p;
78 /* NULL-terminate */
79 *p = ANSI_NULL;
80
81 /* Move the NULL-terminated string back into 'QuotedString' in place */
82 Size = (strlen(Start) + 1) * sizeof(CHAR);
83 memmove(QuotedString, Start, Size);
84}
85
87LoadAndBootLinux(
88 _In_ ULONG Argc,
89 _In_ PCHAR Argv[],
90 _In_ PCHAR Envp[])
91{
94 PCSTR ArgValue;
95 PCSTR BootPath;
96 ULONG LinuxKernel = 0;
97 ULONG LinuxInitrdFile = 0;
99 CHAR ArcPath[MAX_PATH];
100
101#if DBG
102 /* Ensure the boot type is the one expected */
103 ArgValue = GetArgumentValue(Argc, Argv, "BootType");
104 if (!ArgValue || !*ArgValue || _stricmp(ArgValue, "Linux") != 0)
105 {
106 ERR("Unexpected boot type '%s', aborting\n", ArgValue ? ArgValue : "n/a");
107 return EINVAL;
108 }
109#endif
110
111 Description = GetArgumentValue(Argc, Argv, "LoadIdentifier");
112 if (Description && *Description)
113 RtlStringCbPrintfA(LinuxBootDescription, sizeof(LinuxBootDescription), "Loading %s...", Description);
114 else
115 strcpy(LinuxBootDescription, "Loading Linux...");
116
118 UiDrawStatusText(LinuxBootDescription);
119 UiDrawProgressBarCenter(LinuxBootDescription);
120
121 /* Find all the message box settings and run them */
122 UiShowMessageBoxesInArgv(Argc, Argv);
123
124 /*
125 * Check whether we have a "BootPath" value (takes precedence
126 * over both "BootDrive" and "BootPartition").
127 */
128 BootPath = GetArgumentValue(Argc, Argv, "BootPath");
129 if (!BootPath || !*BootPath)
130 {
131 /* We don't have one, check whether we use "BootDrive" and "BootPartition" */
132
133 /* Retrieve the boot drive (optional, fall back to using default path otherwise) */
134 ArgValue = GetArgumentValue(Argc, Argv, "BootDrive");
135 if (ArgValue && *ArgValue)
136 {
137 UCHAR DriveNumber = DriveMapGetBiosDriveNumber(ArgValue);
138
139 /* Retrieve the boot partition (not optional and cannot be zero) */
141 ArgValue = GetArgumentValue(Argc, Argv, "BootPartition");
142 if (ArgValue && *ArgValue)
143 PartitionNumber = atoi(ArgValue);
144 if (PartitionNumber == 0)
145 {
146 UiMessageBox("Boot partition cannot be 0!");
147 goto LinuxBootFailed;
148 // return EINVAL;
149 }
150
151 /* Construct the corresponding ARC path */
152 ConstructArcPath(ArcPath, "", DriveNumber, PartitionNumber);
153 *strrchr(ArcPath, '\\') = ANSI_NULL; // Trim the trailing path separator.
154
155 BootPath = ArcPath;
156 }
157 else
158 {
159 /* Fall back to using the system partition as default path */
160 BootPath = GetArgumentValue(Argc, Argv, "SystemPartition");
161 }
162 }
163
164 /* Get the kernel name */
165 LinuxKernelName = GetArgumentValue(Argc, Argv, "Kernel");
166 if (!LinuxKernelName || !*LinuxKernelName)
167 {
168 UiMessageBox("Linux kernel filename not specified for selected OS!");
169 goto LinuxBootFailed;
170 }
171
172 /* Get the initrd name (optional) */
173 LinuxInitrdName = GetArgumentValue(Argc, Argv, "Initrd");
174
175 /* Get the command line (optional) */
176 LinuxCommandLineSize = 0;
177 LinuxCommandLine = GetArgumentValue(Argc, Argv, "CommandLine");
178 if (LinuxCommandLine && *LinuxCommandLine)
179 {
180 RemoveQuotes(LinuxCommandLine);
181 LinuxCommandLineSize = (ULONG)strlen(LinuxCommandLine) + 1;
182 LinuxCommandLineSize = min(LinuxCommandLineSize, 260);
183 }
184
185 /* Open the kernel */
186 Status = FsOpenFile(LinuxKernelName, BootPath, OpenReadOnly, &LinuxKernel);
187 if (Status != ESUCCESS)
188 {
189 UiMessageBox("Linux kernel '%s' not found.", LinuxKernelName);
190 goto LinuxBootFailed;
191 }
192
193 /* Open the initrd file image (if necessary) */
194 if (LinuxInitrdName)
195 {
196 Status = FsOpenFile(LinuxInitrdName, BootPath, OpenReadOnly, &LinuxInitrdFile);
197 if (Status != ESUCCESS)
198 {
199 UiMessageBox("Linux initrd image '%s' not found.", LinuxInitrdName);
200 goto LinuxBootFailed;
201 }
202 }
203
204 /* Load the boot sector */
205 if (!LinuxReadBootSector(LinuxKernel))
206 goto LinuxBootFailed;
207
208 /* Load the setup sector */
209 if (!LinuxReadSetupSector(LinuxKernel))
210 goto LinuxBootFailed;
211
212 /* Calc kernel size */
213 Status = ArcGetFileInformation(LinuxKernel, &FileInfo);
214 if (Status != ESUCCESS || FileInfo.EndingAddress.HighPart != 0)
215 LinuxKernelSize = 0;
216 else
217 LinuxKernelSize = FileInfo.EndingAddress.LowPart - (512 + SetupSectorSize);
218
219 /* Get the initrd file image (if necessary) */
220 LinuxInitrdSize = 0;
221 if (LinuxInitrdName)
222 {
223 Status = ArcGetFileInformation(LinuxInitrdFile, &FileInfo);
224 if (Status != ESUCCESS || FileInfo.EndingAddress.HighPart != 0)
225 LinuxInitrdSize = 0;
226 else
227 LinuxInitrdSize = FileInfo.EndingAddress.LowPart;
228 }
229
230 /* Load the kernel */
231 if (!LinuxReadKernel(LinuxKernel))
232 goto LinuxBootFailed;
233
234 /* Load the initrd (if necessary) */
235 if (LinuxInitrdName)
236 {
237 if (!LinuxReadInitrd(LinuxInitrdFile))
238 goto LinuxBootFailed;
239 }
240
241 /*
242 * If the default root device is set to FLOPPY (0000h), change to /dev/fd0 (0200h).
243 * For a list of majors, see
244 * https://github.com/torvalds/linux/blob/master/include/uapi/linux/major.h
245 * For some examples of (decoded) root devices values, see
246 * https://github.com/torvalds/linux/blob/cc89c63e2/include/linux/root_dev.h
247 *
248 * NOTE: The RootDevice field is deprecated since commits
249 * https://github.com/torvalds/linux/commit/079f85e62
250 * https://github.com/torvalds/linux/commit/7448e8e5d
251 */
252#define NODEV 0
253#define FLOPPY_MAJOR 2
254#define makedev(maj, min) (((maj) << 8) | (min))
255 if (LinuxBootSector->RootDevice == NODEV)
256 LinuxBootSector->RootDevice = makedev(FLOPPY_MAJOR, 0);
257
258 if (LinuxSetupSector->Version >= 0x0202)
259 {
260 LinuxSetupSector->CommandLinePointer = 0x99000;
261 }
262 else
263 {
264 LinuxBootSector->CommandLineMagic = LINUX_COMMAND_LINE_MAGIC;
265 LinuxBootSector->CommandLineOffset = 0x9000;
266 }
267
268 if (NewStyleLinuxKernel)
269 LinuxSetupSector->TypeOfLoader = LINUX_LOADER_TYPE_FREELOADER;
270 else
271 LinuxSetupSector->LoadFlags = 0;
272
273 RtlCopyMemory((PVOID)0x90000, LinuxBootSector, 512);
274 RtlCopyMemory((PVOID)0x90200, LinuxSetupSector, SetupSectorSize);
275 RtlCopyMemory((PVOID)0x99000,
276 LinuxCommandLine ? LinuxCommandLine : "",
277 LinuxCommandLine ? LinuxCommandLineSize : sizeof(ANSI_NULL));
278
279 UiUnInitialize("Booting Linux...");
280 IniCleanup();
281
282 BootLinuxKernel(LinuxKernelSize, LinuxKernelLoadAddress,
283 (LinuxSetupSector->LoadFlags & LINUX_FLAG_LOAD_HIGH)
284 ? (PVOID)LINUX_KERNEL_LOAD_ADDRESS /* == 0x100000 */
285 : (PVOID)0x10000);
286 /* Must not return! */
287 return ESUCCESS;
288
289LinuxBootFailed:
290
291 if (LinuxKernel)
292 ArcClose(LinuxKernel);
293
294 if (LinuxInitrdFile)
295 ArcClose(LinuxInitrdFile);
296
297 if (LinuxBootSector != NULL)
298 MmFreeMemory(LinuxBootSector);
299
300 if (LinuxSetupSector != NULL)
301 MmFreeMemory(LinuxSetupSector);
302
303 if (LinuxKernelLoadAddress != NULL)
304 MmFreeMemory(LinuxKernelLoadAddress);
305
306 if (LinuxInitrdLoadAddress != NULL)
307 MmFreeMemory(LinuxInitrdLoadAddress);
308
309 LinuxBootSector = NULL;
310 LinuxSetupSector = NULL;
311 SetupSectorSize = 0;
312 NewStyleLinuxKernel = FALSE;
313 LinuxKernelSize = 0;
314 LinuxInitrdSize = 0;
315 LinuxKernelName = NULL;
316 LinuxInitrdName = NULL;
317 LinuxCommandLine = NULL;
318 LinuxCommandLineSize = 0;
319 LinuxKernelLoadAddress = NULL;
320 LinuxInitrdLoadAddress = NULL;
321 *LinuxBootDescription = ANSI_NULL;
322
323 return ENOEXEC;
324}
325
326static BOOLEAN LinuxReadBootSector(ULONG LinuxKernelFile)
327{
329
330 /* Allocate memory for boot sector */
331 LinuxBootSector = MmAllocateMemoryWithType(512, LoaderSystemCode);
332 if (LinuxBootSector == NULL)
333 return FALSE;
334
335 /* Load the linux boot sector */
336 Position.QuadPart = 0;
337 if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
338 return FALSE;
339 if (ArcRead(LinuxKernelFile, LinuxBootSector, 512, NULL) != ESUCCESS)
340 return FALSE;
341
342 /* Check for validity */
343 if (LinuxBootSector->BootFlag != LINUX_BOOT_SECTOR_MAGIC)
344 {
345 UiMessageBox("Invalid boot sector magic (0xaa55)");
346 return FALSE;
347 }
348
349 // DbgDumpBuffer(DPRINT_LINUX, LinuxBootSector, 512);
350
351 TRACE("SetupSectors: %d\n" , LinuxBootSector->SetupSectors);
352 TRACE("RootFlags: 0x%x\n", LinuxBootSector->RootFlags);
353 TRACE("SystemSize: 0x%x\n", LinuxBootSector->SystemSize);
354 TRACE("SwapDevice: 0x%x\n", LinuxBootSector->SwapDevice);
355 TRACE("RamSize: 0x%x\n", LinuxBootSector->RamSize);
356 TRACE("VideoMode: 0x%x\n", LinuxBootSector->VideoMode);
357 TRACE("RootDevice: 0x%x\n", LinuxBootSector->RootDevice);
358 TRACE("BootFlag: 0x%x\n", LinuxBootSector->BootFlag);
359
360 return TRUE;
361}
362
363static BOOLEAN LinuxReadSetupSector(ULONG LinuxKernelFile)
364{
366 UCHAR TempLinuxSetupSector[512];
367
368 /* Load the first linux setup sector */
369 Position.QuadPart = 512;
370 if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
371 return FALSE;
372 if (ArcRead(LinuxKernelFile, TempLinuxSetupSector, 512, NULL) != ESUCCESS)
373 return FALSE;
374
375 /* Check the kernel version */
376 LinuxSetupSector = (PLINUX_SETUPSECTOR)TempLinuxSetupSector;
377 if (!LinuxCheckKernelVersion())
378 return FALSE;
379
380 if (NewStyleLinuxKernel)
381 SetupSectorSize = 512 * LinuxBootSector->SetupSectors;
382 else
383 SetupSectorSize = 512 * 4; // Always 4 setup sectors
384
385 /* Allocate memory for setup sectors */
386 LinuxSetupSector = MmAllocateMemoryWithType(SetupSectorSize, LoaderSystemCode);
387 if (LinuxSetupSector == NULL)
388 return FALSE;
389
390 /* Copy over first setup sector */
391 RtlCopyMemory(LinuxSetupSector, TempLinuxSetupSector, 512);
392
393 /* Load the rest of the linux setup sectors */
394 Position.QuadPart = 1024;
395 if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
396 return FALSE;
397 if (ArcRead(LinuxKernelFile, (PVOID)((ULONG_PTR)LinuxSetupSector + 512), SetupSectorSize - 512, NULL) != ESUCCESS)
398 return FALSE;
399
400 // DbgDumpBuffer(DPRINT_LINUX, LinuxSetupSector, SetupSectorSize);
401
402 TRACE("SetupHeaderSignature: 0x%x (HdrS)\n", LinuxSetupSector->SetupHeaderSignature);
403 TRACE("Version: 0x%x\n", LinuxSetupSector->Version);
404 TRACE("RealModeSwitch: 0x%x\n", LinuxSetupSector->RealModeSwitch);
405 TRACE("SetupSeg: 0x%x\n", LinuxSetupSector->SetupSeg);
406 TRACE("StartSystemSeg: 0x%x\n", LinuxSetupSector->StartSystemSeg);
407 TRACE("KernelVersion: 0x%x\n", LinuxSetupSector->KernelVersion);
408 TRACE("TypeOfLoader: 0x%x\n", LinuxSetupSector->TypeOfLoader);
409 TRACE("LoadFlags: 0x%x\n", LinuxSetupSector->LoadFlags);
410 TRACE("SetupMoveSize: 0x%x\n", LinuxSetupSector->SetupMoveSize);
411 TRACE("Code32Start: 0x%x\n", LinuxSetupSector->Code32Start);
412 TRACE("RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress);
413 TRACE("RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize);
414 TRACE("BootSectKludgeOffset: 0x%x\n", LinuxSetupSector->BootSectKludgeOffset);
415 TRACE("BootSectKludgeSegment: 0x%x\n", LinuxSetupSector->BootSectKludgeSegment);
416 TRACE("HeapEnd: 0x%x\n", LinuxSetupSector->HeapEnd);
417
418 return TRUE;
419}
420
421static BOOLEAN LinuxReadKernel(ULONG LinuxKernelFile)
422{
423 PVOID LoadAddress;
425 ULONG BytesLoaded;
426 CHAR StatusText[260];
427
428 RtlStringCbPrintfA(StatusText, sizeof(StatusText), "Loading %s", LinuxKernelName);
429 UiDrawStatusText(StatusText);
430
431 /* Try to allocate memory for the Linux kernel; if it fails, allocate somewhere else */
432 LinuxKernelLoadAddress = MmAllocateMemoryAtAddress(LinuxKernelSize, (PVOID)LINUX_KERNEL_LOAD_ADDRESS, LoaderSystemCode);
433 if (LinuxKernelLoadAddress != (PVOID)LINUX_KERNEL_LOAD_ADDRESS)
434 {
435 /* It's OK, let's allocate again somewhere else */
436 LinuxKernelLoadAddress = MmAllocateMemoryWithType(LinuxKernelSize, LoaderSystemCode);
437 if (LinuxKernelLoadAddress == NULL)
438 {
439 TRACE("Failed to allocate 0x%lx bytes for the kernel image.\n", LinuxKernelSize);
440 return FALSE;
441 }
442 }
443
444 LoadAddress = LinuxKernelLoadAddress;
445
446 /* Load the linux kernel at 0x100000 (1mb) */
447 Position.QuadPart = 512 + SetupSectorSize;
448 if (ArcSeek(LinuxKernelFile, &Position, SeekAbsolute) != ESUCCESS)
449 return FALSE;
450 for (BytesLoaded = 0; BytesLoaded < LinuxKernelSize; )
451 {
452 if (ArcRead(LinuxKernelFile, LoadAddress, LINUX_READ_CHUNK_SIZE, NULL) != ESUCCESS)
453 return FALSE;
454
455 BytesLoaded += LINUX_READ_CHUNK_SIZE;
456 LoadAddress = (PVOID)((ULONG_PTR)LoadAddress + LINUX_READ_CHUNK_SIZE);
457
458 UiUpdateProgressBar(BytesLoaded * 100 / (LinuxKernelSize + LinuxInitrdSize), NULL);
459 }
460
461 return TRUE;
462}
463
464static BOOLEAN LinuxCheckKernelVersion(VOID)
465{
466 /* Just assume old kernel until we find otherwise */
467 NewStyleLinuxKernel = FALSE;
468
469 /* Check for new style setup header */
470 if (LinuxSetupSector->SetupHeaderSignature != LINUX_SETUP_HEADER_ID)
471 {
472 NewStyleLinuxKernel = FALSE;
473 }
474 /* Check for version below 2.0 */
475 else if (LinuxSetupSector->Version < 0x0200)
476 {
477 NewStyleLinuxKernel = FALSE;
478 }
479 /* Check for version 2.0 */
480 else if (LinuxSetupSector->Version == 0x0200)
481 {
482 NewStyleLinuxKernel = TRUE;
483 }
484 /* Check for version 2.01+ */
485 else if (LinuxSetupSector->Version >= 0x0201)
486 {
487 NewStyleLinuxKernel = TRUE;
488 LinuxSetupSector->HeapEnd = 0x9000;
489 LinuxSetupSector->LoadFlags |= LINUX_FLAG_CAN_USE_HEAP;
490 }
491
492 if ((NewStyleLinuxKernel == FALSE) && (LinuxInitrdName))
493 {
494 UiMessageBox("Error: Cannot load a ramdisk (initrd) with an old kernel image.");
495 return FALSE;
496 }
497
498 return TRUE;
499}
500
501static BOOLEAN LinuxReadInitrd(ULONG LinuxInitrdFile)
502{
503 ULONG BytesLoaded;
504 CHAR StatusText[260];
505
506 RtlStringCbPrintfA(StatusText, sizeof(StatusText), "Loading %s", LinuxInitrdName);
507 UiDrawStatusText(StatusText);
508
509 /* Allocate memory for the ramdisk, below 4GB */
510 // LinuxInitrdLoadAddress = MmAllocateMemory(LinuxInitrdSize);
511 /* Try to align it at the next MB boundary after the kernel */
512 // LinuxInitrdLoadAddress = MmAllocateMemoryAtAddress(LinuxInitrdSize, (PVOID)ROUND_UP((LINUX_KERNEL_LOAD_ADDRESS + LinuxKernelSize), 0x100000));
513 if (LinuxSetupSector->Version <= 0x0202)
514 {
515#ifdef _M_AMD64
516 C_ASSERT(LINUX_MAX_INITRD_ADDRESS < 0x100000000);
517#endif
518 LinuxInitrdLoadAddress = MmAllocateHighestMemoryBelowAddress(LinuxInitrdSize, (PVOID)LINUX_MAX_INITRD_ADDRESS, LoaderSystemCode);
519 }
520 else
521 {
522 LinuxInitrdLoadAddress = MmAllocateHighestMemoryBelowAddress(LinuxInitrdSize, UlongToPtr(LinuxSetupSector->InitrdAddressMax), LoaderSystemCode);
523 }
524 if (LinuxInitrdLoadAddress == NULL)
525 {
526 return FALSE;
527 }
528#ifdef _M_AMD64
529 ASSERT((ULONG_PTR)LinuxInitrdLoadAddress < 0x100000000);
530#endif
531
532 /* Set the information in the setup struct */
533 LinuxSetupSector->RamdiskAddress = PtrToUlong(LinuxInitrdLoadAddress);
534 LinuxSetupSector->RamdiskSize = LinuxInitrdSize;
535
536 TRACE("RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress);
537 TRACE("RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize);
538
539 if (LinuxSetupSector->Version >= 0x0203)
540 {
541 TRACE("InitrdAddressMax: 0x%x\n", LinuxSetupSector->InitrdAddressMax);
542 }
543
544 /* Load the ramdisk */
545 for (BytesLoaded = 0; BytesLoaded < LinuxInitrdSize; )
546 {
547 if (ArcRead(LinuxInitrdFile, LinuxInitrdLoadAddress, LINUX_READ_CHUNK_SIZE, NULL) != ESUCCESS)
548 return FALSE;
549
550 BytesLoaded += LINUX_READ_CHUNK_SIZE;
551 LinuxInitrdLoadAddress = (PVOID)((ULONG_PTR)LinuxInitrdLoadAddress + LINUX_READ_CHUNK_SIZE);
552
553 UiUpdateProgressBar((BytesLoaded + LinuxKernelSize) * 100 / (LinuxInitrdSize + LinuxKernelSize), NULL);
554 }
555
556 return TRUE;
557}
558
559#endif /* _M_IX86 || _M_AMD64 */
unsigned char BOOLEAN
#define EINVAL
Definition: acclib.h:90
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
PSTR GetArgumentValue(_In_ ULONG Argc, _In_ PCHAR Argv[], _In_ PCSTR ArgumentName)
Definition: arcsupp.c:42
VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition)
Definition: arcname.c:175
#define DriveMapGetBiosDriveNumber(DeviceName)
Definition: hardware.h:35
#define ERR(fmt,...)
Definition: debug.h:110
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:103
ARC_STATUS ArcClose(ULONG FileId)
Definition: fs.c:220
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
Definition: fs.c:252
ARC_STATUS ArcSeek(ULONG FileId, LARGE_INTEGER *Position, SEEKMODE SeekMode)
Definition: fs.c:245
ARC_STATUS FsOpenFile(IN PCSTR FileName, IN PCSTR DefaultPath OPTIONAL, IN OPENMODE OpenMode, OUT PULONG FileId)
Definition: fs.c:268
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
Definition: fs.c:238
PVOID MmAllocateMemoryAtAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:85
VOID MmFreeMemory(PVOID MemoryPointer)
Definition: mm.c:215
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:31
PVOID MmAllocateHighestMemoryBelowAddress(SIZE_T MemorySize, PVOID DesiredAddress, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:160
VOID UiShowMessageBoxesInArgv(IN ULONG Argc, IN PCHAR Argv[])
Definition: ui.c:568
VOID UiUpdateProgressBar(_In_ ULONG Percentage, _In_opt_ PCSTR ProgressText)
Definition: ui.c:454
VOID UiUnInitialize(PCSTR BootText)
Definition: ui.c:224
VOID UiDrawBackdrop(VOID)
Definition: ui.c:233
VOID UiDrawProgressBarCenter(_In_ PCSTR ProgressText)
Definition: ui.c:487
VOID UiDrawStatusText(PCSTR StatusText)
Definition: ui.c:286
VOID UiMessageBox(_In_ PCSTR Format,...)
Definition: ui.c:359
#define makedev(major, minor)
Definition: btrfs_drv.h:1637
#define _stricmp
Definition: cat.c:22
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR Description[]
Definition: oid.c:1266
#define MAX_PATH
Definition: compat.h:34
static LPWSTR RemoveQuotes(LPWSTR str)
Definition: doskey.c:173
#define ENOEXEC
Definition: errno.h:14
#define NODEV
Definition: fs.h:27
#define UlongToPtr(u)
Definition: config.h:106
#define PtrToUlong(u)
Definition: config.h:107
Status
Definition: gdiplustypes.h:25
GLfloat GLfloat p
Definition: glext.h:8902
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
VOID IniCleanup(VOID)
Definition: inifile.c:238
#define C_ASSERT(e)
Definition: intsafe.h:73
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define ASSERT(a)
Definition: mode.c:44
#define min(a, b)
Definition: monoChain.cc:55
#define _In_
Definition: ms_sal.h:308
#define ANSI_NULL
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
@ ESUCCESS
Definition: arc.h:32
@ LoaderSystemCode
Definition: arc.h:183
ULONG ARC_STATUS
Definition: arc.h:4
@ SeekAbsolute
Definition: arc.h:59
@ OpenReadOnly
Definition: arc.h:65
#define TRACE(s)
Definition: solgame.cpp:4
static COORD Position
Definition: mouse.c:34
char * PSTR
Definition: typedefs.h:51
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
@ Start
Definition: partlist.h:33
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2061
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175