ReactOS  0.4.15-dev-3295-gaa8fc87
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 559 of file livecd.c.

560 {
562  RECT rcParent;
563  RECT rcWindow;
564 
566  if (hWndParent == NULL)
568 
569  GetWindowRect(hWndParent, &rcParent);
570  GetWindowRect(hWnd, &rcWindow);
571 
573  HWND_TOP,
574  ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2,
575  ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2,
576  0,
577  0,
578  SWP_NOSIZE);
579 }
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
#define HWND_TOP
Definition: winuser.h:1193
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define SWP_NOSIZE
Definition: winuser.h:1231
HWND WINAPI GetParent(_In_ HWND)
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
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 377 of file livecd.c.

379 {
380  HKEY hKey;
381  WCHAR szLayoutId[9], szCurrentLayoutId[9];
383  DWORD dwIndex = 0;
384  DWORD dwSize;
385  INT iIndex;
386  LONG lError;
387  ULONG ulLayoutId;
388 
389  if (!GetKeyboardLayoutNameW(szCurrentLayoutId))
390  wcscpy(szCurrentLayoutId, L"00000409");
391 
393  L"System\\CurrentControlSet\\Control\\Keyboard Layouts",
394  0,
396  &hKey);
397  if (lError != ERROR_SUCCESS)
398  return;
399 
400  while (TRUE)
401  {
402  dwSize = ARRAYSIZE(szLayoutId);
403 
404  lError = RegEnumKeyExW(hKey,
405  dwIndex,
406  szLayoutId,
407  &dwSize,
408  NULL,
409  NULL,
410  NULL,
411  NULL);
412  if (lError != ERROR_SUCCESS)
413  break;
414 
415  GetLayoutName(szLayoutId, KeyName);
416 
417  iIndex = (INT)SendMessageW(hItemsList, CB_ADDSTRING, 0, (LPARAM)KeyName);
418 
419  ulLayoutId = wcstoul(szLayoutId, NULL, 16);
420  SendMessageW(hItemsList, CB_SETITEMDATA, iIndex, (LPARAM)ulLayoutId);
421 
422  if (wcscmp(szLayoutId, szCurrentLayoutId) == 0)
423  {
424  SendMessageW(hItemsList, CB_SETCURSEL, (WPARAM)iIndex, (LPARAM)0);
425  }
426 
427  dwIndex++;
428  }
429 
430  RegCloseKey(hKey);
431 }
#define CB_SETITEMDATA
Definition: winuser.h:1949
static BOOL GetLayoutName(LPCWSTR szLCID, LPWSTR szName)
Definition: livecd.c:241
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
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:58
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define CB_ADDSTRING
Definition: winuser.h:1919
LONG_PTR LPARAM
Definition: windef.h:208
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
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:1944
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
FxAutoRegKey hKey
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
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:2527
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#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,
PSTATE  pState 
)
static

Definition at line 212 of file livecd.c.

213 {
214  WCHAR langSel[255];
215  LCID Locale = 0;
216 
217  hList = hwnd;
218  bSpain = FALSE;
220 
221  if (pState->Unattend->bEnabled)
222  Locale = pState->Unattend->LocaleID;
223 
224  if (!Locale)
225  {
226  /* Select current locale */
227  /* or should it be System and not user? */
228  Locale = GetUserDefaultLCID();
229  }
231 
234  -1,
235  (LPARAM)langSel);
236 }
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
DWORD LCID
Definition: nls.h:13
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:768
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define FALSE
Definition: types.h:117
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:1943
HWND hList
Definition: livecd.c:10
static BOOL CALLBACK LocalesEnumProc(LPTSTR lpLocale)
Definition: livecd.c:162
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LCID_SUPPORTED
Definition: winnls.h:202

Referenced by LocaleDlgProc().

◆ GetLayoutName()

static BOOL GetLayoutName ( LPCWSTR  szLCID,
LPWSTR  szName 
)
static

Definition at line 241 of file livecd.c.

