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

Go to the source code of this file.

Classes

struct  _LIVECD_UNATTEND
 

Typedefs

typedef struct _LIVECD_UNATTEND LIVECD_UNATTEND
 

Functions

static VOID InitLogo (PIMGINFO pImgInfo, HWND hwndDlg)
 
BOOL IsMiniNT (VOID)
 Check whether we are running in MiniNT mode (e.g. live medium).
 
static BOOL CALLBACK LocalesEnumProc (LPTSTR lpLocale)
 
static VOID CreateLanguagesList (HWND hwnd, PSTATE pState)
 
static BOOL GetLayoutName (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)
 
static BOOL ExpandInstallerPath (_In_ PCWSTR pInstallerName, _Out_writes_z_(PathSize) PWSTR pInstallerPath, _In_ SIZE_T PathSize)
 Expands the path for the ReactOS Installer "reactos.exe". See also base/setup/welcome/welcome.c!ExpandInstallerPath()
 
VOID RunLiveCD (PSTATE pState)
 

Variables

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

Typedef Documentation

◆ LIVECD_UNATTEND

Function Documentation

◆ CenterWindow()

VOID CenterWindow ( HWND  hWnd)

Definition at line 521 of file livecd.c.

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

Referenced by LocaleDlgProc(), and StartDlgProc().

◆ CreateKeyboardLayoutList()

static VOID CreateKeyboardLayoutList ( HWND  hItemsList)
static

Definition at line 340 of file livecd.c.

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

Referenced by LocaleDlgProc().

◆ CreateLanguagesList()

static VOID CreateLanguagesList ( HWND  hwnd,
PSTATE  pState 
)
static

Definition at line 179 of file livecd.c.

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

Referenced by LocaleDlgProc().

◆ ExpandInstallerPath()

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

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

Definition at line 858 of file livecd.c.

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

Referenced by RunLiveCD().

◆ GetLayoutName()

static BOOL GetLayoutName ( LPCWSTR  szLCID,
LPWSTR  szName 
)
static

Definition at line 207 of file livecd.c.

