Do not overwrite the disk signature, if we install the boot code into
the mbr.
Modified: trunk/reactos/subsys/system/usetup/bootsup.c
Modified: trunk/reactos/subsys/system/usetup/usetup.h
_____
Modified: trunk/reactos/subsys/system/usetup/bootsup.c
--- trunk/reactos/subsys/system/usetup/bootsup.c 2005-09-17
21:22:47 UTC (rev 17902)
+++ trunk/reactos/subsys/system/usetup/bootsup.c 2005-09-17
22:00:35 UTC (rev 17903)
@@ -1002,13 +1002,13 @@
UNICODE_STRING Name;
HANDLE FileHandle;
NTSTATUS Status;
- PUCHAR OrigBootSector;
- PUCHAR NewBootSector;
+ PPARTITION_SECTOR OrigBootSector;
+ PPARTITION_SECTOR NewBootSector;
/* Allocate buffer for original bootsector */
- OrigBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap,
- 0,
- SECTORSIZE);
+ OrigBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap,
+ 0,
+
sizeof(PARTITION_SECTOR));
if (OrigBootSector == NULL)
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -1052,9 +1052,9 @@
/* Allocate buffer for new bootsector */
- NewBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap,
- 0,
- SECTORSIZE);
+ NewBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap,
+ 0,
+
sizeof(PARTITION_SECTOR));
if (NewBootSector == NULL)
{
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
@@ -1090,7 +1090,7 @@
NULL,
&IoStatusBlock,
NewBootSector,
- SECTORSIZE,
+ sizeof(PARTITION_SECTOR),
NULL,
NULL);
NtClose(FileHandle);
@@ -1102,9 +1102,9 @@
}
/* Copy partition table from old MBR to new */
- RtlCopyMemory ((NewBootSector + 446),
- (OrigBootSector + 446),
- 4*16 /* Length of partition table */);
+ RtlCopyMemory (&NewBootSector->Signature,
+ &OrigBootSector->Signature,
+ sizeof(PARTITION_SECTOR) - offsetof(PARTITION_SECTOR,
Signature) /* Length of partition table */);
/* Free the original boot sector */
RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
_____
Modified: trunk/reactos/subsys/system/usetup/usetup.h
--- trunk/reactos/subsys/system/usetup/usetup.h 2005-09-17 21:22:47 UTC
(rev 17902)
+++ trunk/reactos/subsys/system/usetup/usetup.h 2005-09-17 22:00:35 UTC
(rev 17903)
@@ -30,6 +30,7 @@
/* C Headers */
#include <ctype.h>
#include <stdio.h>
+#include <stddef.h>
/* PSDK/NDK */
#include <windows.h>
Show replies by date