static
VOID
-CreateCommonFreeLoaderSections(PINICACHE IniCache)
+CreateCommonFreeLoaderSections(
+ PINICACHE IniCache)
{
PINICACHESECTION IniSection;
return Status;
}
-
/* Allocate buffer for new bootsector */
NewBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap,
0,
return Status;
}
+
NTSTATUS
-InstallFat12BootCodeToFloppy(PWSTR SrcPath,
- PWSTR RootPath)
+InstallFat12BootCodeToFloppy(
+ PWSTR SrcPath,
+ PWSTR RootPath)
{
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
PFAT_BOOTSECTOR OrigBootSector;
PFAT_BOOTSECTOR NewBootSector;
-
+
/* Allocate buffer for original bootsector */
OrigBootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE);
if (OrigBootSector == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
-
+
/* Read current boot sector into buffer */
RtlInitUnicodeString(&Name, RootPath);
-
+
InitializeObjectAttributes(&ObjectAttributes,
&Name,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
-
+
Status = NtOpenFile(&FileHandle,
GENERIC_READ | SYNCHRONIZE,
&ObjectAttributes,
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return Status;
}
-
+
Status = NtReadFile(FileHandle,
NULL,
NULL,
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return Status;
}
-
-
+
/* Allocate buffer for new bootsector */
NewBootSector = RtlAllocateHeap(ProcessHeap,
0,
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
return STATUS_INSUFFICIENT_RESOURCES;
}
-
+
/* Read new bootsector from SrcPath */
RtlInitUnicodeString(&Name, SrcPath);
-
+
InitializeObjectAttributes(&ObjectAttributes,
&Name,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
-
+
Status = NtOpenFile(&FileHandle,
GENERIC_READ | SYNCHRONIZE,
&ObjectAttributes,
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return Status;
}
-
+
Status = NtReadFile(FileHandle,
NULL,
NULL,
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return Status;
}
-
+
/* Adjust bootsector (copy a part of the FAT16 BPB) */
memcpy(&NewBootSector->OemName,
&OrigBootSector->OemName,
FIELD_OFFSET(FAT_BOOTSECTOR, BootCodeAndData) -
FIELD_OFFSET(FAT_BOOTSECTOR, OemName));
-
+
/* Free the original boot sector */
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
-
+
/* Write new bootsector to RootPath */
RtlInitUnicodeString(&Name, RootPath);
-
+
InitializeObjectAttributes(&ObjectAttributes,
&Name,
0,
NULL,
NULL);
-
+
Status = NtOpenFile(&FileHandle,
GENERIC_WRITE | SYNCHRONIZE,
&ObjectAttributes,
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
return Status;
}
-
+
#if 0
FilePosition.QuadPart = 0;
#endif
NULL,
NULL);
NtClose(FileHandle);
-
+
/* Free the new boot sector */
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
-
+
return Status;
}
return Status;
}
-
/* Allocate buffer for new bootsector */
NewBootSector = RtlAllocateHeap(ProcessHeap,
0,
return Status;
}
+
BOOLEAN
CheckInstallFatBootcodeToPartition(
PUNICODE_STRING SystemRootPath)
#endif
}
+
NTSTATUS
InstallVBRToPartition(
PUNICODE_STRING SystemRootPath,
WCHAR SrcPath[MAX_PATH];
WCHAR DstPath[MAX_PATH];
NTSTATUS Status;
-
+
/* Format the floppy first */
Status = VfatFormat(&FloppyDevice,
FMIFS_FLOPPY,