210{
211 HKEY hKey;
212 DWORD dwBufLen;
213 WCHAR szBuf[MAX_PATH], szDispName[MAX_PATH], szIndex[MAX_PATH], szPath[MAX_PATH];
214 HANDLE hLib;
215 UINT i, j, k;
216
217 wsprintf(szBuf, L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s", szLCID);
218
220 {
221 dwBufLen = sizeof(szDispName);
222
223 if (RegQueryValueExW(hKey, L"Layout Display Name", NULL, NULL, (LPBYTE)szDispName, &dwBufLen) == ERROR_SUCCESS)
224 {
225 if (szDispName[0] == '@')
226 {
227 for (i = 0; i < wcslen(szDispName); i++)
228 {
229 if ((szDispName[i] == ',') && (szDispName[i + 1] == '-'))
230 {
231 for (j = i + 2, k = 0; j < wcslen(szDispName)+1; j++, k++)
232 {
233 szIndex[k] = szDispName[j];
234 }
235 szDispName[i - 1] = '\0';
236 break;
237 }
238 else
239 szDispName[i] = szDispName[i + 1];
240 }
241
243 {
244 hLib = LoadLibraryW(szPath);
245 if (hLib)
246 {
247 if (LoadStringW(hLib, _wtoi(szIndex), szPath, ARRAYSIZE(szPath)) != 0)
248 {
251 return TRUE;
252 }
253 FreeLibrary(hLib);
254 }
255 }
256 }
257 }
258
259 dwBufLen = sizeof(szBuf);
260
261 if (RegQueryValueExW(hKey, L"Layout Text", NULL, NULL, (LPBYTE)szName, &dwBufLen) == ERROR_SUCCESS)
262 {
264 return TRUE;
265 }
266 }
267
268 return FALSE;
269}
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
_ACRTIMP int __cdecl _wtoi(const wchar_t *)
Definition: wcs.c:2778
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned int UINT
Definition: sysinfo.c:13
LPCWSTR szPath
Definition: env.c:37
int k
Definition: mpi.c:3369
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
static const WCHAR szName[]
Definition: powrprof.c:45
#define LoadStringW
Definition: utils.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
#define wsprintf
Definition: winuser.h:6031

Referenced by CreateKeyboardLayoutList().

◆ InitializeDefaultUserLocale()

static VOID InitializeDefaultUserLocale ( PLCID  pNewLcid)
static

Definition at line 398 of file livecd.c.

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

Referenced by LocaleDlgProc().

◆ InitLogo()

static VOID InitLogo ( PIMGINFO  pImgInfo,
HWND  hwndDlg 
)
static

Definition at line 27 of file livecd.c.

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

Referenced by RunLiveCD().

◆ IsMiniNT()

BOOL IsMiniNT ( VOID  )

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

Definition at line 110 of file livecd.c.

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

◆ LocaleDlgProc()

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

Definition at line 583 of file livecd.c.

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

Referenced by RunLiveCD().

◆ LocalesEnumProc()

static BOOL CALLBACK LocalesEnumProc ( LPTSTR  lpLocale)
static

Definition at line 129 of file livecd.c.

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

Referenced by CreateLanguagesList().

◆ OnDrawItem()

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

Definition at line 545 of file livecd.c.

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

Referenced by LocaleDlgProc(), and StartDlgProc().

◆ ParseUnattend()

VOID ParseUnattend ( LPCWSTR  UnattendInf,
LIVECD_UNATTEND pUnattend 
)

Definition at line 812 of file livecd.c.

813{
815
816 pUnattend->bEnabled = FALSE;
817
818 if (!GetPrivateProfileStringW(L"Unattend", L"Signature", L"", Buffer, _countof(Buffer), UnattendInf))
819 {
820 ERR("Unable to parse Signature\n");
821 return;
822 }
823
824 if (_wcsicmp(Buffer, L"$ReactOS$") && _wcsicmp(Buffer, L"$Windows NT$"))
825 {
826 TRACE("Unknown signature: %S\n", Buffer);
827 return;
828 }
829
830 if (!GetPrivateProfileStringW(L"Unattend", L"UnattendSetupEnabled", L"", Buffer, _countof(Buffer), UnattendInf))
831 {
832 ERR("Unable to parse UnattendSetupEnabled\n");
833 return;
834 }
835
836 if (_wcsicmp(Buffer, L"yes"))
837 {
838 TRACE("Unattended setup is not enabled\n", Buffer);
839 return;
840 }
841
842 pUnattend->bEnabled = TRUE;
843 pUnattend->LocaleID = 0;
844
845 if (GetPrivateProfileStringW(L"Unattend", L"LocaleID", L"", Buffer, _countof(Buffer), UnattendInf) && Buffer[0])
846 {
847 pUnattend->LocaleID = wcstol(Buffer, NULL, 16);
848 }
849}
Definition: bufpool.h:45
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
#define _countof(array)
Definition: sndvol32.h:70
LCID LocaleID
Definition: livecd.c:19
BOOL bEnabled
Definition: livecd.c:18

Referenced by RunLiveCD().

◆ RunLiveCD()

VOID RunLiveCD ( PSTATE  pState)

Definition at line 978 of file livecd.c.

980{
981 LIVECD_UNATTEND Unattend = {0};
982 WCHAR UnattendInf[MAX_PATH];
983
984 /* Try to locate the ReactOS Installer */
985 if (!ExpandInstallerPath(L"reactos.exe", Installer, _countof(Installer)))
987 if (*Installer)
988 TRACE("ReactOS Installer: '%S'\n", Installer);
989 else
990 WARN("Could not find the ReactOS Installer\n");
991
992 GetWindowsDirectoryW(UnattendInf, _countof(UnattendInf));
993 wcscat(UnattendInf, L"\\unattend.inf");
994 ParseUnattend(UnattendInf, &Unattend);
995 pState->Unattend = &Unattend;
996
997 InitLogo(&pState->ImageInfo, NULL);
998
999 while (pState->NextPage != DONE)
1000 {
1001 switch (pState->NextPage)
1002 {
1003 case LOCALEPAGE:
1006 NULL,
1008 (LPARAM)pState);
1009 break;
1010
1011 case STARTPAGE:
1014 NULL,
1016 (LPARAM)pState);
1017 break;
1018
1019 default:
1020 break;
1021 }
1022 }
1023
1024 DeleteObject(pState->ImageInfo.hBitmap);
1025}
#define IDD_STARTPAGE
Definition: resource.h:27
#define IDD_LOCALEPAGE
Definition: resource.h:13
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2271
static INT_PTR CALLBACK LocaleDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:583
static BOOL ExpandInstallerPath(_In_ PCWSTR pInstallerName, _Out_writes_z_(PathSize) PWSTR pInstallerPath, _In_ SIZE_T PathSize)
Expands the path for the ReactOS Installer "reactos.exe". See also base/setup/welcome/welcome....
Definition: livecd.c:858
WCHAR Installer[MAX_PATH]
Definition: livecd.c:14
VOID ParseUnattend(LPCWSTR UnattendInf, LIVECD_UNATTEND *pUnattend)
Definition: livecd.c:812
static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: livecd.c:720
static VOID InitLogo(PIMGINFO pImgInfo, HWND hwndDlg)
Definition: livecd.c:27
wcscat
@ LOCALEPAGE
Definition: userinit.h:35
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by wWinMain().

◆ SelectKeyboardForLanguage()

static VOID SelectKeyboardForLanguage ( HWND  hwnd,
LCID  lcid 
)
static

Definition at line 297 of file livecd.c.

300{
301 INT i, nCount;
302 LCID LayoutId;
303
304 TRACE("LCID: %08lx\n", lcid);
305 TRACE("LangID: %04lx\n", LANGIDFROMLCID(lcid));
306
307 nCount = SendMessageW(hwnd, CB_GETCOUNT, 0, 0);
308
309 for (i = 0; i < nCount; i++)
310 {
311 LayoutId = (LCID)SendMessageW(hwnd, CB_GETITEMDATA, i, 0);
312 TRACE("Layout: %08lx\n", LayoutId);
313
314 if (LANGIDFROMLCID(LayoutId) == LANGIDFROMLCID(lcid))
315 {
316 TRACE("Found 1: %08lx --> %08lx\n", LayoutId, lcid);
318 return;
319 }
320 }
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 (PRIMARYLANGID(LayoutId) == PRIMARYLANGID(lcid))
328 {
329 TRACE("Found 2: %08lx --> %08lx\n", LayoutId, lcid);
331 return;
332 }
333 }
334
335 TRACE("No match found!\n");
336}
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define CB_GETCOUNT
Definition: winuser.h:1971

Referenced by LocaleDlgProc().

◆ SetKeyboardLayout()

static VOID SetKeyboardLayout ( HWND  hwnd)
static

Definition at line 273 of file livecd.c.

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

Referenced by LocaleDlgProc().

◆ StartDlgProc()

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

Definition at line 720 of file livecd.c.

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

Referenced by RunLiveCD().

Variable Documentation

◆ bSpain

BOOL bSpain = FALSE

Definition at line 12 of file livecd.c.

Referenced by CreateLanguagesList(), and LocalesEnumProc().

◆ hList

◆ hLocaleList

HWND hLocaleList

Definition at line 11 of file livecd.c.

◆ Installer