ReactOS 0.4.17-dev-804-g023d8af
livecd.c File Reference
#include "userinit.h"
Include dependency graph for livecd.c:

Go to the source code of this file.

Classes

struct  _LIVECD_UNATTEND
 

Typedefs

typedef struct _LIVECD_UNATTEND LIVECD_UNATTEND
 

Functions

static VOID InitLogo (PIMGINFO pImgInfo, HWND hwndDlg)
 
BOOL IsMiniNT (VOID)
 Check whether we are running in MiniNT mode (e.g. live medium).
 
static BOOL CALLBACK LocalesEnumProc (LPTSTR lpLocale)
 
static VOID CreateLanguagesList (HWND hwnd, PSTATE pState)
 
static BOOL GetLayoutName (_In_ PCWSTR pszKLID, _Out_writes_z_(NameSize) PWSTR pszName, _In_ SIZE_T NameSize)
 
static VOID SetKeyboardLayout (HWND hwnd)
 
static VOID SelectKeyboardForLanguage (HWND hwnd, LCID lcid)
 
static VOID CreateKeyboardLayoutList (HWND hItemsList)
 
static VOID InitializeDefaultUserLocale (PLCID pNewLcid)
 
VOID CenterWindow (HWND hWnd)
 
static VOID OnDrawItem (LPDRAWITEMSTRUCT lpDrawItem, PSTATE pState, UINT uCtlID)
 
static INT_PTR CALLBACK LocaleDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK StartDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID ParseUnattend (_In_ LPCWSTR UnattendInf, _Out_ LIVECD_UNATTEND *pUnattend)
 
static BOOL ExpandInstallerPath (_In_ PCWSTR pInstallerName, _Out_writes_z_(PathSize) PWSTR pInstallerPath, _In_ SIZE_T PathSize)
 Expands the path for the ReactOS Installer "reactos.exe". See also base/setup/welcome/welcome.c!ExpandInstallerPath()
 
VOID RunLiveCD (PSTATE pState)
 

Variables

HWND hList
 
HWND hLocaleList
 
BOOL bSpain = FALSE
 
WCHAR Installer [MAX_PATH]
 

Typedef Documentation

◆ LIVECD_UNATTEND

Function Documentation

◆ CenterWindow()

VOID CenterWindow ( HWND  hWnd)

Definition at line 520 of file livecd.c.

521{
523 RECT rcParent;
524 RECT rcWindow;
525
527 if (hWndParent == NULL)
529
530 GetWindowRect(hWndParent, &rcParent);
531 GetWindowRect(hWnd, &rcWindow);
532
534 HWND_TOP,
535 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
536 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
537 0,
538 0,
539 SWP_NOSIZE);
540}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1256
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define HWND_TOP
Definition: winuser.h:1218
HWND WINAPI GetParent(_In_ HWND)

Referenced by LocaleDlgProc(), and StartDlgProc().

◆ CreateKeyboardLayoutList()

static VOID CreateKeyboardLayoutList ( HWND  hItemsList)
static

Definition at line 351 of file livecd.c.

