Reactos
at master 63 lines 1.4 kB view raw
1/* 2 * PROJECT: ReactOS DiskPart 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: base/system/diskpart/inactive.c 5 * PURPOSE: Manages all the partitions of the OS in an interactive way. 6 * PROGRAMMERS: Lee Schroeder 7 */ 8 9#include "diskpart.h" 10 11#define NDEBUG 12#include <debug.h> 13 14 15EXIT_CODE 16inactive_main( 17 _In_ INT argc, 18 _In_ PWSTR *argv) 19{ 20 NTSTATUS Status; 21 22 DPRINT("Inactive()\n"); 23 24 if (CurrentDisk == NULL) 25 { 26 ConResPuts(StdOut, IDS_SELECT_NO_DISK); 27 return EXIT_SUCCESS; 28 } 29 30 if (CurrentPartition == NULL) 31 { 32 ConResPuts(StdOut, IDS_SELECT_NO_PARTITION); 33 return EXIT_SUCCESS; 34 } 35 36 if (CurrentDisk->PartitionStyle == PARTITION_STYLE_MBR) 37 { 38 if (!CurrentPartition->Mbr.BootIndicator) 39 { 40 ConResPuts(StdOut, IDS_INACTIVE_ALREADY); 41 return EXIT_SUCCESS; 42 } 43 44 CurrentPartition->Mbr.BootIndicator = FALSE; 45 CurrentDisk->Dirty = TRUE; 46 UpdateMbrDiskLayout(CurrentDisk); 47 Status = WriteMbrPartitions(CurrentDisk); 48 if (NT_SUCCESS(Status)) 49 { 50 ConResPuts(StdOut, IDS_INACTIVE_SUCCESS); 51 } 52 else 53 { 54 ConResPuts(StdOut, IDS_INACTIVE_FAIL); 55 } 56 } 57 else 58 { 59 ConResPuts(StdOut, IDS_INACTIVE_NO_MBR); 60 } 61 62 return EXIT_SUCCESS; 63}