[USERINIT]
[reactos.git] / reactos / base / system / userinit / livecd.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Userinit Logon Application
4 * FILE: base/system/userinit/livecd.c
5 * PROGRAMMERS: Eric Kohl
6 */
7
8 #include "userinit.h"
9
10 HWND hList;
11 HWND hLocaleList;
12 BOOL bSpain = FALSE;
13
14 static VOID
15 InitImageInfo(PIMGINFO ImgInfo)
16 {
17 BITMAP bitmap;
18
19 ZeroMemory(ImgInfo, sizeof(*ImgInfo));
20
21 ImgInfo->hBitmap = LoadImage(hInstance,
22 MAKEINTRESOURCE(IDB_ROSLOGO),
23 IMAGE_BITMAP,
24 0,
25 0,
26 LR_DEFAULTCOLOR);
27
28 if (ImgInfo->hBitmap != NULL)
29 {
30 GetObject(ImgInfo->hBitmap, sizeof(BITMAP), &bitmap);
31
32 ImgInfo->cxSource = bitmap.bmWidth;
33 ImgInfo->cySource = bitmap.bmHeight;
34 }
35 }
36
37
38 BOOL
39 IsLiveCD(VOID)
40 {
41 HKEY ControlKey = NULL;
42 LPWSTR SystemStartOptions = NULL;
43 LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
44 LONG rc;
45 BOOL ret = FALSE;
46
47 TRACE("IsLiveCD()\n");
48
49 rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
50 REGSTR_PATH_CURRENT_CONTROL_SET,
51 0,
52 KEY_QUERY_VALUE,
53 &ControlKey);
54 if (rc != ERROR_SUCCESS)
55 {
56 WARN("RegOpenKeyEx() failed with error %lu\n", rc);
57 goto cleanup;
58 }
59
60 rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
61 if (rc != ERROR_SUCCESS)
62 {
63 WARN("ReadRegSzKey() failed with error %lu\n", rc);
64 goto cleanup;
65 }
66
67 /* Check for CONSOLE switch in SystemStartOptions */
68 CurrentOption = SystemStartOptions;
69 while (CurrentOption)
70 {
71 NextOption = wcschr(CurrentOption, L' ');
72 if (NextOption)
73 *NextOption = L'\0';
74 if (_wcsicmp(CurrentOption, L"MININT") == 0)
75 {
76 TRACE("Found 'MININT' boot option\n");
77 ret = TRUE;
78 goto cleanup;
79 }
80 CurrentOption = NextOption ? NextOption + 1 : NULL;
81 }
82
83 cleanup:
84 if (ControlKey != NULL)
85 RegCloseKey(ControlKey);
86 HeapFree(GetProcessHeap(), 0, SystemStartOptions);
87
88 TRACE("IsLiveCD() returning %d\n", ret);
89
90 return ret;
91 }
92
93
94 static BOOL CALLBACK
95 LocalesEnumProc(LPTSTR lpLocale)
96 {
97 LCID lcid;
98 WCHAR lang[255];
99 INT index;
100 BOOL bNoShow = FALSE;
101
102 lcid = wcstoul(lpLocale, NULL, 16);
103
104 /* Display only languages with installed support */
105 if (!IsValidLocale(lcid, LCID_INSTALLED))
106 return TRUE;
107
108 if (lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) ||
109 lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT))
110 {
111 if (bSpain == FALSE)
112 {
113 LoadStringW(hInstance, IDS_SPAIN, lang, 255);
114 bSpain = TRUE;
115 }
116 else
117 {
118 bNoShow = TRUE;
119 }
120 }
121 else
122 {
123 GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(WCHAR));
124 }
125
126 if (bNoShow == FALSE)
127 {
128 index = SendMessageW(hList,
129 CB_ADDSTRING,
130 0,
131 (LPARAM)lang);
132
133 SendMessageW(hList,
134 CB_SETITEMDATA,
135 index,
136 (LPARAM)lcid);
137 }
138
139 return TRUE;
140 }
141
142
143 static VOID
144 CreateLanguagesList(HWND hwnd)
145 {
146 WCHAR langSel[255];
147
148 hList = hwnd;
149 bSpain = FALSE;
150 EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
151
152 /* Select current locale */
153 /* or should it be System and not user? */
154 GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)/sizeof(WCHAR));
155
156 SendMessageW(hList,
157 CB_SELECTSTRING,
158 -1,
159 (LPARAM)langSel);
160 }
161
162
163 #if 0
164 static
165 BOOL
166 GetLayoutID(LPWSTR szLayoutNum, LPWSTR szLCID)
167 {
168 DWORD dwBufLen;
169 DWORD dwRes;
170 HKEY hKey;
171 WCHAR szTempLCID[9];
172
173 // Get the Layout ID
174 if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
175 {
176 dwBufLen = sizeof(szTempLCID);
177 dwRes = RegQueryValueExW(hKey, szLayoutNum, NULL, NULL, (LPBYTE)szTempLCID, &dwBufLen);
178
179 if (dwRes != ERROR_SUCCESS)
180 {
181 RegCloseKey(hKey);
182 return FALSE;
183 }
184
185 RegCloseKey(hKey);
186 }
187
188 // Look for a substitude of this layout
189 if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
190 {
191 dwBufLen = sizeof(szTempLCID);
192
193 if (RegQueryValueExW(hKey, szTempLCID, NULL, NULL, (LPBYTE)szLCID, &dwBufLen) != ERROR_SUCCESS)
194 {
195 // No substitute found, then use the old LCID
196 wcscpy(szLCID, szTempLCID);
197 }
198
199 RegCloseKey(hKey);
200 }
201 else
202 {
203 // Substitutes key couldn't be opened, so use the old LCID
204 wcscpy(szLCID, szTempLCID);
205 }
206
207 return TRUE;
208 }
209 #endif
210
211
212 static
213 BOOL
214 GetLayoutName(
215 LPCWSTR szLCID,
216 LPWSTR szName)
217 {
218 HKEY hKey;
219 DWORD dwBufLen;
220 WCHAR szBuf[MAX_PATH], szDispName[MAX_PATH], szIndex[MAX_PATH], szPath[MAX_PATH];
221 HANDLE hLib;
222 unsigned i, j, k;
223
224 wsprintf(szBuf, L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s", szLCID);
225
226 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, (LPCTSTR)szBuf, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
227 {
228 dwBufLen = sizeof(szBuf);
229
230 if (RegQueryValueExW(hKey, L"Layout Display Name", NULL, NULL, (LPBYTE)szDispName, &dwBufLen) == ERROR_SUCCESS)
231 {
232 if (szDispName[0] == '@')
233 {
234 for (i = 0; i < wcslen(szDispName); i++)
235 {
236 if ((szDispName[i] == ',') && (szDispName[i + 1] == '-'))
237 {
238 for (j = i + 2, k = 0; j < wcslen(szDispName)+1; j++, k++)
239 {
240 szIndex[k] = szDispName[j];
241 }
242 szDispName[i - 1] = '\0';
243 break;
244 }
245 else
246 szDispName[i] = szDispName[i + 1];
247 }
248
249 if (ExpandEnvironmentStringsW(szDispName, szPath, MAX_PATH))
250 {
251 hLib = LoadLibraryW(szPath);
252 if (hLib)
253 {
254 if (LoadStringW(hLib, _wtoi(szIndex), szPath, sizeof(szPath) / sizeof(WCHAR)) != 0)
255 {
256 wcscpy(szName, szPath);
257 RegCloseKey(hKey);
258 return TRUE;
259 }
260 FreeLibrary(hLib);
261 }
262 }
263 }
264 }
265
266 dwBufLen = sizeof(szBuf);
267
268 if (RegQueryValueExW(hKey, L"Layout Text", NULL, NULL, (LPBYTE)szName, &dwBufLen) == ERROR_SUCCESS)
269 {
270 RegCloseKey(hKey);
271 return TRUE;
272 }
273 }
274
275 return FALSE;
276 }
277
278
279 static
280 VOID
281 SetKeyboardLayout(
282 HWND hwnd)
283 {
284 #if 0
285 INT iCurSel;
286 PWSTR pszLCID;
287 HKL hKl;
288 WCHAR szLCID[9];
289
290 iCurSel = SendMessageW(hwnd, CB_GETCURSEL, 0, 0);
291 if (iCurSel == CB_ERR)
292 return;
293
294 pszLCID = (PWSTR)SendMessageW(hwnd, CB_GETITEMDATA, iCurSel, 0);
295 if (pszLCID == (PWSTR)CB_ERR)
296 return;
297
298 if (GetLayoutID(pszLCID, szLCID))
299 {
300 hKl = LoadKeyboardLayoutW(szLCID, KLF_ACTIVATE | KLF_SETFORPROCESS);
301 SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hKl, SPIF_SENDWININICHANGE);
302 }
303 #endif
304 }
305
306
307 static
308 VOID
309 SelectKeyboardForLanguage(
310 HWND hwnd,
311 LCID lcid)
312 {
313 INT i, nCount;
314 LCID LayoutId;
315
316 TRACE("LCID: %08lx\n", lcid);
317 TRACE("LangID: %04lx\n", LANGIDFROMLCID(lcid));
318
319 nCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
320
321 for (i = 0; i < nCount; i++)
322 {
323 LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
324 TRACE("Layout: %08lx\n", LayoutId);
325
326 if (LANGIDFROMLCID(LayoutId) == LANGIDFROMLCID(lcid))
327 {
328 TRACE("Found 1: %08lx --> %08lx\n", LayoutId, lcid);
329 SendMessageW(hwnd, CB_SETCURSEL, i, 0);
330 return;
331 }
332 }
333
334 for (i = 0; i < nCount; i++)
335 {
336 LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
337 TRACE("Layout: %08lx\n", LayoutId);
338
339 if (PRIMARYLANGID(LayoutId) == PRIMARYLANGID(lcid))
340 {
341 TRACE("Found 2: %08lx --> %08lx\n", LayoutId, lcid);
342 SendMessageW(hwnd, CB_SETCURSEL, i, 0);
343 return;
344 }
345 }
346
347 TRACE("No match found!\n");
348 }
349
350
351 static
352 VOID
353 CreateKeyboardLayoutList(
354 HWND hItemsList)
355 {
356 HKEY hKey;
357 WCHAR szLayoutID[9], KeyName[MAX_PATH];
358 DWORD dwIndex = 0;
359 DWORD dwSize;
360 INT iIndex;
361 LONG lError;
362 ULONG ulLayoutID;
363
364 lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
365 L"System\\CurrentControlSet\\Control\\Keyboard Layouts",
366 0,
367 KEY_ENUMERATE_SUB_KEYS,
368 &hKey);
369 if (lError != ERROR_SUCCESS)
370 return;
371
372 while (TRUE)
373 {
374 dwSize = sizeof(szLayoutID) / sizeof(WCHAR);
375
376 lError = RegEnumKeyExW(hKey,
377 dwIndex,
378 szLayoutID,
379 &dwSize,
380 NULL,
381 NULL,
382 NULL,
383 NULL);
384 if (lError != ERROR_SUCCESS)
385 break;
386
387 GetLayoutName(szLayoutID, KeyName);
388
389 iIndex = (INT)SendMessageW(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
390
391 ulLayoutID = wcstoul(szLayoutID, NULL, 16);
392 SendMessageW(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)ulLayoutID);
393
394 // FIXME!
395 if (wcscmp(szLayoutID, L"00000409") == 0)
396 {
397 SendMessageW(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0);
398 }
399
400 dwIndex++;
401 }
402
403 RegCloseKey(hKey);
404 }
405
406
407 static
408 VOID
409 InitializeDefaultUserLocale(
410 PLCID pNewLcid)
411 {
412 WCHAR szBuffer[80];
413 PWSTR ptr;
414 HKEY hLocaleKey;
415 DWORD ret;
416 DWORD dwSize;
417 LCID lcid;
418 INT i;
419
420 struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
421 /* Number */
422 {LOCALE_SDECIMAL, L"sDecimal"},
423 {LOCALE_STHOUSAND, L"sThousand"},
424 {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
425 {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
426 {LOCALE_SGROUPING, L"sGrouping"},
427 {LOCALE_SLIST, L"sList"},
428 {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
429 {LOCALE_INEGNUMBER, L"iNegNumber"},
430 {LOCALE_IDIGITS, L"iDigits"},
431 {LOCALE_ILZERO, L"iLZero"},
432 {LOCALE_IMEASURE, L"iMeasure"},
433 {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
434
435 /* Currency */
436 {LOCALE_SCURRENCY, L"sCurrency"},
437 {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
438 {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
439 {LOCALE_SMONGROUPING, L"sMonGrouping"},
440 {LOCALE_ICURRENCY, L"iCurrency"},
441 {LOCALE_INEGCURR, L"iNegCurr"},
442 {LOCALE_ICURRDIGITS, L"iCurrDigits"},
443
444 /* Time */
445 {LOCALE_STIMEFORMAT, L"sTimeFormat"},
446 {LOCALE_STIME, L"sTime"},
447 {LOCALE_S1159, L"s1159"},
448 {LOCALE_S2359, L"s2359"},
449 {LOCALE_ITIME, L"iTime"},
450 {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
451 {LOCALE_ITLZERO, L"iTLZero"},
452
453 /* Date */
454 {LOCALE_SLONGDATE, L"sLongDate"},
455 {LOCALE_SSHORTDATE, L"sShortDate"},
456 {LOCALE_SDATE, L"sDate"},
457 {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
458 {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
459 {LOCALE_IDATE, L"iDate"},
460 {LOCALE_ICALENDARTYPE, L"iCalendarType"},
461
462 /* Misc */
463 {LOCALE_SCOUNTRY, L"sCountry"},
464 {LOCALE_SLANGUAGE, L"sLanguage"},
465 {LOCALE_ICOUNTRY, L"iCountry"},
466 {0, NULL}};
467
468 ret = RegOpenKeyExW(HKEY_USERS,
469 L".DEFAULT\\Control Panel\\International",
470 0,
471 KEY_READ | KEY_WRITE,
472 &hLocaleKey);
473 if (ret != ERROR_SUCCESS)
474 {
475 return;
476 }
477
478 if (pNewLcid == NULL)
479 {
480 dwSize = 9 * sizeof(WCHAR);
481 ret = RegQueryValueExW(hLocaleKey,
482 L"Locale",
483 NULL,
484 NULL,
485 (PBYTE)szBuffer,
486 &dwSize);
487 if (ret != ERROR_SUCCESS)
488 goto done;
489
490 lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
491 if (lcid == 0)
492 goto done;
493 }
494 else
495 {
496 lcid = *pNewLcid;
497
498 swprintf(szBuffer, L"%08lx", lcid);
499 RegSetValueExW(hLocaleKey,
500 L"Locale",
501 0,
502 REG_SZ,
503 (PBYTE)szBuffer,
504 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
505 }
506
507 i = 0;
508 while (LocaleData[i].pValue != NULL)
509 {
510 if (GetLocaleInfo(lcid,
511 LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
512 szBuffer,
513 sizeof(szBuffer) / sizeof(WCHAR)))
514 {
515 RegSetValueExW(hLocaleKey,
516 LocaleData[i].pValue,
517 0,
518 REG_SZ,
519 (PBYTE)szBuffer,
520 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
521 }
522
523 i++;
524 }
525
526 done:
527 RegCloseKey(hLocaleKey);
528 }
529
530
531 VOID
532 CenterWindow(HWND hWnd)
533 {
534 HWND hWndParent;
535 RECT rcParent;
536 RECT rcWindow;
537
538 hWndParent = GetParent(hWnd);
539 if (hWndParent == NULL)
540 hWndParent = GetDesktopWindow();
541
542 GetWindowRect(hWndParent, &rcParent);
543 GetWindowRect(hWnd, &rcWindow);
544
545 SetWindowPos(hWnd,
546 HWND_TOP,
547 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
548 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
549 0,
550 0,
551 SWP_NOSIZE);
552 }
553
554
555 static
556 VOID
557 OnDrawItem(
558 LPDRAWITEMSTRUCT lpDrawItem,
559 PSTATE pState,
560 UINT uCtlID)
561 {
562 HDC hdcMem;
563 LONG left;
564
565 if (lpDrawItem->CtlID == uCtlID)
566 {
567 /* position image in centre of dialog */
568 left = (lpDrawItem->rcItem.right - pState->ImageInfo.cxSource) / 2;
569
570 hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
571 if (hdcMem != NULL)
572 {
573 SelectObject(hdcMem, pState->ImageInfo.hBitmap);
574 BitBlt(lpDrawItem->hDC,
575 left,
576 lpDrawItem->rcItem.top,
577 lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
578 lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
579 hdcMem,
580 0,
581 0,
582 SRCCOPY);
583 DeleteDC(hdcMem);
584 }
585 }
586 }
587
588
589 static
590 INT_PTR
591 CALLBACK
592 LocaleDlgProc(
593 HWND hwndDlg,
594 UINT uMsg,
595 WPARAM wParam,
596 LPARAM lParam)
597 {
598 PSTATE pState;
599
600 /* Retrieve pointer to the state */
601 pState = (PSTATE)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
602
603 switch (uMsg)
604 {
605 case WM_INITDIALOG:
606 /* Save pointer to the global state */
607 pState = (PSTATE)lParam;
608 SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pState);
609
610 /* Center the dialog window */
611 CenterWindow (hwndDlg);
612
613 CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
614 CreateKeyboardLayoutList(GetDlgItem(hwndDlg, IDC_LAYOUTLIST));
615
616 EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
617 return FALSE;
618
619 case WM_DRAWITEM:
620 OnDrawItem((LPDRAWITEMSTRUCT)lParam,
621 pState,
622 IDC_LOCALELOGO);
623 return TRUE;
624
625 case WM_COMMAND:
626 switch (LOWORD(wParam))
627 {
628 case IDC_LANGUAGELIST:
629 if (HIWORD(wParam) == CBN_SELCHANGE)
630 {
631 LCID NewLcid;
632 INT iCurSel;
633
634 iCurSel = SendDlgItemMessageW(hwndDlg,
635 IDC_LANGUAGELIST,
636 CB_GETCURSEL,
637 0,
638 0);
639 if (iCurSel == CB_ERR)
640 break;
641
642 NewLcid = SendDlgItemMessageW(hwndDlg,
643 IDC_LANGUAGELIST,
644 CB_GETITEMDATA,
645 iCurSel,
646 0);
647 if (NewLcid == (LCID)CB_ERR)
648 break;
649
650 TRACE("LCID: 0x%08lx\n", NewLcid);
651 SelectKeyboardForLanguage(GetDlgItem(hwndDlg, IDC_LAYOUTLIST),
652 NewLcid);
653 }
654 break;
655
656 case IDOK:
657 if (HIWORD(wParam) == BN_CLICKED)
658 {
659 LCID NewLcid;
660 INT iCurSel;
661
662 iCurSel = SendDlgItemMessageW(hwndDlg,
663 IDC_LANGUAGELIST,
664 CB_GETCURSEL,
665 0,
666 0);
667 if (iCurSel == CB_ERR)
668 break;
669
670 NewLcid = SendDlgItemMessageW(hwndDlg,
671 IDC_LANGUAGELIST,
672 CB_GETITEMDATA,
673 iCurSel,
674 0);
675 if (NewLcid == (LCID)CB_ERR)
676 break;
677
678 NtSetDefaultLocale(TRUE, NewLcid);
679 InitializeDefaultUserLocale(&NewLcid);
680
681 SetKeyboardLayout(GetDlgItem(hwndDlg, IDC_LAYOUTLIST));
682
683 pState->NextPage = STARTPAGE;
684 EndDialog(hwndDlg, 0);
685 }
686 break;
687
688 default:
689 break;
690 }
691 break;
692
693 default:
694 break;
695 }
696
697 return FALSE;
698 }
699
700
701 static
702 INT_PTR
703 CALLBACK
704 StartDlgProc(
705 HWND hwndDlg,
706 UINT uMsg,
707 WPARAM wParam,
708 LPARAM lParam)
709 {
710 PSTATE pState;
711
712 /* Retrieve pointer to the state */
713 pState = (PSTATE)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
714
715 switch (uMsg)
716 {
717 case WM_INITDIALOG:
718 /* Save pointer to the state */
719 pState = (PSTATE)lParam;
720 SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pState);
721
722 /* Center the dialog window */
723 CenterWindow(hwndDlg);
724
725 EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
726 return FALSE;
727
728 case WM_DRAWITEM:
729 OnDrawItem((LPDRAWITEMSTRUCT)lParam,
730 pState,
731 IDC_STARTLOGO);
732 return TRUE;
733
734 case WM_COMMAND:
735 if (HIWORD(wParam) == BN_CLICKED)
736 {
737 switch (LOWORD(wParam))
738 {
739 case IDC_RUN:
740 pState->NextPage = DONE;
741 pState->Run = SHELL;
742 EndDialog(hwndDlg, 0);
743 break;
744
745 case IDC_INSTALL:
746 pState->NextPage = DONE;
747 pState->Run = INSTALLER;
748 EndDialog(hwndDlg, 0);
749 break;
750
751 case IDOK:
752 pState->NextPage = LOCALEPAGE;
753 EndDialog(hwndDlg, 0);
754 break;
755
756 default:
757 break;
758 }
759 }
760 break;
761
762 default:
763 break;
764 }
765
766 return FALSE;
767 }
768
769
770 VOID
771 RunLiveCD(
772 PSTATE pState)
773 {
774 InitImageInfo(&pState->ImageInfo);
775
776 while (pState->NextPage != DONE)
777 {
778 switch (pState->NextPage)
779 {
780 case LOCALEPAGE:
781 DialogBoxParam(hInstance,
782 MAKEINTRESOURCE(IDD_LOCALEPAGE),
783 NULL,
784 LocaleDlgProc,
785 (LPARAM)pState);
786 break;
787
788 case STARTPAGE:
789 DialogBoxParam(hInstance,
790 MAKEINTRESOURCE(IDD_STARTPAGE),
791 NULL,
792 StartDlgProc,
793 (LPARAM)pState);
794 break;
795
796 default:
797 break;
798 }
799 }
800
801 DeleteObject(pState->ImageInfo.hBitmap);
802 }
803
804 /* EOF */