353{
354 HKEY hKey;
355 WCHAR szCurrentKLID[KL_NAMELENGTH], szKLID[KL_NAMELENGTH];
357 DWORD dwIndex;
359 INT iIndex;
360 ULONG ulLayoutId;
361
362 if (!GetKeyboardLayoutNameW(szCurrentKLID))
363 wcscpy(szCurrentKLID, L"00000409");
364
366 L"System\\CurrentControlSet\\Control\\Keyboard Layouts",
368 {
369 return;
370 }
371
372 for (dwIndex = 0; ; ++dwIndex)
373 {
374 dwSize = ARRAYSIZE(szKLID);
375 if (RegEnumKeyExW(hKey, dwIndex, szKLID, &dwSize,
377 {
378 break;
379 }
380
382
383 iIndex = (INT)SendMessageW(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
384
385 ulLayoutId = wcstoul(szKLID, NULL, 16);
386 SendMessageW(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)ulLayoutId);
387
388 if (_wcsicmp(szKLID, szCurrentKLID) == 0)
389 SendMessageW(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0);
390 }
391
393}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
#define MAX_PATH
Definition: compat.h:34
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2917
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
static BOOL GetLayoutName(_In_ PCWSTR pszKLID, _Out_writes_z_(NameSize) PWSTR pszName, _In_ SIZE_T NameSize)
Definition: livecd.c:207
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1022
short WCHAR
Definition: pedump.c:58
#define INT
Definition: polytest.cpp:20
wcscpy
#define _countof(array)
Definition: sndvol32.h:70
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
BOOL WINAPI GetKeyboardLayoutNameW(_Out_writes_(KL_NAMELENGTH) LPWSTR)
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define KL_NAMELENGTH
Definition: winuser.h:122
#define CB_SETCURSEL
Definition: winuser.h:1990
#define CB_ADDSTRING
Definition: winuser.h:1965
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by LocaleDlgProc().

◆ CreateLanguagesList()

static VOID CreateLanguagesList ( HWND  hwnd,
PSTATE  pState 
)
static

Definition at line 179 of file livecd.c.

180{
181 WCHAR langSel[255];
182 LCID Locale = 0;
183
184 hList = hwnd;
185 bSpain = FALSE;
187
188 if (pState->Unattend->bEnabled)
189 Locale = pState->Unattend->LocaleID;
190
191 if (!Locale)
192 {
193 /* Select current locale */
194 /* or should it be System and not user? */
195 Locale = GetUserDefaultLCID();
196 }
198
201 -1,
202 (LPARAM)langSel);
203}
#define FALSE
Definition: types.h:117
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: locale.c:3001
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
HWND hList
Definition: livecd.c:10
static BOOL CALLBACK LocalesEnumProc(LPTSTR lpLocale)
Definition: livecd.c:129
BOOL bSpain
Definition: livecd.c:12
TCHAR langSel[255]
Definition: powercfg.c:17
DWORD LCID
Definition: nls.h:13
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define LOCALE_SLANGUAGE
Definition: winnls.h:31
#define LCID_SUPPORTED
Definition: winnls.h:225
#define CB_SELECTSTRING
Definition: winuser.h:1989

Referenced by LocaleDlgProc().

◆ ExpandInstallerPath()

static BOOL ExpandInstallerPath ( _In_ PCWSTR  pInstallerName,
_Out_writes_z_(PathSize) PWSTR  pInstallerPath,
_In_ SIZE_T  PathSize 
)
static

Expands the path for the ReactOS Installer "reactos.exe". See also base/setup/welcome/welcome.c!ExpandInstallerPath()

Definition at line 867 of file livecd.c.

871{
872 SYSTEM_INFO SystemInfo;
873 SIZE_T cchInstallerNameLen;
874 PWSTR ptr;
875 DWORD dwAttribs;
876
877 cchInstallerNameLen = wcslen(pInstallerName);
878 if (PathSize < cchInstallerNameLen)
879 {
880 /* The buffer is not large enough to contain the installer file name */
881 *pInstallerPath = UNICODE_NULL;
882 return FALSE;
883 }
884
885 /*
886 * First, try to find the installer using the default drive, under
887 * the directory whose name corresponds to the currently-running
888 * CPU architecture.
889 */
890 GetSystemInfo(&SystemInfo);
891
892 *pInstallerPath = UNICODE_NULL;
893 /* Alternatively one can use SharedUserData->NtSystemRoot */
894 GetSystemWindowsDirectoryW(pInstallerPath, PathSize - cchInstallerNameLen - 1);
895 ptr = wcschr(pInstallerPath, L'\\');
896 if (ptr)
897 *++ptr = UNICODE_NULL;
898 else
899 *pInstallerPath = UNICODE_NULL;
900
901 /* Append the corresponding CPU architecture */
902 switch (SystemInfo.wProcessorArchitecture)
903 {
905 StringCchCatW(pInstallerPath, PathSize, L"I386");
906 break;
907
909 StringCchCatW(pInstallerPath, PathSize, L"MIPS");
910 break;
911
913 StringCchCatW(pInstallerPath, PathSize, L"ALPHA");
914 break;
915
917 StringCchCatW(pInstallerPath, PathSize, L"PPC");
918 break;
919
921 StringCchCatW(pInstallerPath, PathSize, L"SHX");
922 break;
923
925 StringCchCatW(pInstallerPath, PathSize, L"ARM");
926 break;
927
929 StringCchCatW(pInstallerPath, PathSize, L"IA64");
930 break;
931
933 StringCchCatW(pInstallerPath, PathSize, L"ALPHA64");
934 break;
935
937 StringCchCatW(pInstallerPath, PathSize, L"AMD64");
938 break;
939
940 // case PROCESSOR_ARCHITECTURE_MSIL: /* .NET CPU-independent code */
942 default:
943 WARN("Unknown processor architecture %lu\n", SystemInfo.wProcessorArchitecture);
945 break;
946 }
947
949 StringCchCatW(pInstallerPath, PathSize, L"\\");
950 StringCchCatW(pInstallerPath, PathSize, pInstallerName);
951
952 dwAttribs = GetFileAttributesW(pInstallerPath);
953 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
954 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
955 {
956 /* We have found the installer */
957 return TRUE;
958 }
959
960 WARN("Couldn't find the installer '%s', trying alternative.\n", debugstr_w(pInstallerPath));
961
962 /*
963 * We failed. Try to find the installer from either the current
964 * ReactOS installation directory, or from our current directory.
965 */
966 *pInstallerPath = UNICODE_NULL;
967 /* Alternatively one can use SharedUserData->NtSystemRoot */
968 if (GetSystemWindowsDirectoryW(pInstallerPath, PathSize - cchInstallerNameLen - 1))
969 StringCchCatW(pInstallerPath, PathSize, L"\\");
970 StringCchCatW(pInstallerPath, PathSize, pInstallerName);
971
972 dwAttribs = GetFileAttributesW(pInstallerPath);
973 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
974 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
975 {
976 /* We have found the installer */
977 return TRUE;
978 }
979
980 /* Installer not found */
981 ERR("Couldn't find the installer '%s'\n", debugstr_w(pInstallerPath));
982 *pInstallerPath = UNICODE_NULL;
983 return FALSE;
984}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define TRUE
Definition: types.h:120
#define wcschr
Definition: compat.h:17
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:636
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2316
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
#define PROCESSOR_ARCHITECTURE_IA64
Definition: ketypes.h:111
#define PROCESSOR_ARCHITECTURE_ALPHA64
Definition: ketypes.h:112
#define PROCESSOR_ARCHITECTURE_ALPHA
Definition: ketypes.h:107
#define PROCESSOR_ARCHITECTURE_ARM
Definition: ketypes.h:110
#define PROCESSOR_ARCHITECTURE_UNKNOWN
Definition: ketypes.h:115
#define PROCESSOR_ARCHITECTURE_SHX
Definition: ketypes.h:109
#define PROCESSOR_ARCHITECTURE_MIPS
Definition: ketypes.h:106
#define PROCESSOR_ARCHITECTURE_PPC
Definition: ketypes.h:108
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define PROCESSOR_ARCHITECTURE_INTEL
Definition: ketypes.h:105
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define UNICODE_NULL
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
WORD wProcessorArchitecture
Definition: winbase.h:894
uint16_t * PWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

Referenced by RunLiveCD().

◆ GetLayoutName()

static BOOL GetLayoutName ( _In_ PCWSTR  pszKLID,
_Out_writes_z_(NameSize) PWSTR  pszName,
_In_ SIZE_T  NameSize 
)
static

Definition at line 207 of file livecd.c.

211{
212 HKEY hKey;
213 BOOL ret;
214 DWORD dwBufLen;
215 WCHAR szBuf[1 + MAX_PATH + 2 + 10]; // "@file_path,-resID"
217
218 if (NameSize < sizeof(WCHAR))
219 return FALSE;
220 *pszName = UNICODE_NULL;
221
222 StringCchPrintfW(szBuf, _countof(szBuf), L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s", pszKLID);
224 return FALSE;
225
226 dwBufLen = sizeof(szBuf);
227 if (RegQueryValueExW(hKey, L"Layout Display Name", NULL, NULL, (PBYTE)szBuf, &dwBufLen) == ERROR_SUCCESS)
228 {
229 if (szBuf[0] == L'@') do
230 {
231 PWCHAR dllname, index_str;
232 INT index;
233
234 dllname = szBuf + 1;
235 index_str = wcsrchr(szBuf, L',');
236 if (!index_str)
237 break;
238 *index_str++ = UNICODE_NULL;
239
240 index = wcstol(index_str, NULL, 10);
241 if (index >= 0)
242 {
243 FIXME("Cannot handle non-negative indices (%d)\n", index);
244 break;
245 }
246 index = -index;
247
249 {
251 if (hLib)
252 {
253 ret = (LoadStringW(hLib, index, szPath, _countof(szPath)) != 0);
254 FreeLibrary(hLib);
255 if (ret)
256 {
257 StringCchCopyW(pszName, NameSize, szPath);
258 goto Quit;
259 }
260 }
261 }
262 } while (0);
263 }
264
265 dwBufLen = NameSize * sizeof(WCHAR);
266 ret = (RegQueryValueExW(hKey, L"Layout Text", NULL, NULL, (PBYTE)pszName, &dwBufLen) == ERROR_SUCCESS);
267
268Quit:
270 return ret;
271}
#define index(s, c)
Definition: various.h:29
#define FIXME(fmt,...)
Definition: precomp.h:53
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define wcsrchr
Definition: compat.h:16
#define FreeLibrary(x)
Definition: compat.h:748
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
LPCWSTR szPath
Definition: env.c:37
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
BYTE * PBYTE
Definition: pedump.c:66
#define LoadStringW
Definition: utils.h:64
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
uint16_t * PWCHAR
Definition: typedefs.h:56
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338

Referenced by CreateKeyboardLayoutList().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( PLCID  pNewLcid)
static

Definition at line 397 of file livecd.c.

399{
400 WCHAR szBuffer[80];
401 PWSTR ptr;
402 HKEY hLocaleKey;
403 DWORD ret;
405 LCID lcid;
406 INT i;
407
408 struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
409 /* Number */
410 {LOCALE_SDECIMAL, L"sDecimal"},
411 {LOCALE_STHOUSAND, L"sThousand"},
412 {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
413 {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
414 {LOCALE_SGROUPING, L"sGrouping"},
415 {LOCALE_SLIST, L"sList"},
416 {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
417 {LOCALE_INEGNUMBER, L"iNegNumber"},
418 {LOCALE_IDIGITS, L"iDigits"},
419 {LOCALE_ILZERO, L"iLZero"},
420 {LOCALE_IMEASURE, L"iMeasure"},
421 {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
422
423 /* Currency */
424 {LOCALE_SCURRENCY, L"sCurrency"},
425 {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
426 {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
427 {LOCALE_SMONGROUPING, L"sMonGrouping"},
428 {LOCALE_ICURRENCY, L"iCurrency"},
429 {LOCALE_INEGCURR, L"iNegCurr"},
430 {LOCALE_ICURRDIGITS, L"iCurrDigits"},
431
432 /* Time */
433 {LOCALE_STIMEFORMAT, L"sTimeFormat"},
434 {LOCALE_STIME, L"sTime"},
435 {LOCALE_S1159, L"s1159"},
436 {LOCALE_S2359, L"s2359"},
437 {LOCALE_ITIME, L"iTime"},
438 {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
439 {LOCALE_ITLZERO, L"iTLZero"},
440
441 /* Date */
442 {LOCALE_SLONGDATE, L"sLongDate"},
443 {LOCALE_SSHORTDATE, L"sShortDate"},
444 {LOCALE_SDATE, L"sDate"},
445 {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
446 {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
447 {LOCALE_IDATE, L"iDate"},
448 {LOCALE_ICALENDARTYPE, L"iCalendarType"},
449
450 /* Misc */
451 {LOCALE_SCOUNTRY, L"sCountry"},
452 {LOCALE_SABBREVLANGNAME, L"sLanguage"},
453 {LOCALE_ICOUNTRY, L"iCountry"},
454 {0, NULL}};
455
457 L".DEFAULT\\Control Panel\\International",
458 0,
460 &hLocaleKey);
461 if (ret != ERROR_SUCCESS)
462 {
463 return;
464 }
465
466 if (pNewLcid == NULL)
467 {
468 dwSize = 9 * sizeof(WCHAR);
469 ret = RegQueryValueExW(hLocaleKey,
470 L"Locale",
471 NULL,
472 NULL,
473 (PBYTE)szBuffer,
474 &dwSize);
475 if (ret != ERROR_SUCCESS)
476 goto done;
477
478 lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
479 if (lcid == 0)
480 goto done;
481 }
482 else
483 {
484 lcid = *pNewLcid;
485
486 _swprintf(szBuffer, L"%08lx", lcid);
487 RegSetValueExW(hLocaleKey,
488 L"Locale",
489 0,
490 REG_SZ,
491 (PBYTE)szBuffer,
492 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
493 }
494
495 i = 0;
496 while (LocaleData[i].pValue != NULL)
497 {
499 LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
500 szBuffer,
501 ARRAYSIZE(szBuffer)))
502 {
503 RegSetValueExW(hLocaleKey,
504 LocaleData[i].pValue,
505 0,
506 REG_SZ,
507 (PBYTE)szBuffer,
508 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
509 }
510
511 i++;
512 }
513
514done:
515 RegCloseKey(hLocaleKey);
516}
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LCID lcid
Definition: locale.c:5660
PWCHAR pValue
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REG_SZ
Definition: layer.c:22
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_WRITE
Definition: nt_native.h:1034
#define LOCALE_ICURRDIGITS
Definition: winnls.h:64
#define LOCALE_SCOUNTRY
Definition: winnls.h:40
#define LOCALE_SDATE
Definition: winnls.h:68
#define LOCALE_SGROUPING
Definition: winnls.h:54
#define LOCALE_ICOUNTRY
Definition: winnls.h:39
#define LOCALE_SDECIMAL
Definition: winnls.h:52
#define LOCALE_IDATE
Definition: winnls.h:73
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:86
#define LOCALE_IMEASURE
Definition: winnls.h:51
#define LOCALE_SLONGDATE
Definition: winnls.h:71
#define LOCALE_S1159
Definition: winnls.h:81
#define LOCALE_SSHORTDATE
Definition: winnls.h:70
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:127
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:61
#define LOCALE_ITIME
Definition: winnls.h:75
#define LOCALE_ICURRENCY
Definition: winnls.h:66
#define LOCALE_ITLZERO
Definition: winnls.h:78
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:62
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_IDIGITS
Definition: winnls.h:55
#define LOCALE_STHOUSAND
Definition: winnls.h:53
#define LOCALE_STIMEFORMAT
Definition: winnls.h:72
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:85
#define LOCALE_STIME
Definition: winnls.h:69
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:37
#define LOCALE_INEGNUMBER
Definition: winnls.h:57
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:128
DWORD LCTYPE
Definition: winnls.h:592
#define LOCALE_S2359
Definition: winnls.h:82
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:58
#define LOCALE_SLIST
Definition: winnls.h:50
#define LOCALE_ILZERO
Definition: winnls.h:56
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:83
#define LOCALE_SMONGROUPING
Definition: winnls.h:63
#define LOCALE_SCURRENCY
Definition: winnls.h:59
#define LOCALE_INEGCURR
Definition: winnls.h:67
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:76
#define HKEY_USERS
Definition: winreg.h:13

Referenced by LocaleDlgProc().

◆ InitLogo()

static VOID InitLogo ( PIMGINFO  pImgInfo,
HWND  hwndDlg 
)
static

Definition at line 27 of file livecd.c.

28{
29 BITMAP logoBitmap;
30 BITMAP maskBitmap;
32 HDC hDC, hDCLogo, hDCMask;
33 HBITMAP hMask = NULL, hLogo = NULL;
34 HBITMAP hAlphaLogo = NULL;
35 COLORREF *pBits;
37
38 hDC = GetDC(hwndDlg);
39 hDCLogo = CreateCompatibleDC(NULL);
40 hDCMask = CreateCompatibleDC(NULL);
41
42 if (hDC == NULL || hDCLogo == NULL || hDCMask == NULL)
43 goto Cleanup;
44
45 ZeroMemory(pImgInfo, sizeof(*pImgInfo));
46 ZeroMemory(&bmpi, sizeof(bmpi));
47
50
51 if (hLogo == NULL || hMask == NULL)
52 goto Cleanup;
53
54 GetObject(hLogo, sizeof(logoBitmap), &logoBitmap);
55 GetObject(hMask, sizeof(maskBitmap), &maskBitmap);
56
57 if (logoBitmap.bmHeight != maskBitmap.bmHeight || logoBitmap.bmWidth != maskBitmap.bmWidth)
58 goto Cleanup;
59
61 bmpi.bmiHeader.biWidth = logoBitmap.bmWidth;
62 bmpi.bmiHeader.biHeight = logoBitmap.bmHeight;
66 bmpi.bmiHeader.biSizeImage = 4 * logoBitmap.bmWidth * logoBitmap.bmHeight;
67
68 /* Create a premultiplied bitmap */
69 hAlphaLogo = CreateDIBSection(hDC, &bmpi, DIB_RGB_COLORS, (PVOID*)&pBits, 0, 0);
70 if (!hAlphaLogo)
71 goto Cleanup;
72
73 SelectObject(hDCLogo, hLogo);
74 SelectObject(hDCMask, hMask);
75
76 for (line = logoBitmap.bmHeight - 1; line >= 0; line--)
77 {
78 for (column = 0; column < logoBitmap.bmWidth; column++)
79 {
80 COLORREF alpha = GetPixel(hDCMask, column, line) & 0xFF;
81 COLORREF Color = GetPixel(hDCLogo, column, line);
82 DWORD r, g, b;
83
84 r = GetRValue(Color) * alpha / 255;
85 g = GetGValue(Color) * alpha / 255;
86 b = GetBValue(Color) * alpha / 255;
87
88 *pBits++ = b | (g << 8) | (r << 16) | (alpha << 24);
89 }
90 }
91
92 pImgInfo->hBitmap = hAlphaLogo;
93 pImgInfo->cxSource = logoBitmap.bmWidth;
94 pImgInfo->cySource = logoBitmap.bmHeight;
95 pImgInfo->iBits = logoBitmap.bmBitsPixel;
96 pImgInfo->iPlanes = logoBitmap.bmPlanes;
97
99 if (hMask != NULL) DeleteObject(hMask);
100 if (hLogo != NULL) DeleteObject(hLogo);
101 if (hDCMask != NULL) DeleteDC(hDCMask);
102 if (hDCLogo != NULL) DeleteDC(hDCLogo);
103 if (hDC != NULL) ReleaseDC(hwndDlg, hDC);
104}
static HDC hDC
Definition: 3dtext.c:33
#define IDB_ROSLOGO
Definition: resource.h:6
#define IDB_ROSMASK
Definition: resource.h:7
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
HINSTANCE hInstance
Definition: charmap.c:19
static PIMGINFO pImgInfo
Definition: general.c:33
static const WCHAR Cleanup[]
Definition: register.c:80
#define GetBValue(quad)
Definition: precomp.h:71
#define GetGValue(quad)
Definition: precomp.h:70
#define GetRValue(quad)
Definition: precomp.h:69
pKey DeleteObject()
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
#define ZeroMemory
Definition: minwinbase.h:31
BITMAPINFO bmpi
Definition: alphablend.c:68
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
INT iPlanes
Definition: userinit.h:52
INT cxSource
Definition: userinit.h:50
INT iBits
Definition: userinit.h:53
INT cySource
Definition: userinit.h:51
HBITMAP hBitmap
Definition: userinit.h:49
Definition: parser.c:49
USHORT biBitCount
Definition: precomp.h:34
ULONG biCompression
Definition: precomp.h:35
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
WORD bmPlanes
Definition: wingdi.h:1871
WORD bmBitsPixel
Definition: wingdi.h:1872
#define BI_RGB
Definition: uefivid.c:46
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
DWORD COLORREF
Definition: windef.h:100
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
struct tagBITMAPINFO BITMAPINFO
#define GetObject
Definition: wingdi.h:4914
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define IMAGE_BITMAP
Definition: winuser.h:211
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
HDC WINAPI GetDC(_In_opt_ HWND)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by RunLiveCD().

◆ IsMiniNT()

BOOL IsMiniNT ( VOID  )

Check whether we are running in MiniNT mode (e.g. live medium).

Definition at line 110 of file livecd.c.

111{
112 HKEY hKey;
113 LONG rc;
114
115 /* Check for the presence of the "MiniNT" registry key */
117 L"SYSTEM\\CurrentControlSet\\Control\\MiniNT",
118 0,
120 &hKey);
121 if (rc == ERROR_SUCCESS)
123
124 return (rc == ERROR_SUCCESS);
125}
long LONG
Definition: pedump.c:60

◆ LocaleDlgProc()

static INT_PTR CALLBACK LocaleDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 582 of file livecd.c.

587{
588 PSTATE pState;
589
590 /* Retrieve pointer to the state */
591 pState = (PSTATE)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
592
593 switch (uMsg)
594 {
595 case WM_INITDIALOG:
596 {
597 /* Save pointer to the state */
598 pState = (PSTATE)lParam;
599 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
600
601 /* Center the dialog window */
602 CenterWindow(hwndDlg);
603
604 /* Fill the language and keyboard layout lists */
607
608 /* In unattended mode, advance to the next page */
609 if (pState->Unattend->bEnabled)
611 return TRUE;
612 }
613
614 case WM_DRAWITEM:
616 return TRUE;
617
618 case WM_COMMAND:
619 switch (LOWORD(wParam))
620 {
621 case IDC_LANGUAGELIST:
623 {
624 LCID NewLcid;
625 INT iCurSel;
626
627 iCurSel = SendDlgItemMessageW(hwndDlg,
630 0,
631 0);
632 if (iCurSel == CB_ERR)
633 break;
634
635 NewLcid = SendDlgItemMessageW(hwndDlg,
638 iCurSel,
639 0);
640 if (NewLcid == (LCID)CB_ERR)
641 break;
642
643 TRACE("LCID: 0x%08lx\n", NewLcid);
645 NewLcid);
646 }
647 break;
648
649 case IDOK:
650 if (HIWORD(wParam) == BN_CLICKED)
651 {
652 LCID NewLcid;
653 INT iCurSel;
654
655 iCurSel = SendDlgItemMessageW(hwndDlg,
658 0,
659 0);
660 if (iCurSel == CB_ERR)
661 break;
662
663 NewLcid = SendDlgItemMessageW(hwndDlg,
666 iCurSel,
667 0);
668 if (NewLcid == (LCID)CB_ERR)
669 break;
670
671 /* Set the locale for the current thread */
672 NtSetDefaultLocale(TRUE, NewLcid);
673
674 /* Store the locale settings in the registry */
676
677 /* Set UI language for this thread */
678 SetThreadLocale(NewLcid);
679
681
682 pState->NextPage = STARTPAGE;
683 EndDialog(hwndDlg, LOWORD(wParam));
684 }
685 break;
686
687 case IDCANCEL:
688 if (HIWORD(wParam) == BN_CLICKED)
689 {
690 static WCHAR szMsg[RC_STRING_MAX_SIZE];
691 INT ret;
693 ret = MessageBoxW(hwndDlg, szMsg, L"ReactOS LiveCD", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
694 if (ret == IDOK || ret == IDYES)
695 {
696 pState->NextPage = DONE;
697 pState->Run = REBOOT;
698 EndDialog(hwndDlg, LOWORD(wParam));
699 }
700 }
701 break;
702
703 default:
704 break;
705 }
706 break;
707
708 default:
709 break;
710 }
711
712 return FALSE;
713}
#define RC_STRING_MAX_SIZE
Definition: resource.h:3
#define IDC_LOCALELOGO
Definition: resource.h:14
#define IDC_LAYOUTLIST
Definition: resource.h:17
#define IDC_LANGUAGELIST
Definition: resource.h:15
#define IDS_CANCEL_CONFIRM
Definition: resource.h:30
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI SetThreadLocale(LCID lcid)
Definition: locale.c:2822
static VOID CreateLanguagesList(HWND hwnd, PSTATE pState)
Definition: livecd.c:179
static VOID CreateKeyboardLayoutList(HWND hItemsList)
Definition: livecd.c:351
static VOID InitializeDefaultUserLocale(PLCID pNewLcid)
Definition: livecd.c:397
VOID CenterWindow(HWND hWnd)
Definition: livecd.c:520
static VOID SetKeyboardLayout(HWND hwnd)
Definition: livecd.c:275
static VOID OnDrawItem(LPDRAWITEMSTRUCT lpDrawItem, PSTATE pState, UINT uCtlID)
Definition: livecd.c:544
static VOID SelectKeyboardForLanguage(HWND hwnd, LCID lcid)
Definition: livecd.c:299
struct _STATE * PSTATE
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:433
#define LOWORD(l)
Definition: pedump.c:82
#define DONE
Definition: rnr20lib.h:14
#define TRACE(s)
Definition: solgame.cpp:4
#define GWLP_USERDATA
Definition: treelist.c:63
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
@ REBOOT
Definition: userinit.h:44
@ STARTPAGE
Definition: userinit.h:36
#define GetModuleHandle
Definition: winbase.h:3548
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define IDCANCEL
Definition: winuser.h:842
#define WM_COMMAND
Definition: winuser.h:1768
#define CB_ERR
Definition: winuser.h:2471
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_YESNO
Definition: winuser.h:828
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:841
#define WM_DRAWITEM
Definition: winuser.h:1673
#define CBN_SELCHANGE
Definition: winuser.h:2008
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETITEMDATA
Definition: winuser.h:1979
#define MB_ICONWARNING
Definition: winuser.h:797
#define MB_DEFBUTTON2
Definition: winuser.h:810
#define BN_CLICKED
Definition: winuser.h:1954
#define IDYES
Definition: winuser.h:846
#define CB_GETCURSEL
Definition: winuser.h:1972
#define SetWindowLongPtrW
Definition: winuser.h:5512
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by RunLiveCD().

◆ LocalesEnumProc()

static BOOL CALLBACK LocalesEnumProc ( LPTSTR  lpLocale)
static

Definition at line 129 of file livecd.c.

130{
131 LCID lcid;
132 WCHAR lang[255];
133 INT index;
134 BOOL bNoShow = FALSE;
135
136 lcid = wcstoul(lpLocale, NULL, 16);
137
138 /* Display only languages with installed support */
140 return TRUE;
141
142 // See http://archives.miloush.net/michkap/archive/2006/09/23/768178.html for why we handle spain differently
145 {
146 if (bSpain == FALSE)
147 {
149 bSpain = TRUE;
150 }
151 else
152 {
153 bNoShow = TRUE;
154 }
155 }
156 else
157 {
159 }
160
161 if (bNoShow == FALSE)
162 {
165 0,
166 (LPARAM)lang);
167
170 index,
171 (LPARAM)lcid);
172 }
173
174 return TRUE;
175}
#define IDS_SPAIN
Definition: resource.h:32
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: locale.c:2925
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define SUBLANG_SPANISH
Definition: nls.h:336
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_SPANISH
Definition: nls.h:123
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define LCID_INSTALLED
Definition: winnls.h:224

Referenced by CreateLanguagesList().

◆ OnDrawItem()

static VOID OnDrawItem ( LPDRAWITEMSTRUCT  lpDrawItem,
PSTATE  pState,
UINT  uCtlID 
)
static

Definition at line 544 of file livecd.c.

548{
549 HDC hdcMem;
550 LONG left;
551
552 if (lpDrawItem->CtlID == uCtlID)
553 {
554 /* Position image in centre of dialog */
555 left = (lpDrawItem->rcItem.right - pState->ImageInfo.cxSource) / 2;
556
557 hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
558 if (hdcMem != NULL)
559 {
561
562 SelectObject(hdcMem, pState->ImageInfo.hBitmap);
563 GdiAlphaBlend(lpDrawItem->hDC,
564 left,
565 lpDrawItem->rcItem.top,
566 pState->ImageInfo.cxSource,
567 pState->ImageInfo.cySource,
568 hdcMem,
569 0, 0,
570 pState->ImageInfo.cxSource,
571 pState->ImageInfo.cySource,
572 BlendFunc);
574 }
575 }
576}
static const BLENDFUNCTION BlendFunc
Definition: general.c:34
GLint left
Definition: glext.h:7726
BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heightDst, HDC hdcSrc, int xSrc, int ySrc, int widthSrc, int heightSrc, BLENDFUNCTION blendFunction)
#define AC_SRC_ALPHA
Definition: alphablend.c:9
HDC hdcMem
Definition: welcome.c:104
#define AC_SRC_OVER
Definition: wingdi.h:1369

Referenced by LocaleDlgProc(), and StartDlgProc().

◆ ParseUnattend()

static VOID ParseUnattend ( _In_ LPCWSTR  UnattendInf,
_Out_ LIVECD_UNATTEND pUnattend 
)
static

Definition at line 813 of file livecd.c.

816{
818
819 pUnattend->bEnabled = FALSE;
820
821 if (!GetPrivateProfileStringW(L"Unattend", L"Signature", L"", Buffer, _countof(Buffer), UnattendInf))
822 {
823 ERR("Unable to parse Signature\n");
824 return;
825 }
826
827 if (_wcsicmp(Buffer, L"$ReactOS$") && _wcsicmp(Buffer, L"$Windows NT$"))
828 {
829 TRACE("Unknown signature: %S\n", Buffer);
830 return;
831 }
832
833 if (!GetPrivateProfileStringW(L"Unattend", L"UnattendSetupEnabled", L"", Buffer, _countof(Buffer), UnattendInf))
834 {
835 ERR("Unable to parse UnattendSetupEnabled\n");
836 return;
837 }
838
839 if (_wcsicmp(Buffer, L"yes") != 0)
840 {
841 TRACE("Unattended setup is not enabled\n");
842 return;
843 }
844 /* If the user presses Ctrl+Shift+F10, disable unattended setup */
846 {
847 WARN("Unattended setup is disabled by keypress\n");
848 return;
849 }
850
851 pUnattend->bEnabled = TRUE;
852 pUnattend->LocaleID = 0;
853
854 if (GetPrivateProfileStringW(L"Unattend", L"LocaleID", L"", Buffer, _countof(Buffer), UnattendInf) && Buffer[0])
855 {
856 pUnattend->LocaleID = wcstol(Buffer, NULL, 16);
857 }
858}
Definition: bufpool.h:45
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
#define VK_F10
Definition: winuser.h:2300
#define VK_CONTROL
Definition: winuser.h:2239
#define VK_SHIFT
Definition: winuser.h:2238
SHORT WINAPI GetKeyState(_In_ int)

Referenced by RunLiveCD().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  pState)

Definition at line 987 of file livecd.c.

989{
990 LIVECD_UNATTEND Unattend = {0};
991 WCHAR UnattendInf[MAX_PATH];
992
993 /* Try to locate the ReactOS Installer */
994 if (!ExpandInstallerPath(L"reactos.exe", Installer, _countof(Installer)))
996 if (*Installer)
997 TRACE("ReactOS Installer: '%S'\n", Installer);
998 else
999 WARN("Could not find the ReactOS Installer\n");
1000
1001 /* If the ReactOS Installer was located, use its path for the
1002 * unattended file; otherwise, use the current ReactOS directory. */
1003 StringCchCopyW(UnattendInf, _countof(UnattendInf), Installer);
1004 if (*UnattendInf)
1005 {
1006 /* Find the last path separator and truncate the path there.
1007 * If there is none, NUL the path. */
1008 PWCHAR ptr = wcsrchr(UnattendInf, L'\\');
1009 if (!ptr)
1010 ptr = UnattendInf;
1011 *ptr = UNICODE_NULL;
1012 }
1013 if (!*UnattendInf)
1014 {
1015 /* No actual path was found, fall back to the ReactOS directory */
1016 GetWindowsDirectoryW(UnattendInf, _countof(UnattendInf));
1017 }
1018 StringCchCatW(UnattendInf, _countof(UnattendInf), L"\\unattend.inf");
1019 ParseUnattend(UnattendInf, &Unattend);
1020 pState->Unattend = &Unattend;
1021
1022 InitLogo(&pState->ImageInfo, NULL);
1023
1024 while (pState->NextPage != DONE)
1025 {
1026 switch (pState->NextPage)
1027 {
1028 case LOCALEPAGE:
1031 NULL,
1033 (LPARAM)pState);
1034 break;
1035
1036 case STARTPAGE:
1039 NULL,
1041 (LPARAM)pState);
1042 break;
1043
1044 default:
1045 break;
1046 }
1047 }
1048
1049 DeleteObject(pState->ImageInfo.hBitmap);
1050}
#define IDD_STARTPAGE
Definition: resource.h:27
#define IDD_LOCALEPAGE
Definition: resource.h:13
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2271
static INT_PTR CALLBACK LocaleDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:582
static BOOL ExpandInstallerPath(_In_ PCWSTR pInstallerName, _Out_writes_z_(PathSize) PWSTR pInstallerPath, _In_ SIZE_T PathSize)
Expands the path for the ReactOS Installer "reactos.exe". See also base/setup/welcome/welcome....
Definition: livecd.c:867
WCHAR Installer[MAX_PATH]
Definition: livecd.c:14
static VOID ParseUnattend(_In_ LPCWSTR UnattendInf, _Out_ LIVECD_UNATTEND *pUnattend)
Definition: livecd.c:813
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:718
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:27
@ LOCALEPAGE
Definition: userinit.h:35
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by wWinMain().

◆ SelectKeyboardForLanguage()

static VOID SelectKeyboardForLanguage ( HWND  hwnd,
LCID  lcid 
)
static

Definition at line 299 of file livecd.c.

302{
303 INT i, nCount;
304 ULONG ulLayoutId;
305
306 TRACE("LCID: %08lx, LangID: %04lx\n", lcid, LANGIDFROMLCID(lcid));
307
308 nCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
309
310 for (i = 0; i < nCount; i++)
311 {
312 ulLayoutId = (ULONG)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
313 TRACE("Layout: %08lx\n", ulLayoutId);
314
315 if (LANGIDFROMLCID(ulLayoutId) == LANGIDFROMLCID(lcid))
316 {
317 TRACE("Found 1: %08lx --> %08lx\n", ulLayoutId, lcid);
319 return;
320 }
321 }
322
323 for (i = 0; i < nCount; i++)
324 {
325 ulLayoutId = (ULONG)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
326 TRACE("Layout: %08lx\n", ulLayoutId);
327
328 if (PRIMARYLANGID(ulLayoutId) == PRIMARYLANGID(lcid))
329 {
330 TRACE("Found 2: %08lx --> %08lx\n", ulLayoutId, lcid);
332 return;
333 }
334 }
335
336 TRACE("No match found!\n");
337 /* No match found, try selecting English (United States) */
338 for (i = 0; i < nCount; i++)
339 {
340 ulLayoutId = (DWORD)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
341 if (ulLayoutId == 0x00000409)
342 {
344 return;
345 }
346 }
347}
#define DWORD
Definition: nt_native.h:44
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define CB_GETCOUNT
Definition: winuser.h:1971

Referenced by LocaleDlgProc().

◆ SetKeyboardLayout()

static VOID SetKeyboardLayout ( HWND  hwnd)
static

Definition at line 275 of file livecd.c.

277{
278 INT iCurSel;
279 ULONG ulLayoutId;
280 HKL hKl;
281 WCHAR szKLID[KL_NAMELENGTH];
282
283 iCurSel = SendMessageW(hwnd, CB_GETCURSEL, 0, 0);
284 if (iCurSel == CB_ERR)
285 return;
286
287 ulLayoutId = (ULONG)SendMessageW(hwnd, CB_GETITEMDATA, iCurSel, 0);
288 if (ulLayoutId == (ULONG)CB_ERR)
289 return;
290
291 _swprintf(szKLID, L"%08lx", ulLayoutId);
292
294 SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hKl, SPIF_SENDCHANGE);
295}
UINT_PTR HKL
Definition: msctf.idl:125
#define KLF_SETFORPROCESS
Definition: winuser.h:117
#define KLF_REPLACELANG
Definition: winuser.h:115
#define KLF_ACTIVATE
Definition: winuser.h:111
#define SPIF_SENDCHANGE
Definition: winuser.h:1600
HKL WINAPI LoadKeyboardLayoutW(_In_ LPCWSTR, _In_ UINT)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by LocaleDlgProc().

◆ StartDlgProc()

static INT_PTR CALLBACK StartDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 718 of file livecd.c.

723{
724 PSTATE pState;
725
726 /* Retrieve pointer to the state */
727 pState = (PSTATE)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
728
729 switch (uMsg)
730 {
731 case WM_INITDIALOG:
732 {
733 /* Save pointer to the state */
734 pState = (PSTATE)lParam;
735 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
736
737 /* Center the dialog window */
738 CenterWindow(hwndDlg);
739
740 /* If the ReactOS Installer could not be located, directly start
741 * the LiveCD. Otherwise, directly start the installer if we are
742 * in unattended mode. */
743 if (!*Installer)
744 {
745 /* Disable the "Install" button and click on "Run LiveCD" */
748 }
749 else if (pState->Unattend->bEnabled)
750 {
751 /* Click on "Install" */
753 }
754 return TRUE;
755 }
756
757 case WM_DRAWITEM:
759 return TRUE;
760
761 case WM_COMMAND:
762 if (HIWORD(wParam) == BN_CLICKED)
763 {
764 switch (LOWORD(wParam))
765 {
766 case IDC_RUN:
767 pState->NextPage = DONE;
768 pState->Run = SHELL;
769 EndDialog(hwndDlg, LOWORD(wParam));
770 break;
771
772 case IDC_INSTALL:
773 pState->NextPage = DONE;
774 pState->Run = INSTALLER;
775 EndDialog(hwndDlg, LOWORD(wParam));
776 break;
777
778 case IDOK:
779 pState->NextPage = LOCALEPAGE;
780 EndDialog(hwndDlg, LOWORD(wParam));
781 break;
782
783 case IDCANCEL:
784 if (HIWORD(wParam) == BN_CLICKED)
785 {
786 static WCHAR szMsg[RC_STRING_MAX_SIZE];
787 INT ret;
789 ret = MessageBoxW(hwndDlg, szMsg, L"ReactOS LiveCD", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
790 if (ret == IDOK || ret == IDYES)
791 {
792 pState->NextPage = DONE;
793 pState->Run = REBOOT;
794 EndDialog(hwndDlg, LOWORD(wParam));
795 }
796 }
797 break;
798
799 default:
800 break;
801 }
802 }
803 break;
804
805 default:
806 break;
807 }
808
809 return FALSE;
810}
#define IDC_STARTLOGO
Definition: resource.h:20
#define IDC_RUN
Definition: resource.h:21
#define IDC_INSTALL
Definition: fontview.h:13
@ INSTALLER
Definition: userinit.h:43
@ SHELL
Definition: userinit.h:42
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by RunLiveCD().

Variable Documentation

◆ bSpain

BOOL bSpain = FALSE

Definition at line 12 of file livecd.c.

Referenced by CreateLanguagesList(), and LocalesEnumProc().

◆ hList

◆ hLocaleList

HWND hLocaleList

Definition at line 11 of file livecd.c.

◆ Installer