ReactOS 0.4.16-dev-2207-geb15453
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 IsLiveCD (VOID)
 
static BOOL CALLBACK LocalesEnumProc (LPTSTR lpLocale)
 
static VOID CreateLanguagesList (HWND hwnd, PSTATE pState)
 
static BOOL GetLayoutName (LPCWSTR szLCID, LPWSTR szName)
 
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)
 
VOID ParseUnattend (LPCWSTR UnattendInf, LIVECD_UNATTEND *pUnattend)
 
VOID RunLiveCD (PSTATE pState)
 

Variables

HWND hList
 
HWND hLocaleList
 
BOOL bSpain = FALSE
 

Typedef Documentation

◆ LIVECD_UNATTEND

Function Documentation

◆ CenterWindow()

VOID CenterWindow ( HWND  hWnd)

Definition at line 556 of file livecd.c.

557{
559 RECT rcParent;
560 RECT rcWindow;
561
563 if (hWndParent == NULL)
565
566 GetWindowRect(hWndParent, &rcParent);
567 GetWindowRect(hWnd, &rcWindow);
568
570 HWND_TOP,
571 ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
572 ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
573 0,
574 0,
575 SWP_NOSIZE);
576}
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 374 of file livecd.c.

376{
377 HKEY hKey;
378 WCHAR szLayoutId[9], szCurrentLayoutId[9];
380 DWORD dwIndex = 0;
382 INT iIndex;
383 LONG lError;
384 ULONG ulLayoutId;
385
386 if (!GetKeyboardLayoutNameW(szCurrentLayoutId))
387 wcscpy(szCurrentLayoutId, L"00000409");
388
390 L"System\\CurrentControlSet\\Control\\Keyboard Layouts",
391 0,
393 &hKey);
394 if (lError != ERROR_SUCCESS)
395 return;
396
397 while (TRUE)
398 {
399 dwSize = ARRAYSIZE(szLayoutId);
400
401 lError = RegEnumKeyExW(hKey,
402 dwIndex,
403 szLayoutId,
404 &dwSize,
405 NULL,
406 NULL,
407 NULL,
408 NULL);
409 if (lError != ERROR_SUCCESS)
410 break;
411
412 GetLayoutName(szLayoutId, KeyName);
413
414 iIndex = (INT)SendMessageW(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
415
416 ulLayoutId = wcstoul(szLayoutId, NULL, 16);
417 SendMessageW(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)ulLayoutId);
418
419 if (wcscmp(szLayoutId, szCurrentLayoutId) == 0)
420 {
421 SendMessageW(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0);
422 }
423
424 dwIndex++;
425 }
426
428}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#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:2912
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
static BOOL GetLayoutName(LPCWSTR szLCID, LPWSTR szName)
Definition: livecd.c:238
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
long LONG
Definition: pedump.c:60
#define INT
Definition: polytest.cpp:20
wcscpy
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 CB_SETCURSEL
Definition: winuser.h:1990
#define CB_ADDSTRING
Definition: winuser.h:1965
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by LocaleDlgProc().

◆ CreateLanguagesList()

static VOID CreateLanguagesList ( HWND  hwnd,
PSTATE  pState 
)
static

Definition at line 209 of file livecd.c.

210{
211 WCHAR langSel[255];
212 LCID Locale = 0;
213
214 hList = hwnd;
215 bSpain = FALSE;
217
218 if (pState->Unattend->bEnabled)
219 Locale = pState->Unattend->LocaleID;
220
221 if (!Locale)
222 {
223 /* Select current locale */
224 /* or should it be System and not user? */
225 Locale = GetUserDefaultLCID();
226 }
228
231 -1,
232 (LPARAM)langSel);
233}
#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:159
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:215
#define CB_SELECTSTRING
Definition: winuser.h:1989

Referenced by LocaleDlgProc().

◆ GetLayoutName()

static BOOL GetLayoutName ( LPCWSTR  szLCID,
LPWSTR  szName 
)
static

