64 BootEntry->BootFilePath =
NULL;
75 BootEntry->FriendlyName =
L"\"ReactOS\"";
81 BootEntry->FriendlyName =
L"\"ReactOS (Debug)\"";
82 Options->OsLoadOptions =
L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS";
88 BootEntry->FriendlyName =
L"\"ReactOS (VBoxDebug)\"";
89 Options->OsLoadOptions =
L"/DEBUG /DEBUGPORT=VBOX /SOS";
96 BootEntry->FriendlyName =
L"\"ReactOS (RosDbg)\"";
97 Options->OsLoadOptions =
L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /KDSERIAL";
103 BootEntry->FriendlyName =
L"\"ReactOS (Screen)\"";
104 Options->OsLoadOptions =
L"/DEBUG /DEBUGPORT=SCREEN /SOS";
109 BootEntry->FriendlyName =
L"\"ReactOS (Log file)\"";
110 Options->OsLoadOptions =
L"/DEBUG /DEBUGPORT=FILE /SOS";
115 BootEntry->FriendlyName =
L"\"ReactOS (RAM Disk)\"";
116 Options->OsLoadPath =
L"ramdisk(0)\\ReactOS";
117 Options->OsLoadOptions =
L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /RDPATH=reactos.img /RDIMAGEOFFSET=32256";
122 BootEntry->FriendlyName =
L"\"ReactOS (Emergency Management Services)\"";
124 Options->OsLoadOptions =
L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /redirect=com2 /redirectbaudrate=115200";
171 PVOID BootStoreHandle;
197 PVOID BootStoreHandle;
211 BootEntry->BootFilePath =
NULL;
219 Options->Partition = BootPartition;
271 DPRINT(
" An installation '%S' of unsupported type %lu\n",
272 BootEntry->FriendlyName, BootEntry->OsOptionsLength);
281 DPRINT1(
" A Win2k3 install '%S' without an ARC path?!\n", BootEntry->FriendlyName);
301 DPRINT(
" Found a candidate Win2k3 install '%S' with ARC path '%S'\n",
302 BootEntry->FriendlyName,
Options->OsLoadPath);
306 DPRINT(
"EnumerateReactOSEntries: OsLoadPath: '%S'\n",
Options->OsLoadPath);
319 L"ReactOS_%lu",
Data->i);
321 L"\"ReactOS %lu\"",
Data->i);
334 PVOID BootStoreHandle;
348 Data.ArcPath = ArcPath;
359 if (!
Data.UseExistingEntry)
365 BootEntry->BootFilePath =
NULL;
375 BootEntry->FriendlyName =
Data.OsName;
393 PVOID BootStoreHandle;
409 Data.ArcPath = EntryName;
420 if (!
Data.UseExistingEntry
423 BootEntry->Version =
NtLdr;
424 BootEntry->BootFilePath =
NULL;
431 Options->OsLoadPath = EntryName;
435 BootEntry->FriendlyName = EntryValue;
556 IN PFS_INSTALL_BOOTCODE InstallBootCode)
588 Status = InstallBootCode(SrcPath, PartitionHandle, PartitionHandle);
602 IN PFS_INSTALL_BOOTCODE InstallBootCode)
744 IN PCWSTR DestinationDevicePathBuffer)
759 L"\\Device\\Harddisk%d\\Partition0",
764 SourceRootPath->Buffer,
L"\\loader\\dosmbr.bin");
770 SystemRootPath->Buffer,
L"mbr.old");
772 DPRINT1(
"Save MBR: %S ==> %S\n", DestinationDevicePathBuffer,
DstPath);
781 DPRINT1(
"Install MBR bootcode: %S ==> %S\n",
782 SourceMbrPathBuffer, DestinationDevicePathBuffer);
786 DestinationDevicePathBuffer,
805 DPRINT(
"System path: '%wZ'\n", SystemRootPath);
821 if (DoesFreeLdrExist)
824 DPRINT1(
"Update existing 'freeldr.ini'\n");
828 DPRINT1(
"UpdateFreeLoaderIni() failed (Status %lx)\n",
Status);
842 DPRINT1(
"Found Microsoft Windows NT/2000/XP boot loader\n");
845 if (DoesFreeLdrExist ==
FALSE)
848 DPRINT1(
"Create new 'freeldr.ini'\n");
852 DPRINT1(
"CreateFreeLoaderIniForReactOS() failed (Status %lx)\n",
Status);
859 if (
wcsicmp(FileSystemName,
L"FAT32") == 0)
866 SystemRootPath->Buffer,
870 DPRINT1(
"InstallBootCodeToFile(FAT32) failed (Status %lx)\n",
Status);
881 SystemRootPath->Buffer,
885 DPRINT1(
"InstallBootCodeToFile(FAT16) failed (Status %lx)\n",
Status);
894 DPRINT1(
"Update 'boot.ini'\n");
918 DPRINT1(
"Found COMPAQ MS-DOS 1.x (1.11, 1.12) / MS-DOS 1.25 boot loader\n");
923 BootPartition =
L"1";
932 DPRINT1(
"Found Microsoft DOS or Windows 9x boot loader\n");
937 BootPartition =
L"1";
946 DPRINT1(
"Found IBM PC-DOS or DR-DOS 5.x or IBM OS/2 1.0\n");
949 Description =
L"\"IBM PC-DOS or DR-DOS 5.x or IBM OS/2 1.0\"";
951 BootPartition =
L"1";
964 BootPartition =
L"1";
972 DPRINT1(
"Found Dell Real-Mode Kernel OS\n");
977 BootPartition =
L"1";
986 DPRINT1(
"Found MS OS/2 1.x\n");
991 BootPartition =
L"1";
1000 DPRINT1(
"Found MS/IBM OS/2\n");
1002 Section =
L"IBMOS2";
1005 BootPartition =
L"1";
1012 DPRINT1(
"Found FreeDOS boot loader\n");
1017 BootPartition =
L"1";
1023 DPRINT1(
"No or unknown boot loader found\n");
1025 Section =
L"Unknown";
1028 BootPartition =
L"1";
1033 if (DoesFreeLdrExist ==
FALSE)
1036 DPRINT1(
"Create new 'freeldr.ini'\n");
1041 SystemRootPath->Buffer, DestinationArcPath->Buffer,
1046 DPRINT1(
"CreateFreeLoaderIniForReactOSAndBootSector() failed (Status %lx)\n",
Status);
1053 DPRINT1(
"Save bootsector: %S ==> %S\n", SystemRootPath->Buffer,
DstPath);
1066 DPRINT1(
"CreateFreeLoaderIniForReactOS() failed (Status %lx)\n",
Status);
1072 if (
wcsicmp(FileSystemName,
L"FAT32") == 0)
1077 DPRINT1(
"Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer);
1081 DPRINT1(
"InstallBootCodeToDisk(FAT32) failed (Status %lx)\n",
Status);
1090 DPRINT1(
"Install FAT16 bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer);
1094 DPRINT1(
"InstallBootCodeToDisk(FAT16) failed (Status %lx)\n",
Status);
1117 DPRINT(
"System path: '%wZ'\n", SystemRootPath);
1132 DoesFreeLdrExist =
DoesFileExist_2(SystemRootPath->Buffer,
L"freeldr.ini");
1133 if (DoesFreeLdrExist)
1136 DPRINT1(
"Update existing 'freeldr.ini'\n");
1140 DPRINT1(
"UpdateFreeLoaderIni() failed (Status %lx)\n",
Status);
1148 if (DoesFreeLdrExist ==
FALSE)
1151 DPRINT1(
"Create new 'freeldr.ini'\n");
1154 DPRINT1(
"*nix or unknown boot loader found\n");
1161 SystemRootPath->Buffer, DestinationArcPath->Buffer,
1162 L"Linux",
L"\"Linux\"",
1166 DPRINT1(
"CreateFreeLoaderIniForReactOSAndBootSector() failed (Status %lx)\n",
Status);
1173 DPRINT1(
"Save bootsector: %S ==> %S\n", SystemRootPath->Buffer,
DstPath);
1186 DPRINT1(
"CreateFreeLoaderIniForReactOS() failed (Status %lx)\n",
Status);
1195 DPRINT1(
"Install BTRFS bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer);
1199 DPRINT1(
"InstallBootCodeToDisk(BTRFS) failed (Status %lx)\n",
Status);
1215 if (
wcsicmp(FileSystemName,
L"FAT") == 0 ||
1216 wcsicmp(FileSystemName,
L"FAT32") == 0)
1230 else if (
wcsicmp(FileSystemName,
L"BTRFS") == 0)
1234 DestinationArcPath);
1249 DPRINT1(
"Unknown file system '%S'\n", FileSystemName);
1283 DPRINT1(
"FAT FS non existent on this system?!\n");
1303 DPRINT(
"Create new 'freeldr.ini'\n");
1307 DPRINT1(
"CreateFreeLoaderIniForReactOS() failed (Status %lx)\n",
Status);
1315 DPRINT(
"Install FAT12 bootcode: %S ==> %S\n", SrcPath,
DstPath);
1319 DPRINT1(
"InstallBootCodeToDisk(FAT12) failed (Status %lx)\n",
Status);
#define BOOT_SECTOR_OPTIONS_SIGNATURE
#define NTOS_OPTIONS_SIGNATURE
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define InstallFat12BootCode
#define RTL_FIELD_SIZE(type, field)
static NTSTATUS InstallBootCodeToDisk(IN PCWSTR SrcPath, IN PCWSTR RootPath, IN PFS_INSTALL_BOOTCODE InstallBootCode)
return STATUS_NOT_SUPPORTED
#define FILE_SEQUENTIAL_ONLY
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_NO_MORE_ENTRIES
struct _BOOT_SECTOR_OPTIONS BOOT_SECTOR_OPTIONS
#define OBJ_CASE_INSENSITIVE
static NTSTATUS InstallFatBootcodeToPartition(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath, IN PCWSTR FileSystemName)
BOOLEAN DoesFileExist_2(IN PCWSTR PathName OPTIONAL, IN PCWSTR FileName)
static VOID TrimTrailingPathSeparators_UStr(IN OUT PUNICODE_STRING UnicodeString)
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
#define BTRFS_BOOTSECTOR_SIZE
NTSTATUS SetupCopyFile(IN PCWSTR SourceFileName, IN PCWSTR DestinationFileName, IN BOOLEAN FailIfExists)
static VOID CreateFreeLoaderReactOSEntries(IN PVOID BootStoreHandle, IN PCWSTR ArcPath)
NTSTATUS EnumerateBootStoreEntries(IN PVOID Handle, IN PENUM_BOOT_ENTRIES_ROUTINE EnumBootEntriesRoutine, IN PVOID Parameter OPTIONAL)
NTSTATUS ReadBootCodeFromFile(IN OUT PBOOTCODE BootCodeInfo, IN PUNICODE_STRING FilePath, IN ULONG Length OPTIONAL)
NTSTATUS AddBootStoreEntry(IN PVOID Handle, IN PBOOT_STORE_ENTRY BootEntry, IN ULONG_PTR BootEntryKey)
static const WCHAR Description[]
static NTSTATUS InstallMbrBootCode(IN PCWSTR SrcPath, IN HANDLE DstPath, IN HANDLE DiskHandle)
NTSTATUS InstallBtrfsBootCode(IN PCWSTR SrcPath, IN HANDLE DstPath, IN HANDLE RootPartition)
NTSTATUS CloseBootStore(IN PVOID Handle)
static NTSTATUS SaveBootSector(IN PCWSTR RootPath, IN PCWSTR DstPath, IN ULONG Length)
struct _BOOT_STORE_ENTRY * PBOOT_STORE_ENTRY
struct _BootSector BootSector
static NTSTATUS CreateFreeLoaderIniForReactOS(IN PCWSTR IniPath, IN PCWSTR ArcPath)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
static NTSTATUS CreateFreeLoaderIniForReactOSAndBootSector(IN PCWSTR IniPath, IN PCWSTR ArcPath, IN PCWSTR Section, IN PCWSTR Description, IN PCWSTR BootDrive, IN PCWSTR BootPartition, IN PCWSTR BootSector)
#define OBJ_NAME_PATH_SEPARATOR
BOOLEAN IsUnattendedSetup
struct _NTOS_OPTIONS NTOS_OPTIONS
struct _ENUM_REACTOS_ENTRIES_DATA * PENUM_REACTOS_ENTRIES_DATA
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
static BOOLEAN IsThereAValidBootSector(IN PCWSTR RootPath)
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define NT_SUCCESS(StatCode)
static NTSTATUS UpdateBootIni(IN PCWSTR IniPath, IN PCWSTR EntryName, IN PCWSTR EntryValue)
NTSTATUS InstallFatBootcodeToFloppy(IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath)
IN HANDLE IN HANDLE RootPartition
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define DoesDirExist(RootDirectory, DirName)
#define FILE_ATTRIBUTE_NORMAL
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)
NTSTATUS SetBootStoreOptions(IN PVOID Handle, IN PBOOT_STORE_OPTIONS BootOptions, IN ULONG FieldsToChange)
NTSTATUS InstallMbrBootCodeToDisk(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PCWSTR DestinationDevicePathBuffer)
NTSTATUS FormatFileSystem(IN PCWSTR DriveRoot, IN PCWSTR FileSystemName, IN FMIFS_MEDIA_FLAG MediaFlag, IN PCWSTR Label, IN BOOLEAN QuickFormat, IN ULONG ClusterSize, IN PFMIFSCALLBACK Callback)
NTSTATUS OpenBootStore(OUT PVOID *Handle, IN PCWSTR SystemPartition, IN BOOT_STORE_TYPE Type, IN BOOLEAN CreateNew)
NTSTATUS ReadBootCodeByHandle(IN OUT PBOOTCODE BootCodeInfo, IN HANDLE FileHandle, IN ULONG Length OPTIONAL)
VOID FreeBootCode(IN OUT PBOOTCODE BootCodeInfo)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static NTSTATUS InstallBootCodeToFile(IN PCWSTR SrcPath, IN PCWSTR DstPath, IN PCWSTR RootPath, IN PFS_INSTALL_BOOTCODE InstallBootCode)
enum _BOOT_STORE_TYPE BOOT_STORE_TYPE
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
static NTSTATUS NTAPI EnumerateReactOSEntries(IN BOOT_STORE_TYPE Type, IN PBOOT_STORE_ENTRY BootEntry, IN PVOID Parameter OPTIONAL)
_In_ PFCB _In_ LONGLONG FileOffset
#define FIELD_OFFSET(t, f)
static OUT PIO_STATUS_BLOCK IoStatusBlock
NTSTATUS InstallFat32BootCode(IN PCWSTR SrcPath, IN HANDLE DstPath, IN HANDLE RootPartition)
#define FILE_SYNCHRONOUS_IO_NONALERT
struct _NTOS_OPTIONS * PNTOS_OPTIONS
struct _BOOT_SECTOR_OPTIONS * PBOOT_SECTOR_OPTIONS
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
#define RtlCopyMemory(Destination, Source, Length)
NTSTATUS InstallVBRToPartition(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath, IN PCWSTR FileSystemName)
static const WCHAR Signature[]
struct _ENUM_REACTOS_ENTRIES_DATA ENUM_REACTOS_ENTRIES_DATA
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
static NTSTATUS InstallBtrfsBootcodeToPartition(IN PUNICODE_STRING SystemRootPath, IN PUNICODE_STRING SourceRootPath, IN PUNICODE_STRING DestinationArcPath)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define RtlCompareMemory(s1, s2, l)
static NTSTATUS UpdateFreeLoaderIni(IN PCWSTR IniPath, IN PCWSTR ArcPath)
#define STATUS_DEVICE_NOT_READY
#define InstallFat16BootCode
PULONG MinorVersion OPTIONAL