ReactOS  0.4.13-dev-100-gc8611ae
livecd.c File Reference
#include "userinit.h"
Include dependency graph for livecd.c:

Go to the source code of this file.

Functions

static VOID InitLogo (PIMGINFO pImgInfo, HWND hwndDlg)
 
BOOL IsLiveCD (VOID)
 
static BOOL CALLBACK LocalesEnumProc (LPTSTR lpLocale)
 
static VOID CreateLanguagesList (HWND hwnd)
 
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 RunLiveCD (PSTATE pState)
 

Variables

HWND hList
 
HWND hLocaleList
 
BOOL bSpain = FALSE
 

Function Documentation

◆ CenterWindow()

VOID CenterWindow ( HWND  hWnd)

Definition at line 536 of file livecd.c.

537 {
539  RECT rcParent;
540  RECT rcWindow;
541 
543  if (hWndParent == NULL)
545 
546  GetWindowRect(hWndParent, &rcParent);
547  GetWindowRect(hWnd, &rcWindow);
548 
550  HWND_TOP,
551  ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
552  ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
553  0,
554  0,
555  SWP_NOSIZE);
556 }
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:292
#define HWND_TOP
Definition: winuser.h:1193
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
#define SWP_NOSIZE
Definition: winuser.h:1230
HWND WINAPI GetParent(_In_ HWND)
LONG bottom
Definition: windef.h:294
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)

Referenced by LocaleDlgProc(), and StartDlgProc().

◆ CreateKeyboardLayoutList()

static VOID CreateKeyboardLayoutList ( HWND  hItemsList)
static

Definition at line 354 of file livecd.c.

356 {
357  HKEY hKey;
358  WCHAR szLayoutId[9], szCurrentLayoutId[9];
360  DWORD dwIndex = 0;
361  DWORD dwSize;
362  INT iIndex;
363  LONG lError;
364  ULONG ulLayoutId;
365 
366  if (!GetKeyboardLayoutNameW(szCurrentLayoutId))
367  wcscpy(szCurrentLayoutId, L"00000409");
368 
370  L"System\\CurrentControlSet\\Control\\Keyboard Layouts",
371  0,
373  &hKey);
374  if (lError != ERROR_SUCCESS)
375  return;
376 
377  while (TRUE)
378  {
379  dwSize = ARRAYSIZE(szLayoutId);
380 
381  lError = RegEnumKeyExW(hKey,
382  dwIndex,
383  szLayoutId,
384  &dwSize,
385  NULL,
386  NULL,
387  NULL,
388  NULL);
389  if (lError != ERROR_SUCCESS)
390  break;
391 
392  GetLayoutName(szLayoutId, KeyName);
393 
394  iIndex = (INT)SendMessageW(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
395 
396  ulLayoutId = wcstoul(szLayoutId, NULL, 16);
397  SendMessageW(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)ulLayoutId);
398 
399  if (wcscmp(szLayoutId, szCurrentLayoutId) == 0)
400  {
401  SendMessageW(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0);
402  }
403 
404  dwIndex++;
405  }
406 
407  RegCloseKey(hKey);
408 }
#define CB_SETITEMDATA
Definition: winuser.h:1927
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
#define TRUE
Definition: types.h:120
static BOOL GetLayoutName(LPCWSTR szLCID, LPWSTR szName)
Definition: livecd.c:218
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI GetKeyboardLayoutNameW(_Out_writes_(KL_NAMELENGTH) LPWSTR)
#define INT
Definition: polytest.cpp:20
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
UINT_PTR WPARAM
Definition: windef.h:207
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
int32_t INT
Definition: typedefs.h:56
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CB_ADDSTRING
Definition: winuser.h:1897
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define CB_SETCURSEL
Definition: winuser.h:1922
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
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:2541
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

Referenced by LocaleDlgProc().

◆ CreateLanguagesList()

static VOID CreateLanguagesList ( HWND  hwnd)
static

Definition at line 197 of file livecd.c.

198 {
199  WCHAR langSel[255];
200 
201  hList = hwnd;
202  bSpain = FALSE;
204 
205  /* Select current locale */
206  /* or should it be System and not user? */
208 
211  -1,
212  (LPARAM)langSel);
213 }
TCHAR langSel[255]
Definition: powercfg.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
BOOL bSpain
Definition: livecd.c:12
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:768
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: lang.c:1604
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CB_SELECTSTRING
Definition: winuser.h:1921
HWND hList
Definition: livecd.c:10
static BOOL CALLBACK LocalesEnumProc(LPTSTR lpLocale)
Definition: livecd.c:148
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LCID_SUPPORTED
Definition: winnls.h:199

