[RAPPS] Making checkboxes useful WIP
[reactos.git] / reactos / base / setup / setup / setup.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS GUI/console setup
4 * FILE: base/setup/setup/setup.c
5 * PURPOSE: Second stage setup
6 * PROGRAMMER: Eric Kohl
7 */
8
9 #include <stdarg.h>
10 #include <windef.h>
11 #include <winbase.h>
12
13 #define NDEBUG
14 #include <debug.h>
15
16 typedef INT (WINAPI *PINSTALL_REACTOS)(INT argc, WCHAR** argv);
17
18 /* FUNCTIONS ****************************************************************/
19
20 static
21 INT
22 RunInstallReactOS(INT argc, WCHAR* argv[])
23 {
24 INT RetVal;
25 HMODULE hDll;
26 PINSTALL_REACTOS InstallReactOS;
27
28 hDll = LoadLibraryW(L"syssetup.dll");
29 if (hDll == NULL)
30 {
31 DPRINT("Failed to load 'syssetup.dll'!\n");
32 return GetLastError();
33 }
34 DPRINT("Loaded 'syssetup.dll'!\n");
35
36 /* Call the standard Windows-compatible export */
37 InstallReactOS = (PINSTALL_REACTOS)GetProcAddress(hDll, "InstallWindowsNt");
38 if (InstallReactOS == NULL)
39 {
40 RetVal = GetLastError();
41 DPRINT("Failed to get address for 'InstallWindowsNt()'!\n");
42 }
43 else
44 {
45 RetVal = InstallReactOS(argc, argv);
46 }
47
48 FreeLibrary(hDll);
49 return RetVal;
50 }
51
52
53 /* Called from wmainCRTStartup */
54 INT wmain(INT argc, WCHAR* argv[])
55 {
56 LPWSTR CmdLine, p;
57
58 // NOTE: Temporary, until we correctly use argc/argv.
59 CmdLine = GetCommandLineW();
60 DPRINT("CmdLine: <%S>\n", CmdLine);
61
62 p = wcschr(CmdLine, L'-');
63 if (p == NULL)
64 return ERROR_INVALID_PARAMETER;
65 p++;
66
67 // NOTE: On Windows, "mini" means "minimal UI", and can be used
68 // in addition to "newsetup"; these options are not exclusive.
69 if (_wcsicmp(p, L"newsetup") == 0 || _wcsicmp(p, L"mini") == 0)
70 {
71 RunInstallReactOS(argc, argv);
72 }
73
74 #if 0
75 /* Add new setup types here */
76 else if (...)
77 {
78
79 }
80 #endif
81
82 return 0;
83 }
84
85 /* EOF */