Index: base/setup/usetup/interface/usetup.c =================================================================== --- base/setup/usetup/interface/usetup.c (revision 74470) +++ base/setup/usetup/interface/usetup.c (working copy) @@ -4417,6 +4417,7 @@ { UCHAR PartitionType; NTSTATUS Status; + WCHAR OriginalDevicePathBuffer[MAX_PATH]; WCHAR DestinationDevicePathBuffer[MAX_PATH]; WCHAR SourceMbrPathBuffer[MAX_PATH]; WCHAR DstPath[MAX_PATH]; @@ -4435,6 +4436,9 @@ } /* Step 2: Write the MBR */ + swprintf(OriginalDevicePathBuffer, + L"\\Device\\Harddisk%d\\Partition0", + PartitionList->OriginalSystemDisk->DiskNumber); swprintf(DestinationDevicePathBuffer, L"\\Device\\Harddisk%d\\Partition0", PartitionList->SystemDisk->DiskNumber); @@ -4445,14 +4449,20 @@ DPRINT1("Install MBR bootcode: %S ==> %S\n", SourceMbrPathBuffer, DestinationDevicePathBuffer); - if (IsThereAValidBootSector(DestinationDevicePathBuffer)) + /* + * We need to save original MBR only if system disk is the same and already contains valid MBR + * This is just for reference to user if he wants to write back his old MBR back, because we + * are overwriting it, otherwise it is not used. + */ + if (IsThereAValidBootSector(OriginalDevicePathBuffer) && + PartitionList->OriginalSystemDisk->DiskNumber == PartitionList->SystemDisk->DiskNumber) { /* Save current MBR */ wcscpy(DstPath, SystemRootPath.Buffer); wcscat(DstPath, L"\\mbr.old"); - DPRINT1("Save MBR: %S ==> %S\n", DestinationDevicePathBuffer, DstPath); - Status = SaveBootSector(DestinationDevicePathBuffer, DstPath, sizeof(PARTITION_SECTOR)); + DPRINT1("Save MBR: %S ==> %S\n", OriginalDevicePathBuffer, DstPath); + Status = SaveBootSector(OriginalDevicePathBuffer, DstPath, sizeof(PARTITION_SECTOR)); if (!NT_SUCCESS(Status)) { DPRINT1("SaveBootSector() failed (Status %lx)\n", Status);