xref: /reactos/base/system/diskpart/active.c (revision 1734f297)
1 /*
2  * PROJECT:         ReactOS DiskPart
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            base/system/diskpart/active.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 
15 BOOL
16 active_main(
17     _In_ INT argc,
18     _In_ PWSTR *argv)
19 {
20     NTSTATUS Status;
21 
22     DPRINT("Active()\n");
23 
24     if (CurrentDisk == NULL)
25     {
26         ConResPuts(StdOut, IDS_SELECT_NO_DISK);
27         return TRUE;
28     }
29 
30     if (CurrentPartition == NULL)
31     {
32         ConResPuts(StdOut, IDS_SELECT_NO_PARTITION);
33         return TRUE;
34     }
35 
36     if (CurrentPartition->BootIndicator)
37     {
38         ConResPuts(StdOut, IDS_ACTIVE_ALREADY);
39         return TRUE;
40     }
41 
42     CurrentPartition->BootIndicator = TRUE;
43     CurrentDisk->Dirty = TRUE;
44     UpdateDiskLayout(CurrentDisk);
45     Status = WritePartitions(CurrentDisk);
46     if (NT_SUCCESS(Status))
47     {
48         ConResPuts(StdOut, IDS_ACTIVE_SUCCESS);
49     }
50     else
51     {
52         ConResPuts(StdOut, IDS_ACTIVE_FAIL);
53     }
54 
55     return TRUE;
56 }
57