mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
- Fixed the destination path for installing freeldr on a floppy.
- Used NtOpenFile for accessing the mbr or the boot sector. svn path=/trunk/; revision=14568
This commit is contained in:
parent
d36e7a745d
commit
71160a6cae
1 changed files with 17 additions and 25 deletions
|
@ -1134,19 +1134,15 @@ InstallMbrBootCodeToDisk (PWSTR SrcPath,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtCreateFile(&FileHandle,
|
Status = NtOpenFile(&FileHandle,
|
||||||
FILE_WRITE_ACCESS,
|
FILE_WRITE_ACCESS | FILE_WRITE_ATTRIBUTES,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
NULL,
|
0,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY);
|
||||||
0,
|
|
||||||
FILE_OVERWRITE_IF,
|
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY,
|
|
||||||
NULL,
|
|
||||||
0);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
|
||||||
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1295,19 +1291,15 @@ InstallFat16BootCodeToDisk(PWSTR SrcPath,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtCreateFile(&FileHandle,
|
Status = NtOpenFile(&FileHandle,
|
||||||
FILE_WRITE_ACCESS,
|
FILE_WRITE_ACCESS | FILE_WRITE_ATTRIBUTES,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
NULL,
|
0,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY);
|
||||||
0,
|
|
||||||
FILE_OVERWRITE_IF,
|
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY,
|
|
||||||
NULL,
|
|
||||||
0);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
DPRINT1("NtOpenFile() failed (Status %lx)\n", Status);
|
||||||
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
RtlFreeHeap(ProcessHeap, 0, NewBootSector);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -2080,7 +2072,7 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath,
|
||||||
wcscpy(SrcPath, SourceRootPath->Buffer);
|
wcscpy(SrcPath, SourceRootPath->Buffer);
|
||||||
wcscat(SrcPath, L"\\loader\\freeldr.sys");
|
wcscat(SrcPath, L"\\loader\\freeldr.sys");
|
||||||
|
|
||||||
wcscat(DstPath, L"\\Device\\Floppy0\\freeldr.sys");
|
wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.sys");
|
||||||
|
|
||||||
DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
|
DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath);
|
||||||
Status = SetupCopyFile(SrcPath, DstPath);
|
Status = SetupCopyFile(SrcPath, DstPath);
|
||||||
|
@ -2091,7 +2083,7 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create new 'freeldr.ini' */
|
/* Create new 'freeldr.ini' */
|
||||||
wcscat(DstPath, L"\\Device\\Floppy0\\freeldr.ini");
|
wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.ini");
|
||||||
|
|
||||||
DPRINT("Create new 'freeldr.ini'\n");
|
DPRINT("Create new 'freeldr.ini'\n");
|
||||||
Status = CreateFreeLoaderIniForReactos(DstPath,
|
Status = CreateFreeLoaderIniForReactos(DstPath,
|
||||||
|
@ -2106,7 +2098,7 @@ InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath,
|
||||||
wcscpy(SrcPath, SourceRootPath->Buffer);
|
wcscpy(SrcPath, SourceRootPath->Buffer);
|
||||||
wcscat(SrcPath, L"\\loader\\fat.bin");
|
wcscat(SrcPath, L"\\loader\\fat.bin");
|
||||||
|
|
||||||
wcscat(DstPath, L"\\Device\\Floppy0");
|
wcscpy(DstPath, L"\\Device\\Floppy0");
|
||||||
|
|
||||||
DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath);
|
DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath);
|
||||||
Status = InstallFat16BootCodeToDisk(SrcPath,
|
Status = InstallFat16BootCodeToDisk(SrcPath,
|
||||||
|
|
Loading…
Reference in a new issue