Definition at line 238 of file livecd.c.

241{
242 HKEY hKey;
243 DWORD dwBufLen;
244 WCHAR szBuf[MAX_PATH], szDispName[MAX_PATH], szIndex[MAX_PATH], szPath[MAX_PATH];
245 HANDLE hLib;
246 UINT i, j, k;
247
248 wsprintf(szBuf, L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s", szLCID);
249
251 {
252 dwBufLen = sizeof(szDispName);
253
254 if (RegQueryValueExW(hKey, L"Layout Display Name", NULL, NULL, (LPBYTE)szDispName, &dwBufLen) == ERROR_SUCCESS)
255 {
256 if (szDispName[0] == '@')
257 {
258 for (i = 0; i < wcslen(szDispName); i++)
259 {
260 if ((szDispName[i] == ',') && (szDispName[i + 1] == '-'))
261 {
262 for (j = i + 2, k = 0; j < wcslen(szDispName)+1; j++, k++)
263 {
264 szIndex[k] = szDispName[j];
265 }
266 szDispName[i - 1] = '\0';
267 break;
268 }
269 else
270 szDispName[i] = szDispName[i + 1];
271 }
272
274 {
275 hLib = LoadLibraryW(szPath);
276 if (hLib)
277 {
278 if (LoadStringW(hLib, _wtoi(szIndex), szPath, ARRAYSIZE(szPath)) != 0)
279 {
282 return TRUE;
283 }
284 FreeLibrary(hLib);
285 }
286 }
287 }
288 }
289
290 dwBufLen = sizeof(szBuf);
291
292 if (RegQueryValueExW(hKey, L"Layout Text", NULL, NULL, (LPBYTE)szName, &dwBufLen) == ERROR_SUCCESS)
293 {
295 return TRUE;
296 }
297 }
298
299 return FALSE;
300}
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 FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:520
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
_ACRTIMP int __cdecl _wtoi(const wchar_t *)
Definition: wcs.c:2773
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
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
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 GLint GLint j
Definition: glfuncs.h:250
LPCWSTR szPath
Definition: env.c:37
int k
Definition: mpi.c:3369
unsigned int UINT
Definition: ndis.h:50
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
static const WCHAR szName[]
Definition: powrprof.c:45
unsigned char * LPBYTE
Definition: typedefs.h:53
#define wsprintf
Definition: winuser.h:5976

Referenced by CreateKeyboardLayoutList().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( PLCID  pNewLcid)
static

Definition at line 433 of file livecd.c.

435{
436 WCHAR szBuffer[80];
437 PWSTR ptr;
438 HKEY hLocaleKey;
439 DWORD ret;
441 LCID lcid;
442 INT i;
443
444 struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
445 /* Number */
446 {LOCALE_SDECIMAL, L"sDecimal"},
447 {LOCALE_STHOUSAND, L"sThousand"},
448 {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
449 {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
450 {LOCALE_SGROUPING, L"sGrouping"},
451 {LOCALE_SLIST, L"sList"},
452 {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
453 {LOCALE_INEGNUMBER, L"iNegNumber"},
454 {LOCALE_IDIGITS, L"iDigits"},
455 {LOCALE_ILZERO, L"iLZero"},
456 {LOCALE_IMEASURE, L"iMeasure"},
457 {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
458
459 /* Currency */
460 {LOCALE_SCURRENCY, L"sCurrency"},
461 {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
462 {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
463 {LOCALE_SMONGROUPING, L"sMonGrouping"},
464 {LOCALE_ICURRENCY, L"iCurrency"},
465 {LOCALE_INEGCURR, L"iNegCurr"},
466 {LOCALE_ICURRDIGITS, L"iCurrDigits"},
467
468 /* Time */
469 {LOCALE_STIMEFORMAT, L"sTimeFormat"},
470 {LOCALE_STIME, L"sTime"},
471 {LOCALE_S1159, L"s1159"},
472 {LOCALE_S2359, L"s2359"},
473 {LOCALE_ITIME, L"iTime"},
474 {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
475 {LOCALE_ITLZERO, L"iTLZero"},
476
477 /* Date */
478 {LOCALE_SLONGDATE, L"sLongDate"},
479 {LOCALE_SSHORTDATE, L"sShortDate"},
480 {LOCALE_SDATE, L"sDate"},
481 {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
482 {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
483 {LOCALE_IDATE, L"iDate"},
484 {LOCALE_ICALENDARTYPE, L"iCalendarType"},
485
486 /* Misc */
487 {LOCALE_SCOUNTRY, L"sCountry"},
488 {LOCALE_SABBREVLANGNAME, L"sLanguage"},
489 {LOCALE_ICOUNTRY, L"iCountry"},
490 {0, NULL}};
491
493 L".DEFAULT\\Control Panel\\International",
494 0,
496 &hLocaleKey);
497 if (ret != ERROR_SUCCESS)
498 {
499 return;
500 }
501
502 if (pNewLcid == NULL)
503 {
504 dwSize = 9 * sizeof(WCHAR);
505 ret = RegQueryValueExW(hLocaleKey,
506 L"Locale",
507 NULL,
508 NULL,
509 (PBYTE)szBuffer,
510 &dwSize);
511 if (ret != ERROR_SUCCESS)
512 goto done;
513
514 lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
515 if (lcid == 0)
516 goto done;
517 }
518 else
519 {
520 lcid = *pNewLcid;
521
522 swprintf(szBuffer, L"%08lx", lcid);
523 RegSetValueExW(hLocaleKey,
524 L"Locale",
525 0,
526 REG_SZ,
527 (PBYTE)szBuffer,
528 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
529 }
530
531 i = 0;
532 while (LocaleData[i].pValue != NULL)
533 {
535 LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
536 szBuffer,
537 ARRAYSIZE(szBuffer)))
538 {
539 RegSetValueExW(hLocaleKey,
540 LocaleData[i].pValue,
541 0,
542 REG_SZ,
543 (PBYTE)szBuffer,
544 (wcslen(szBuffer) + 1) * sizeof(WCHAR));
545 }
546
547 i++;
548 }
549
550done:
551 RegCloseKey(hLocaleKey);
552}
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:5656
#define swprintf
Definition: precomp.h:40
return ret
Definition: mutex.c:146
PWCHAR pValue
#define REG_SZ
Definition: layer.c:22
static PVOID ptr
Definition: dispmode.c:27
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_WRITE
Definition: nt_native.h:1034
BYTE * PBYTE
Definition: pedump.c:66
uint16_t * PWSTR
Definition: typedefs.h:56
#define LOCALE_ICURRDIGITS
Definition: winnls.h:61
#define LOCALE_SCOUNTRY
Definition: winnls.h:37
#define LOCALE_SDATE
Definition: winnls.h:65
#define LOCALE_SGROUPING
Definition: winnls.h:51
#define LOCALE_ICOUNTRY
Definition: winnls.h:36
#define LOCALE_SDECIMAL
Definition: winnls.h:49
#define LOCALE_IDATE
Definition: winnls.h:70
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:83
#define LOCALE_IMEASURE
Definition: winnls.h:48
#define LOCALE_SLONGDATE
Definition: winnls.h:68
#define LOCALE_S1159
Definition: winnls.h:78
#define LOCALE_SSHORTDATE
Definition: winnls.h:67
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:124
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:58
#define LOCALE_ITIME
Definition: winnls.h:72
#define LOCALE_ICURRENCY
Definition: winnls.h:63
#define LOCALE_ITLZERO
Definition: winnls.h:75
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:59
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_IDIGITS
Definition: winnls.h:52
#define LOCALE_STHOUSAND
Definition: winnls.h:50
#define LOCALE_STIMEFORMAT
Definition: winnls.h:69
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:82
#define LOCALE_STIME
Definition: winnls.h:66
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:34
#define LOCALE_INEGNUMBER
Definition: winnls.h:54
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:125
DWORD LCTYPE
Definition: winnls.h:581
#define LOCALE_S2359
Definition: winnls.h:79
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:55
#define LOCALE_SLIST
Definition: winnls.h:47
#define LOCALE_ILZERO
Definition: winnls.h:53
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:80
#define LOCALE_SMONGROUPING
Definition: winnls.h:60
#define LOCALE_SCURRENCY
Definition: winnls.h:56
#define LOCALE_INEGCURR
Definition: winnls.h:64
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:73
#define HKEY_USERS
Definition: winreg.h:13

Referenced by LocaleDlgProc().

◆ InitLogo()

static VOID InitLogo ( PIMGINFO  pImgInfo,
HWND  hwndDlg 
)
static

Definition at line 25 of file livecd.c.

26{
27 BITMAP logoBitmap;
28 BITMAP maskBitmap;
30 HDC hDC, hDCLogo, hDCMask;
31 HBITMAP hMask = NULL, hLogo = NULL;
32 HBITMAP hAlphaLogo = NULL;
33 COLORREF *pBits;
35
36 hDC = GetDC(hwndDlg);
37 hDCLogo = CreateCompatibleDC(NULL);
38 hDCMask = CreateCompatibleDC(NULL);
39
40 if (hDC == NULL || hDCLogo == NULL || hDCMask == NULL)
41 goto Cleanup;
42
43 ZeroMemory(pImgInfo, sizeof(*pImgInfo));
44 ZeroMemory(&bmpi, sizeof(bmpi));
45
48
49 if (hLogo == NULL || hMask == NULL)
50 goto Cleanup;
51
52 GetObject(hLogo, sizeof(logoBitmap), &logoBitmap);
53 GetObject(hMask, sizeof(maskBitmap), &maskBitmap);
54
55 if (logoBitmap.bmHeight != maskBitmap.bmHeight || logoBitmap.bmWidth != maskBitmap.bmWidth)
56 goto Cleanup;
57
59 bmpi.bmiHeader.biWidth = logoBitmap.bmWidth;
60 bmpi.bmiHeader.biHeight = logoBitmap.bmHeight;
64 bmpi.bmiHeader.biSizeImage = 4 * logoBitmap.bmWidth * logoBitmap.bmHeight;
65
66 /* Create a premultiplied bitmap */
67 hAlphaLogo = CreateDIBSection(hDC, &bmpi, DIB_RGB_COLORS, (PVOID*)&pBits, 0, 0);
68 if (!hAlphaLogo)
69 goto Cleanup;
70
71 SelectObject(hDCLogo, hLogo);
72 SelectObject(hDCMask, hMask);
73
74 for (line = logoBitmap.bmHeight - 1; line >= 0; line--)
75 {
76 for (column = 0; column < logoBitmap.bmWidth; column++)
77 {
78 COLORREF alpha = GetPixel(hDCMask, column, line) & 0xFF;
79 COLORREF Color = GetPixel(hDCLogo, column, line);
80 DWORD r, g, b;
81
82 r = GetRValue(Color) * alpha / 255;
83 g = GetGValue(Color) * alpha / 255;
84 b = GetBValue(Color) * alpha / 255;
85
86 *pBits++ = b | (g << 8) | (r << 16) | (alpha << 24);
87 }
88 }
89
90 pImgInfo->hBitmap = hAlphaLogo;
91 pImgInfo->cxSource = logoBitmap.bmWidth;
92 pImgInfo->cySource = logoBitmap.bmHeight;
93 pImgInfo->iBits = logoBitmap.bmBitsPixel;
94 pImgInfo->iPlanes = logoBitmap.bmPlanes;
95
97 if (hMask != NULL) DeleteObject(hMask);
98 if (hLogo != NULL) DeleteObject(hLogo);
99 if (hDCMask != NULL) DeleteDC(hDCMask);
100 if (hDCLogo != NULL) DeleteDC(hDCLogo);
101 if (hDC != NULL) ReleaseDC(hwndDlg, hDC);
102}
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 BI_RGB
Definition: precomp.h:44
#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
Definition: bl.h:1331
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
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:2555
HDC WINAPI GetDC(_In_opt_ HWND)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by RunLiveCD().

◆ IsLiveCD()

BOOL IsLiveCD ( VOID  )

Definition at line 106 of file livecd.c.

107{
108 HKEY ControlKey = NULL;
109 LPWSTR SystemStartOptions = NULL;
110 LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
111 LONG rc;
112 BOOL ret = FALSE;
113
116 0,
118 &ControlKey);
119 if (rc != ERROR_SUCCESS)
120 {
121 WARN("RegOpenKeyEx() failed with error %lu\n", rc);
122 goto cleanup;
123 }
124
125 rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
126 if (rc != ERROR_SUCCESS)
127 {
128 WARN("ReadRegSzKey() failed with error %lu\n", rc);
129 goto cleanup;
130 }
131
132 /* Check for CONSOLE switch in SystemStartOptions */
133 CurrentOption = SystemStartOptions;
134 while (CurrentOption)
135 {
136 NextOption = wcschr(CurrentOption, L' ');
137 if (NextOption)
138 *NextOption = L'\0';
139 if (_wcsicmp(CurrentOption, L"MININT") == 0)
140 {
141 TRACE("Found 'MININT' boot option\n");
142 ret = TRUE;
143 goto cleanup;
144 }
145 CurrentOption = NextOption ? NextOption + 1 : NULL;
146 }
147
148cleanup:
149 if (ControlKey != NULL)
150 RegCloseKey(ControlKey);
151 HeapFree(GetProcessHeap(), 0, SystemStartOptions);
152
153 TRACE("IsLiveCD() returning %u\n", ret);
154 return ret;
155}
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:253
#define WARN(fmt,...)
Definition: precomp.h:61
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
static void cleanup(void)
Definition: main.c:1335
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
unsigned int BOOL
Definition: ntddk_ex.h:94
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
#define REGSTR_PATH_CURRENT_CONTROL_SET
Definition: regstr.h:564
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by wWinMain().

◆ LocaleDlgProc()

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

Definition at line 619 of file livecd.c.

624{
625 PSTATE pState;
626
627 /* Retrieve pointer to the state */
628 pState = (PSTATE)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
629
630 switch (uMsg)
631 {
632 case WM_INITDIALOG:
633 /* Save pointer to the state */
634 pState = (PSTATE)lParam;
635 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
636
637 /* Center the dialog window */
638 CenterWindow(hwndDlg);
639
640 /* Fill the language and keyboard layout lists */
643 if (pState->Unattend->bEnabled)
644 {
645 /* Advance to the next page */
647 }
648 return FALSE;
649
650 case WM_DRAWITEM:
652 pState,
654 return TRUE;
655
656 case WM_COMMAND:
657 switch (LOWORD(wParam))
658 {
659 case IDC_LANGUAGELIST:
661 {
662 LCID NewLcid;
663 INT iCurSel;
664
665 iCurSel = SendDlgItemMessageW(hwndDlg,
668 0,
669 0);
670 if (iCurSel == CB_ERR)
671 break;
672
673 NewLcid = SendDlgItemMessageW(hwndDlg,
676 iCurSel,
677 0);
678 if (NewLcid == (LCID)CB_ERR)
679 break;
680
681 TRACE("LCID: 0x%08lx\n", NewLcid);
683 NewLcid);
684 }
685 break;
686
687 case IDOK:
688 if (HIWORD(wParam) == BN_CLICKED)
689 {
690 LCID NewLcid;
691 INT iCurSel;
692
693 iCurSel = SendDlgItemMessageW(hwndDlg,
696 0,
697 0);
698 if (iCurSel == CB_ERR)
699 break;
700
701 NewLcid = SendDlgItemMessageW(hwndDlg,
704 iCurSel,
705 0);
706 if (NewLcid == (LCID)CB_ERR)
707 break;
708
709 /* Set the locale for the current thread */
710 NtSetDefaultLocale(TRUE, NewLcid);
711
712 /* Store the locale settings in the registry */
714
715 /* Set UI language for this thread */
716 SetThreadLocale(NewLcid);
717
719
720 pState->NextPage = STARTPAGE;
721 EndDialog(hwndDlg, LOWORD(wParam));
722 }
723 break;
724
725 case IDCANCEL:
726 if (HIWORD(wParam) == BN_CLICKED)
727 {
728 static WCHAR szMsg[RC_STRING_MAX_SIZE];
729 INT ret;
731 ret = MessageBoxW(hwndDlg, szMsg, L"ReactOS LiveCD", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
732 if (ret == IDOK || ret == IDYES)
733 {
734 pState->NextPage = DONE;
735 pState->Run = REBOOT;
736 EndDialog(hwndDlg, LOWORD(wParam));
737 }
738 }
739 break;
740
741 default:
742 break;
743 }
744 break;
745
746 default:
747 break;
748 }
749
750 return FALSE;
751}
#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:209
static VOID CreateKeyboardLayoutList(HWND hItemsList)
Definition: livecd.c:374
static VOID InitializeDefaultUserLocale(PLCID pNewLcid)
Definition: livecd.c:433
VOID CenterWindow(HWND hWnd)
Definition: livecd.c:556
static VOID SetKeyboardLayout(HWND hwnd)
Definition: livecd.c:305
static VOID OnDrawItem(LPDRAWITEMSTRUCT lpDrawItem, PSTATE pState, UINT uCtlID)
Definition: livecd.c:581
static VOID SelectKeyboardForLanguage(HWND hwnd, LCID lcid)
Definition: livecd.c:330
struct _STATE * PSTATE
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:437
#define LOWORD(l)
Definition: pedump.c:82
#define DONE
Definition: rnr20lib.h:14
#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:3576
#define MAKEWPARAM(l, h)
Definition: winuser.h:4111
#define GetWindowLongPtrW
Definition: winuser.h:4931
#define IDCANCEL
Definition: winuser.h:842
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#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:5457
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by RunLiveCD().

◆ LocalesEnumProc()

static BOOL CALLBACK LocalesEnumProc ( LPTSTR  lpLocale)
static

Definition at line 159 of file livecd.c.

160{
161 LCID lcid;
162 WCHAR lang[255];
163 INT index;
164 BOOL bNoShow = FALSE;
165
166 lcid = wcstoul(lpLocale, NULL, 16);
167
168 /* Display only languages with installed support */
170 return TRUE;
171
172 // See http://archives.miloush.net/michkap/archive/2006/09/23/768178.html for why we handle spain differently
175 {
176 if (bSpain == FALSE)
177 {
179 bSpain = TRUE;
180 }
181 else
182 {
183 bNoShow = TRUE;
184 }
185 }
186 else
187 {
189 }
190
191 if (bNoShow == FALSE)
192 {
195 0,
196 (LPARAM)lang);
197
200 index,
201 (LPARAM)lcid);
202 }
203
204 return TRUE;
205}
#define index(s, c)
Definition: various.h:29
#define IDS_SPAIN
Definition: resource.h:32
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: locale.c:2925
GLuint index
Definition: glext.h:6031
#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:214

Referenced by CreateLanguagesList().

◆ OnDrawItem()

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

Definition at line 581 of file livecd.c.

585{
586 HDC hdcMem;
587 LONG left;
588
589 if (lpDrawItem->CtlID == uCtlID)
590 {
591 /* Position image in centre of dialog */
592 left = (lpDrawItem->rcItem.right - pState->ImageInfo.cxSource) / 2;
593
594 hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
595 if (hdcMem != NULL)
596 {
598
599 SelectObject(hdcMem, pState->ImageInfo.hBitmap);
600 GdiAlphaBlend(lpDrawItem->hDC,
601 left,
602 lpDrawItem->rcItem.top,
603 pState->ImageInfo.cxSource,
604 pState->ImageInfo.cySource,
605 hdcMem,
606 0, 0,
607 pState->ImageInfo.cxSource,
608 pState->ImageInfo.cySource,
609 BlendFunc);
611 }
612 }
613}
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()

VOID ParseUnattend ( LPCWSTR  UnattendInf,
LIVECD_UNATTEND pUnattend 
)

Definition at line 852 of file livecd.c.

853{
855
856 pUnattend->bEnabled = FALSE;
857
858 if (!GetPrivateProfileStringW(L"Unattend", L"Signature", L"", Buffer, _countof(Buffer), UnattendInf))
859 {
860 ERR("Unable to parse Signature\n");
861 return;
862 }
863
864 if (_wcsicmp(Buffer, L"$ReactOS$") && _wcsicmp(Buffer, L"$Windows NT$"))
865 {
866 TRACE("Unknown signature: %S\n", Buffer);
867 return;
868 }
869
870 if (!GetPrivateProfileStringW(L"Unattend", L"UnattendSetupEnabled", L"", Buffer, _countof(Buffer), UnattendInf))
871 {
872 ERR("Unable to parse UnattendSetupEnabled\n");
873 return;
874 }
875
876 if (_wcsicmp(Buffer, L"yes"))
877 {
878 TRACE("Unattended setup is not enabled\n", Buffer);
879 return;
880 }
881
882 pUnattend->bEnabled = TRUE;
883 pUnattend->LocaleID = 0;
884
885 if (GetPrivateProfileStringW(L"Unattend", L"LocaleID", L"", Buffer, _countof(Buffer), UnattendInf) && Buffer[0])
886 {
887 pUnattend->LocaleID = wcstol(Buffer, NULL, 16);
888 }
889}
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: bufpool.h:45
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2747
#define _countof(array)
Definition: sndvol32.h:70
LCID LocaleID
Definition: livecd.c:17
BOOL bEnabled
Definition: livecd.c:16

Referenced by RunLiveCD().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  pState)

Definition at line 892 of file livecd.c.

894{
895 LIVECD_UNATTEND Unattend = {0};
896 WCHAR UnattendInf[MAX_PATH];
897
898 InitLogo(&pState->ImageInfo, NULL);
899
900 GetWindowsDirectoryW(UnattendInf, _countof(UnattendInf));
901 wcscat(UnattendInf, L"\\unattend.inf");
902 ParseUnattend(UnattendInf, &Unattend);
903 pState->Unattend = &Unattend;
904
905 while (pState->NextPage != DONE)
906 {
907 switch (pState->NextPage)
908 {
909 case LOCALEPAGE:
912 NULL,
914 (LPARAM)pState);
915 break;
916
917 case STARTPAGE:
920 NULL,
922 (LPARAM)pState);
923 break;
924
925 default:
926 break;
927 }
928 }
929
930 DeleteObject(pState->ImageInfo.hBitmap);
931}
#define IDD_STARTPAGE
Definition: resource.h:18
#define IDD_LOCALEPAGE
Definition: resource.h:13
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
static INT_PTR CALLBACK LocaleDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:619
VOID ParseUnattend(LPCWSTR UnattendInf, LIVECD_UNATTEND *pUnattend)
Definition: livecd.c:852
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:757
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:25
wcscat
@ 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 330 of file livecd.c.

333{
334 INT i, nCount;
335 LCID LayoutId;
336
337 TRACE("LCID: %08lx\n", lcid);
338 TRACE("LangID: %04lx\n", LANGIDFROMLCID(lcid));
339
340 nCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
341
342 for (i = 0; i < nCount; i++)
343 {
344 LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
345 TRACE("Layout: %08lx\n", LayoutId);
346
347 if (LANGIDFROMLCID(LayoutId) == LANGIDFROMLCID(lcid))
348 {
349 TRACE("Found 1: %08lx --> %08lx\n", LayoutId, lcid);
351 return;
352 }
353 }
354
355 for (i = 0; i < nCount; i++)
356 {
357 LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
358 TRACE("Layout: %08lx\n", LayoutId);
359
360 if (PRIMARYLANGID(LayoutId) == PRIMARYLANGID(lcid))
361 {
362 TRACE("Found 2: %08lx --> %08lx\n", LayoutId, lcid);
364 return;
365 }
366 }
367
368 TRACE("No match found!\n");
369}
#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 305 of file livecd.c.

307{
308 INT iCurSel;
309 ULONG ulLayoutId;
310 HKL hKl;
311 WCHAR szLayoutId[9];
312
313 iCurSel = SendMessageW(hwnd, CB_GETCURSEL, 0, 0);
314 if (iCurSel == CB_ERR)
315 return;
316
317 ulLayoutId = (ULONG)SendMessageW(hwnd, CB_GETITEMDATA, iCurSel, 0);
318 if (ulLayoutId == (ULONG)CB_ERR)
319 return;
320
321 swprintf(szLayoutId, L"%08lx", ulLayoutId);
322
324 SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hKl, SPIF_SENDCHANGE);
325}
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 757 of file livecd.c.