Referenced by LocaleDlgProc().

◆ GetLayoutName()

static BOOL GetLayoutName ( LPCWSTR  szLCID,
LPWSTR  szName 
)
static

Definition at line 218 of file livecd.c.

221 {
222  HKEY hKey;
223  DWORD dwBufLen;
224  WCHAR szBuf[MAX_PATH], szDispName[MAX_PATH], szIndex[MAX_PATH], szPath[MAX_PATH];
225  HANDLE hLib;
226  UINT i, j, k;
227 
228  wsprintf(szBuf, L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s", szLCID);
229 
231  {
232  dwBufLen = sizeof(szDispName);
233 
234  if (RegQueryValueExW(hKey, L"Layout Display Name", NULL, NULL, (LPBYTE)szDispName, &dwBufLen) == ERROR_SUCCESS)
235  {
236  if (szDispName[0] == '@')
237  {
238  for (i = 0; i < wcslen(szDispName); i++)
239  {
240  if ((szDispName[i] == ',') && (szDispName[i + 1] == '-'))
241  {
242  for (j = i + 2, k = 0; j < wcslen(szDispName)+1; j++, k++)
243  {
244  szIndex[k] = szDispName[j];
245  }
246  szDispName[i - 1] = '\0';
247  break;
248  }
249  else
250  szDispName[i] = szDispName[i + 1];
251  }
252 
254  {
255  hLib = LoadLibraryW(szPath);
256  if (hLib)
257  {
258  if (LoadStringW(hLib, _wtoi(szIndex), szPath, ARRAYSIZE(szPath)) != 0)
259  {
260  wcscpy(szName, szPath);
261  RegCloseKey(hKey);
262  return TRUE;
263  }
264  FreeLibrary(hLib);
265  }
266  }
267  }
268  }
269 
270  dwBufLen = sizeof(szBuf);
271 
272  if (RegQueryValueExW(hKey, L"Layout Text", NULL, NULL, (LPBYTE)szName, &dwBufLen) == ERROR_SUCCESS)
273  {
274  RegCloseKey(hKey);
275  return TRUE;
276  }
277  }
278 
279  return FALSE;
280 }
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define ERROR_SUCCESS
Definition: deptool.c:10
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
_In_ HCRYPTHASH _In_ BOOL _In_ DWORD _Inout_ DWORD _In_ DWORD dwBufLen
Definition: wincrypt.h:4245
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
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
#define FreeLibrary(x)
Definition: compat.h:405
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
LPCWSTR szPath
Definition: env.c:35
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
unsigned int UINT
Definition: ndis.h:50
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
static const WCHAR szName[]
Definition: msipriv.h:1194
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define wsprintf
Definition: winuser.h:5731
int k
Definition: mpi.c:3369
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CreateKeyboardLayoutList().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( PLCID  pNewLcid)
static

Definition at line 413 of file livecd.c.

415 {
416  WCHAR szBuffer[80];
417  PWSTR ptr;
418  HKEY hLocaleKey;
419  DWORD ret;
420  DWORD dwSize;
421  LCID lcid;
422  INT i;
423 
424  struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
425  /* Number */
426  {LOCALE_SDECIMAL, L"sDecimal"},
427  {LOCALE_STHOUSAND, L"sThousand"},
428  {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
429  {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
430  {LOCALE_SGROUPING, L"sGrouping"},
431  {LOCALE_SLIST, L"sList"},
432  {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
433  {LOCALE_INEGNUMBER, L"iNegNumber"},
434  {LOCALE_IDIGITS, L"iDigits"},
435  {LOCALE_ILZERO, L"iLZero"},
436  {LOCALE_IMEASURE, L"iMeasure"},
437  {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
438 
439  /* Currency */
440  {LOCALE_SCURRENCY, L"sCurrency"},
441  {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
442  {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
443  {LOCALE_SMONGROUPING, L"sMonGrouping"},
444  {LOCALE_ICURRENCY, L"iCurrency"},
445  {LOCALE_INEGCURR, L"iNegCurr"},
446  {LOCALE_ICURRDIGITS, L"iCurrDigits"},
447 
448  /* Time */
449  {LOCALE_STIMEFORMAT, L"sTimeFormat"},
450  {LOCALE_STIME, L"sTime"},
451  {LOCALE_S1159, L"s1159"},
452  {LOCALE_S2359, L"s2359"},
453  {LOCALE_ITIME, L"iTime"},
454  {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
455  {LOCALE_ITLZERO, L"iTLZero"},
456 
457  /* Date */
458  {LOCALE_SLONGDATE, L"sLongDate"},
459  {LOCALE_SSHORTDATE, L"sShortDate"},
460  {LOCALE_SDATE, L"sDate"},
461  {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
462  {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
463  {LOCALE_IDATE, L"iDate"},
464  {LOCALE_ICALENDARTYPE, L"iCalendarType"},
465 
466  /* Misc */
467  {LOCALE_SCOUNTRY, L"sCountry"},
468  {LOCALE_SABBREVLANGNAME, L"sLanguage"},
469  {LOCALE_ICOUNTRY, L"iCountry"},
470  {0, NULL}};
471 
473  L".DEFAULT\\Control Panel\\International",
474  0,
476  &hLocaleKey);
477  if (ret != ERROR_SUCCESS)
478  {
479  return;
480  }
481 
482  if (pNewLcid == NULL)
483  {
484  dwSize = 9 * sizeof(WCHAR);
485  ret = RegQueryValueExW(hLocaleKey,
486  L"Locale",
487  NULL,
488  NULL,
489  (PBYTE)szBuffer,
490  &dwSize);
491  if (ret != ERROR_SUCCESS)
492  goto done;
493 
494  lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
495  if (lcid == 0)
496  goto done;
497  }
498  else
499  {
500  lcid = *pNewLcid;
501 
502  swprintf(szBuffer, L"%08lx", lcid);
503  RegSetValueExW(hLocaleKey,
504  L"Locale",
505  0,
506  REG_SZ,
507  (PBYTE)szBuffer,
508  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
509  }
510 
511  i = 0;
512  while (LocaleData[i].pValue != NULL)
513  {
514  if (GetLocaleInfoW(lcid,
515  LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
516  szBuffer,
517  ARRAYSIZE(szBuffer)))
518  {
519  RegSetValueExW(hLocaleKey,
520  LocaleData[i].pValue,
521  0,
522  REG_SZ,
523  (PBYTE)szBuffer,
524  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
525  }
526 
527  i++;
528  }
529 
530 done:
531  RegCloseKey(hLocaleKey);
532 }
#define HKEY_USERS
Definition: winreg.h:13
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_SMONGROUPING
Definition: winnls.h:53
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:54
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:73
#define LOCALE_ILZERO
Definition: winnls.h:46
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD LCID
Definition: nls.h:13
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define LOCALE_IMEASURE
Definition: winnls.h:41
int32_t INT
Definition: typedefs.h:56
#define LOCALE_SCURRENCY
Definition: winnls.h:49
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
DWORD LCTYPE
Definition: winnls.h:514
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 LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define LOCALE_SLONGDATE
Definition: winnls.h:61
static PVOID ptr
Definition: dispmode.c:27
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:66
#define LOCALE_INEGCURR
Definition: winnls.h:57
smooth NULL
Definition: ftsmooth.c:416
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_STIME
Definition: winnls.h:59
#define KEY_WRITE
Definition: nt_native.h:1031
#define LOCALE_ICURRENCY
Definition: winnls.h:56
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:4917
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:51
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:52
#define LOCALE_SDATE
Definition: winnls.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_ITLZERO
Definition: winnls.h:68
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_ICOUNTRY
Definition: winnls.h:30
#define LOCALE_IDIGITS
Definition: winnls.h:45
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:75
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:76
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
#define LOCALE_ITIME
Definition: winnls.h:65
#define LOCALE_SLIST
Definition: winnls.h:40
#define LOCALE_SCOUNTRY
Definition: winnls.h:31
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:48
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define REG_SZ
Definition: layer.c:22

Referenced by LocaleDlgProc().

◆ InitLogo()

static VOID InitLogo ( PIMGINFO  pImgInfo,
HWND  hwndDlg 
)
static

Definition at line 18 of file livecd.c.

19 {
20  BITMAP logoBitmap;
21  BITMAP maskBitmap;
23  HDC hDC = GetDC(hwndDlg);
24  HDC hDCLogo = CreateCompatibleDC(NULL);
25  HDC hDCMask = CreateCompatibleDC(NULL);
26  HBITMAP hMask, hLogo, hAlphaLogo = NULL;
27  COLORREF *pBits;
28  INT line, column;
29 
30  ZeroMemory(pImgInfo, sizeof(*pImgInfo));
31  ZeroMemory(&bmpi, sizeof(bmpi));
32 
35 
36  if (hLogo != NULL && hMask != NULL)
37  {
38  GetObject(hLogo, sizeof(logoBitmap), &logoBitmap);
39  GetObject(hMask, sizeof(maskBitmap), &maskBitmap);
40 
41  if (logoBitmap.bmHeight != maskBitmap.bmHeight || logoBitmap.bmWidth != maskBitmap.bmWidth)
42  goto Cleanup;
43 
44  bmpi.bmiHeader.biSize = sizeof(BITMAPINFO);
45  bmpi.bmiHeader.biWidth = logoBitmap.bmWidth;
46  bmpi.bmiHeader.biHeight = logoBitmap.bmHeight;
50  bmpi.bmiHeader.biSizeImage = 4 * logoBitmap.bmWidth * logoBitmap.bmHeight;
51 
52  /* Create a premultiplied bitmap */
53  hAlphaLogo = CreateDIBSection(hDC, &bmpi, DIB_RGB_COLORS, (PVOID*)&pBits, 0, 0);
54  if (!hAlphaLogo)
55  goto Cleanup;
56 
57  SelectObject(hDCLogo, hLogo);
58  SelectObject(hDCMask, hMask);
59 
60  for (line = logoBitmap.bmHeight - 1; line >= 0; line--)
61  {
62  for (column = 0; column < logoBitmap.bmWidth; column++)
63  {
64  COLORREF alpha = GetPixel(hDCMask, column, line) & 0xFF;
65  COLORREF Color = GetPixel(hDCLogo, column, line);
66  DWORD r, g, b;
67 
68  r = GetRValue(Color) * alpha / 255;
69  g = GetGValue(Color) * alpha / 255;
70  b = GetBValue(Color) * alpha / 255;
71 
72  *pBits++ = b | g << 8 | r << 16 | alpha << 24;
73  }
74  }
75 
76  pImgInfo->hBitmap = hAlphaLogo;
77  pImgInfo->cxSource = logoBitmap.bmWidth;
78  pImgInfo->cySource = logoBitmap.bmHeight;
79  pImgInfo->iBits = logoBitmap.bmBitsPixel;
80  pImgInfo->iPlanes = logoBitmap.bmPlanes;
81  }
82 
83 Cleanup:
84  DeleteObject(hMask);
85  DeleteObject(hLogo);
86  DeleteDC(hDCMask);
87  DeleteDC(hDCLogo);
88 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
INT iBits
Definition: userinit.h:53
HDC WINAPI GetDC(_In_opt_ HWND)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HDC
Definition: imagelist.c:92
#define GetRValue(rgb)
Definition: wingdi.h:2913
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
int32_t INT
Definition: typedefs.h:56
#define GetGValue(rgb)
Definition: wingdi.h:2914
HINSTANCE hInstance
Definition: charmap.c:20
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
INT cySource
Definition: userinit.h:51
#define b
Definition: ke_i.h:79
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
DWORD COLORREF
Definition: windef.h:285
unsigned long DWORD
Definition: ntddk_ex.h:95
INT iPlanes
Definition: userinit.h:52
DWORD biSizeImage
Definition: amvideo.idl:36
#define GetObject
Definition: wingdi.h:4446
#define IDB_ROSMASK
Definition: resource.h:7
PIMGINFO pImgInfo
Definition: general.c:31
char line[200]
Definition: main.c:97
static const WCHAR Cleanup[]
Definition: register.c:80
INT cxSource
Definition: userinit.h:50
static HDC hDC
Definition: 3dtext.c:33
BITMAPINFO bmpi
Definition: alphablend.c:68
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
Definition: bl.h:1331
HBITMAP hBitmap
Definition: userinit.h:49
#define IMAGE_BITMAP
Definition: winuser.h:211
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
#define GetBValue(rgb)
Definition: wingdi.h:2915
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
#define IDB_ROSLOGO
Definition: resource.h:6
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define BI_RGB
Definition: precomp.h:35
struct tagBITMAPINFO BITMAPINFO

Referenced by RunLiveCD().

◆ IsLiveCD()

BOOL IsLiveCD ( VOID  )

Definition at line 92 of file livecd.c.

93 {
94  HKEY ControlKey = NULL;
95  LPWSTR SystemStartOptions = NULL;
96  LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
97  LONG rc;
98  BOOL ret = FALSE;
99 
100  TRACE("IsLiveCD()\n");
101 
104  0,
106  &ControlKey);
107  if (rc != ERROR_SUCCESS)
108  {
109  WARN("RegOpenKeyEx() failed with error %lu\n", rc);
110  goto cleanup;
111  }
112 
113  rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
114  if (rc != ERROR_SUCCESS)
115  {
116  WARN("ReadRegSzKey() failed with error %lu\n", rc);
117  goto cleanup;
118  }
119 
120  /* Check for CONSOLE switch in SystemStartOptions */
121  CurrentOption = SystemStartOptions;
122  while (CurrentOption)
123  {
124  NextOption = wcschr(CurrentOption, L' ');
125  if (NextOption)
126  *NextOption = L'\0';
127  if (_wcsicmp(CurrentOption, L"MININT") == 0)
128  {
129  TRACE("Found 'MININT' boot option\n");
130  ret = TRUE;
131  goto cleanup;
132  }
133  CurrentOption = NextOption ? NextOption + 1 : NULL;
134  }
135 
136 cleanup:
137  if (ControlKey != NULL)
138  RegCloseKey(ControlKey);
139  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
140 
141  TRACE("IsLiveCD() returning %d\n", ret);
142 
143  return ret;
144 }
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: umpnpmgr.c:3985
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WARN(fmt,...)
Definition: debug.h:111
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define REGSTR_PATH_CURRENT_CONTROL_SET
Definition: regstr.h:564
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static char * NextOption(const char *const ostr)
Definition: getopt.c:31
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by wWinMain().

◆ LocaleDlgProc()

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

Definition at line 599 of file livecd.c.

604 {
605  PSTATE pState;
606 
607  /* Retrieve pointer to the state */
608  pState = (PSTATE)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
609 
610  switch (uMsg)
611  {
612  case WM_INITDIALOG:
613  /* Save pointer to the global state */
614  pState = (PSTATE)lParam;
615  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
616 
617  /* Center the dialog window */
618  CenterWindow(hwndDlg);
619 
620  /* Fill the language and keyboard layout lists */
623  return FALSE;
624 
625  case WM_DRAWITEM:
627  pState,
629  return TRUE;
630 
631  case WM_COMMAND:
632  switch (LOWORD(wParam))
633  {
634  case IDC_LANGUAGELIST:
635  if (HIWORD(wParam) == CBN_SELCHANGE)
636  {
637  LCID NewLcid;
638  INT iCurSel;
639 
640  iCurSel = SendDlgItemMessageW(hwndDlg,
642  CB_GETCURSEL,
643  0,
644  0);
645  if (iCurSel == CB_ERR)
646  break;
647 
648  NewLcid = SendDlgItemMessageW(hwndDlg,
651  iCurSel,
652  0);
653  if (NewLcid == (LCID)CB_ERR)
654  break;
655 
656  TRACE("LCID: 0x%08lx\n", NewLcid);
658  NewLcid);
659  }
660  break;
661 
662  case IDOK:
663  if (HIWORD(wParam) == BN_CLICKED)
664  {
665  LCID NewLcid;
666  INT iCurSel;
667 
668  iCurSel = SendDlgItemMessageW(hwndDlg,
670  CB_GETCURSEL,
671  0,
672  0);
673  if (iCurSel == CB_ERR)
674  break;
675 
676  NewLcid = SendDlgItemMessageW(hwndDlg,
679  iCurSel,
680  0);
681  if (NewLcid == (LCID)CB_ERR)
682  break;
683 
684  /* Set the locale for the current thread */
685  NtSetDefaultLocale(TRUE, NewLcid);
686 
687  /* Store the locale settings in the registry */
688  InitializeDefaultUserLocale(&NewLcid);
689 
691 
692  pState->NextPage = STARTPAGE;
693  EndDialog(hwndDlg, LOWORD(wParam));
694  }
695  break;
696 
697  case IDCANCEL:
698  if (HIWORD(wParam) == BN_CLICKED)
699  {
700  static WCHAR szMsg[RC_STRING_MAX_SIZE];
701  INT ret;
703  ret = MessageBoxW(hwndDlg, szMsg, L"ReactOS LiveCD", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
704  if (ret == IDOK || ret == IDYES)
705  {
706  pState->NextPage = DONE;
707  pState->Run = REBOOT;
708  EndDialog(hwndDlg, LOWORD(wParam));
709  }
710  }
711  break;
712 
713  default:
714  break;
715  }
716  break;
717 
718  default:
719  break;
720  }
721 
722  return FALSE;
723 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDYES
Definition: winuser.h:829
#define CB_GETITEMDATA
Definition: winuser.h:1911
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define IDC_LANGUAGELIST
Definition: resource.h:15
DWORD LCID
Definition: nls.h:13
#define GetWindowLongPtrW
Definition: winuser.h:4698
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1904
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define MB_ICONWARNING
Definition: winuser.h:780
static VOID SelectKeyboardForLanguage(HWND hwnd, LCID lcid)
Definition: livecd.c:310
#define MB_YESNO
Definition: winuser.h:811
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
struct _STATE * PSTATE
#define CB_ERR
Definition: winuser.h:2389
#define TRACE(s)
Definition: solgame.cpp:4
static VOID OnDrawItem(LPDRAWITEMSTRUCT lpDrawItem, PSTATE pState, UINT uCtlID)
Definition: livecd.c:561
#define RC_STRING_MAX_SIZE
Definition: resource.h:3
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:203
#define BN_CLICKED
Definition: winuser.h:1886
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define WM_COMMAND
Definition: winuser.h:1716
VOID CenterWindow(HWND hWnd)
Definition: livecd.c:536
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define IDS_CANCEL_CONFIRM
Definition: resource.h:30
#define GetModuleHandle
Definition: winbase.h:3641
#define IDC_LAYOUTLIST
Definition: resource.h:17
#define CBN_SELCHANGE
Definition: winuser.h:1940
#define WM_DRAWITEM
Definition: winuser.h:1627
static VOID CreateKeyboardLayoutList(HWND hItemsList)
Definition: livecd.c:354
#define MB_DEFBUTTON2
Definition: winuser.h:793
#define HIWORD(l)
Definition: typedefs.h:246
static VOID InitializeDefaultUserLocale(PLCID pNewLcid)
Definition: livecd.c:413
#define DONE
Definition: rnr20lib.h:14
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define IDCANCEL
Definition: winuser.h:825
#define IDC_LOCALELOGO
Definition: resource.h:14
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
static VOID SetKeyboardLayout(HWND hwnd)
Definition: livecd.c:285
#define LOWORD(l)
Definition: pedump.c:82
static VOID CreateLanguagesList(HWND hwnd)
Definition: livecd.c:197

Referenced by RunLiveCD().

◆ LocalesEnumProc()

static BOOL CALLBACK LocalesEnumProc ( LPTSTR  lpLocale)
static

Definition at line 148 of file livecd.c.

149 {
150  LCID lcid;
151  WCHAR lang[255];
152  INT index;
153  BOOL bNoShow = FALSE;
154 
155  lcid = wcstoul(lpLocale, NULL, 16);
156 
157  /* Display only languages with installed support */
158  if (!IsValidLocale(lcid, LCID_INSTALLED))
159  return TRUE;
160 
163  {
164  if (bSpain == FALSE)
165  {
167  bSpain = TRUE;
168  }
169  else
170  {
171  bNoShow = TRUE;
172  }
173  }
174  else
175  {
177  }
178 
179  if (bNoShow == FALSE)
180  {
182  CB_ADDSTRING,
183  0,
184  (LPARAM)lang);
185 
188  index,
189  (LPARAM)lcid);
190  }
191 
192  return TRUE;
193 }
#define CB_SETITEMDATA
Definition: winuser.h:1927
#define MAKELCID(lgid, srtid)
#define TRUE
Definition: types.h:120
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
BOOL bSpain
Definition: livecd.c:12
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD LCID
Definition: nls.h:13
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
#define LCID_INSTALLED
Definition: winnls.h:198
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define IDS_SPAIN
Definition: resource.h:32
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_ADDSTRING
Definition: winuser.h:1897
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
static const WCHAR lang[]
Definition: wbemdisp.c:287
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SORT_DEFAULT
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: lang.c:1548
#define index(s, c)
Definition: various.h:29
#define SUBLANG_SPANISH
Definition: nls.h:336
HWND hList
Definition: livecd.c:10
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_SPANISH
Definition: nls.h:123

Referenced by CreateLanguagesList().

◆ OnDrawItem()

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

Definition at line 561 of file livecd.c.

565 {
566  HDC hdcMem;
567  LONG left;
568 
569  if (lpDrawItem->CtlID == uCtlID)
570  {
571  /* Position image in centre of dialog */
572  left = (lpDrawItem->rcItem.right - pState->ImageInfo.cxSource) / 2;
573 
574  hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
575  if (hdcMem != NULL)
576  {
577  static BLENDFUNCTION BlendFunc = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA};
578 
579  SelectObject(hdcMem, pState->ImageInfo.hBitmap);
580  GdiAlphaBlend(lpDrawItem->hDC,
581  left,
582  lpDrawItem->rcItem.top,
583  pState->ImageInfo.cxSource,
584  pState->ImageInfo.cySource,
585  hdcMem,
586  0, 0,
587  pState->ImageInfo.cxSource,
588  pState->ImageInfo.cySource,
589  BlendFunc);
590  DeleteDC(hdcMem);
591  }
592  }
593 }
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)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define AC_SRC_ALPHA
Definition: alphablend.c:9
LONG right
Definition: windef.h:293
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
GLint left
Definition: glext.h:7726
#define AC_SRC_OVER
Definition: wingdi.h:1351
BOOL WINAPI DeleteDC(_In_ HDC)
BLENDFUNCTION BlendFunc
Definition: general.c:32
HDC hdcMem
Definition: welcome.c:104

Referenced by LocaleDlgProc(), and StartDlgProc().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  pState)

Definition at line 810 of file livecd.c.

812 {
813  InitLogo(&pState->ImageInfo, NULL);
814 
815  while (pState->NextPage != DONE)
816  {
817  switch (pState->NextPage)
818  {
819  case LOCALEPAGE:
822  NULL,
824  (LPARAM)pState);
825  break;
826 
827  case STARTPAGE:
830  NULL,
831  StartDlgProc,
832  (LPARAM)pState);
833  break;
834 
835  default:
836  break;
837  }
838  }
839 
840  DeleteObject(pState->ImageInfo.hBitmap);
841 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define IDD_STARTPAGE
Definition: resource.h:18
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:18
#define IDD_LOCALEPAGE
Definition: resource.h:13
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:729
#define DONE
Definition: rnr20lib.h:14
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static INT_PTR CALLBACK LocaleDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:599

Referenced by wWinMain().

◆ SelectKeyboardForLanguage()

static VOID SelectKeyboardForLanguage ( HWND  hwnd,
LCID  lcid 
)
static

Definition at line 310 of file livecd.c.

313 {
314  INT i, nCount;
315  LCID LayoutId;
316 
317  TRACE("LCID: %08lx\n", lcid);
318  TRACE("LangID: %04lx\n", LANGIDFROMLCID(lcid));
319 
320  nCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
321 
322  for (i = 0; i < nCount; i++)
323  {
324  LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
325  TRACE("Layout: %08lx\n", LayoutId);
326 
327  if (LANGIDFROMLCID(LayoutId) == LANGIDFROMLCID(lcid))
328  {
329  TRACE("Found 1: %08lx --> %08lx\n", LayoutId, lcid);
331  return;
332  }
333  }
334 
335  for (i = 0; i < nCount; i++)
336  {
337  LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
338  TRACE("Layout: %08lx\n", LayoutId);
339 
340  if (PRIMARYLANGID(LayoutId) == PRIMARYLANGID(lcid))
341  {
342  TRACE("Found 2: %08lx --> %08lx\n", LayoutId, lcid);
344  return;
345  }
346  }
347 
348  TRACE("No match found!\n");
349 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CB_GETITEMDATA
Definition: winuser.h:1911
DWORD LCID
Definition: nls.h:13
int32_t INT
Definition: typedefs.h:56
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 TRACE(s)
Definition: solgame.cpp:4
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define CB_SETCURSEL
Definition: winuser.h:1922
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1903
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by LocaleDlgProc().

◆ SetKeyboardLayout()

static VOID SetKeyboardLayout ( HWND  hwnd)
static

Definition at line 285 of file livecd.c.

287 {
288  INT iCurSel;
289  ULONG ulLayoutId;
290  HKL hKl;
291  WCHAR szLayoutId[9];
292 
293  iCurSel = SendMessageW(hwnd, CB_GETCURSEL, 0, 0);
294  if (iCurSel == CB_ERR)
295  return;
296 
297  ulLayoutId = (ULONG)SendMessageW(hwnd, CB_GETITEMDATA, iCurSel, 0);
298  if (ulLayoutId == (ULONG)CB_ERR)
299  return;
300 
301  swprintf(szLayoutId, L"%08lx", ulLayoutId);
302 
304  SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hKl, SPIF_SENDWININICHANGE);
305 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define KLF_ACTIVATE
Definition: winuser.h:111
#define CB_GETITEMDATA
Definition: winuser.h:1911
int32_t INT
Definition: typedefs.h:56
#define CB_GETCURSEL
Definition: winuser.h:1904
#define CB_ERR
Definition: winuser.h:2389
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define SPIF_SENDWININICHANGE
Definition: winuser.h:1554
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
static const WCHAR L[]
Definition: oid.c:1250
UINT_PTR HKL
Definition: msctf.idl:101
#define KLF_REPLACELANG
Definition: winuser.h:115
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define KLF_SETFORPROCESS
Definition: winuser.h:117
HKL WINAPI LoadKeyboardLayoutW(_In_ LPCWSTR, _In_ UINT)
unsigned int ULONG
Definition: retypes.h:1

Referenced by LocaleDlgProc().

◆ StartDlgProc()

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

Definition at line 729 of file livecd.c.

734 {
735  PSTATE pState;
736 
737  /* Retrieve pointer to the state */
738  pState = (PSTATE)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
739 
740  switch (uMsg)
741  {
742  case WM_INITDIALOG:
743  /* Save pointer to the state */
744  pState = (PSTATE)lParam;
745  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
746 
747  /* Center the dialog window */
748  CenterWindow(hwndDlg);
749  return FALSE;
750 
751  case WM_DRAWITEM:
753  pState,
754  IDC_STARTLOGO);
755  return TRUE;
756 
757  case WM_COMMAND:
758  if (HIWORD(wParam) == BN_CLICKED)
759  {
760  switch (LOWORD(wParam))
761  {
762  case IDC_RUN:
763  pState->NextPage = DONE;
764  pState->Run = SHELL;
765  EndDialog(hwndDlg, LOWORD(wParam));
766  break;
767 
768  case IDC_INSTALL:
769  pState->NextPage = DONE;
770  pState->Run = INSTALLER;
771  EndDialog(hwndDlg, LOWORD(wParam));
772  break;
773 
774  case IDOK:
775  pState->NextPage = LOCALEPAGE;
776  EndDialog(hwndDlg, LOWORD(wParam));
777  break;
778 
779  case IDCANCEL:
780  if (HIWORD(wParam) == BN_CLICKED)
781  {
782  static WCHAR szMsg[RC_STRING_MAX_SIZE];
783  INT ret;
785  ret = MessageBoxW(hwndDlg, szMsg, L"ReactOS LiveCD", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
786  if (ret == IDOK || ret == IDYES)
787  {
788  pState->NextPage = DONE;
789  pState->Run = REBOOT;
790  EndDialog(hwndDlg, LOWORD(wParam));
791  }
792  }
793  break;
794 
795  default:
796  break;
797  }
798  }
799  break;
800 
801  default:
802  break;
803  }
804 
805  return FALSE;
806 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDYES
Definition: winuser.h:829
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define GetWindowLongPtrW
Definition: winuser.h:4698
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define MB_ICONWARNING
Definition: winuser.h:780
#define MB_YESNO
Definition: winuser.h:811
#define GWLP_USERDATA
Definition: treelist.c:63
#define IDC_RUN
Definition: resource.h:21
smooth NULL
Definition: ftsmooth.c:416
struct _STATE * PSTATE
static VOID OnDrawItem(LPDRAWITEMSTRUCT lpDrawItem, PSTATE pState, UINT uCtlID)
Definition: livecd.c:561
#define RC_STRING_MAX_SIZE
Definition: resource.h:3
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BN_CLICKED
Definition: winuser.h:1886
Definition: userinit.h:42
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define WM_COMMAND
Definition: winuser.h:1716
VOID CenterWindow(HWND hWnd)
Definition: livecd.c:536
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define IDS_CANCEL_CONFIRM
Definition: resource.h:30
#define GetModuleHandle
Definition: winbase.h:3641
#define WM_DRAWITEM
Definition: winuser.h:1627
#define MB_DEFBUTTON2
Definition: winuser.h:793
#define IDC_STARTLOGO
Definition: resource.h:20
#define HIWORD(l)
Definition: typedefs.h:246
#define DONE
Definition: rnr20lib.h:14
#define SetWindowLongPtrW
Definition: winuser.h:5215
#define IDCANCEL
Definition: winuser.h:825
#define IDC_INSTALL
Definition: fontview.h:13
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

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.