244 {
245  HKEY hKey;
246  DWORD dwBufLen;
247  WCHAR szBuf[MAX_PATH], szDispName[MAX_PATH], szIndex[MAX_PATH], szPath[MAX_PATH];
248  HANDLE hLib;
249  UINT i, j, k;
250 
251  wsprintf(szBuf, L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s", szLCID);
252 
254  {
255  dwBufLen = sizeof(szDispName);
256 
257  if (RegQueryValueExW(hKey, L"Layout Display Name", NULL, NULL, (LPBYTE)szDispName, &dwBufLen) == ERROR_SUCCESS)
258  {
259  if (szDispName[0] == '@')
260  {
261  for (i = 0; i < wcslen(szDispName); i++)
262  {
263  if ((szDispName[i] == ',') && (szDispName[i + 1] == '-'))
264  {
265  for (j = i + 2, k = 0; j < wcslen(szDispName)+1; j++, k++)
266  {
267  szIndex[k] = szDispName[j];
268  }
269  szDispName[i - 1] = '\0';
270  break;
271  }
272  else
273  szDispName[i] = szDispName[i + 1];
274  }
275 
277  {
278  hLib = LoadLibraryW(szPath);
279  if (hLib)
280  {
281  if (LoadStringW(hLib, _wtoi(szIndex), szPath, ARRAYSIZE(szPath)) != 0)
282  {
283  wcscpy(szName, szPath);
284  RegCloseKey(hKey);
285  return TRUE;
286  }
287  FreeLibrary(hLib);
288  }
289  }
290  }
291  }
292 
293  dwBufLen = sizeof(szBuf);
294 
295  if (RegQueryValueExW(hKey, L"Layout Text", NULL, NULL, (LPBYTE)szName, &dwBufLen) == ERROR_SUCCESS)
296  {
297  RegCloseKey(hKey);
298  return TRUE;
299  }
300  }
301 
302  return FALSE;
303 }
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
_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)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:606
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:607
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
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
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
FxAutoRegKey hKey
LPCWSTR szPath
Definition: env.c:37
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static const WCHAR szName[]
Definition: msipriv.h:1194
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define wsprintf
Definition: winuser.h:5841
int k
Definition: mpi.c:3369
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CreateKeyboardLayoutList().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( PLCID  pNewLcid)
static

Definition at line 436 of file livecd.c.

