convert parts of syssetup to WCHAR - please help to fix this mess

svn path=/trunk/; revision=38007
This commit is contained in:
Christoph von Wittich 2008-12-11 09:41:55 +00:00
parent dbd198da9d
commit 15ea296cd4

View file

@ -133,7 +133,7 @@ static HFONT
CreateTitleFont(VOID) CreateTitleFont(VOID)
{ {
NONCLIENTMETRICS ncm; NONCLIENTMETRICS ncm;
LOGFONT LogFont; LOGFONTW LogFont;
HDC hdc; HDC hdc;
INT FontSize; INT FontSize;
HFONT hFont; HFONT hFont;
@ -143,12 +143,12 @@ CreateTitleFont(VOID)
LogFont = ncm.lfMessageFont; LogFont = ncm.lfMessageFont;
LogFont.lfWeight = FW_BOLD; LogFont.lfWeight = FW_BOLD;
_tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg")); wcscpy(LogFont.lfFaceName, L"MS Shell Dlg");
hdc = GetDC(NULL); hdc = GetDC(NULL);
FontSize = 12; FontSize = 12;
LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72; LogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72;
hFont = CreateFontIndirect(&LogFont); hFont = CreateFontIndirectW(&LogFont);
ReleaseDC(NULL, hdc); ReleaseDC(NULL, hdc);
return hFont; return hFont;
@ -553,7 +553,7 @@ WriteComputerSettings(TCHAR * ComputerName, HWND hwndDlg)
{ {
wcscpy(ErrorComputerName, L"Setup failed to set the computer name."); wcscpy(ErrorComputerName, L"Setup failed to set the computer name.");
} }
MessageBox(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK); MessageBoxW(hwndDlg, ErrorComputerName, Title, MB_ICONERROR | MB_OK);
return FALSE; return FALSE;
} }
@ -637,7 +637,7 @@ ComputerPageDlgProc(HWND hwndDlg,
{ {
wcscpy(EmptyComputerName, L"Setup cannot continue until you enter the name of your computer."); wcscpy(EmptyComputerName, L"Setup cannot continue until you enter the name of your computer.");
} }
MessageBox(hwndDlg, EmptyComputerName, Title, MB_ICONERROR | MB_OK); MessageBoxW(hwndDlg, EmptyComputerName, Title, MB_ICONERROR | MB_OK);
SetFocus(GetDlgItem(hwndDlg, IDC_COMPUTERNAME)); SetFocus(GetDlgItem(hwndDlg, IDC_COMPUTERNAME));
SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
return TRUE; return TRUE;
@ -663,7 +663,7 @@ ComputerPageDlgProc(HWND hwndDlg,
{ {
wcscpy(EmptyPassword, L"You must enter a password !"); wcscpy(EmptyPassword, L"You must enter a password !");
} }
MessageBox(hwndDlg, EmptyPassword, Title, MB_ICONERROR | MB_OK); MessageBoxW(hwndDlg, EmptyPassword, Title, MB_ICONERROR | MB_OK);
SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
return TRUE; return TRUE;
} }
@ -679,7 +679,7 @@ ComputerPageDlgProc(HWND hwndDlg,
{ {
wcscpy(NotMatchPassword, L"The passwords you entered do not match. Please enter the desired password again."); wcscpy(NotMatchPassword, L"The passwords you entered do not match. Please enter the desired password again.");
} }
MessageBox(hwndDlg, NotMatchPassword, Title, MB_ICONERROR | MB_OK); MessageBoxW(hwndDlg, NotMatchPassword, Title, MB_ICONERROR | MB_OK);
SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
return TRUE; return TRUE;
} }
@ -695,7 +695,7 @@ ComputerPageDlgProc(HWND hwndDlg,
{ {
wcscpy(WrongPassword, L"The password you entered contains invalid characters. Please enter a cleaned password."); wcscpy(WrongPassword, L"The password you entered contains invalid characters. Please enter a cleaned password.");
} }
MessageBox(hwndDlg, WrongPassword, Title, MB_ICONERROR | MB_OK); MessageBoxW(hwndDlg, WrongPassword, Title, MB_ICONERROR | MB_OK);
SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
return TRUE; return TRUE;
break; break;
@ -784,11 +784,11 @@ SetKeyboardLayoutName(HWND hwnd)
static BOOL static BOOL
RunControlPanelApplet(HWND hwnd, WCHAR *lpCommandLine) RunControlPanelApplet(HWND hwnd, WCHAR *lpCommandLine)
{ {
STARTUPINFO StartupInfo; STARTUPINFOW StartupInfo;
PROCESS_INFORMATION ProcessInformation; PROCESS_INFORMATION ProcessInformation;
ZeroMemory(&StartupInfo, sizeof(STARTUPINFO)); ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
StartupInfo.cb = sizeof(STARTUPINFO); StartupInfo.cb = sizeof(STARTUPINFOW);
if (!CreateProcessW(NULL, if (!CreateProcessW(NULL,
lpCommandLine, lpCommandLine,
@ -801,7 +801,7 @@ RunControlPanelApplet(HWND hwnd, WCHAR *lpCommandLine)
&StartupInfo, &StartupInfo,
&ProcessInformation)) &ProcessInformation))
{ {
MessageBox(hwnd, _T("Error: failed to launch rundll32"), NULL, MB_ICONERROR); MessageBoxW(hwnd, L"Error: failed to launch rundll32", NULL, MB_ICONERROR);
return FALSE; return FALSE;
} }
@ -816,17 +816,17 @@ WriteUserLocale(VOID)
{ {
HKEY hKey; HKEY hKey;
LCID lcid; LCID lcid;
TCHAR Locale[12]; WCHAR Locale[12];
lcid = GetSystemDefaultLCID(); lcid = GetSystemDefaultLCID();
if (GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Locale, sizeof(Locale) / sizeof(Locale[0])) != 0) if (GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Locale, sizeof(Locale) / sizeof(Locale[0])) != 0)
{ {
if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\International"), if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Control Panel\\International",
0, NULL, REG_OPTION_NON_VOLATILE, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
{ {
RegSetValueEx(hKey, _T("Locale"), 0, REG_SZ, (LPBYTE)Locale, (_tcslen(Locale)+1) * sizeof(TCHAR)); RegSetValueExW(hKey, L"Locale", 0, REG_SZ, (LPBYTE)Locale, (wcslen(Locale)+1) * sizeof(WCHAR));
RegCloseKey(hKey); RegCloseKey(hKey);
} }
} }
@ -864,7 +864,7 @@ LocalePageDlgProc(HWND hwndDlg,
{ {
case IDC_CUSTOMLOCALE: case IDC_CUSTOMLOCALE:
{ {
wcscpy(szBuffer, _T("rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5")); wcscpy(szBuffer, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5");
RunControlPanelApplet(hwndDlg, szBuffer); RunControlPanelApplet(hwndDlg, szBuffer);
/* FIXME: Update input locale name */ /* FIXME: Update input locale name */
} }
@ -872,7 +872,7 @@ LocalePageDlgProc(HWND hwndDlg,
case IDC_CUSTOMLAYOUT: case IDC_CUSTOMLAYOUT:
{ {
wcscpy(szBuffer, _T("rundll32.exe shell32.dll,Control_RunDLL input.dll,@1")); wcscpy(szBuffer, L"rundll32.exe shell32.dll,Control_RunDLL input.dll,@1");
RunControlPanelApplet(hwndDlg, szBuffer); RunControlPanelApplet(hwndDlg, szBuffer);
} }
break; break;
@ -1341,15 +1341,15 @@ SetAutoDaylightInfo(HWND hwnd)
if (SendMessage(hwnd, BM_GETCHECK, 0, 0) == BST_UNCHECKED) if (SendMessage(hwnd, BM_GETCHECK, 0, 0) == BST_UNCHECKED)
{ {
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
_T("SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation"), L"SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation",
0, 0,
KEY_SET_VALUE, KEY_SET_VALUE,
&hKey)) &hKey))
return; return;
RegSetValueEx(hKey, RegSetValueExW(hKey,
_T("DisableAutoDaylightTimeSet"), L"DisableAutoDaylightTimeSet",
0, 0,
REG_DWORD, REG_DWORD,
(LPBYTE)&dwValue, (LPBYTE)&dwValue,
@ -1438,7 +1438,7 @@ WriteDateTimeSettings(HWND hwndDlg, PSETUPDATA SetupData)
{ {
wcscpy(ErrorLocalTime, L"Setup failed to set the computer name."); wcscpy(ErrorLocalTime, L"Setup failed to set the computer name.");
} }
MessageBox(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK); MessageBoxW(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK);
return FALSE; return FALSE;
} }
@ -1523,7 +1523,7 @@ DateTimePageDlgProc(HWND hwndDlg,
{ {
wcscpy(ErrorLocalTime, L"Setup failed to set the computer name."); wcscpy(ErrorLocalTime, L"Setup failed to set the computer name.");
} }
MessageBox(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK); MessageBoxW(hwndDlg, ErrorLocalTime, Title, MB_ICONWARNING | MB_OK);
} }
} }
break; break;
@ -1920,8 +1920,8 @@ static VOID
SetupIsActive( DWORD dw ) SetupIsActive( DWORD dw )
{ {
HKEY hKey = 0; HKEY hKey = 0;
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("SYSTEM\\Setup"), 0, KEY_WRITE, &hKey ) == ERROR_SUCCESS) { if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"SYSTEM\\Setup", 0, KEY_WRITE, &hKey ) == ERROR_SUCCESS) {
RegSetValueEx( hKey, _T("SystemSetupInProgress"), 0, REG_DWORD, (CONST BYTE *)&dw, sizeof(dw) ); RegSetValueExW( hKey, L"SystemSetupInProgress", 0, REG_DWORD, (CONST BYTE *)&dw, sizeof(dw) );
RegCloseKey( hKey ); RegCloseKey( hKey );
} }
} }