* Sync to trunk HEAD (r53318).
[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 /* C Headers */
28 #include <ctype.h>
29 #include <stdio.h>
30 #include <stddef.h>
31
32 /* PSDK/NDK */
33 #define WIN32_NO_STATUS
34 #include <windows.h>
35 #define NTOS_MODE_USER
36 #include <ndk/cmfuncs.h>
37 #include <ndk/exfuncs.h>
38 #include <ndk/iofuncs.h>
39 #include <ndk/kefuncs.h>
40 #include <ndk/mmtypes.h>
41 #include <ndk/mmfuncs.h>
42 #include <ndk/obfuncs.h>
43 #include <ndk/psfuncs.h>
44 #include <ndk/rtlfuncs.h>
45 #include <fmifs/fmifs.h>
46
47 /* Filesystem headers */
48 #include <fslib/ext2lib.h>
49 #include <fslib/vfatlib.h>
50 #include <fslib/vfatxlib.h>
51
52 /* DDK Disk Headers */
53 #include <ntddscsi.h>
54
55 /* ReactOS Version */
56 #include <reactos/buildno.h>
57
58 /* Internal Headers */
59 #include "interface/consup.h"
60 #include "partlist.h"
61 #include "inffile.h"
62 #include "inicache.h"
63 #include "progress.h"
64 #ifdef __REACTOS__
65 #include "infros.h"
66 #include "filequeue.h"
67 #endif
68 #include "bootsup.h"
69 #include "registry.h"
70 #include "fslist.h"
71 #include "chkdsk.h"
72 #include "format.h"
73 #include "cabinet.h"
74 #include "filesup.h"
75 #include "drivesup.h"
76 #include "genlist.h"
77 #include "settings.h"
78 #include "host.h"
79 #include "mui.h"
80 #include "errorcode.h"
81
82 #define INITGUID
83 #include <guiddef.h>
84 #include <libs/umpnpmgr/sysguid.h>
85
86 #include <zlib.h>
87
88 extern HANDLE ProcessHeap;
89 extern UNICODE_STRING SourceRootPath;
90 extern UNICODE_STRING SourceRootDir;
91 extern UNICODE_STRING SourcePath;
92 extern BOOLEAN IsUnattendedSetup;
93 extern PWCHAR SelectedLanguageId;
94
95 #ifdef __REACTOS__
96
97 extern VOID InfSetHeap(PVOID Heap);
98 extern VOID InfCloseFile(HINF InfHandle);
99 extern BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn,
100 PINFCONTEXT ContextOut);
101 extern BOOLEAN InfGetBinaryField(PINFCONTEXT Context,
102 ULONG FieldIndex,
103 PUCHAR ReturnBuffer,
104 ULONG ReturnBufferSize,
105 PULONG RequiredSize);
106 extern BOOLEAN InfGetMultiSzField(PINFCONTEXT Context,
107 ULONG FieldIndex,
108 PWSTR ReturnBuffer,
109 ULONG ReturnBufferSize,
110 PULONG RequiredSize);
111 extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
112 ULONG FieldIndex,
113 PWSTR ReturnBuffer,
114 ULONG ReturnBufferSize,
115 PULONG RequiredSize);
116
117 #define SetupCloseInfFile InfCloseFile
118 #define SetupFindNextLine InfFindNextLine
119 #define SetupGetBinaryField InfGetBinaryField
120 #define SetupGetMultiSzFieldW InfGetMultiSzField
121 #define SetupGetStringFieldW InfGetStringField
122
123 #endif /* __REACTOS__ */
124
125 #ifndef _PAGE_NUMBER_DEFINED
126 #define _PAGE_NUMBER_DEFINED
127 typedef enum _PAGE_NUMBER
128 {
129 START_PAGE,
130 LANGUAGE_PAGE,
131 INTRO_PAGE,
132 LICENSE_PAGE,
133 INSTALL_INTRO_PAGE,
134
135 // SCSI_CONTROLLER_PAGE,
136
137 DEVICE_SETTINGS_PAGE,
138 COMPUTER_SETTINGS_PAGE,
139 DISPLAY_SETTINGS_PAGE,
140 KEYBOARD_SETTINGS_PAGE,
141 LAYOUT_SETTINGS_PAGE,
142
143 SELECT_PARTITION_PAGE,
144 CREATE_PARTITION_PAGE,
145 DELETE_PARTITION_PAGE,
146
147 SELECT_FILE_SYSTEM_PAGE,
148 FORMAT_PARTITION_PAGE,
149 CHECK_FILE_SYSTEM_PAGE,
150
151 PREPARE_COPY_PAGE,
152 INSTALL_DIRECTORY_PAGE,
153 FILE_COPY_PAGE,
154 REGISTRY_PAGE,
155 BOOT_LOADER_PAGE,
156 BOOT_LOADER_FLOPPY_PAGE,
157 BOOT_LOADER_HARDDISK_MBR_PAGE,
158 BOOT_LOADER_HARDDISK_VBR_PAGE,
159
160 REPAIR_INTRO_PAGE,
161
162 SUCCESS_PAGE,
163 QUIT_PAGE,
164 FLUSH_PAGE,
165 REBOOT_PAGE, /* virtual page */
166 } PAGE_NUMBER, *PPAGE_NUMBER;
167 #endif
168
169 #define POPUP_WAIT_NONE 0
170 #define POPUP_WAIT_ANY_KEY 1
171 #define POPUP_WAIT_ENTER 2
172
173 #define LIST_FOR_EACH(elem, list, type, field) \
174 for ((elem) = CONTAINING_RECORD((list)->Flink, type, field); \
175 &(elem)->field != (list) || (elem == NULL); \
176 (elem) = CONTAINING_RECORD((elem)->field.Flink, type, field))
177
178 #define InsertAscendingList(ListHead, NewEntry, Type, ListEntryField, SortField)\
179 {\
180 PLIST_ENTRY current;\
181 \
182 current = (ListHead)->Flink;\
183 while (current != (ListHead))\
184 {\
185 if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >=\
186 (NewEntry)->SortField)\
187 {\
188 break;\
189 }\
190 current = current->Flink;\
191 }\
192 \
193 InsertTailList(current, &((NewEntry)->ListEntryField));\
194 }
195
196 /* EOF */