- Do only allow to install reactos on disks which are visible by the bios.
[reactos.git] / reactos / subsys / system / usetup / fslist.c
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2003 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /*
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: subsys/system/usetup/fslist.c
23 * PURPOSE: Filesystem list functions
24 * PROGRAMMER: Eric Kohl
25 * Casper S. Hornstrup (chorns@users.sourceforge.net)
26 */
27
28 #include <usetup.h>
29
30 #define NDEBUG
31 #include <debug.h>
32
33 /* FUNCTIONS ****************************************************************/
34
35 PFILE_SYSTEM_LIST
36 CreateFileSystemList (SHORT Left,
37 SHORT Top,
38 BOOLEAN ForceFormat,
39 FILE_SYSTEM ForceFileSystem)
40 {
41 PFILE_SYSTEM_LIST List;
42
43 List = (PFILE_SYSTEM_LIST)RtlAllocateHeap (ProcessHeap, 0, sizeof(FILE_SYSTEM_LIST));
44 if (List == NULL)
45 return NULL;
46
47 List->Left = Left;
48 List->Top = Top;
49
50 List->ForceFormat = ForceFormat;
51 List->FileSystemCount = 1;
52 if (ForceFormat)
53 {
54 List->CurrentFileSystem = ForceFileSystem;
55 }
56 else
57 {
58 List->FileSystemCount++;
59 List->CurrentFileSystem = FsKeep;
60 }
61
62 return List;
63 }
64
65
66 VOID
67 DestroyFileSystemList (PFILE_SYSTEM_LIST List)
68 {
69 RtlFreeHeap (ProcessHeap, 0, List);
70 }
71
72
73 VOID
74 DrawFileSystemList (PFILE_SYSTEM_LIST List)
75 {
76 COORD coPos;
77 ULONG Written;
78 ULONG Index;
79
80 Index = 0;
81
82 coPos.X = List->Left;
83 coPos.Y = List->Top + Index;
84 FillConsoleOutputAttribute (0x17,
85 50,
86 coPos,
87 &Written);
88 FillConsoleOutputCharacter (' ',
89 50,
90 coPos,
91 &Written);
92
93 if (List->CurrentFileSystem == FsFat)
94 {
95 SetInvertedTextXY (List->Left,
96 List->Top + Index,
97 " Format partition as FAT file system ");
98 }
99 else
100 {
101 SetTextXY (List->Left,
102 List->Top + Index,
103 " Format partition as FAT file system ");
104 }
105 Index++;
106
107 if (List->ForceFormat == FALSE)
108 {
109 coPos.X = List->Left;
110 coPos.Y = List->Top + Index;
111 FillConsoleOutputAttribute (0x17,
112 50,
113 coPos,
114 &Written);
115 FillConsoleOutputCharacter (' ',
116 50,
117 coPos,
118 &Written);
119
120 if (List->CurrentFileSystem == FsKeep)
121 {
122 SetInvertedTextXY (List->Left,
123 List->Top + Index,
124 " Keep current file system (no changes) ");
125 }
126 else
127 {
128 SetTextXY (List->Left,
129 List->Top + Index,
130 " Keep current file system (no changes) ");
131 }
132 }
133 }
134
135
136 VOID
137 ScrollDownFileSystemList (PFILE_SYSTEM_LIST List)
138 {
139 if ((ULONG) List->CurrentFileSystem < List->FileSystemCount - 1)
140 {
141 (ULONG) List->CurrentFileSystem++;
142 DrawFileSystemList (List);
143 }
144 }
145
146
147 VOID
148 ScrollUpFileSystemList (PFILE_SYSTEM_LIST List)
149 {
150 if ((ULONG) List->CurrentFileSystem > 0)
151 {
152 (ULONG) List->CurrentFileSystem--;
153 DrawFileSystemList (List);
154 }
155 }
156
157 /* EOF */