Author: dchapyshev Date: Sun Nov 23 09:10:09 2008 New Revision: 37592
URL: http://svn.reactos.org/svn/reactos?rev=37592&view=rev Log: - More correct fix
Modified: trunk/reactos/base/setup/reactos/reactos.c
Modified: trunk/reactos/base/setup/reactos/reactos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/reactos.... ============================================================================== --- trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/reactos/reactos.c [iso-8859-1] Sun Nov 23 09:10:09 2008 @@ -28,7 +28,7 @@
#include <windows.h> #include <commctrl.h> -#include <wchar.h> +#include <tchar.h> #include <setupapi.h> #include <initguid.h> #include <devguid.h> @@ -42,23 +42,23 @@
typedef struct _LANG { - WCHAR LangId[9]; - WCHAR LangName[128]; + TCHAR LangId[9]; + TCHAR LangName[128]; } LANG, *PLANG;
typedef struct _KBLAYOUT { - WCHAR LayoutId[9]; - WCHAR LayoutName[128]; - WCHAR DllName[128]; + TCHAR LayoutId[9]; + TCHAR LayoutName[128]; + TCHAR DllName[128]; } KBLAYOUT, *PKBLAYOUT;
// generic entries with simple 1:1 mapping typedef struct _GENENTRY { - WCHAR Id[24]; - WCHAR Value[128]; + TCHAR Id[24]; + TCHAR Value[128]; } GENENTRY, *PGENENTRY;
struct @@ -72,7 +72,7 @@ LONG FormatPart; // type of format the partition LONG SelectedLangId; // selected language (table index) LONG SelectedKBLayout; // selected keyboard layout (table index) - WCHAR InstallDir[MAX_PATH]; // installation directory on hdd + TCHAR InstallDir[MAX_PATH]; // installation directory on hdd LONG SelectedComputer; // selected computer type (table index) LONG SelectedDisplay; // selected display type (table index) LONG SelectedKeyboard; // selected keyboard type (table index) @@ -99,7 +99,7 @@ INT cySource; } IMGINFO, *PIMGINFO;
-WCHAR abort_msg[512], abort_title[64]; +TCHAR abort_msg[512], abort_title[64]; HINSTANCE hInstance; BOOL isUnattend;
@@ -142,7 +142,7 @@
LogFont = ncm.lfMessageFont; LogFont.lfWeight = FW_BOLD; - wcscpy(LogFont.lfFaceName, L"MS Shell Dlg"); + _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg"));
hdc = GetDC(NULL); FontSize = 12; @@ -359,20 +359,20 @@
case PSN_WIZNEXT: // set the selected data { - hList = GetDlgItem(hwndDlg, IDC_LANGUAGES); - tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); + hList =GetDlgItem(hwndDlg, IDC_LANGUAGES); + tindex = SendMessage(hList,CB_GETCURSEL, (WPARAM)0, (LPARAM)0);
if (tindex != CB_ERR) { SetupData.SelectedLangId = SendMessage(hList, CB_GETITEMDATA, (WPARAM) tindex, (LPARAM) 0); - WORD LangID = wcstol(SetupData.pLanguages[SetupData.SelectedLangId].LangId, NULL, 16); + WORD LangID = _tcstol(SetupData.pLanguages[SetupData.SelectedLangId].LangId, NULL, 16); SetThreadLocale(MAKELCID(LangID, SORT_DEFAULT)); // FIXME: need to reload all resource to force // the new language setting }
hList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT); - tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); + tindex = SendMessage(hList,CB_GETCURSEL, (WPARAM)0, (LPARAM)0); if (tindex != CB_ERR) { SetupData.SelectedKBLayout = SendMessage(hList, CB_GETITEMDATA, (WPARAM) tindex, (LPARAM) 0); @@ -614,7 +614,7 @@ { SendMessage(GetDlgItem(hwndDlg, IDC_PATH), WM_GETTEXT, - (WPARAM) sizeof(SetupData.InstallDir) / sizeof(WCHAR), + (WPARAM) sizeof(SetupData.InstallDir) / sizeof(TCHAR), (LPARAM) SetupData.InstallDir);
EndDialog(hwndDlg, IDOK); @@ -976,11 +976,11 @@ void LoadSetupData() { WCHAR szPath[MAX_PATH]; - WCHAR tmp[10]; + TCHAR tmp[10]; WCHAR *ch; HINF hTxtsetupSif; INFCONTEXT InfContext; - //WCHAR szValue[MAX_PATH]; + //TCHAR szValue[MAX_PATH]; DWORD LineLength; LONG Count;
@@ -994,7 +994,7 @@ if (hTxtsetupSif != INVALID_HANDLE_VALUE) { // get language list - Count = SetupGetLineCount(hTxtsetupSif, L"Language"); + Count = SetupGetLineCount(hTxtsetupSif, _T("Language")); if (Count > 0) { SetupData.pLanguages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LANG) * Count); @@ -1002,20 +1002,20 @@ { SetupData.LangCount = Count; Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, L"Language", NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, _T("Language"), NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pLanguages[Count].LangId, - sizeof(SetupData.pLanguages[Count].LangId) / sizeof(WCHAR), + sizeof(SetupData.pLanguages[Count].LangId) / sizeof(TCHAR), &LineLength);
SetupGetStringField(&InfContext, 1, SetupData.pLanguages[Count].LangName, - sizeof(SetupData.pLanguages[Count].LangName) / sizeof(WCHAR), + sizeof(SetupData.pLanguages[Count].LangName) / sizeof(TCHAR), &LineLength); ++Count; } @@ -1025,7 +1025,7 @@ }
// get keyboard layout list - Count = SetupGetLineCount(hTxtsetupSif, L"KeyboardLayout"); + Count = SetupGetLineCount(hTxtsetupSif, _T("KeyboardLayout")); if (Count > 0) { SetupData.pKbLayouts = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(KBLAYOUT) * Count); @@ -1033,20 +1033,20 @@ { SetupData.KbLayoutCount = Count; Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, L"KeyboardLayout", NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, _T("KeyboardLayout"), NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pKbLayouts[Count].LayoutId, - sizeof(SetupData.pKbLayouts[Count].LayoutId) / sizeof(WCHAR), + sizeof(SetupData.pKbLayouts[Count].LayoutId) / sizeof(TCHAR), &LineLength);
SetupGetStringField(&InfContext, 1, SetupData.pKbLayouts[Count].LayoutName, - sizeof(SetupData.pKbLayouts[Count].LayoutName) / sizeof(WCHAR), + sizeof(SetupData.pKbLayouts[Count].LayoutName) / sizeof(TCHAR), &LineLength); ++Count; } @@ -1060,22 +1060,22 @@ SetupData.DefaultLang = -1;
// TODO: get defaults from underlaying running system - if (SetupFindFirstLine(hTxtsetupSif, L"NLS", L"DefaultLayout", &InfContext)) - { - SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(WCHAR), &LineLength); + if (SetupFindFirstLine(hTxtsetupSif, _T("NLS"), _T("DefaultLayout"), &InfContext)) + { + SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(TCHAR), &LineLength); for (Count = 0; Count < SetupData.KbLayoutCount; Count++) - if (wcscmp(tmp, SetupData.pKbLayouts[Count].LayoutId) == 0) + if (_tcscmp(tmp, SetupData.pKbLayouts[Count].LayoutId) == 0) { SetupData.DefaultKBLayout = Count; break; } }
- if (SetupFindFirstLine(hTxtsetupSif, L"NLS", L"DefaultLanguage", &InfContext)) - { - SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(WCHAR), &LineLength); + if (SetupFindFirstLine(hTxtsetupSif, _T("NLS"), _T("DefaultLanguage"), &InfContext)) + { + SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(TCHAR), &LineLength); for (Count = 0; Count < SetupData.LangCount; Count++) - if (wcscmp(tmp, SetupData.pLanguages[Count].LangId) == 0) + if (_tcscmp(tmp, SetupData.pLanguages[Count].LangId) == 0) { SetupData.DefaultLang = Count; break; @@ -1083,7 +1083,7 @@ }
// get computers list - Count = SetupGetLineCount(hTxtsetupSif, L"Computer"); + Count = SetupGetLineCount(hTxtsetupSif, _T("Computer")); if (Count > 0) { SetupData.pComputers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); @@ -1091,20 +1091,20 @@ { SetupData.CompCount = Count; Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, L"Computer", NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, _T("Computer"), NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pComputers[Count].Id, - sizeof(SetupData.pComputers[Count].Id) / sizeof(WCHAR), + sizeof(SetupData.pComputers[Count].Id) / sizeof(TCHAR), &LineLength);
SetupGetStringField(&InfContext, 1, SetupData.pComputers[Count].Value, - sizeof(SetupData.pComputers[Count].Value) / sizeof(WCHAR), + sizeof(SetupData.pComputers[Count].Value) / sizeof(TCHAR), &LineLength); ++Count; } @@ -1114,7 +1114,7 @@ }
// get display list - Count = SetupGetLineCount(hTxtsetupSif, L"Display"); + Count = SetupGetLineCount(hTxtsetupSif, _T("Display")); if (Count > 0) { SetupData.pDisplays = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); @@ -1123,20 +1123,20 @@ SetupData.DispCount = Count; Count = 0;
- if (SetupFindFirstLine(hTxtsetupSif, L"Display", NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, _T("Display"), NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pDisplays[Count].Id, - sizeof(SetupData.pDisplays[Count].Id) / sizeof(WCHAR), + sizeof(SetupData.pDisplays[Count].Id) / sizeof(TCHAR), &LineLength);
SetupGetStringField(&InfContext, 1, SetupData.pDisplays[Count].Value, - sizeof(SetupData.pDisplays[Count].Value) / sizeof(WCHAR), + sizeof(SetupData.pDisplays[Count].Value) / sizeof(TCHAR), &LineLength); ++Count; } @@ -1146,7 +1146,7 @@ }
// get keyboard list - Count = SetupGetLineCount(hTxtsetupSif, L"Keyboard"); + Count = SetupGetLineCount(hTxtsetupSif, _T("Keyboard")); if (Count > 0) { SetupData.pKeyboards = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); @@ -1155,20 +1155,20 @@ SetupData.KeybCount = Count; Count = 0;
- if (SetupFindFirstLine(hTxtsetupSif, L"Keyboard", NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, _T("Keyboard"), NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pKeyboards[Count].Id, - sizeof(SetupData.pKeyboards[Count].Id) / sizeof(WCHAR), + sizeof(SetupData.pKeyboards[Count].Id) / sizeof(TCHAR), &LineLength);
SetupGetStringField(&InfContext, 1, SetupData.pKeyboards[Count].Value, - sizeof(SetupData.pKeyboards[Count].Value) / sizeof(WCHAR), + sizeof(SetupData.pKeyboards[Count].Value) / sizeof(TCHAR), &LineLength); ++Count; } @@ -1178,12 +1178,12 @@ }
// get install directory - if (SetupFindFirstLine(hTxtsetupSif, L"SetupData", L"DefaultPath", &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, _T("SetupData"), _T("DefaultPath"), &InfContext)) { SetupGetStringField(&InfContext, 1, SetupData.InstallDir, - sizeof(SetupData.InstallDir) / sizeof(WCHAR), + sizeof(SetupData.InstallDir) / sizeof(TCHAR), &LineLength); } SetupCloseInfFile(hTxtsetupSif); @@ -1196,7 +1196,7 @@ WCHAR *ch; HINF hUnattendedInf; INFCONTEXT InfContext; - WCHAR szValue[MAX_PATH]; + TCHAR szValue[MAX_PATH]; DWORD LineLength; //HKEY hKey; BOOL result = 0; @@ -1211,13 +1211,13 @@
if (hUnattendedInf != INVALID_HANDLE_VALUE) { - if (SetupFindFirstLine(hUnattendedInf, L"Unattend", L"UnattendSetupEnabled",&InfContext)) + if (SetupFindFirstLine(hUnattendedInf, _T("Unattend"), _T("UnattendSetupEnabled"),&InfContext)) { if (SetupGetStringField(&InfContext, 1, szValue, - sizeof(szValue) / sizeof(WCHAR), - &LineLength) && (_wcsicmp(szValue, L"yes") == 0)) + sizeof(szValue) / sizeof(TCHAR), + &LineLength) && (_tcsicmp(szValue, _T("yes")) == 0)) { result = 1; // unattendSetup enabled // read values and store in SetupData @@ -1230,10 +1230,10 @@ }
int WINAPI -wWinMain(HINSTANCE hInst, - HINSTANCE hPrevInstance, - LPWSTR lpszCmdLine, - int nCmdShow) +_tWinMain(HINSTANCE hInst, + HINSTANCE hPrevInstance, + LPTSTR lpszCmdLine, + int nCmdShow) { PROPSHEETHEADER psh; HPROPSHEETPAGE ahpsp[8]; @@ -1244,8 +1244,8 @@
if (!isUnattend) { - LoadString(hInst, IDS_ABORTSETUP, abort_msg, sizeof(abort_msg) / sizeof(WCHAR)); - LoadString(hInst, IDS_ABORTSETUP2, abort_title, sizeof(abort_title) / sizeof(WCHAR)); + LoadString(hInst,IDS_ABORTSETUP, abort_msg, sizeof(abort_msg)/sizeof(TCHAR)); + LoadString(hInst,IDS_ABORTSETUP2, abort_title,sizeof(abort_title)/sizeof(TCHAR));
LoadSetupData();