762{
763 PSTATE pState;
764
765 /* Retrieve pointer to the state */
766 pState = (PSTATE)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
767
768 switch (uMsg)
769 {
770 case WM_INITDIALOG:
771 {
772 WCHAR Installer[MAX_PATH];
773
774 /* Save pointer to the state */
775 pState = (PSTATE)lParam;
776 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
777
778 /* Center the dialog window */
779 CenterWindow(hwndDlg);
780
781 /* Check whether we can find the ReactOS installer. If not,
782 * disable the "Install" button and directly start the LiveCD. */
783 *Installer = UNICODE_NULL;
784 if (!ExpandInstallerPath(L"reactos.exe", Installer, ARRAYSIZE(Installer)))
786
787 if (pState->Unattend->bEnabled || (*Installer == UNICODE_NULL))
788 {
789 /* Click on the 'Run' button */
791 }
792 return FALSE;
793 }
794
795 case WM_DRAWITEM:
797 pState,
799 return TRUE;
800
801 case WM_COMMAND:
802 if (HIWORD(wParam) == BN_CLICKED)
803 {
804 switch (LOWORD(wParam))
805 {
806 case IDC_RUN:
807 pState->NextPage = DONE;
808 pState->Run = SHELL;
809 EndDialog(hwndDlg, LOWORD(wParam));
810 break;
811
812 case IDC_INSTALL:
813 pState->NextPage = DONE;
814 pState->Run = INSTALLER;
815 EndDialog(hwndDlg, LOWORD(wParam));
816 break;
817
818 case IDOK:
819 pState->NextPage = LOCALEPAGE;
820 EndDialog(hwndDlg, LOWORD(wParam));
821 break;
822
823 case IDCANCEL:
824 if (HIWORD(wParam) == BN_CLICKED)
825 {
826 static WCHAR szMsg[RC_STRING_MAX_SIZE];
827 INT ret;
829 ret = MessageBoxW(hwndDlg, szMsg, L"ReactOS LiveCD", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
830 if (ret == IDOK || ret == IDYES)
831 {
832 pState->NextPage = DONE;
833 pState->Run = REBOOT;
834 EndDialog(hwndDlg, LOWORD(wParam));
835 }
836 }
837 break;
838
839 default:
840 break;
841 }
842 }
843 break;
844
845 default:
846 break;
847 }
848
849 return FALSE;
850}
#define IDC_STARTLOGO
Definition: resource.h:20
#define IDC_RUN
Definition: resource.h:21
#define IDC_INSTALL
Definition: fontview.h:13
#define UNICODE_NULL
@ INSTALLER
Definition: userinit.h:43
@ SHELL
Definition: userinit.h:42
BOOL ExpandInstallerPath(IN LPCTSTR lpInstallerName, OUT LPTSTR lpInstallerPath, IN SIZE_T PathSize)
Definition: welcome.c:218
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.