* Sync with recent trunk (r52637).
[reactos.git] / base / setup / usetup / usetup.h
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2002 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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 /*
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: subsys/system/usetup/usetup.h
23 * PURPOSE: Text-mode setup
24 * PROGRAMMER: Eric Kohl
25 */
26
27 #pragma once
28
29 /* C Headers */
30 #include <ctype.h>
31 #include <stdio.h>
32 #include <stddef.h>
33
34 /* PSDK/NDK */
35 #define WIN32_NO_STATUS
36 #include <windows.h>
37 #define NTOS_MODE_USER
38 #include <ndk/ntndk.h>
39 #include <fmifs/fmifs.h>
40
41 /* VFAT */
42 #include <fslib/vfatlib.h>
43
44 /* DDK Disk Headers */
45 #include <ntddscsi.h>
46
47 /* ReactOS Version */
48 #include <reactos/buildno.h>
49
50 /* Internal Headers */
51 #include "interface/consup.h"
52 #include "partlist.h"
53 #include "infros.h"
54 #include "inffile.h"
55 #include "inicache.h"
56 #include "progress.h"
57 #ifdef __REACTOS__
58 #include "filequeue.h"
59 #endif
60 #include "bootsup.h"
61 #include "registry.h"
62 #include "fslist.h"
63 #include "chkdsk.h"
64 #include "format.h"
65 #include "cabinet.h"
66 #include "filesup.h"
67 #include "drivesup.h"
68 #include "genlist.h"
69 #include "settings.h"
70 #include "host.h"
71 #include "mui.h"
72 #include "errorcode.h"
73
74 extern HANDLE ProcessHeap;
75 extern UNICODE_STRING SourceRootPath;
76 extern UNICODE_STRING SourceRootDir;
77 extern UNICODE_STRING SourcePath;
78 extern BOOLEAN IsUnattendedSetup;
79 extern PWCHAR SelectedLanguageId;
80
81 #ifdef __REACTOS__
82
83 extern VOID InfSetHeap(PVOID Heap);
84 extern VOID InfCloseFile(HINF InfHandle);
85 extern BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn,
86 PINFCONTEXT ContextOut);
87 extern BOOLEAN InfGetBinaryField(PINFCONTEXT Context,
88 ULONG FieldIndex,
89 PUCHAR ReturnBuffer,
90 ULONG ReturnBufferSize,
91 PULONG RequiredSize);
92 extern BOOLEAN InfGetMultiSzField(PINFCONTEXT Context,
93 ULONG FieldIndex,
94 PWSTR ReturnBuffer,
95 ULONG ReturnBufferSize,
96 PULONG RequiredSize);
97 extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
98 ULONG FieldIndex,
99 PWSTR ReturnBuffer,
100 ULONG ReturnBufferSize,
101 PULONG RequiredSize);
102
103 #define SetupCloseInfFile InfCloseFile
104 #define SetupFindNextLine InfFindNextLine
105 #define SetupGetBinaryField InfGetBinaryField
106 #define SetupGetMultiSzFieldW InfGetMultiSzField
107 #define SetupGetStringFieldW InfGetStringField
108
109 #endif /* __REACTOS__ */
110
111 typedef enum _PAGE_NUMBER
112 {
113 START_PAGE,
114 LANGUAGE_PAGE,
115 INTRO_PAGE,
116 LICENSE_PAGE,
117 INSTALL_INTRO_PAGE,
118
119 // SCSI_CONTROLLER_PAGE,
120
121 DEVICE_SETTINGS_PAGE,
122 COMPUTER_SETTINGS_PAGE,
123 DISPLAY_SETTINGS_PAGE,
124 KEYBOARD_SETTINGS_PAGE,
125 LAYOUT_SETTINGS_PAGE,
126
127 SELECT_PARTITION_PAGE,
128 CREATE_PARTITION_PAGE,
129 DELETE_PARTITION_PAGE,
130
131 SELECT_FILE_SYSTEM_PAGE,
132 FORMAT_PARTITION_PAGE,
133 CHECK_FILE_SYSTEM_PAGE,
134
135 PREPARE_COPY_PAGE,
136 INSTALL_DIRECTORY_PAGE,
137 FILE_COPY_PAGE,
138 REGISTRY_PAGE,
139 BOOT_LOADER_PAGE,
140 BOOT_LOADER_FLOPPY_PAGE,
141 BOOT_LOADER_HARDDISK_MBR_PAGE,
142 BOOT_LOADER_HARDDISK_VBR_PAGE,
143
144 REPAIR_INTRO_PAGE,
145
146 SUCCESS_PAGE,
147 QUIT_PAGE,
148 FLUSH_PAGE,
149 REBOOT_PAGE, /* virtual page */
150 } PAGE_NUMBER, *PPAGE_NUMBER;
151
152 #define POPUP_WAIT_NONE 0
153 #define POPUP_WAIT_ANY_KEY 1
154 #define POPUP_WAIT_ENTER 2
155
156 #define LIST_FOR_EACH(elem, list, type, field) \
157 for ((elem) = CONTAINING_RECORD((list)->Flink, type, field); \
158 &(elem)->field != (list) || (elem == NULL); \
159 (elem) = CONTAINING_RECORD((elem)->field.Flink, type, field))
160
161 #define InsertAscendingList(ListHead, NewEntry, Type, ListEntryField, SortField)\
162 {\
163 PLIST_ENTRY current;\
164 \
165 current = (ListHead)->Flink;\
166 while (current != (ListHead))\
167 {\
168 if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >=\
169 (NewEntry)->SortField)\
170 {\
171 break;\
172 }\
173 current = current->Flink;\
174 }\
175 \
176 InsertTailList(current, &((NewEntry)->ListEntryField));\
177 }
178
179 /* EOF */