438 {
439  WCHAR szBuffer[80];
440  PWSTR ptr;
441  HKEY hLocaleKey;
442  DWORD ret;
443  DWORD dwSize;
444  LCID lcid;
445  INT i;
446 
447  struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
448  /* Number */
449  {LOCALE_SDECIMAL, L"sDecimal"},
450  {LOCALE_STHOUSAND, L"sThousand"},
451  {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
452  {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
453  {LOCALE_SGROUPING, L"sGrouping"},
454  {LOCALE_SLIST, L"sList"},
455  {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
456  {LOCALE_INEGNUMBER, L"iNegNumber"},
457  {LOCALE_IDIGITS, L"iDigits"},
458  {LOCALE_ILZERO, L"iLZero"},
459  {LOCALE_IMEASURE, L"iMeasure"},
460  {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
461 
462  /* Currency */
463  {LOCALE_SCURRENCY, L"sCurrency"},
464  {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
465  {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
466  {LOCALE_SMONGROUPING, L"sMonGrouping"},
467  {LOCALE_ICURRENCY, L"iCurrency"},
468  {LOCALE_INEGCURR, L"iNegCurr"},
469  {LOCALE_ICURRDIGITS, L"iCurrDigits"},
470 
471  /* Time */
472  {LOCALE_STIMEFORMAT, L"sTimeFormat"},
473  {LOCALE_STIME, L"sTime"},
474  {LOCALE_S1159, L"s1159"},
475  {LOCALE_S2359, L"s2359"},
476  {LOCALE_ITIME, L"iTime"},
477  {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
478  {LOCALE_ITLZERO, L"iTLZero"},
479 
480  /* Date */
481  {LOCALE_SLONGDATE, L"sLongDate"},
482  {LOCALE_SSHORTDATE, L"sShortDate"},
483  {LOCALE_SDATE, L"sDate"},
484  {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
485  {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
486  {LOCALE_IDATE, L"iDate"},
487  {LOCALE_ICALENDARTYPE, L"iCalendarType"},
488 
489  /* Misc */
490  {LOCALE_SCOUNTRY, L"sCountry"},
491  {LOCALE_SABBREVLANGNAME, L"sLanguage"},
492  {LOCALE_ICOUNTRY, L"iCountry"},
493  {0, NULL}};
494 
496  L".DEFAULT\\Control Panel\\International",
497  0,
499  &hLocaleKey);
500  if (ret != ERROR_SUCCESS)
501  {
502  return;
503  }
504 
505  if (pNewLcid == NULL)
506  {
507  dwSize = 9 * sizeof(WCHAR);
508  ret = RegQueryValueExW(hLocaleKey,
509  L"Locale",
510  NULL,
511  NULL,
512  (PBYTE)szBuffer,
513  &dwSize);
514  if (ret != ERROR_SUCCESS)
515  goto done;
516 
517  lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
518  if (lcid == 0)
519  goto done;
520  }
521  else
522  {
523  lcid = *pNewLcid;
524 
525  swprintf(szBuffer, L"%08lx", lcid);
526  RegSetValueExW(hLocaleKey,
527  L"Locale",
528  0,
529  REG_SZ,
530  (PBYTE)szBuffer,
531  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
532  }
533 
534  i = 0;
535  while (LocaleData[i].pValue != NULL)
536  {
537  if (GetLocaleInfoW(lcid,
538  LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
539  szBuffer,
540  ARRAYSIZE(szBuffer)))
541  {
542  RegSetValueExW(hLocaleKey,
543  LocaleData[i].pValue,
544  0,
545  REG_SZ,
546  (PBYTE)szBuffer,
547  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
548  }
549 
550  i++;
551  }
552 
553 done:
554  RegCloseKey(hLocaleKey);
555 }
#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:56
#define LOCALE_IDATE
Definition: winnls.h:63
PWCHAR pValue
#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 swprintf
Definition: precomp.h:40
#define LOCALE_IMEASURE
Definition: winnls.h:41
int32_t INT
Definition: typedefs.h:58
#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:517
#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
#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:4895
#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:4116
#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
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
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_ITIME
Definition: winnls.h:65
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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:3366
#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
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define REG_SZ
Definition: layer.c:22

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;
34  INT line, column;
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 
58  bmpi.bmiHeader.biSize = sizeof(BITMAPINFO);
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 
96 Cleanup:
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 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
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
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define GetRValue(quad)
Definition: precomp.h:64
#define ZeroMemory
Definition: winbase.h:1664
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:58
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
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD biCompression
Definition: amvideo.idl:35
Definition: parser.c:48
#define GetBValue(quad)
Definition: precomp.h:66
INT cySource
Definition: userinit.h:51
#define GetGValue(quad)
Definition: precomp.h:65
#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:300
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:4468
#define IDB_ROSMASK
Definition: resource.h:7
static PIMGINFO pImgInfo
Definition: general.c:31
IN PCTCH line
Definition: pager.h:36
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:199
Definition: bl.h:1331
HBITMAP hBitmap
Definition: userinit.h:49
#define NULL
Definition: types.h:112
#define IMAGE_BITMAP
Definition: winuser.h:211
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
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:367
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define BI_RGB
Definition: precomp.h:47
struct tagBITMAPINFO BITMAPINFO

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 
114  TRACE("IsLiveCD()\n");
115 
118  0,
120  &ControlKey);
121  if (rc != ERROR_SUCCESS)
122  {
123  WARN("RegOpenKeyEx() failed with error %lu\n", rc);
124  goto cleanup;
125  }
126 
127  rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
128  if (rc != ERROR_SUCCESS)
129  {
130  WARN("ReadRegSzKey() failed with error %lu\n", rc);
131  goto cleanup;
132  }
133 
134  /* Check for CONSOLE switch in SystemStartOptions */
135  CurrentOption = SystemStartOptions;
136  while (CurrentOption)
137  {
138  NextOption = wcschr(CurrentOption, L' ');
139  if (NextOption)
140  *NextOption = L'\0';
141  if (_wcsicmp(CurrentOption, L"MININT") == 0)
142  {
143  TRACE("Found 'MININT' boot option\n");
144  ret = TRUE;
145  goto cleanup;
146  }
147  CurrentOption = NextOption ? NextOption + 1 : NULL;
148  }
149 
150 cleanup:
151  if (ControlKey != NULL)
152  RegCloseKey(ControlKey);
153  HeapFree(GetProcessHeap(), 0, SystemStartOptions);
154 
155  TRACE("IsLiveCD() returning %d\n", ret);
156 
157  return ret;
158 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
static LONG ReadRegSzKey(IN HKEY hKey, IN LPCWSTR pszKey, OUT LPWSTR *pValue)
Definition: install.c:234
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
_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 NULL
Definition: types.h:112
#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:3366
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
_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 622 of file livecd.c.

627 {
628  PSTATE pState;
629 
630  /* Retrieve pointer to the state */
631  pState = (PSTATE)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
632 
633  switch (uMsg)
634  {
635  case WM_INITDIALOG:
636  /* Save pointer to the global state */
637  pState = (PSTATE)lParam;
638  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
639 
640  /* Center the dialog window */
641  CenterWindow(hwndDlg);
642 
643  /* Fill the language and keyboard layout lists */
646  if (pState->Unattend->bEnabled)
647  {
648  // Advance to the next page
650  }
651  return FALSE;
652 
653  case WM_DRAWITEM:
655  pState,
657  return TRUE;
658 
659  case WM_COMMAND:
660  switch (LOWORD(wParam))
661  {
662  case IDC_LANGUAGELIST:
663  if (HIWORD(wParam) == CBN_SELCHANGE)
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  TRACE("LCID: 0x%08lx\n", NewLcid);
686  NewLcid);
687  }
688  break;
689 
690  case IDOK:
691  if (HIWORD(wParam) == BN_CLICKED)
692  {
693  LCID NewLcid;
694  INT iCurSel;
695 
696  iCurSel = SendDlgItemMessageW(hwndDlg,
698  CB_GETCURSEL,
699  0,
700  0);
701  if (iCurSel == CB_ERR)
702  break;
703 
704  NewLcid = SendDlgItemMessageW(hwndDlg,
707  iCurSel,
708  0);
709  if (NewLcid == (LCID)CB_ERR)
710  break;
711 
712  /* Set the locale for the current thread */
713  NtSetDefaultLocale(TRUE, NewLcid);
714 
715  /* Store the locale settings in the registry */
716  InitializeDefaultUserLocale(&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 IDOK
Definition: winuser.h:824
#define IDYES
Definition: winuser.h:829
static VOID CreateLanguagesList(HWND hwnd, PSTATE pState)
Definition: livecd.c:212
#define TRUE
Definition: types.h:120
#define CB_GETITEMDATA
Definition: winuser.h:1933
#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:4805
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:58
#define CB_GETCURSEL
Definition: winuser.h:1926
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:333
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
#define GWLP_USERDATA
Definition: treelist.c:63
#define MAKELONG(a, b)
Definition: typedefs.h:249
struct _STATE * PSTATE
#define CB_ERR
Definition: winuser.h:2411
#define TRACE(s)
Definition: solgame.cpp:4
static VOID OnDrawItem(LPDRAWITEMSTRUCT lpDrawItem, PSTATE pState, UINT uCtlID)
Definition: livecd.c:584
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:1908
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:1723
VOID CenterWindow(HWND hWnd)
Definition: livecd.c:559
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define IDS_CANCEL_CONFIRM
Definition: resource.h:30
#define GetModuleHandle
Definition: winbase.h:3683
#define IDC_LAYOUTLIST
Definition: resource.h:17
#define NULL
Definition: types.h:112
#define CBN_SELCHANGE
Definition: winuser.h:1962
#define WM_DRAWITEM
Definition: winuser.h:1628
static VOID CreateKeyboardLayoutList(HWND hItemsList)
Definition: livecd.c:377
#define MB_DEFBUTTON2
Definition: winuser.h:793
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HIWORD(l)
Definition: typedefs.h:247
static VOID InitializeDefaultUserLocale(PLCID pNewLcid)
Definition: livecd.c:436
#define DONE
Definition: rnr20lib.h:14
#define SetWindowLongPtrW
Definition: winuser.h:5322
#define IDCANCEL
Definition: winuser.h:825
#define IDC_LOCALELOGO
Definition: resource.h:14
#define WM_INITDIALOG
Definition: winuser.h:1722
LPARAM lParam
Definition: combotst.c:139
static VOID SetKeyboardLayout(HWND hwnd)
Definition: livecd.c:308
#define LOWORD(l)
Definition: pedump.c:82
#define RC_STRING_MAX_SIZE
Definition: resource.h:3

Referenced by RunLiveCD().

◆ LocalesEnumProc()

static BOOL CALLBACK LocalesEnumProc ( LPTSTR  lpLocale)
static

Definition at line 162 of file livecd.c.

163 {
164  LCID lcid;
165  WCHAR lang[255];
166  INT index;
167  BOOL bNoShow = FALSE;
168 
169  lcid = wcstoul(lpLocale, NULL, 16);
170 
171  /* Display only languages with installed support */
172  if (!IsValidLocale(lcid, LCID_INSTALLED))
173  return TRUE;
174 
175  // See http://archives.miloush.net/michkap/archive/2006/09/23/768178.html for why we handle spain differently
178  {
179  if (bSpain == FALSE)
180  {
182  bSpain = TRUE;
183  }
184  else
185  {
186  bNoShow = TRUE;
187  }
188  }
189  else
190  {
192  }
193 
194  if (bNoShow == FALSE)
195  {
197  CB_ADDSTRING,
198  0,
199  (LPARAM)lang);
200 
203  index,
204  (LPARAM)lcid);
205  }
206 
207  return TRUE;
208 }
#define CB_SETITEMDATA
Definition: winuser.h:1949
#define MAKELCID(lgid, srtid)
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
BOOL bSpain
Definition: livecd.c:12
#define TRUE
Definition: types.h:120
#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:58
#define LCID_INSTALLED
Definition: winnls.h:201
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
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_ADDSTRING
Definition: winuser.h:1919
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 NULL
Definition: types.h:112
#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 584 of file livecd.c.

588 {
589  HDC hdcMem;
590  LONG left;
591 
592  if (lpDrawItem->CtlID == uCtlID)
593  {
594  /* Position image in centre of dialog */
595  left = (lpDrawItem->rcItem.right - pState->ImageInfo.cxSource) / 2;
596 
597  hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
598  if (hdcMem != NULL)
599  {
600  static BLENDFUNCTION BlendFunc = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA};
601 
602  SelectObject(hdcMem, pState->ImageInfo.hBitmap);
603  GdiAlphaBlend(lpDrawItem->hDC,
604  left,
605  lpDrawItem->rcItem.top,
606  pState->ImageInfo.cxSource,
607  pState->ImageInfo.cySource,
608  hdcMem,
609  0, 0,
610  pState->ImageInfo.cxSource,
611  pState->ImageInfo.cySource,
612  BlendFunc);
613  DeleteDC(hdcMem);
614  }
615  }
616 }
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:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define AC_SRC_ALPHA
Definition: alphablend.c:9
LONG right
Definition: windef.h:308
long LONG
Definition: pedump.c:60
static const BLENDFUNCTION BlendFunc
Definition: general.c:32
GLint left
Definition: glext.h:7726
#define AC_SRC_OVER
Definition: wingdi.h:1369
BOOL WINAPI DeleteDC(_In_ HDC)
#define NULL
Definition: types.h:112
HDC hdcMem
Definition: welcome.c:104

Referenced by LocaleDlgProc(), and StartDlgProc().

◆ ParseUnattend()

VOID ParseUnattend ( LPCWSTR  UnattendInf,
LIVECD_UNATTEND pUnattend 
)

Definition at line 843 of file livecd.c.

844 {
846 
847  pUnattend->bEnabled = FALSE;
848 
849  if (!GetPrivateProfileStringW(L"Unattend", L"Signature", L"", Buffer, _countof(Buffer), UnattendInf))
850  {
851  ERR("Unable to parse Signature\n");
852  return;
853  }
854 
855  if (_wcsicmp(Buffer, L"$ReactOS$") && _wcsicmp(Buffer, L"$Windows NT$"))
856  {
857  TRACE("Unknown signature: %S\n", Buffer);
858  return;
859  }
860 
861  if (!GetPrivateProfileStringW(L"Unattend", L"UnattendSetupEnabled", L"", Buffer, _countof(Buffer), UnattendInf))
862  {
863  ERR("Unable to parse UnattendSetupEnabled\n");
864  return;
865  }
866 
867  if (_wcsicmp(Buffer, L"yes"))
868  {
869  TRACE("Unattended setup is not enabled\n", Buffer);
870  return;
871  }
872 
873  pUnattend->bEnabled = TRUE;
874  pUnattend->LocaleID = 0;
875 
876  if (GetPrivateProfileStringW(L"Unattend", L"LocaleID", L"", Buffer, _countof(Buffer), UnattendInf) && Buffer[0])
877  {
878  pUnattend->LocaleID = wcstol(Buffer, NULL, 16);
879  }
880 }
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
#define TRUE
Definition: types.h:120
BOOL bEnabled
Definition: livecd.c:16
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define FALSE
Definition: types.h:117
LCID LocaleID
Definition: livecd.c:17
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by RunLiveCD().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  pState)

Definition at line 883 of file livecd.c.

885 {
886  LIVECD_UNATTEND Unattend = {0};
887  WCHAR UnattendInf[MAX_PATH];
888 
889  InitLogo(&pState->ImageInfo, NULL);
890 
891  GetWindowsDirectoryW(UnattendInf, _countof(UnattendInf));
892  wcscat(UnattendInf, L"\\unattend.inf");
893  ParseUnattend(UnattendInf, &Unattend);
894  pState->Unattend = &Unattend;
895 
896  while (pState->NextPage != DONE)
897  {
898  switch (pState->NextPage)
899  {
900  case LOCALEPAGE:
903  NULL,
905  (LPARAM)pState);
906  break;
907 
908  case STARTPAGE:
911  NULL,
912  StartDlgProc,
913  (LPARAM)pState);
914  break;
915 
916  default:
917  break;
918  }
919  }
920 
921  DeleteObject(pState->ImageInfo.hBitmap);
922 }
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)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2351
HINSTANCE hInstance
Definition: charmap.c:20
LONG_PTR LPARAM
Definition: windef.h:208
VOID ParseUnattend(LPCWSTR UnattendInf, LIVECD_UNATTEND *pUnattend)
Definition: livecd.c:843
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:25
static const WCHAR L[]
Definition: oid.c:1250
#define IDD_LOCALEPAGE
Definition: resource.h:13
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:757
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NULL
Definition: types.h:112
#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:622

Referenced by wWinMain().

◆ SelectKeyboardForLanguage()

static VOID SelectKeyboardForLanguage ( HWND  hwnd,
LCID  lcid 
)
static

Definition at line 333 of file livecd.c.

336 {
337  INT i, nCount;
338  LCID LayoutId;
339 
340  TRACE("LCID: %08lx\n", lcid);
341  TRACE("LangID: %04lx\n", LANGIDFROMLCID(lcid));
342 
343  nCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
344 
345  for (i = 0; i < nCount; i++)
346  {
347  LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
348  TRACE("Layout: %08lx\n", LayoutId);
349 
350  if (LANGIDFROMLCID(LayoutId) == LANGIDFROMLCID(lcid))
351  {
352  TRACE("Found 1: %08lx --> %08lx\n", LayoutId, lcid);
354  return;
355  }
356  }
357 
358  for (i = 0; i < nCount; i++)
359  {
360  LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
361  TRACE("Layout: %08lx\n", LayoutId);
362 
363  if (PRIMARYLANGID(LayoutId) == PRIMARYLANGID(lcid))
364  {
365  TRACE("Found 2: %08lx --> %08lx\n", LayoutId, lcid);
367  return;
368  }
369  }
370 
371  TRACE("No match found!\n");
372 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CB_GETITEMDATA
Definition: winuser.h:1933
DWORD LCID
Definition: nls.h:13
int32_t INT
Definition: typedefs.h:58
#define TRACE(s)
Definition: solgame.cpp:4
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define CB_SETCURSEL
Definition: winuser.h:1944
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
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETCOUNT
Definition: winuser.h:1925
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by LocaleDlgProc().

◆ SetKeyboardLayout()

static VOID SetKeyboardLayout ( HWND  hwnd)
static

Definition at line 308 of file livecd.c.

310 {
311  INT iCurSel;
312  ULONG ulLayoutId;
313  HKL hKl;
314  WCHAR szLayoutId[9];
315 
316  iCurSel = SendMessageW(hwnd, CB_GETCURSEL, 0, 0);
317  if (iCurSel == CB_ERR)
318  return;
319 
320  ulLayoutId = (ULONG)SendMessageW(hwnd, CB_GETITEMDATA, iCurSel, 0);
321  if (ulLayoutId == (ULONG)CB_ERR)
322  return;
323 
324  swprintf(szLayoutId, L"%08lx", ulLayoutId);
325 
327  SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hKl, SPIF_SENDCHANGE);
328 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define KLF_ACTIVATE
Definition: winuser.h:111
#define CB_GETITEMDATA
Definition: winuser.h:1933
#define swprintf
Definition: precomp.h:40
int32_t INT
Definition: typedefs.h:58
#define CB_GETCURSEL
Definition: winuser.h:1926
#define CB_ERR
Definition: winuser.h:2411
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
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)
#define SPIF_SENDCHANGE
Definition: winuser.h:1555
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 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  /* Save pointer to the state */
772  pState = (PSTATE)lParam;
773  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pState);
774 
775  /* Center the dialog window */
776  CenterWindow(hwndDlg);
777 
778  if (pState->Unattend->bEnabled)
779  {
780  // Click on the 'Run' button
782  }
783 
784  return FALSE;
785 
786  case WM_DRAWITEM:
788  pState,
789  IDC_STARTLOGO);
790  return TRUE;
791 
792  case WM_COMMAND:
793  if (HIWORD(wParam) == BN_CLICKED)
794  {
795  switch (LOWORD(wParam))
796  {
797  case IDC_RUN:
798  pState->NextPage = DONE;
799  pState->Run = SHELL;
800  EndDialog(hwndDlg, LOWORD(wParam));
801  break;
802 
803  case IDC_INSTALL:
804  pState->NextPage = DONE;
805  pState->Run = INSTALLER;
806  EndDialog(hwndDlg, LOWORD(wParam));
807  break;
808 
809  case IDOK:
810  pState->NextPage = LOCALEPAGE;
811  EndDialog(hwndDlg, LOWORD(wParam));
812  break;
813 
814  case IDCANCEL:
815  if (HIWORD(wParam) == BN_CLICKED)
816  {
817  static WCHAR szMsg[RC_STRING_MAX_SIZE];
818  INT ret;
820  ret = MessageBoxW(hwndDlg, szMsg, L"ReactOS LiveCD", MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
821  if (ret == IDOK || ret == IDYES)
822  {
823  pState->NextPage = DONE;
824  pState->Run = REBOOT;
825  EndDialog(hwndDlg, LOWORD(wParam));
826  }
827  }
828  break;
829 
830  default:
831  break;
832  }
833  }
834  break;
835 
836  default:
837  break;
838  }
839 
840  return FALSE;
841 }
#define IDOK
Definition: winuser.h:824
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define GetWindowLongPtrW
Definition: winuser.h:4805
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:58
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define MB_ICONWARNING
Definition: winuser.h:780
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
#define GWLP_USERDATA
Definition: treelist.c:63
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define IDC_RUN
Definition: resource.h:21
struct _STATE * PSTATE
static VOID OnDrawItem(LPDRAWITEMSTRUCT lpDrawItem, PSTATE pState, UINT uCtlID)
Definition: livecd.c:584
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:1908
Definition: userinit.h:42
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define WM_COMMAND
Definition: winuser.h:1723
VOID CenterWindow(HWND hWnd)
Definition: livecd.c:559
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define IDS_CANCEL_CONFIRM
Definition: resource.h:30
#define GetModuleHandle
Definition: winbase.h:3683
#define NULL
Definition: types.h:112
#define WM_DRAWITEM
Definition: winuser.h:1628
#define MB_DEFBUTTON2
Definition: winuser.h:793
#define IDC_STARTLOGO
Definition: resource.h:20
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HIWORD(l)
Definition: typedefs.h:247
#define DONE
Definition: rnr20lib.h:14
#define SetWindowLongPtrW
Definition: winuser.h:5322
#define IDCANCEL
Definition: winuser.h:825
#define IDC_INSTALL
Definition: fontview.h:13
#define WM_INITDIALOG
Definition: winuser.h:1722
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define RC_STRING_MAX_SIZE
Definition: resource.h:3

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.