ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2008
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
28 participants
657 discussions
Start a n
N
ew thread
[cgutman] 37593: - NDIS always calls NdisMIndicateStatusComplete immediately after calling NdisMIndicateStatus
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Nov 23 10:50:11 2008 New Revision: 37593 URL:
http://svn.reactos.org/svn/reactos?rev=37593&view=rev
Log: - NDIS always calls NdisMIndicateStatusComplete immediately after calling NdisMIndicateStatus Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
============================================================================== --- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Sun Nov 23 10:50:11 2008 @@ -270,6 +270,7 @@ KIRQL OldIrql; NdisMIndicateStatus(Adapter, NDIS_STATUS_RESET_END, NULL, 0); + NdisMIndicateStatusComplete(Adapter); KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
16 years, 1 month
1
0
0
0
[dchapyshev] 37592: - More correct fix
by dchapyshev@svn.reactos.org
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();
16 years, 1 month
1
0
0
0
[dgoette] 37591: * fix bug in language detection * let the user decide which language he want to set instead of preselecting by browser preferences * minor fixes * fix the famous metadata bug
by dgoette@svn.reactos.org
Author: dgoette Date: Sun Nov 23 08:54:05 2008 New Revision: 37591 URL:
http://svn.reactos.org/svn/reactos?rev=37591&view=rev
Log: * fix bug in language detection * let the user decide which language he want to set instead of preselecting by browser preferences * minor fixes * fix the famous metadata bug Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/lib/CMSWebsiteSaveEntry.class.…
[iso-8859-1] Sun Nov 23 08:54:05 2008 @@ -98,6 +98,19 @@ $stmt->execute(); $rev_id = $stmt->fetchColumn(); + // get stable entry + $stmt=DBConnection::getInstance()->prepare("SELECT r.rev_id, r.data_id FROM data_tag a JOIN data_revision r ON (r.data_id = a.data_id AND r.rev_id = a.data_rev_id) JOIN data_tag_name n ON a.tag_name_id = n.tn_id JOIN data_tag_value v ON a.tag_value_id = v.tv_id WHERE r.data_id = :data_id AND r.rev_language = :lang AND r.rev_id = a.data_rev_id AND a.tag_usrid = '-1' AND n.tn_name = 'status' AND v.tv_value = 'stable' ORDER BY r.rev_id DESC LIMIT 1"); + $stmt->bindParam('data_id',$_GET['d_id'],PDO::PARAM_INT); + $stmt->bindParam('lang',$_GET['d_r_lang'],PDO::PARAM_STR); + $stmt->execute(); + $stable = $stmt->fetchOnce(PDO::FETCH_ASSOC); + if ($stable !== false) { + + // transfer from stable entry + Tag::copyFromData($stable['data_id'], $stable['rev_id'], $_GET['d_id'], $rev_id, false); + Tag::deleteByName($_GET['d_id'], $rev_id, 'status', -1); + } + // tag the revision as new or draft if ($type == 'submit') { Tag::add($_GET['d_id'], $rev_id, 'status', 'new', -1); Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/lib/Editor_Website.class.php
[iso-8859-1] Sun Nov 23 08:54:05 2008 @@ -221,7 +221,7 @@ if (Data::copy($revision['data_id'], $revision['rev_id'], 1 /* copy mode */, $RosCMS_GET_d_r_lang)) { $stmt=DBConnection::getInstance()->prepare("SELECT data_id, rev_id, rev_language FROM data_revision WHERE data_id = :data_id AND rev_usrid = :user_id AND rev_version = 0 AND rev_language = :lang AND rev_date = :date ORDER BY rev_id DESC LIMIT 1"); $stmt->bindParam('data_id',$revision['data_id'],PDO::PARAM_STR); - $stmt->bindParam('user_id',$thisuser->id(),PDO::PARAM_INT); + $stmt->bindParam('user_id',ThisUser::getInstance()->id(),PDO::PARAM_INT); $stmt->bindParam('lang',$_GET['d_r_lang'],PDO::PARAM_STR); $stmt->bindParam('date',date('Y-m-d'),PDO::PARAM_STR); $stmt->execute(); Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/lib/HTML_User_ProfileEdit.clas…
[iso-8859-1] Sun Nov 23 08:54:05 2008 @@ -87,7 +87,7 @@ <div class="corner4"> <div style="text-align:center; padding: 4px; ">'); - $stmt=DBConnection::getInstance()->prepare("SELECT user_id, user_name, user_fullname, user_email, user_email_activation, user_website, user_country, user_timezone, user_occupation, user_setting_multisession, user_setting_browseragent, user_setting_ipaddress, user_setting_timeout FROM users WHERE user_id = :user_id LIMIT 1"); + $stmt=DBConnection::getInstance()->prepare("SELECT user_id, user_name, user_fullname, user_email, user_email_activation, user_website, user_country, user_language, user_timezone, user_occupation, user_setting_multisession, user_setting_browseragent, user_setting_ipaddress, user_setting_timeout FROM users WHERE user_id = :user_id LIMIT 1"); $stmt->bindParam('user_id',ThisUser::getInstance()->id(),PDO::PARAM_INT); $stmt->execute(); $profile = $stmt->fetchOnce(); @@ -137,9 +137,6 @@ if (($activation_code == '' || strlen($activation_code) <= 6) && isset($_POST['registerpost']) && ($safepwd === true || $safepwd === '') && (isset($_POST['userpwd1']) && ($_POST['userpwd1'] == "" || (strlen($_POST['userpwd1']) >= $rdf_register_user_pwd_min && strlen($_POST['userpwd1']) < $rdf_register_user_pwd_max))) && isset($_POST['useremail']) && EMail::isValid($_POST['useremail']) && !$existemail) { - // user language (browser settings) - $userlang = Language::checkStatic($_SERVER["HTTP_ACCEPT_LANGUAGE"]); - // email address activation code $s = ''; for ($n=0; $n<20; $n++) { @@ -173,7 +170,7 @@ $stmt=DBConnection::getInstance()->prepare("UPDATE users SET user_timestamp_touch2 = NOW( ) , user_fullname = :fullname, user_website = :website, user_language = :language, user_country = :country, user_timezone = :timezone, user_occupation = :occupation, user_setting_multisession = :setting_multisession, user_setting_browseragent = :setting_browser, user_setting_ipaddress = :setting_ip, user_setting_timeout = :setting_timeout WHERE user_id = :user_id LIMIT 1"); $stmt->bindParam('fullname',htmlspecialchars($_POST['userfullname']),PDO::PARAM_STR); $stmt->bindParam('website',$_POST['userwebsite'],PDO::PARAM_STR); - $stmt->bindParam('language',$userlang,PDO::PARAM_STR); + $stmt->bindParam('language',Language::checkStatic($_POST['language']),PDO::PARAM_STR); $stmt->bindParam('country',$_POST['country'],PDO::PARAM_STR); $stmt->bindParam('timezone',$_POST['tzone'],PDO::PARAM_STR); $stmt->bindParam('occupation',$_POST['useroccupation'],PDO::PARAM_STR); @@ -286,6 +283,27 @@ <div class="login-form"> <label for="userfullname">First and Last Name *</label> <input name="userfullname" type="text" class="input" tabindex="5" id="userfullname" value="'.(isset($_POST['userfullname']) ? $_POST['userfullname'] : $profile['user_fullname']).'" size="50" maxlength="50" /> + </div> + + <div class="login-form"> + <label for="language"'.(isset($_POST['registerpost']) && $_POST['language'] == '' ? ' style="color:red;"' : '').'>Language</label> + <select id="language" name="language" tabindex="6"> + <option value="">Select One</option>'); + + $stmt=DBConnection::getInstance()->prepare("SELECT lang_id, lang_name, lang_name_org FROM languages ORDER BY lang_name ASC"); + $stmt->execute(); + while ($language = $stmt->fetch(PDO::FETCH_ASSOC)) { + echo '<option value="'.$language['lang_id'].'"'; + + if ((isset($_POST['language']) && $_POST['language'] == $country['lang_id']) || (empty($_POST['language']) && $language['lang_id'] == $profile['user_language'])) { + echo ' selected="selected"'; + } + + echo '>'.$language['lang_name'].' ('.$language['lang_name_org'].')</option>'; + } + + echo_strip(' + </select> </div> <div class="login-form"> Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/lib/Language.class.php
[iso-8859-1] Sun Nov 23 08:54:05 2008 @@ -25,8 +25,6 @@ public static function checkStatic( $lang_code ) { global $roscms_standard_language; - - $lang_code = substr($lang_code, 0, 2); switch ($lang_code) { case 'ar': @@ -58,7 +56,7 @@ case 'uk': case 'vi': case 'zh': - $ret = $lang_code; + return $lang_code; break; case '*': default: Modified:
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
URL:
http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/ro…
============================================================================== ---
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
[iso-8859-1] (original) +++
branches/danny-web/reactos.org/htdocs/roscms/lib/Subsystem_Bugzilla.class.p…
[iso-8859-1] Sun Nov 23 08:54:05 2008 @@ -171,7 +171,7 @@ } } - foreach ($global_events as $event) { + foreach ($this->global_events as $event) { $stmt=DBConnection::getInstance()->prepare("INSERT INTO ".self::DB_NAME.".email_setting (user_id, relationship, event) VALUES (LAST_INSERT_ID(), :relation, :event)"); $stmt->bindValue('relation',self::REL_ANY,PDO::PARAM_INT); $stmt->bindParam('event',$event,PDO::PARAM_INT);
16 years, 1 month
1
0
0
0
[dchapyshev] 37589: - Set flag unicode="yes" - Use WCHARs instead of TCHAR
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sun Nov 23 08:16:46 2008 New Revision: 37589 URL:
http://svn.reactos.org/svn/reactos?rev=37589&view=rev
Log: - Set flag unicode="yes" - Use WCHARs instead of TCHAR Modified: trunk/reactos/base/setup/reactos/reactos.c trunk/reactos/base/setup/reactos/reactos.rbuild 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 08:16:46 2008 @@ -28,7 +28,7 @@ #include <windows.h> #include <commctrl.h> -#include <tchar.h> +#include <wchar.h> #include <setupapi.h> #include <initguid.h> #include <devguid.h> @@ -42,23 +42,23 @@ typedef struct _LANG { - TCHAR LangId[9]; - TCHAR LangName[128]; + WCHAR LangId[9]; + WCHAR LangName[128]; } LANG, *PLANG; typedef struct _KBLAYOUT { - TCHAR LayoutId[9]; - TCHAR LayoutName[128]; - TCHAR DllName[128]; + WCHAR LayoutId[9]; + WCHAR LayoutName[128]; + WCHAR DllName[128]; } KBLAYOUT, *PKBLAYOUT; // generic entries with simple 1:1 mapping typedef struct _GENENTRY { - TCHAR Id[24]; - TCHAR Value[128]; + WCHAR Id[24]; + WCHAR 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) - TCHAR InstallDir[MAX_PATH]; // installation directory on hdd + WCHAR 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; -TCHAR abort_msg[512], abort_title[64]; +WCHAR abort_msg[512], abort_title[64]; HINSTANCE hInstance; BOOL isUnattend; @@ -142,7 +142,7 @@ LogFont = ncm.lfMessageFont; LogFont.lfWeight = FW_BOLD; - _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg")); + wcscpy(LogFont.lfFaceName, L"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 = strtol(SetupData.pLanguages[SetupData.SelectedLangId].LangId, NULL, 16); + WORD LangID = wcstol(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(TCHAR), + (WPARAM) sizeof(SetupData.InstallDir) / sizeof(WCHAR), (LPARAM) SetupData.InstallDir); EndDialog(hwndDlg, IDOK); @@ -976,11 +976,11 @@ void LoadSetupData() { WCHAR szPath[MAX_PATH]; - TCHAR tmp[10]; + WCHAR tmp[10]; WCHAR *ch; HINF hTxtsetupSif; INFCONTEXT InfContext; - //TCHAR szValue[MAX_PATH]; + //WCHAR szValue[MAX_PATH]; DWORD LineLength; LONG Count; @@ -994,7 +994,7 @@ if (hTxtsetupSif != INVALID_HANDLE_VALUE) { // get language list - Count = SetupGetLineCount(hTxtsetupSif, _T("Language")); + Count = SetupGetLineCount(hTxtsetupSif, L"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, _T("Language"), NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, L"Language", NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pLanguages[Count].LangId, - sizeof(SetupData.pLanguages[Count].LangId) / sizeof(TCHAR), + sizeof(SetupData.pLanguages[Count].LangId) / sizeof(WCHAR), &LineLength); SetupGetStringField(&InfContext, 1, SetupData.pLanguages[Count].LangName, - sizeof(SetupData.pLanguages[Count].LangName) / sizeof(TCHAR), + sizeof(SetupData.pLanguages[Count].LangName) / sizeof(WCHAR), &LineLength); ++Count; } @@ -1025,7 +1025,7 @@ } // get keyboard layout list - Count = SetupGetLineCount(hTxtsetupSif, _T("KeyboardLayout")); + Count = SetupGetLineCount(hTxtsetupSif, L"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, _T("KeyboardLayout"), NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, L"KeyboardLayout", NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pKbLayouts[Count].LayoutId, - sizeof(SetupData.pKbLayouts[Count].LayoutId) / sizeof(TCHAR), + sizeof(SetupData.pKbLayouts[Count].LayoutId) / sizeof(WCHAR), &LineLength); SetupGetStringField(&InfContext, 1, SetupData.pKbLayouts[Count].LayoutName, - sizeof(SetupData.pKbLayouts[Count].LayoutName) / sizeof(TCHAR), + sizeof(SetupData.pKbLayouts[Count].LayoutName) / sizeof(WCHAR), &LineLength); ++Count; } @@ -1060,22 +1060,22 @@ SetupData.DefaultLang = -1; // TODO: get defaults from underlaying running system - if (SetupFindFirstLine(hTxtsetupSif, _T("NLS"), _T("DefaultLayout"), &InfContext)) - { - SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(TCHAR), &LineLength); + if (SetupFindFirstLine(hTxtsetupSif, L"NLS", L"DefaultLayout", &InfContext)) + { + SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(WCHAR), &LineLength); for (Count = 0; Count < SetupData.KbLayoutCount; Count++) - if (_tcscmp(tmp, SetupData.pKbLayouts[Count].LayoutId) == 0) + if (wcscmp(tmp, SetupData.pKbLayouts[Count].LayoutId) == 0) { SetupData.DefaultKBLayout = Count; break; } } - if (SetupFindFirstLine(hTxtsetupSif, _T("NLS"), _T("DefaultLanguage"), &InfContext)) - { - SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(TCHAR), &LineLength); + if (SetupFindFirstLine(hTxtsetupSif, L"NLS", L"DefaultLanguage", &InfContext)) + { + SetupGetStringField(&InfContext, 1, tmp, sizeof(tmp) / sizeof(WCHAR), &LineLength); for (Count = 0; Count < SetupData.LangCount; Count++) - if (_tcscmp(tmp, SetupData.pLanguages[Count].LangId) == 0) + if (wcscmp(tmp, SetupData.pLanguages[Count].LangId) == 0) { SetupData.DefaultLang = Count; break; @@ -1083,7 +1083,7 @@ } // get computers list - Count = SetupGetLineCount(hTxtsetupSif, _T("Computer")); + Count = SetupGetLineCount(hTxtsetupSif, L"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, _T("Computer"), NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, L"Computer", NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pComputers[Count].Id, - sizeof(SetupData.pComputers[Count].Id) / sizeof(TCHAR), + sizeof(SetupData.pComputers[Count].Id) / sizeof(WCHAR), &LineLength); SetupGetStringField(&InfContext, 1, SetupData.pComputers[Count].Value, - sizeof(SetupData.pComputers[Count].Value) / sizeof(TCHAR), + sizeof(SetupData.pComputers[Count].Value) / sizeof(WCHAR), &LineLength); ++Count; } @@ -1114,7 +1114,7 @@ } // get display list - Count = SetupGetLineCount(hTxtsetupSif, _T("Display")); + Count = SetupGetLineCount(hTxtsetupSif, L"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, _T("Display"), NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, L"Display", NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pDisplays[Count].Id, - sizeof(SetupData.pDisplays[Count].Id) / sizeof(TCHAR), + sizeof(SetupData.pDisplays[Count].Id) / sizeof(WCHAR), &LineLength); SetupGetStringField(&InfContext, 1, SetupData.pDisplays[Count].Value, - sizeof(SetupData.pDisplays[Count].Value) / sizeof(TCHAR), + sizeof(SetupData.pDisplays[Count].Value) / sizeof(WCHAR), &LineLength); ++Count; } @@ -1146,7 +1146,7 @@ } // get keyboard list - Count = SetupGetLineCount(hTxtsetupSif, _T("Keyboard")); + Count = SetupGetLineCount(hTxtsetupSif, L"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, _T("Keyboard"), NULL, &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, L"Keyboard", NULL, &InfContext)) { do { SetupGetStringField(&InfContext, 0, SetupData.pKeyboards[Count].Id, - sizeof(SetupData.pKeyboards[Count].Id) / sizeof(TCHAR), + sizeof(SetupData.pKeyboards[Count].Id) / sizeof(WCHAR), &LineLength); SetupGetStringField(&InfContext, 1, SetupData.pKeyboards[Count].Value, - sizeof(SetupData.pKeyboards[Count].Value) / sizeof(TCHAR), + sizeof(SetupData.pKeyboards[Count].Value) / sizeof(WCHAR), &LineLength); ++Count; } @@ -1178,12 +1178,12 @@ } // get install directory - if (SetupFindFirstLine(hTxtsetupSif, _T("SetupData"), _T("DefaultPath"), &InfContext)) + if (SetupFindFirstLine(hTxtsetupSif, L"SetupData", L"DefaultPath", &InfContext)) { SetupGetStringField(&InfContext, 1, SetupData.InstallDir, - sizeof(SetupData.InstallDir) / sizeof(TCHAR), + sizeof(SetupData.InstallDir) / sizeof(WCHAR), &LineLength); } SetupCloseInfFile(hTxtsetupSif); @@ -1196,7 +1196,7 @@ WCHAR *ch; HINF hUnattendedInf; INFCONTEXT InfContext; - TCHAR szValue[MAX_PATH]; + WCHAR szValue[MAX_PATH]; DWORD LineLength; //HKEY hKey; BOOL result = 0; @@ -1211,13 +1211,13 @@ if (hUnattendedInf != INVALID_HANDLE_VALUE) { - if (SetupFindFirstLine(hUnattendedInf, _T("Unattend"), _T("UnattendSetupEnabled"),&InfContext)) + if (SetupFindFirstLine(hUnattendedInf, L"Unattend", L"UnattendSetupEnabled",&InfContext)) { if (SetupGetStringField(&InfContext, 1, szValue, - sizeof(szValue) / sizeof(TCHAR), - &LineLength) && (_tcsicmp(szValue, _T("yes")) == 0)) + sizeof(szValue) / sizeof(WCHAR), + &LineLength) && (_wcsicmp(szValue, L"yes") == 0)) { result = 1; // unattendSetup enabled // read values and store in SetupData @@ -1230,10 +1230,10 @@ } int WINAPI -WinMain(HINSTANCE hInst, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) +wWinMain(HINSTANCE hInst, + HINSTANCE hPrevInstance, + LPWSTR lpszCmdLine, + int nCmdShow) { PROPSHEETHEADER psh; HPROPSHEETPAGE ahpsp[8]; @@ -1244,8 +1244,8 @@ if (!isUnattend) { - LoadString(hInst,IDS_ABORTSETUP, abort_msg, sizeof(abort_msg)/sizeof(TCHAR)); - LoadString(hInst,IDS_ABORTSETUP2, abort_title,sizeof(abort_title)/sizeof(TCHAR)); + LoadString(hInst, IDS_ABORTSETUP, abort_msg, sizeof(abort_msg) / sizeof(WCHAR)); + LoadString(hInst, IDS_ABORTSETUP2, abort_title, sizeof(abort_title) / sizeof(WCHAR)); LoadSetupData(); Modified: trunk/reactos/base/setup/reactos/reactos.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/reactos…
============================================================================== --- trunk/reactos/base/setup/reactos/reactos.rbuild [iso-8859-1] (original) +++ trunk/reactos/base/setup/reactos/reactos.rbuild [iso-8859-1] Sun Nov 23 08:16:46 2008 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> -<module name="reactos" type="win32gui"> +<module name="reactos" type="win32gui" unicode="yes"> <bootstrap installbase="$(CDOUTPUT)" /> <include base="reactos">.</include> <library>kernel32</library>
16 years, 1 month
1
0
0
0
[dchapyshev] 37588: - Fix formatting. No code change
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sun Nov 23 07:52:57 2008 New Revision: 37588 URL:
http://svn.reactos.org/svn/reactos?rev=37588&view=rev
Log: - Fix formatting. No code change Modified: trunk/reactos/base/setup/reactos/reactos.c trunk/reactos/base/setup/reactos/resource.h 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 07:52:57 2008 @@ -23,6 +23,7 @@ * FILE: subsys/system/reactos/reactos.c * PROGRAMMERS: Eric Kohl * Matthias Kupfer + * Dmitry Chapyshev (dmitry(a)reactos.org) */ #include <windows.h> @@ -62,33 +63,33 @@ struct { - // Settings - LONG DestDiskNumber; // physical disk - LONG DestPartNumber; // partition on disk - LONG DestPartSize; // if partition doesn't exist, size of partition - LONG FSType; // file system type on partition - LONG MBRInstallType; // install bootloader - LONG FormatPart; // type of format the partition - LONG SelectedLangId; // selected language (table index) - LONG SelectedKBLayout; // selected keyboard layout (table index) - 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) - BOOLEAN RepairUpdateFlag; // flag for update/repair an installed reactos - // txtsetup.sif data - LONG DefaultLang; // default language (table index) - PLANG pLanguages; - LONG LangCount; - LONG DefaultKBLayout; // default keyboard layout (table index) - PKBLAYOUT pKbLayouts; - LONG KbLayoutCount; - PGENENTRY pComputers; - LONG CompCount; - PGENENTRY pDisplays; - LONG DispCount; - PGENENTRY pKeyboards; - LONG KeybCount; + // Settings + LONG DestDiskNumber; // physical disk + LONG DestPartNumber; // partition on disk + LONG DestPartSize; // if partition doesn't exist, size of partition + LONG FSType; // file system type on partition + LONG MBRInstallType; // install bootloader + LONG FormatPart; // type of format the partition + LONG SelectedLangId; // selected language (table index) + LONG SelectedKBLayout; // selected keyboard layout (table index) + 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) + BOOLEAN RepairUpdateFlag; // flag for update/repair an installed reactos + // txtsetup.sif data + LONG DefaultLang; // default language (table index) + PLANG pLanguages; + LONG LangCount; + LONG DefaultKBLayout; // default keyboard layout (table index) + PKBLAYOUT pKbLayouts; + LONG KbLayoutCount; + PGENENTRY pComputers; + LONG CompCount; + PGENENTRY pDisplays; + LONG DispCount; + PGENENTRY pKeyboards; + LONG KeybCount; } SetupData; typedef struct _IMGINFO @@ -98,7 +99,7 @@ INT cySource; } IMGINFO, *PIMGINFO; -TCHAR abort_msg[512],abort_title[64]; +TCHAR abort_msg[512], abort_title[64]; HINSTANCE hInstance; BOOL isUnattend; @@ -107,49 +108,49 @@ static VOID CenterWindow(HWND hWnd) { - HWND hWndParent; - RECT rcParent; - RECT rcWindow; - - hWndParent = GetParent(hWnd); - if (hWndParent == NULL) - hWndParent = GetDesktopWindow(); - - GetWindowRect(hWndParent, &rcParent); - GetWindowRect(hWnd, &rcWindow); - - SetWindowPos(hWnd, - HWND_TOP, - ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2, - ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2, - 0, - 0, - SWP_NOSIZE); + HWND hWndParent; + RECT rcParent; + RECT rcWindow; + + hWndParent = GetParent(hWnd); + if (hWndParent == NULL) + hWndParent = GetDesktopWindow(); + + GetWindowRect(hWndParent, &rcParent); + GetWindowRect(hWnd, &rcWindow); + + SetWindowPos(hWnd, + HWND_TOP, + ((rcParent.right - rcParent.left) - (rcWindow.right - rcWindow.left)) / 2, + ((rcParent.bottom - rcParent.top) - (rcWindow.bottom - rcWindow.top)) / 2, + 0, + 0, + SWP_NOSIZE); } static HFONT CreateTitleFont(VOID) { - NONCLIENTMETRICS ncm; - LOGFONT LogFont; - HDC hdc; - INT FontSize; - HFONT hFont; - - ncm.cbSize = sizeof(NONCLIENTMETRICS); - SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); - - LogFont = ncm.lfMessageFont; - LogFont.lfWeight = FW_BOLD; - _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg")); - - hdc = GetDC(NULL); - FontSize = 12; - LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72; - hFont = CreateFontIndirect(&LogFont); - ReleaseDC(NULL, hdc); - - return hFont; + NONCLIENTMETRICS ncm; + LOGFONT LogFont; + HDC hdc; + INT FontSize; + HFONT hFont; + + ncm.cbSize = sizeof(NONCLIENTMETRICS); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); + + LogFont = ncm.lfMessageFont; + LogFont.lfWeight = FW_BOLD; + _tcscpy(LogFont.lfFaceName, _T("MS Shell Dlg")); + + hdc = GetDC(NULL); + FontSize = 12; + LogFont.lfHeight = 0 - GetDeviceCaps (hdc, LOGPIXELSY) * FontSize / 72; + hFont = CreateFontIndirect(&LogFont); + ReleaseDC(NULL, hdc); + + return hFont; } static VOID @@ -177,60 +178,63 @@ static INT_PTR CALLBACK StartDlgProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - /* Center the wizard window */ - CenterWindow (hwndControl); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - /* Hide and disable the 'Cancel' button at the moment, - * we use this button to cancel the setup process - * like F3 in usetup - */ - hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); - ShowWindow (hwndControl, SW_HIDE); - EnableWindow (hwndControl, FALSE); - - /* Set title font */ - SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE); -} - break; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT); - break; - default: - break; - } - break; - } - default: - break; - - } - return FALSE; + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + /* Center the wizard window */ + CenterWindow (hwndControl); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + /* Hide and disable the 'Cancel' button at the moment, + * we use this button to cancel the setup process + * like F3 in usetup + */ + hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); + ShowWindow (hwndControl, SW_HIDE); + EnableWindow (hwndControl, FALSE); + + /* Set title font */ + SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE); + } + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT); + break; + default: + break; + } + } + break; + + default: + break; + + } + + return FALSE; } static INT_PTR CALLBACK @@ -239,67 +243,74 @@ WPARAM wParam, LPARAM lParam) { - PIMGINFO pImgInfo; - LONG i; - LRESULT tindex; - HWND hList; - pImgInfo = (PIMGINFO)GetWindowLongPtr(hwndDlg, DWLP_USER); - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); - ShowWindow (hwndControl, SW_SHOW); - EnableWindow (hwndControl, TRUE); - - pImgInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMGINFO)); - if (pImgInfo == NULL) - { - EndDialog(hwndDlg, 0); - return FALSE; - } - - SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pImgInfo); - - InitImageInfo(pImgInfo); - - /* Set title font */ - /*SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE);*/ - hList = GetDlgItem(hwndDlg, IDC_LANGUAGES); - for (i=0; i< SetupData.LangCount;i++) - { - tindex = SendMessage(hList,CB_ADDSTRING,(WPARAM)0,(LPARAM)SetupData.pLanguages[i].LangName); - SendMessage(hList,CB_SETITEMDATA,tindex,i); - if (SetupData.DefaultLang == i) - SendMessage(hList,CB_SETCURSEL,(WPARAM)tindex,(LPARAM)0); - - } - hList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT); - for (i=0; i< SetupData.KbLayoutCount;i++) - { - tindex = SendMessage(hList,CB_ADDSTRING,(WPARAM)0,(LPARAM)SetupData.pKbLayouts[i].LayoutName); - SendMessage(hList,CB_SETITEMDATA,tindex,i); - if (SetupData.DefaultKBLayout == i) - SendMessage(hList,CB_SETCURSEL,(WPARAM)tindex,(LPARAM)0); - } - } - break; - case WM_DRAWITEM: - { + PIMGINFO pImgInfo; + LONG i; + LRESULT tindex; + HWND hList; + + pImgInfo = (PIMGINFO)GetWindowLongPtr(hwndDlg, DWLP_USER); + + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); + ShowWindow (hwndControl, SW_SHOW); + EnableWindow (hwndControl, TRUE); + + pImgInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMGINFO)); + if (pImgInfo == NULL) + { + EndDialog(hwndDlg, 0); + return FALSE; + } + + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pImgInfo); + + InitImageInfo(pImgInfo); + + /* Set title font */ + /*SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE);*/ + + hList = GetDlgItem(hwndDlg, IDC_LANGUAGES); + + for (i=0; i < SetupData.LangCount; i++) + { + tindex = SendMessage(hList, CB_ADDSTRING, (WPARAM) 0, (LPARAM) SetupData.pLanguages[i].LangName); + SendMessage(hList, CB_SETITEMDATA, tindex, i); + if (SetupData.DefaultLang == i) + SendMessage(hList, CB_SETCURSEL, (WPARAM) tindex,(LPARAM) 0); + } + + hList = GetDlgItem(hwndDlg, IDC_KEYLAYOUT); + + for (i=0; i < SetupData.KbLayoutCount; i++) + { + tindex = SendMessage(hList, CB_ADDSTRING, (WPARAM) 0, (LPARAM)SetupData.pKbLayouts[i].LayoutName); + SendMessage(hList, CB_SETITEMDATA, tindex, i); + if (SetupData.DefaultKBLayout == i) + SendMessage(hList,CB_SETCURSEL,(WPARAM)tindex,(LPARAM)0); + } + } + break; + + case WM_DRAWITEM: + { LPDRAWITEMSTRUCT lpDrawItem; lpDrawItem = (LPDRAWITEMSTRUCT) lParam; + if (lpDrawItem->CtlID == IDB_ROSLOGO) { HDC hdcMem; @@ -325,197 +336,256 @@ } } return TRUE; - } - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); - break; - case PSN_QUERYCANCEL: - SetWindowLong(hwndDlg, DWL_MSGRESULT,MessageBox(GetParent(hwndDlg), abort_msg, abort_title, MB_YESNO | MB_ICONQUESTION) != IDYES); - return TRUE; - case PSN_WIZNEXT: // set the selected data - 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=strtol(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); - if (tindex != CB_ERR) - { - SetupData.SelectedKBLayout = SendMessage(hList,CB_GETITEMDATA, (WPARAM)tindex, (LPARAM)0); - } - return TRUE; - default: - break; - } - } - break; - default: - break; - - } - return FALSE; + } + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); + break; + + case PSN_QUERYCANCEL: + SetWindowLong(hwndDlg, + DWL_MSGRESULT, + MessageBox(GetParent(hwndDlg), + abort_msg, + abort_title, + MB_YESNO | MB_ICONQUESTION) != IDYES); + return TRUE; + + case PSN_WIZNEXT: // set the selected data + { + 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 = strtol(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); + if (tindex != CB_ERR) + { + SetupData.SelectedKBLayout = SendMessage(hList, CB_GETITEMDATA, (WPARAM) tindex, (LPARAM) 0); + } + return TRUE; + } + + default: + break; + } + } + break; + + default: + break; + + } + return FALSE; } static INT_PTR CALLBACK TypeDlgProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - CheckDlgButton(hwndDlg, IDC_INSTALL, BST_CHECKED); - - /* Set title font */ - /*SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE);*/ -} - break; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); - break; - case PSN_QUERYCANCEL: - SetWindowLong(hwndDlg, DWL_MSGRESULT,MessageBox(GetParent(hwndDlg), abort_msg, abort_title, MB_YESNO | MB_ICONQUESTION) != IDYES); - return TRUE; - case PSN_WIZNEXT: // set the selected data - - SetupData.RepairUpdateFlag = !(SendMessage(GetDlgItem(hwndDlg, IDC_INSTALL),BM_GETCHECK,(WPARAM)0,(LPARAM)0) == BST_CHECKED); - return TRUE; - default: - break; - } - } - break; - default: - break; - - } - return FALSE; + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + CheckDlgButton(hwndDlg, IDC_INSTALL, BST_CHECKED); + + /* Set title font */ + /*SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE);*/ + } + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); + break; + + case PSN_QUERYCANCEL: + SetWindowLong(hwndDlg, + DWL_MSGRESULT, + MessageBox(GetParent(hwndDlg), + abort_msg, + abort_title, + MB_YESNO | MB_ICONQUESTION) != IDYES); + return TRUE; + + case PSN_WIZNEXT: // set the selected data + SetupData.RepairUpdateFlag = !(SendMessage(GetDlgItem(hwndDlg, IDC_INSTALL), + BM_GETCHECK, + (WPARAM) 0, + (LPARAM) 0) == BST_CHECKED); + return TRUE; + + default: + break; + } + } + break; + + default: + break; + + } + return FALSE; } static INT_PTR CALLBACK DeviceDlgProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - LONG i; - LRESULT tindex; - HWND hList; - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - /* Set title font */ - /*SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE);*/ -} - hList = GetDlgItem(hwndDlg, IDC_COMPUTER); - for (i=0; i< SetupData.CompCount;i++) - { - tindex = SendMessage(hList,CB_ADDSTRING,(WPARAM)0,(LPARAM)SetupData.pComputers[i].Value); - SendMessage(hList,CB_SETITEMDATA,tindex,i); - } - SendMessage(hList,CB_SETCURSEL,0,0); // set first as default - hList = GetDlgItem(hwndDlg, IDC_DISPLAY); - for (i=0; i< SetupData.DispCount;i++) - { - tindex = SendMessage(hList,CB_ADDSTRING,(WPARAM)0,(LPARAM)SetupData.pDisplays[i].Value); - SendMessage(hList,CB_SETITEMDATA,tindex,i); - } - SendMessage(hList,CB_SETCURSEL,0,0); // set first as default - hList = GetDlgItem(hwndDlg, IDC_KEYBOARD); - for (i=0; i< SetupData.KeybCount;i++) - { - tindex = SendMessage(hList,CB_ADDSTRING,(WPARAM)0,(LPARAM)SetupData.pKeyboards[i].Value); - SendMessage(hList,CB_SETITEMDATA,tindex,i); - } - SendMessage(hList,CB_SETCURSEL,0,0); // set first as default - break; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); - break; - case PSN_QUERYCANCEL: - SetWindowLong(hwndDlg, DWL_MSGRESULT,MessageBox(GetParent(hwndDlg), abort_msg, abort_title, MB_YESNO | MB_ICONQUESTION) != IDYES); - return TRUE; - case PSN_WIZNEXT: // set the selected data - hList =GetDlgItem(hwndDlg, IDC_COMPUTER); - tindex = SendMessage(hList,CB_GETCURSEL, (WPARAM)0, (LPARAM)0); - if (tindex != CB_ERR) - { - SetupData.SelectedComputer = SendMessage(hList,CB_GETITEMDATA, (WPARAM)tindex, (LPARAM)0); - } - hList =GetDlgItem(hwndDlg, IDC_DISPLAY); - tindex = SendMessage(hList,CB_GETCURSEL, (WPARAM)0, (LPARAM)0); - if (tindex != CB_ERR) - { - SetupData.SelectedDisplay = SendMessage(hList,CB_GETITEMDATA, (WPARAM)tindex, (LPARAM)0); - } - hList =GetDlgItem(hwndDlg, IDC_KEYBOARD); - tindex = SendMessage(hList,CB_GETCURSEL, (WPARAM)0, (LPARAM)0); - if (tindex != CB_ERR) - { - SetupData.SelectedKeyboard = SendMessage(hList,CB_GETITEMDATA, (WPARAM)tindex, (LPARAM)0); - } - return TRUE; - default: - break; - } - } - break; - default: - break; - - } - return FALSE; + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + LONG i; + LRESULT tindex; + HWND hList; + + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + /* Set title font */ + /*SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE);*/ + + hList = GetDlgItem(hwndDlg, IDC_COMPUTER); + + for (i=0; i < SetupData.CompCount; i++) + { + tindex = SendMessage(hList, CB_ADDSTRING, (WPARAM) 0, (LPARAM) SetupData.pComputers[i].Value); + SendMessage(hList, CB_SETITEMDATA, tindex, i); + } + SendMessage(hList, CB_SETCURSEL, 0, 0); // set first as default + + hList = GetDlgItem(hwndDlg, IDC_DISPLAY); + + for (i=0; i < SetupData.DispCount; i++) + { + tindex = SendMessage(hList, CB_ADDSTRING, (WPARAM) 0, (LPARAM) SetupData.pDisplays[i].Value); + SendMessage(hList, CB_SETITEMDATA, tindex, i); + } + SendMessage(hList, CB_SETCURSEL, 0, 0); // set first as default + + hList = GetDlgItem(hwndDlg, IDC_KEYBOARD); + + for (i=0; i < SetupData.KeybCount; i++) + { + tindex = SendMessage(hList,CB_ADDSTRING,(WPARAM)0,(LPARAM)SetupData.pKeyboards[i].Value); + SendMessage(hList,CB_SETITEMDATA,tindex,i); + } + SendMessage(hList,CB_SETCURSEL,0,0); // set first as default + } + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); + break; + + case PSN_QUERYCANCEL: + SetWindowLong(hwndDlg, + DWL_MSGRESULT, + MessageBox(GetParent(hwndDlg), + abort_msg, + abort_title, + MB_YESNO | MB_ICONQUESTION) != IDYES); + return TRUE; + + case PSN_WIZNEXT: // set the selected data + { + hList = GetDlgItem(hwndDlg, IDC_COMPUTER); + + tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); + if (tindex != CB_ERR) + { + SetupData.SelectedComputer = SendMessage(hList, + CB_GETITEMDATA, + (WPARAM) tindex, + (LPARAM) 0); + } + + hList = GetDlgItem(hwndDlg, IDC_DISPLAY); + + tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); + if (tindex != CB_ERR) + { + SetupData.SelectedDisplay = SendMessage(hList, + CB_GETITEMDATA, + (WPARAM) tindex, + (LPARAM) 0); + } + + hList =GetDlgItem(hwndDlg, IDC_KEYBOARD); + + tindex = SendMessage(hList, CB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); + if (tindex != CB_ERR) + { + SetupData.SelectedKeyboard = SendMessage(hList, + CB_GETITEMDATA, + (WPARAM) tindex, + (LPARAM) 0); + } + return TRUE; + } + + default: + break; + } + } + break; + + default: + break; + + } + return FALSE; } static INT_PTR CALLBACK @@ -524,157 +594,194 @@ WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { - case WM_INITDIALOG: - CheckDlgButton(hwndDlg, IDC_INSTFREELDR, BST_CHECKED); - SendMessage(GetDlgItem(hwndDlg, IDC_PATH),WM_SETTEXT, - (WPARAM)0,(LPARAM)SetupData.InstallDir); - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDOK: - SendMessage(GetDlgItem(hwndDlg, IDC_PATH),WM_GETTEXT, - (WPARAM)sizeof(SetupData.InstallDir)/sizeof(TCHAR),(LPARAM)SetupData.InstallDir); - - EndDialog(hwndDlg, IDOK); - return TRUE; - case IDCANCEL: - EndDialog(hwndDlg, IDCANCEL); - return TRUE; - } - } - return FALSE; + switch (uMsg) + { + case WM_INITDIALOG: + { + CheckDlgButton(hwndDlg, IDC_INSTFREELDR, BST_CHECKED); + SendMessage(GetDlgItem(hwndDlg, IDC_PATH), + WM_SETTEXT, + (WPARAM) 0, + (LPARAM) SetupData.InstallDir); + } + break; + + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + case IDOK: + { + SendMessage(GetDlgItem(hwndDlg, IDC_PATH), + WM_GETTEXT, + (WPARAM) sizeof(SetupData.InstallDir) / sizeof(TCHAR), + (LPARAM) SetupData.InstallDir); + + EndDialog(hwndDlg, IDOK); + return TRUE; + } + + case IDCANCEL: + { + EndDialog(hwndDlg, IDCANCEL); + return TRUE; + } + } + } + } + + return FALSE; } static INT_PTR CALLBACK PartitionDlgProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - switch (uMsg) - { - case WM_INITDIALOG: - break; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDOK: - EndDialog(hwndDlg, IDOK); - return TRUE; - case IDCANCEL: - EndDialog(hwndDlg, IDCANCEL); - return TRUE; - } - } - return FALSE; + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + break; + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + case IDOK: + EndDialog(hwndDlg, IDOK); + return TRUE; + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + return TRUE; + } + } + } + return FALSE; } static INT_PTR CALLBACK DriveDlgProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { #if 0 - HDEVINFO h; - HWND hList; - SP_DEVINFO_DATA DevInfoData; - DWORD i; + HDEVINFO h; + HWND hList; + SP_DEVINFO_DATA DevInfoData; + DWORD i; #endif - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - /* Set title font */ - /*SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE);*/ + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + /* Set title font */ + /*SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE);*/ #if 0 - h = SetupDiGetClassDevs(&GUID_DEVCLASS_DISKDRIVE, NULL, NULL, - DIGCF_PRESENT); - if (h != INVALID_HANDLE_VALUE) - { - hList =GetDlgItem(hwndDlg, IDC_PARTITION); - DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); - for (i=0;SetupDiEnumDeviceInfo(h,i,&DevInfoData);i++) - { - DWORD DataT; - LPTSTR buffer = NULL; - DWORD buffersize = 0; - while (!SetupDiGetDeviceRegistryProperty( - h,&DevInfoData, - SPDRP_DEVICEDESC,&DataT,(PBYTE)buffer, - buffersize,&buffersize)) - { - if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - if (buffer) LocalFree(buffer); - buffer = LocalAlloc(LPTR,buffersize * 2); - } else - break; - } - if (buffer) - { - SendMessage(hList,LB_ADDSTRING,(WPARAM)0,(LPARAM)buffer); - LocalFree(buffer); - } - } - SetupDiDestroyDeviceInfoList(h); - } + h = SetupDiGetClassDevs(&GUID_DEVCLASS_DISKDRIVE, NULL, NULL, DIGCF_PRESENT); + if (h != INVALID_HANDLE_VALUE) + { + hList =GetDlgItem(hwndDlg, IDC_PARTITION); + DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + for (i=0; SetupDiEnumDeviceInfo(h, i, &DevInfoData); i++) + { + DWORD DataT; + LPTSTR buffer = NULL; + DWORD buffersize = 0; + + while (!SetupDiGetDeviceRegistryProperty(h, + &DevInfoData, + SPDRP_DEVICEDESC, + &DataT, + (PBYTE)buffer, + buffersize, + &buffersize)) + { + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + if (buffer) LocalFree(buffer); + buffer = LocalAlloc(LPTR, buffersize * 2); + } + else + break; + } + if (buffer) + { + SendMessage(hList, LB_ADDSTRING, (WPARAM) 0, (LPARAM) buffer); + LocalFree(buffer); + } + } + SetupDiDestroyDeviceInfoList(h); + } #endif - } - break; - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case IDC_PARTMOREOPTS: - DialogBox(hInstance,MAKEINTRESOURCE(IDD_BOOTOPTIONS),hwndDlg,(DLGPROC)MoreOptDlgProc); - break; - case IDC_PARTCREATE: - DialogBox(hInstance,MAKEINTRESOURCE(IDD_PARTITION),hwndDlg,(DLGPROC)PartitionDlgProc); - break; - case IDC_PARTDELETE: - break; - } - break; - - } - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); - break; - case PSN_QUERYCANCEL: - SetWindowLong(hwndDlg, DWL_MSGRESULT,MessageBox(GetParent(hwndDlg), abort_msg, abort_title, MB_YESNO | MB_ICONQUESTION) != IDYES); - return TRUE; - default: - break; - } - break; - } - default: - break; - - } - return FALSE; + } + break; + + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + case IDC_PARTMOREOPTS: + DialogBox(hInstance, + MAKEINTRESOURCE(IDD_BOOTOPTIONS), + hwndDlg, + (DLGPROC) MoreOptDlgProc); + break; + case IDC_PARTCREATE: + DialogBox(hInstance, + MAKEINTRESOURCE(IDD_PARTITION), + hwndDlg, + (DLGPROC) PartitionDlgProc); + break; + case IDC_PARTDELETE: + break; + } + break; + } + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); + break; + + case PSN_QUERYCANCEL: + SetWindowLong(hwndDlg, + DWL_MSGRESULT, + MessageBox(GetParent(hwndDlg), + abort_msg, + abort_title, + MB_YESNO | MB_ICONQUESTION) != IDYES); + return TRUE; + + default: + break; + } + } + break; + + default: + break; + + } + + return FALSE; } static INT_PTR CALLBACK @@ -683,48 +790,52 @@ WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); - ShowWindow (hwndControl, SW_HIDE); - EnableWindow (hwndControl, FALSE); - - /* Set title font */ - /*SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE);*/ - } - break; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); - break; - default: - break; - } - break; - } - default: - break; - } - return FALSE; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); + ShowWindow(hwndControl, SW_HIDE); + EnableWindow(hwndControl, FALSE); + + /* Set title font */ + /*SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE);*/ + } + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT | PSWIZB_BACK); + break; + + default: + break; + } + } + break; + + default: + break; + } + + return FALSE; } static INT_PTR CALLBACK @@ -733,51 +844,55 @@ WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); - ShowWindow (hwndControl, SW_HIDE); - EnableWindow (hwndControl, FALSE); - - /* Set title font */ - /*SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE);*/ -} - break; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT ); - // disable all buttons during installation process - // PropSheet_SetWizButtons(GetParent(hwndDlg), 0 ); - break; - default: - break; - } - } - break; - default: - break; - - } - return FALSE; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + hwndControl = GetDlgItem(GetParent(hwndDlg), IDCANCEL); + ShowWindow(hwndControl, SW_HIDE); + EnableWindow(hwndControl, FALSE); + + /* Set title font */ + /*SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE);*/ + } + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT); + // disable all buttons during installation process + // PropSheet_SetWizButtons(GetParent(hwndDlg), 0 ); + break; + + default: + break; + } + } + break; + + default: + break; + + } + + return FALSE; } static INT_PTR CALLBACK @@ -786,396 +901,464 @@ WPARAM wParam, LPARAM lParam) { - switch (uMsg) - { - case WM_INITDIALOG: - { - HWND hwndControl; - DWORD dwStyle; - - hwndControl = GetParent(hwndDlg); - - dwStyle = GetWindowLong(hwndControl, GWL_STYLE); - SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); - - /* Set title font */ - /*SendDlgItemMessage(hwndDlg, - IDC_STARTTITLE, - WM_SETFONT, - (WPARAM)hTitleFont, - (LPARAM)TRUE);*/ - } - break; - case WM_TIMER: - { - INT Position; - HWND hWndProgress; - - hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS); - Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0); - if (Position == 300) - { - KillTimer(hwndDlg, 1); - PropSheet_PressButton(GetParent(hwndDlg), PSBTN_FINISH); - } - else - { - SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0); - } - return TRUE; - } - case WM_DESTROY: - return TRUE; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - switch (lpnm->code) - { - case PSN_SETACTIVE: // Only "Finish" for closing the App - PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH); - SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 300)); - SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETPOS, 0, 0); - SetTimer(hwndDlg, 1, 50, NULL); - break; - default: - break; - } - break; - } - default: - break; - - } - return FALSE; + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndControl; + DWORD dwStyle; + + hwndControl = GetParent(hwndDlg); + + dwStyle = GetWindowLong(hwndControl, GWL_STYLE); + SetWindowLong(hwndControl, GWL_STYLE, dwStyle & ~WS_SYSMENU); + + /* Set title font */ + /*SendDlgItemMessage(hwndDlg, + IDC_STARTTITLE, + WM_SETFONT, + (WPARAM)hTitleFont, + (LPARAM)TRUE);*/ + } + break; + + case WM_TIMER: + { + INT Position; + HWND hWndProgress; + + hWndProgress = GetDlgItem(hwndDlg, IDC_RESTART_PROGRESS); + Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0); + if (Position == 300) + { + KillTimer(hwndDlg, 1); + PropSheet_PressButton(GetParent(hwndDlg), PSBTN_FINISH); + } + else + { + SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0); + } + return TRUE; + } + + case WM_DESTROY: + return TRUE; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch (lpnm->code) + { + case PSN_SETACTIVE: // Only "Finish" for closing the App + { + PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_FINISH); + SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 300)); + SendDlgItemMessage(hwndDlg, IDC_RESTART_PROGRESS, PBM_SETPOS, 0, 0); + SetTimer(hwndDlg, 1, 50, NULL); + } + break; + + default: + break; + } + } + break; + + default: + break; + + } + + return FALSE; } void LoadSetupData() { - WCHAR szPath[MAX_PATH]; - TCHAR tmp[10]; - WCHAR *ch; - HINF hTxtsetupSif; - INFCONTEXT InfContext; - //TCHAR szValue[MAX_PATH]; - DWORD LineLength; - LONG Count; - - GetModuleFileNameW(NULL,szPath,MAX_PATH); - ch = strrchrW(szPath,L'\\'); - if (ch != NULL) - *ch = L'\0'; - - wcscat(szPath, L"\\txtsetup.sif"); - hTxtsetupSif = SetupOpenInfFileW(szPath, NULL, INF_STYLE_OLDNT, NULL); - if (hTxtsetupSif != INVALID_HANDLE_VALUE) - { - // get language list - Count = SetupGetLineCount(hTxtsetupSif, _T("Language")); - if (Count > 0) - { - SetupData.pLanguages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LANG) * Count); - if (SetupData.pLanguages != NULL) - { - SetupData.LangCount = Count; - Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, _T("Language"), - NULL,&InfContext)) - do - { - SetupGetStringField(&InfContext, 0, SetupData.pLanguages[Count].LangId, sizeof(SetupData.pLanguages[Count].LangId) / sizeof(TCHAR), &LineLength); - SetupGetStringField(&InfContext, 1, SetupData.pLanguages[Count].LangName, sizeof(SetupData.pLanguages[Count].LangName) / sizeof(TCHAR), &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.LangCount); - } - } - // get keyboard layout list - Count = SetupGetLineCount(hTxtsetupSif, _T("KeyboardLayout")); - if (Count > 0) - { - SetupData.pKbLayouts = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(KBLAYOUT) * Count); - if (SetupData.pKbLayouts != NULL) - { - SetupData.KbLayoutCount = Count; - Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, _T("KeyboardLayout"), - NULL,&InfContext)) - do - { - SetupGetStringField(&InfContext, 0, SetupData.pKbLayouts[Count].LayoutId, sizeof(SetupData.pKbLayouts[Count].LayoutId) / sizeof(TCHAR), &LineLength); - SetupGetStringField(&InfContext, 1, SetupData.pKbLayouts[Count].LayoutName, sizeof(SetupData.pKbLayouts[Count].LayoutName) / sizeof(TCHAR), &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.LangCount); - } - } - // get default for keyboard and language - SetupData.DefaultKBLayout = -1; - SetupData.DefaultLang = -1; - // TODO: get defaults from underlaying running system - 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 (_tcscmp(tmp,SetupData.pKbLayouts[Count].LayoutId)==0) - { - SetupData.DefaultKBLayout = Count; - break; - } - } - 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 (_tcscmp(tmp,SetupData.pLanguages[Count].LangId)==0) - { - SetupData.DefaultLang = Count; - break; - } - } - // get computers list - Count = SetupGetLineCount(hTxtsetupSif, _T("Computer")); - if (Count > 0) - { - SetupData.pComputers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); - if (SetupData.pComputers != NULL) - { - SetupData.CompCount = Count; - Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, _T("Computer"), - NULL,&InfContext)) - do - { - SetupGetStringField(&InfContext, 0, SetupData.pComputers[Count].Id, sizeof(SetupData.pComputers[Count].Id) / sizeof(TCHAR), &LineLength); - SetupGetStringField(&InfContext, 1, SetupData.pComputers[Count].Value, sizeof(SetupData.pComputers[Count].Value) / sizeof(TCHAR), &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.CompCount); - } - } - // get display list - Count = SetupGetLineCount(hTxtsetupSif, _T("Display")); - if (Count > 0) - { - SetupData.pDisplays = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); - if (SetupData.pDisplays != NULL) - { - SetupData.DispCount = Count; - Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, _T("Display"), - NULL,&InfContext)) - do - { - SetupGetStringField(&InfContext, 0, SetupData.pDisplays[Count].Id, sizeof(SetupData.pDisplays[Count].Id) / sizeof(TCHAR), &LineLength); - SetupGetStringField(&InfContext, 1, SetupData.pDisplays[Count].Value, sizeof(SetupData.pDisplays[Count].Value) / sizeof(TCHAR), &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.DispCount); - } - } - // get keyboard list - Count = SetupGetLineCount(hTxtsetupSif, _T("Keyboard")); - if (Count > 0) - { - SetupData.pKeyboards = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); - if (SetupData.pKeyboards != NULL) - { - SetupData.KeybCount = Count; - Count = 0; - if (SetupFindFirstLine(hTxtsetupSif, _T("Keyboard"), - NULL,&InfContext)) - do - { - SetupGetStringField(&InfContext, 0, SetupData.pKeyboards[Count].Id, sizeof(SetupData.pKeyboards[Count].Id) / sizeof(TCHAR), &LineLength); - SetupGetStringField(&InfContext, 1, SetupData.pKeyboards[Count].Value, sizeof(SetupData.pKeyboards[Count].Value) / sizeof(TCHAR), &LineLength); - ++Count; - } - while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.KeybCount); - } - } - // get install directory - if (SetupFindFirstLine(hTxtsetupSif, _T("SetupData"), - _T("DefaultPath"),&InfContext)) - { - SetupGetStringField(&InfContext, 1, - SetupData.InstallDir, - sizeof(SetupData.InstallDir) / sizeof(TCHAR), &LineLength); - } - SetupCloseInfFile(hTxtsetupSif); - } + WCHAR szPath[MAX_PATH]; + TCHAR tmp[10]; + WCHAR *ch; + HINF hTxtsetupSif; + INFCONTEXT InfContext; + //TCHAR szValue[MAX_PATH]; + DWORD LineLength; + LONG Count; + + GetModuleFileNameW(NULL,szPath,MAX_PATH); + ch = strrchrW(szPath,L'\\'); + if (ch != NULL) + *ch = L'\0'; + + wcscat(szPath, L"\\txtsetup.sif"); + hTxtsetupSif = SetupOpenInfFileW(szPath, NULL, INF_STYLE_OLDNT, NULL); + if (hTxtsetupSif != INVALID_HANDLE_VALUE) + { + // get language list + Count = SetupGetLineCount(hTxtsetupSif, _T("Language")); + if (Count > 0) + { + SetupData.pLanguages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LANG) * Count); + if (SetupData.pLanguages != NULL) + { + SetupData.LangCount = Count; + Count = 0; + if (SetupFindFirstLine(hTxtsetupSif, _T("Language"), NULL, &InfContext)) + { + do + { + SetupGetStringField(&InfContext, + 0, + SetupData.pLanguages[Count].LangId, + sizeof(SetupData.pLanguages[Count].LangId) / sizeof(TCHAR), + &LineLength); + + SetupGetStringField(&InfContext, + 1, + SetupData.pLanguages[Count].LangName, + sizeof(SetupData.pLanguages[Count].LangName) / sizeof(TCHAR), + &LineLength); + ++Count; + } + while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.LangCount); + } + } + } + + // get keyboard layout list + Count = SetupGetLineCount(hTxtsetupSif, _T("KeyboardLayout")); + if (Count > 0) + { + SetupData.pKbLayouts = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(KBLAYOUT) * Count); + if (SetupData.pKbLayouts != NULL) + { + SetupData.KbLayoutCount = Count; + Count = 0; + if (SetupFindFirstLine(hTxtsetupSif, _T("KeyboardLayout"), NULL, &InfContext)) + { + do + { + SetupGetStringField(&InfContext, + 0, + SetupData.pKbLayouts[Count].LayoutId, + sizeof(SetupData.pKbLayouts[Count].LayoutId) / sizeof(TCHAR), + &LineLength); + + SetupGetStringField(&InfContext, + 1, + SetupData.pKbLayouts[Count].LayoutName, + sizeof(SetupData.pKbLayouts[Count].LayoutName) / sizeof(TCHAR), + &LineLength); + ++Count; + } + while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.LangCount); + } + } + } + + // get default for keyboard and language + SetupData.DefaultKBLayout = -1; + SetupData.DefaultLang = -1; + + // TODO: get defaults from underlaying running system + 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 (_tcscmp(tmp, SetupData.pKbLayouts[Count].LayoutId) == 0) + { + SetupData.DefaultKBLayout = Count; + break; + } + } + + 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 (_tcscmp(tmp, SetupData.pLanguages[Count].LangId) == 0) + { + SetupData.DefaultLang = Count; + break; + } + } + + // get computers list + Count = SetupGetLineCount(hTxtsetupSif, _T("Computer")); + if (Count > 0) + { + SetupData.pComputers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); + if (SetupData.pComputers != NULL) + { + SetupData.CompCount = Count; + Count = 0; + if (SetupFindFirstLine(hTxtsetupSif, _T("Computer"), NULL, &InfContext)) + { + do + { + SetupGetStringField(&InfContext, + 0, + SetupData.pComputers[Count].Id, + sizeof(SetupData.pComputers[Count].Id) / sizeof(TCHAR), + &LineLength); + + SetupGetStringField(&InfContext, + 1, + SetupData.pComputers[Count].Value, + sizeof(SetupData.pComputers[Count].Value) / sizeof(TCHAR), + &LineLength); + ++Count; + } + while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.CompCount); + } + } + } + + // get display list + Count = SetupGetLineCount(hTxtsetupSif, _T("Display")); + if (Count > 0) + { + SetupData.pDisplays = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); + if (SetupData.pDisplays != NULL) + { + SetupData.DispCount = Count; + Count = 0; + + if (SetupFindFirstLine(hTxtsetupSif, _T("Display"), NULL, &InfContext)) + { + do + { + SetupGetStringField(&InfContext, + 0, + SetupData.pDisplays[Count].Id, + sizeof(SetupData.pDisplays[Count].Id) / sizeof(TCHAR), + &LineLength); + + SetupGetStringField(&InfContext, + 1, + SetupData.pDisplays[Count].Value, + sizeof(SetupData.pDisplays[Count].Value) / sizeof(TCHAR), + &LineLength); + ++Count; + } + while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.DispCount); + } + } + } + + // get keyboard list + Count = SetupGetLineCount(hTxtsetupSif, _T("Keyboard")); + if (Count > 0) + { + SetupData.pKeyboards = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GENENTRY) * Count); + if (SetupData.pKeyboards != NULL) + { + SetupData.KeybCount = Count; + Count = 0; + + if (SetupFindFirstLine(hTxtsetupSif, _T("Keyboard"), NULL, &InfContext)) + { + do + { + SetupGetStringField(&InfContext, + 0, + SetupData.pKeyboards[Count].Id, + sizeof(SetupData.pKeyboards[Count].Id) / sizeof(TCHAR), + &LineLength); + + SetupGetStringField(&InfContext, + 1, + SetupData.pKeyboards[Count].Value, + sizeof(SetupData.pKeyboards[Count].Value) / sizeof(TCHAR), + &LineLength); + ++Count; + } + while (SetupFindNextLine(&InfContext, &InfContext) && Count < SetupData.KeybCount); + } + } + } + + // get install directory + if (SetupFindFirstLine(hTxtsetupSif, _T("SetupData"), _T("DefaultPath"), &InfContext)) + { + SetupGetStringField(&InfContext, + 1, + SetupData.InstallDir, + sizeof(SetupData.InstallDir) / sizeof(TCHAR), + &LineLength); + } + SetupCloseInfFile(hTxtsetupSif); + } } BOOL isUnattendSetup() { - WCHAR szPath[MAX_PATH]; - WCHAR *ch; - HINF hUnattendedInf; - INFCONTEXT InfContext; - TCHAR szValue[MAX_PATH]; - DWORD LineLength; - //HKEY hKey; - BOOL result = 0; - - GetModuleFileNameW(NULL,szPath,MAX_PATH); - ch = strrchrW(szPath,L'\\'); - if (ch != NULL) - *ch = L'\0'; - - wcscat(szPath, L"\\unattend.inf"); - hUnattendedInf = SetupOpenInfFileW(szPath, NULL, INF_STYLE_OLDNT, NULL); - if (hUnattendedInf != INVALID_HANDLE_VALUE) - { - if (SetupFindFirstLine(hUnattendedInf, _T("Unattend"), - _T("UnattendSetupEnabled"),&InfContext)) - { - if (SetupGetStringField(&InfContext, 1, szValue, - sizeof(szValue) / sizeof(TCHAR), &LineLength) && - (_tcsicmp(szValue, _T("yes"))==0)) - { - result = 1; // unattendSetup enabled - - // read values and store in SetupData - } - } - SetupCloseInfFile(hUnattendedInf); - } - return result; + WCHAR szPath[MAX_PATH]; + WCHAR *ch; + HINF hUnattendedInf; + INFCONTEXT InfContext; + TCHAR szValue[MAX_PATH]; + DWORD LineLength; + //HKEY hKey; + BOOL result = 0; + + GetModuleFileNameW(NULL, szPath, MAX_PATH); + ch = strrchrW(szPath, L'\\'); + if (ch != NULL) + *ch = L'\0'; + + wcscat(szPath, L"\\unattend.inf"); + hUnattendedInf = SetupOpenInfFileW(szPath, NULL, INF_STYLE_OLDNT, NULL); + + if (hUnattendedInf != INVALID_HANDLE_VALUE) + { + if (SetupFindFirstLine(hUnattendedInf, _T("Unattend"), _T("UnattendSetupEnabled"),&InfContext)) + { + if (SetupGetStringField(&InfContext, + 1, + szValue, + sizeof(szValue) / sizeof(TCHAR), + &LineLength) && (_tcsicmp(szValue, _T("yes")) == 0)) + { + result = 1; // unattendSetup enabled + // read values and store in SetupData + } + } + SetupCloseInfFile(hUnattendedInf); + } + + return result; } int WINAPI WinMain(HINSTANCE hInst, - HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, - int nCmdShow) -{ - PROPSHEETHEADER psh; - HPROPSHEETPAGE ahpsp[8]; - PROPSHEETPAGE psp = {0}; - UINT nPages = 0; - hInstance = hInst; - isUnattend = isUnattendSetup(); - - if (!isUnattend) - { - - LoadString(hInst,IDS_ABORTSETUP, abort_msg, sizeof(abort_msg)/sizeof(TCHAR)); - LoadString(hInst,IDS_ABORTSETUP2, abort_title,sizeof(abort_title)/sizeof(TCHAR)); - - LoadSetupData(); - - /* Create the Start page, until setup is working */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER; - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = StartDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_STARTPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - - /* Create language selection page */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LANGTITLE); - psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LANGSUBTITLE); - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = LangSelDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_LANGSELPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - - /* Create install type selection page */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_TYPETITLE); - psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_TYPESUBTITLE); - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = TypeDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_TYPEPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - - /* Create device settings page */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DEVICETITLE); - psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DEVICESUBTITLE); - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = DeviceDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_DEVICEPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - - /* Create install device settings page / boot method / install directory */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DRIVETITLE); - psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DRIVESUBTITLE); - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = DriveDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_DRIVEPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - - /* Create summary page */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SUMMARYTITLE); - psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUMMARYSUBTITLE); - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = SummaryDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_SUMMARYPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - - } - - /* Create installation progress page */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE); - psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE); - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = ProcessDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - - if (!isUnattend) - { - /* Create finish to reboot page */ - psp.dwSize = sizeof(PROPSHEETPAGE); - psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; - psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_RESTARTTITLE); - psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_RESTARTSUBTITLE); - psp.hInstance = hInst; - psp.lParam = 0; - psp.pfnDlgProc = RestartDlgProc; - psp.pszTemplate = MAKEINTRESOURCE(IDD_RESTARTPAGE); - ahpsp[nPages++] = CreatePropertySheetPage(&psp); - } - - /* Create the property sheet */ - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER; - psh.hInstance = hInst; - psh.hwndParent = NULL; - psh.nPages = nPages; - psh.nStartPage = 0; - psh.phpage = ahpsp; - psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK); - psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER); - - /* Create title font */ - hTitleFont = CreateTitleFont(); - - /* Display the wizard */ - PropertySheet(&psh); - - DeleteObject(hTitleFont); - - return 0; - + HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, + int nCmdShow) +{ + PROPSHEETHEADER psh; + HPROPSHEETPAGE ahpsp[8]; + PROPSHEETPAGE psp = {0}; + UINT nPages = 0; + hInstance = hInst; + isUnattend = isUnattendSetup(); + + if (!isUnattend) + { + LoadString(hInst,IDS_ABORTSETUP, abort_msg, sizeof(abort_msg)/sizeof(TCHAR)); + LoadString(hInst,IDS_ABORTSETUP2, abort_title,sizeof(abort_title)/sizeof(TCHAR)); + + LoadSetupData(); + + /* Create the Start page, until setup is working */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER; + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = StartDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_STARTPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + + /* Create language selection page */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LANGTITLE); + psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LANGSUBTITLE); + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = LangSelDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_LANGSELPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + + /* Create install type selection page */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_TYPETITLE); + psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_TYPESUBTITLE); + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = TypeDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_TYPEPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + + /* Create device settings page */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DEVICETITLE); + psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DEVICESUBTITLE); + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = DeviceDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_DEVICEPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + + /* Create install device settings page / boot method / install directory */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DRIVETITLE); + psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DRIVESUBTITLE); + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = DriveDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_DRIVEPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + + /* Create summary page */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_SUMMARYTITLE); + psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUMMARYSUBTITLE); + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = SummaryDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_SUMMARYPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + } + + /* Create installation progress page */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE); + psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE); + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = ProcessDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + + if (!isUnattend) + { + /* Create finish to reboot page */ + psp.dwSize = sizeof(PROPSHEETPAGE); + psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_RESTARTTITLE); + psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_RESTARTSUBTITLE); + psp.hInstance = hInst; + psp.lParam = 0; + psp.pfnDlgProc = RestartDlgProc; + psp.pszTemplate = MAKEINTRESOURCE(IDD_RESTARTPAGE); + ahpsp[nPages++] = CreatePropertySheetPage(&psp); + } + + /* Create the property sheet */ + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER; + psh.hInstance = hInst; + psh.hwndParent = NULL; + psh.nPages = nPages; + psh.nStartPage = 0; + psh.phpage = ahpsp; + psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK); + psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER); + + /* Create title font */ + hTitleFont = CreateTitleFont(); + + /* Display the wizard */ + PropertySheet(&psh); + + DeleteObject(hTitleFont); + + return 0; } /* EOF */ Modified: trunk/reactos/base/setup/reactos/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/reactos/resourc…
============================================================================== --- trunk/reactos/base/setup/reactos/resource.h [iso-8859-1] (original) +++ trunk/reactos/base/setup/reactos/resource.h [iso-8859-1] Sun Nov 23 07:52:57 2008 @@ -1,66 +1,65 @@ - #ifndef RESOURCE_H #define RESOURCE_H -#define IDB_WATERMARK 100 -#define IDB_HEADER 101 -#define IDB_ROSLOGO 102 +#define IDB_WATERMARK 100 +#define IDB_HEADER 101 +#define IDB_ROSLOGO 102 -#define IDC_STATIC -1 +#define IDC_STATIC -1 -#define IDD_STARTPAGE 2000 -#define IDC_STARTTITLE 2001 -#define IDD_LANGSELPAGE 2002 -#define IDS_LANGTITLE 2003 -#define IDS_LANGSUBTITLE 2004 -#define IDC_LANGUAGES 2005 -#define IDD_TYPEPAGE 2006 -#define IDS_TYPETITLE 2007 -#define IDS_TYPESUBTITLE 2008 -#define IDC_INSTALL 2009 -#define IDC_SETUP 2010 -#define IDD_DEVICEPAGE 2011 -#define IDS_DEVICETITLE 2012 -#define IDS_DEVICESUBTITLE 2013 -#define IDC_COMPUTER 2014 -#define IDC_DISPLAY 2015 -#define IDC_KEYBOARD 2016 -#define IDC_KEYLAYOUT 2017 -#define IDD_DRIVEPAGE 2018 -#define IDS_DRIVETITLE 2019 -#define IDS_DRIVESUBTITLE 2020 -#define IDC_PARTITION 2021 -#define IDC_PARTCREATE 2022 -#define IDC_PARTDELETE 2023 -#define IDC_INSTFREELDR 2024 -#define IDC_NOINSTFREELDR 2025 -#define IDC_PATH 2026 -#define IDD_PROCESSPAGE 2027 -#define IDS_PROCESSTITLE 2028 -#define IDS_PROCESSSUBTITLE 2029 -#define IDC_ACTIVITY 2030 -#define IDC_ITEM 2031 -#define IDC_PROCESSPROGRESS 2032 -#define IDD_RESTARTPAGE 2033 -#define IDS_RESTARTTITLE 2034 -#define IDS_RESTARTSUBTITLE 2035 -#define IDC_FINISHTITLE 2036 -#define IDC_RESTART_PROGRESS 2037 -#define IDS_ABORTSETUP 2038 -#define IDS_ABORTSETUP2 2039 -#define IDC_ACTION 2040 -#define IDC_PARTMOREOPTS 2041 -#define IDD_BOOTOPTIONS 2042 -#define IDD_PARTITION 2043 -#define IDC_UPDOWN1 2044 -#define IDC_PARTSIZE 2045 -#define IDC_UNIT 2046 -#define IDC_FSTYPE 2047 -#define IDD_SUMMARYPAGE 2048 -#define IDS_SUMMARYTITLE 2049 -#define IDS_SUMMARYSUBTITLE 2050 -#define IDC_DEVICEDRIVER 2051 +#define IDD_STARTPAGE 2000 +#define IDC_STARTTITLE 2001 +#define IDD_LANGSELPAGE 2002 +#define IDS_LANGTITLE 2003 +#define IDS_LANGSUBTITLE 2004 +#define IDC_LANGUAGES 2005 +#define IDD_TYPEPAGE 2006 +#define IDS_TYPETITLE 2007 +#define IDS_TYPESUBTITLE 2008 +#define IDC_INSTALL 2009 +#define IDC_SETUP 2010 +#define IDD_DEVICEPAGE 2011 +#define IDS_DEVICETITLE 2012 +#define IDS_DEVICESUBTITLE 2013 +#define IDC_COMPUTER 2014 +#define IDC_DISPLAY 2015 +#define IDC_KEYBOARD 2016 +#define IDC_KEYLAYOUT 2017 +#define IDD_DRIVEPAGE 2018 +#define IDS_DRIVETITLE 2019 +#define IDS_DRIVESUBTITLE 2020 +#define IDC_PARTITION 2021 +#define IDC_PARTCREATE 2022 +#define IDC_PARTDELETE 2023 +#define IDC_INSTFREELDR 2024 +#define IDC_NOINSTFREELDR 2025 +#define IDC_PATH 2026 +#define IDD_PROCESSPAGE 2027 +#define IDS_PROCESSTITLE 2028 +#define IDS_PROCESSSUBTITLE 2029 +#define IDC_ACTIVITY 2030 +#define IDC_ITEM 2031 +#define IDC_PROCESSPROGRESS 2032 +#define IDD_RESTARTPAGE 2033 +#define IDS_RESTARTTITLE 2034 +#define IDS_RESTARTSUBTITLE 2035 +#define IDC_FINISHTITLE 2036 +#define IDC_RESTART_PROGRESS 2037 +#define IDS_ABORTSETUP 2038 +#define IDS_ABORTSETUP2 2039 +#define IDC_ACTION 2040 +#define IDC_PARTMOREOPTS 2041 +#define IDD_BOOTOPTIONS 2042 +#define IDD_PARTITION 2043 +#define IDC_UPDOWN1 2044 +#define IDC_PARTSIZE 2045 +#define IDC_UNIT 2046 +#define IDC_FSTYPE 2047 +#define IDD_SUMMARYPAGE 2048 +#define IDS_SUMMARYTITLE 2049 +#define IDS_SUMMARYSUBTITLE 2050 +#define IDC_DEVICEDRIVER 2051 -#define IDI_MAIN 3000 +#define IDI_MAIN 3000 #endif
16 years, 1 month
1
0
0
0
[greatlrd] 37587: Implement WinWatchOpen
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Nov 23 07:50:47 2008 New Revision: 37587 URL:
http://svn.reactos.org/svn/reactos?rev=37587&view=rev
Log: Implement WinWatchOpen Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman…
============================================================================== --- branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] (original) +++ branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] Sun Nov 23 07:50:47 2008 @@ -12,6 +12,14 @@ CRITICAL_SECTION ddcs; +/* Winwatch internal struct */ +typedef struct _WINWATCH_INT +{ + HWND hWnd; +} WINWATCH_INT, *LPWINWATCH_INT; + + +/* DCI internal struct */ typedef struct _DCISURFACE_LCL { BOOL LostSurface; @@ -393,6 +401,22 @@ return retvalue; } +HWINWATCH WINAPI +WinWatchOpen(HWND hwnd) +{ + LPWINWATCH_INT pWinwatch_int; + + EnterCriticalSection(&ddcs); + + if ( (pWinwatch_int = (LPWINWATCH_INT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINWATCH_INT) )) != NULL ) + { + pWinwatch_int->hWnd = hwnd; + } + LeaveCriticalSection(&ddcs); + return (HWINWATCH) pWinwatch_int; +} + + /***********************************************************************************************************/ /***********************************************************************************************************/
16 years, 1 month
1
0
0
0
[ekohl] 37586: - Replace the check-marks in the protocol menu by radio-bullets because the user can only select one of three protocols. - Mark a protocol in the menu only if it was read correctly. Otherwise the security protocol gets selected although the user is not able to see this protocol. - Minor clean-up of the resource id mess.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Nov 23 07:34:15 2008 New Revision: 37586 URL:
http://svn.reactos.org/svn/reactos?rev=37586&view=rev
Log: - Replace the check-marks in the protocol menu by radio-bullets because the user can only select one of three protocols. - Mark a protocol in the menu only if it was read correctly. Otherwise the security protocol gets selected although the user is not able to see this protocol. - Minor clean-up of the resource id mess. Modified: trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c trunk/reactos/base/applications/mscutils/eventvwr/lang/bg-BG.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/de-DE.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/el-GR.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/fr-FR.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/it-IT.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/ko-KR.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/no-NO.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/pl-PL.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/sk-SK.rc trunk/reactos/base/applications/mscutils/eventvwr/lang/uk-UA.rc trunk/reactos/base/applications/mscutils/eventvwr/resource.h Modified: trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -486,7 +486,7 @@ } -VOID +BOOL QueryEventMessages(LPTSTR lpMachineName, LPTSTR lpLogName) { @@ -529,7 +529,7 @@ _TEXT("Could not open the event log."), _TEXT("Event Log"), MB_OK | MB_ICONINFORMATION); - return; + return FALSE; } // Disable listview redraw @@ -686,6 +686,8 @@ // Close the event log. CloseEventLog(hEventLog); + + return TRUE; } @@ -870,13 +872,19 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - int wmId, wmEvent; RECT rect; NMHDR *hdr; - HMENU hMenu; switch (message) { + case WM_CREATE: + CheckMenuRadioItem(GetMenu(hWnd), + ID_LOG_APPLICATION, + ID_LOG_SYSTEM, + ID_LOG_APPLICATION, + MF_BYCOMMAND); + break; + case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { @@ -888,7 +896,10 @@ if (lpnmitem->iItem != -1) { - DialogBox(hInst, MAKEINTRESOURCE(IDD_EVENTDETAILDIALOG), hWnd, EventDetails); + DialogBox(hInst, + MAKEINTRESOURCE(IDD_EVENTDETAILDIALOG), + hWnd, + EventDetails); } } break; @@ -896,41 +907,43 @@ break; case WM_COMMAND: - wmId = LOWORD(wParam); - wmEvent = HIWORD(wParam); - - if ((wmId == ID_LOG_APPLICATION) || - (wmId == ID_LOG_SYSTEM) || - (wmId == ID_LOG_SECURITY)) - { - hMenu = GetMenu(hWnd); // get the menu handle. Use it below - - CheckMenuItem(hMenu, ID_LOG_APPLICATION, MF_UNCHECKED); - CheckMenuItem(hMenu, ID_LOG_SYSTEM, MF_UNCHECKED); - CheckMenuItem (hMenu, ID_LOG_SECURITY, MF_UNCHECKED); - - if (hMenu) - { - CheckMenuItem(hMenu, wmId, MF_CHECKED); - } - } - // Parse the menu selections: - switch (wmId) + switch (LOWORD(wParam)) { case ID_LOG_APPLICATION: - QueryEventMessages(lpComputerName, // Use the local computer. - EVENT_SOURCE_APPLICATION); // The event log category + if (QueryEventMessages(lpComputerName, // Use the local computer. + EVENT_SOURCE_APPLICATION)) // The event log category + { + CheckMenuRadioItem(GetMenu(hWnd), + ID_LOG_APPLICATION, + ID_LOG_SYSTEM, + ID_LOG_APPLICATION, + MF_BYCOMMAND); + } + break; + + case ID_LOG_SECURITY: + if (QueryEventMessages(lpComputerName, // Use the local computer. + EVENT_SOURCE_SECURITY)) // The event log category + { + CheckMenuRadioItem(GetMenu(hWnd), + ID_LOG_APPLICATION, + ID_LOG_SYSTEM, + ID_LOG_SECURITY, + MF_BYCOMMAND); + } break; case ID_LOG_SYSTEM: - QueryEventMessages(lpComputerName, // Use the local computer. - EVENT_SOURCE_SYSTEM); // The event log category - break; - - case ID_LOG_SECURITY: - QueryEventMessages(lpComputerName, // Use the local computer. - EVENT_SOURCE_SECURITY); // The event log category + if (QueryEventMessages(lpComputerName, // Use the local computer. + EVENT_SOURCE_SYSTEM)) // The event log category + { + CheckMenuRadioItem(GetMenu(hWnd), + ID_LOG_APPLICATION, + ID_LOG_SYSTEM, + ID_LOG_SYSTEM, + MF_BYCOMMAND); + } break; case IDM_REFRESH: Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/bg-BG.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/bg-BG.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/bg-BG.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -4,7 +4,7 @@ BEGIN POPUP "&Äíåâíèê" BEGIN - MENUITEM "&Ïðèëîæåíèå", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Ïðèëîæåíèå", ID_LOG_APPLICATION MENUITEM "&Ñèãóðíîñò", ID_LOG_SECURITY MENUITEM "&Óðåäáà", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/de-DE.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/de-DE.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/de-DE.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Protokoll" BEGIN - MENUITEM "&Anwendung", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Anwendung", ID_LOG_APPLICATION MENUITEM "&Sicherheit", ID_LOG_SECURITY MENUITEM "&System", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/el-GR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/el-GR.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/el-GR.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Log" BEGIN - MENUITEM "&ÅöáñìïãÞ", ID_LOG_APPLICATION, CHECKED + MENUITEM "&ÅöáñìïãÞ", ID_LOG_APPLICATION MENUITEM "&ÁóöÜëåéá", ID_LOG_SECURITY MENUITEM "&Óýóôçìá", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Log" BEGIN - MENUITEM "&Application", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Application", ID_LOG_APPLICATION MENUITEM "&Security", ID_LOG_SECURITY MENUITEM "&System", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/es-ES.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Log" BEGIN - MENUITEM "&Aplicación", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Aplicación", ID_LOG_APPLICATION MENUITEM "&Seguridad", ID_LOG_SECURITY MENUITEM "&Sistema", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/fr-FR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/fr-FR.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/fr-FR.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "Journa&l" BEGIN - MENUITEM "&Application", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Application", ID_LOG_APPLICATION MENUITEM "&Sécurité", ID_LOG_SECURITY MENUITEM "&Système", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/it-IT.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/it-IT.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/it-IT.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Log" BEGIN - MENUITEM "&Applicazioni", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Applicazioni", ID_LOG_APPLICATION MENUITEM "&Sicurezza", ID_LOG_SECURITY MENUITEM "&Sistema", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/ko-KR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/ko-KR.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/ko-KR.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -8,7 +8,7 @@ BEGIN POPUP "·Î±×(&L)" BEGIN - MENUITEM "¾ÖÇø®ÄÉÀ̼Ç(&A)", ID_LOG_APPLICATION, CHECKED + MENUITEM "¾ÖÇø®ÄÉÀ̼Ç(&A)", ID_LOG_APPLICATION MENUITEM "º¸¾È(&S)", ID_LOG_SECURITY MENUITEM "½Ã½ºÅÛ(&S)", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/no-NO.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/no-NO.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/no-NO.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Logg" BEGIN - MENUITEM "&Applikasjon", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Applikasjon", ID_LOG_APPLICATION MENUITEM "&Sikkerhet", ID_LOG_SECURITY MENUITEM "&System", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/pl-PL.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/pl-PL.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/pl-PL.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -16,7 +16,7 @@ BEGIN POPUP "&Logi" BEGIN - MENUITEM "&Aplikacja", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Aplikacja", ID_LOG_APPLICATION MENUITEM "&Zabezpieczenia", ID_LOG_SECURITY MENUITEM "&System", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Ëîãè" BEGIN - MENUITEM "&Ïðèëîæåíèé", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Ïðèëîæåíèé", ID_LOG_APPLICATION MENUITEM "&Áåçîïàñíîñòè", ID_LOG_SECURITY MENUITEM "&Ñèñòåìû", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/sk-SK.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/sk-SK.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/sk-SK.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -9,7 +9,7 @@ BEGIN POPUP "&Záznam" BEGIN - MENUITEM "&Application", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Application", ID_LOG_APPLICATION MENUITEM "&Security", ID_LOG_SECURITY MENUITEM "&System", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/uk-UA.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/uk-UA.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/uk-UA.rc [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -12,7 +12,7 @@ BEGIN POPUP "&Çâ³ò" BEGIN - MENUITEM "&Ïðîãðàìà", ID_LOG_APPLICATION, CHECKED + MENUITEM "&Ïðîãðàìà", ID_LOG_APPLICATION MENUITEM "&Çàõèñò", ID_LOG_SECURITY MENUITEM "&Ñèñòåìà", ID_LOG_SYSTEM MENUITEM SEPARATOR Modified: trunk/reactos/base/applications/mscutils/eventvwr/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/resource.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/resource.h [iso-8859-1] Sun Nov 23 07:34:15 2008 @@ -15,13 +15,13 @@ #define IDC_EVENTVWR 109 #define IDC_EVENTSTRINGIDNOTFOUND 209 #define IDC_PROCESSPROGRESS 250 -#define IDC_EVENTLOG_ERROR_TYPE 251 -#define IDC_EVENTLOG_WARNING_TYPE 252 -#define IDC_EVENTLOG_INFORMATION_TYPE 253 -#define IDC_EVENTLOG_AUDIT_SUCCESS 254 -#define IDC_EVENTLOG_AUDIT_FAILURE 255 -#define IDC_EVENTLOG_SUCCESS 256 -#define IDC_EVENTLOG_UNKNOWN_TYPE 257 +#define IDC_EVENTLOG_ERROR_TYPE 251 +#define IDC_EVENTLOG_WARNING_TYPE 252 +#define IDC_EVENTLOG_INFORMATION_TYPE 253 +#define IDC_EVENTLOG_AUDIT_SUCCESS 254 +#define IDC_EVENTLOG_AUDIT_FAILURE 255 +#define IDC_EVENTLOG_SUCCESS 256 +#define IDC_EVENTLOG_UNKNOWN_TYPE 257 #define IDR_MAINFRAME 128 #define IDI_WARNINGICON 129 #define IDI_INFORMATIONICON 130 @@ -41,10 +41,9 @@ #define IDC_BYTESRADIO 1011 #define IDC_WORDRADIO 1013 #define IDC_EVENTDATAEDIT 1014 -#define ID_LOG_APLICATION 32771 +#define ID_LOG_APPLICATION 32771 #define ID_LOG_SECURITY 32772 #define ID_LOG_SYSTEM 32773 -#define ID_LOG_APPLICATION 32774 #define ID_HELP_HELP 32775 #define ID_HELP 32776 #define ID_OPTIONS 32777
16 years, 1 month
1
0
0
0
[greatlrd] 37585: Implement GetWindowRegionData
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Nov 23 06:35:08 2008 New Revision: 37585 URL:
http://svn.reactos.org/svn/reactos?rev=37585&view=rev
Log: Implement GetWindowRegionData Modified: branches/reactx/reactos/dll/win32/dciman32/dciman32.def branches/reactx/reactos/dll/win32/dciman32/dciman_main.c Modified: branches/reactx/reactos/dll/win32/dciman32/dciman32.def URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman…
============================================================================== --- branches/reactx/reactos/dll/win32/dciman32/dciman32.def [iso-8859-1] (original) +++ branches/reactx/reactos/dll/win32/dciman32/dciman32.def [iso-8859-1] Sun Nov 23 06:35:08 2008 @@ -14,7 +14,7 @@ DCISetDestination@12 DCISetSrcDestClip@16 GetDCRegionData@12 -; GetWindowRegionData + GetWindowRegionData@12 ; WinWatchClose ; WinWatchDidStatusChange ; WinWatchGetClipList Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman…
============================================================================== --- branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] (original) +++ branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] Sun Nov 23 06:35:08 2008 @@ -367,6 +367,32 @@ return retvalue; } +/*++ +* @name DWORD WINAPI GetWindowRegionData(HWND hwnd, DWORD size, LPRGNDATA prd); +* @implemented +* + +* @return +* +* @remarks. +* None +*/ +DWORD WINAPI +GetWindowRegionData(HWND hwnd, DWORD size, LPRGNDATA prd) +{ + DWORD retvalue = 0; + + HDC hDC = GetDC(hwnd); + + if (hDC != NULL) + { + retvalue = GetDCRegionData(hDC,size,prd); + ReleaseDC(hwnd,hDC); + } + + return retvalue; +} + /***********************************************************************************************************/ /***********************************************************************************************************/
16 years, 1 month
1
0
0
0
[greatlrd] 37584: Implement GetDCRegionData
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Nov 23 05:34:58 2008 New Revision: 37584 URL:
http://svn.reactos.org/svn/reactos?rev=37584&view=rev
Log: Implement GetDCRegionData Modified: branches/reactx/reactos/dll/win32/dciman32/dciman32.def branches/reactx/reactos/dll/win32/dciman32/dciman_main.c Modified: branches/reactx/reactos/dll/win32/dciman32/dciman32.def URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman…
============================================================================== --- branches/reactx/reactos/dll/win32/dciman32/dciman32.def [iso-8859-1] (original) +++ branches/reactx/reactos/dll/win32/dciman32/dciman32.def [iso-8859-1] Sun Nov 23 05:34:58 2008 @@ -13,7 +13,7 @@ DCISetClipList@8 DCISetDestination@12 DCISetSrcDestClip@16 -; GetDCRegionData + GetDCRegionData@12 ; GetWindowRegionData ; WinWatchClose ; WinWatchDidStatusChange Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman…
============================================================================== --- branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] (original) +++ branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] Sun Nov 23 05:34:58 2008 @@ -105,6 +105,19 @@ DeleteDC(hDC); } +/*++ +* @name int WINAPI DCICreatePrimary(HDC hDC, LPDCISURFACEINFO *pDciSurfaceInfo) +* @implemented +* +* Create a primary directdraw surface. +* +* @return +* if it fail it return DCI_FAIL_* error codes, if it sussess it return DCI_OK. +* +* @remarks. +* none +* +*--*/ int WINAPI DCICreatePrimary(HDC hDC, LPDCISURFACEINFO *pDciSurfaceInfo) { @@ -267,7 +280,21 @@ return retvalue; } -void WINAPI DCIDestroy(LPDCISURFACEINFO pDciSurfaceInfo) +/*++ +* @name void WINAPI DCIDestroy(LPDCISURFACEINFO pDciSurfaceInfo) +* @implemented +* +* It destory the primary surface and all data that have been alloc from DCICreatePrimary + +* @return +* None +* +* @remarks. +* None +* +*--*/ +void WINAPI +DCIDestroy(LPDCISURFACEINFO pDciSurfaceInfo) { DDHAL_DESTROYSURFACEDATA lpcsd; LPDCISURFACE_INT pDciSurface_int = NULL; @@ -310,6 +337,36 @@ } } +/*++ +* @name DWORD WINAPI GetDCRegionData(HDC hdc, DWORD size, LPRGNDATA prd) +* @implemented +* +* it give the region data, simple it fill in the prd + +* @return +* return value 0 meain it fails, +* if the sussess the size value and return value are same, +* if the prd is null the return value contains the number of bytes needed for the region data. +* +* @remarks. +* None +*/ +DWORD WINAPI +GetDCRegionData(HDC hdc, DWORD size, LPRGNDATA prd) +{ + DWORD retvalue = 0; + HRGN hRgn = CreateRectRgn(0,0,0,0); + + if (hRgn != NULL) + { + GetRandomRgn(hdc,hRgn,SYSRGN); + retvalue = GetRegionData(hRgn,size,prd); + DeleteObject(hRgn); + } + + return retvalue; +} + /***********************************************************************************************************/ /***********************************************************************************************************/
16 years, 1 month
1
0
0
0
[dchapyshev] 37583: - Fix formatting. No code change
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sun Nov 23 05:15:52 2008 New Revision: 37583 URL:
http://svn.reactos.org/svn/reactos?rev=37583&view=rev
Log: - Fix formatting. No code change Modified: trunk/reactos/dll/win32/kernel32/misc/nls.c Modified: trunk/reactos/dll/win32/kernel32/misc/nls.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/nl…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/nls.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/nls.c [iso-8859-1] Sun Nov 23 05:15:52 2008 @@ -59,47 +59,54 @@ * Internal NLS related stuff initialization. */ -BOOL FASTCALL +BOOL +FASTCALL NlsInit() { - UNICODE_STRING DirName; - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE Handle; - - InitializeListHead(&CodePageListHead); - RtlInitializeCriticalSection(&CodePageListLock); - - /* - * FIXME: Eventually this should be done only for the NLS Server - * process, but since we don't have anything like that (yet?) we - * always try to create the "\Nls" directory here. - */ - RtlInitUnicodeString(&DirName, L"\\Nls"); - InitializeObjectAttributes(&ObjectAttributes, &DirName, - OBJ_CASE_INSENSITIVE | OBJ_PERMANENT, - NULL, NULL); - if (NT_SUCCESS(NtCreateDirectoryObject(&Handle, DIRECTORY_ALL_ACCESS, &ObjectAttributes))) - { - NtClose(Handle); - } - - /* Setup ANSI code page. */ - AnsiCodePage.CodePage = CP_ACP; - AnsiCodePage.SectionHandle = NULL; - AnsiCodePage.SectionMapping = NtCurrentTeb()->ProcessEnvironmentBlock->AnsiCodePageData; - RtlInitCodePageTable((PUSHORT)AnsiCodePage.SectionMapping, - &AnsiCodePage.CodePageTable); - InsertTailList(&CodePageListHead, &AnsiCodePage.Entry); - - /* Setup OEM code page. */ - OemCodePage.CodePage = CP_OEMCP; - OemCodePage.SectionHandle = NULL; - OemCodePage.SectionMapping = NtCurrentTeb()->ProcessEnvironmentBlock->OemCodePageData; - RtlInitCodePageTable((PUSHORT)OemCodePage.SectionMapping, - &OemCodePage.CodePageTable); - InsertTailList(&CodePageListHead, &OemCodePage.Entry); - - return TRUE; + UNICODE_STRING DirName; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE Handle; + + InitializeListHead(&CodePageListHead); + RtlInitializeCriticalSection(&CodePageListLock); + + /* + * FIXME: Eventually this should be done only for the NLS Server + * process, but since we don't have anything like that (yet?) we + * always try to create the "\Nls" directory here. + */ + RtlInitUnicodeString(&DirName, L"\\Nls"); + + InitializeObjectAttributes(&ObjectAttributes, + &DirName, + OBJ_CASE_INSENSITIVE | OBJ_PERMANENT, + NULL, + NULL); + + if (NT_SUCCESS(NtCreateDirectoryObject(&Handle, DIRECTORY_ALL_ACCESS, &ObjectAttributes))) + { + NtClose(Handle); + } + + /* Setup ANSI code page. */ + AnsiCodePage.CodePage = CP_ACP; + AnsiCodePage.SectionHandle = NULL; + AnsiCodePage.SectionMapping = NtCurrentTeb()->ProcessEnvironmentBlock->AnsiCodePageData; + + RtlInitCodePageTable((PUSHORT)AnsiCodePage.SectionMapping, + &AnsiCodePage.CodePageTable); + InsertTailList(&CodePageListHead, &AnsiCodePage.Entry); + + /* Setup OEM code page. */ + OemCodePage.CodePage = CP_OEMCP; + OemCodePage.SectionHandle = NULL; + OemCodePage.SectionMapping = NtCurrentTeb()->ProcessEnvironmentBlock->OemCodePageData; + + RtlInitCodePageTable((PUSHORT)OemCodePage.SectionMapping, + &OemCodePage.CodePageTable); + InsertTailList(&CodePageListHead, &OemCodePage.Entry); + + return TRUE; } /** @@ -108,23 +115,24 @@ * Internal NLS related stuff uninitialization. */ -VOID FASTCALL +VOID +FASTCALL NlsUninit() { - PCODEPAGE_ENTRY Current; - - /* Delete the code page list. */ - while (!IsListEmpty(&CodePageListHead)) - { - Current = CONTAINING_RECORD(CodePageListHead.Flink, CODEPAGE_ENTRY, Entry); - if (Current->SectionHandle != NULL) - { - UnmapViewOfFile(Current->SectionMapping); - NtClose(Current->SectionHandle); - } - RemoveHeadList(&CodePageListHead); - } - RtlDeleteCriticalSection(&CodePageListLock); + PCODEPAGE_ENTRY Current; + + /* Delete the code page list. */ + while (!IsListEmpty(&CodePageListHead)) + { + Current = CONTAINING_RECORD(CodePageListHead.Flink, CODEPAGE_ENTRY, Entry); + if (Current->SectionHandle != NULL) + { + UnmapViewOfFile(Current->SectionMapping); + NtClose(Current->SectionHandle); + } + RemoveHeadList(&CodePageListHead); + } + RtlDeleteCriticalSection(&CodePageListLock); } /** @@ -141,27 +149,28 @@ * been loaded yet. */ -PCODEPAGE_ENTRY FASTCALL +PCODEPAGE_ENTRY +FASTCALL IntGetLoadedCodePageEntry(UINT CodePage) { - LIST_ENTRY *CurrentEntry; - PCODEPAGE_ENTRY Current; - - RtlEnterCriticalSection(&CodePageListLock); - for (CurrentEntry = CodePageListHead.Flink; - CurrentEntry != &CodePageListHead; - CurrentEntry = CurrentEntry->Flink) - { - Current = CONTAINING_RECORD(CurrentEntry, CODEPAGE_ENTRY, Entry); - if (Current->CodePage == CodePage) - { - RtlLeaveCriticalSection(&CodePageListLock); - return Current; - } - } - RtlLeaveCriticalSection(&CodePageListLock); - - return NULL; + LIST_ENTRY *CurrentEntry; + PCODEPAGE_ENTRY Current; + + RtlEnterCriticalSection(&CodePageListLock); + for (CurrentEntry = CodePageListHead.Flink; + CurrentEntry != &CodePageListHead; + CurrentEntry = CurrentEntry->Flink) + { + Current = CONTAINING_RECORD(CurrentEntry, CODEPAGE_ENTRY, Entry); + if (Current->CodePage == CodePage) + { + RtlLeaveCriticalSection(&CodePageListLock); + return Current; + } + } + RtlLeaveCriticalSection(&CodePageListLock); + + return NULL; } /** @@ -176,122 +185,142 @@ * @return Code page entry. */ -PCODEPAGE_ENTRY FASTCALL +PCODEPAGE_ENTRY +FASTCALL IntGetCodePageEntry(UINT CodePage) { - CHAR SectionName[40]; - NTSTATUS Status; - HANDLE SectionHandle = INVALID_HANDLE_VALUE, FileHandle; - PBYTE SectionMapping; - OBJECT_ATTRIBUTES ObjectAttributes; - ANSI_STRING AnsiName; - UNICODE_STRING UnicodeName; - WCHAR FileName[MAX_PATH + 1]; - UINT FileNamePos; - PCODEPAGE_ENTRY CodePageEntry; - - if (CodePage == CP_THREAD_ACP) - { - if (!GetLocaleInfoW(GetThreadLocale(), LOCALE_IDEFAULTANSICODEPAGE | - LOCALE_RETURN_NUMBER, (WCHAR *)&CodePage, - sizeof(CodePage) / sizeof(WCHAR))) - { - /* Last error is set by GetLocaleInfoW. */ - return 0; - } - } - else if (CodePage == CP_MACCP) - { - if (!GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTMACCODEPAGE | - LOCALE_RETURN_NUMBER, (WCHAR *)&CodePage, - sizeof(CodePage) / sizeof(WCHAR))) - { - /* Last error is set by GetLocaleInfoW. */ - return 0; - } - } - - /* Try searching for loaded page first. */ - CodePageEntry = IntGetLoadedCodePageEntry(CodePage); - if (CodePageEntry != NULL) - { - return CodePageEntry; - } - - /* - * Yes, we really want to lock here. Otherwise it can happen that - * two parallel requests will try to get the entry for the same - * code page and we would load it twice. - */ - RtlEnterCriticalSection(&CodePageListLock); - - /* Generate the section name. */ - if (!GetNlsSectionName(CodePage, 10, 0, "\\Nls\\NlsSectionCP", - SectionName, sizeof(SectionName))) - { - RtlLeaveCriticalSection(&CodePageListLock); - return NULL; - } - RtlInitAnsiString(&AnsiName, SectionName); - RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); - InitializeObjectAttributes(&ObjectAttributes, &UnicodeName, 0, - NULL, NULL); - - /* Try to open the section first */ - Status = NtOpenSection(&SectionHandle, SECTION_MAP_READ, &ObjectAttributes); - - /* If the section doesn't exist, try to create it. */ - if (Status == STATUS_UNSUCCESSFUL || - Status == STATUS_OBJECT_NAME_NOT_FOUND || - Status == STATUS_OBJECT_PATH_NOT_FOUND) - { - FileNamePos = GetSystemDirectoryW(FileName, MAX_PATH); - if (GetCPFileNameFromRegistry(CodePage, FileName + FileNamePos + 1, - MAX_PATH - FileNamePos - 1)) - { - FileName[FileNamePos] = L'\\'; - FileName[MAX_PATH] = 0; - FileHandle = CreateFileW(FileName, FILE_GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, 0, NULL); - Status = NtCreateSection(&SectionHandle, SECTION_MAP_READ, - &ObjectAttributes, NULL, PAGE_READONLY, - SEC_FILE, FileHandle); - } - } - RtlFreeUnicodeString(&UnicodeName); - - if (!NT_SUCCESS(Status)) - { - RtlLeaveCriticalSection(&CodePageListLock); - return NULL; - } - - SectionMapping = MapViewOfFile(SectionHandle, FILE_MAP_READ, 0, 0, 0); - if (SectionMapping == NULL) - { - NtClose(SectionHandle); - RtlLeaveCriticalSection(&CodePageListLock); - return NULL; - } - - CodePageEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(CODEPAGE_ENTRY)); - if (CodePageEntry == NULL) - { - NtClose(SectionHandle); - RtlLeaveCriticalSection(&CodePageListLock); - return NULL; - } - - CodePageEntry->CodePage = CodePage; - CodePageEntry->SectionHandle = SectionHandle; - CodePageEntry->SectionMapping = SectionMapping; - RtlInitCodePageTable((PUSHORT)SectionMapping, &CodePageEntry->CodePageTable); - - /* Insert the new entry to list and unlock. Uff. */ - InsertTailList(&CodePageListHead, &CodePageEntry->Entry); - RtlLeaveCriticalSection(&CodePageListLock); - - return CodePageEntry; + CHAR SectionName[40]; + NTSTATUS Status; + HANDLE SectionHandle = INVALID_HANDLE_VALUE, FileHandle; + PBYTE SectionMapping; + OBJECT_ATTRIBUTES ObjectAttributes; + ANSI_STRING AnsiName; + UNICODE_STRING UnicodeName; + WCHAR FileName[MAX_PATH + 1]; + UINT FileNamePos; + PCODEPAGE_ENTRY CodePageEntry; + + if (CodePage == CP_THREAD_ACP) + { + if (!GetLocaleInfoW(GetThreadLocale(), + LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, + (WCHAR *)&CodePage, + sizeof(CodePage) / sizeof(WCHAR))) + { + /* Last error is set by GetLocaleInfoW. */ + return 0; + } + } + else if (CodePage == CP_MACCP) + { + if (!GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, + LOCALE_IDEFAULTMACCODEPAGE | LOCALE_RETURN_NUMBER, + (WCHAR *)&CodePage, + sizeof(CodePage) / sizeof(WCHAR))) + { + /* Last error is set by GetLocaleInfoW. */ + return 0; + } + } + + /* Try searching for loaded page first. */ + CodePageEntry = IntGetLoadedCodePageEntry(CodePage); + if (CodePageEntry != NULL) + { + return CodePageEntry; + } + + /* + * Yes, we really want to lock here. Otherwise it can happen that + * two parallel requests will try to get the entry for the same + * code page and we would load it twice. + */ + RtlEnterCriticalSection(&CodePageListLock); + + /* Generate the section name. */ + if (!GetNlsSectionName(CodePage, + 10, + 0, + "\\Nls\\NlsSectionCP", + SectionName, + sizeof(SectionName))) + { + RtlLeaveCriticalSection(&CodePageListLock); + return NULL; + } + + RtlInitAnsiString(&AnsiName, SectionName); + RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); + + InitializeObjectAttributes(&ObjectAttributes, &UnicodeName, 0, NULL, NULL); + + /* Try to open the section first */ + Status = NtOpenSection(&SectionHandle, SECTION_MAP_READ, &ObjectAttributes); + + /* If the section doesn't exist, try to create it. */ + if (Status == STATUS_UNSUCCESSFUL || + Status == STATUS_OBJECT_NAME_NOT_FOUND || + Status == STATUS_OBJECT_PATH_NOT_FOUND) + { + FileNamePos = GetSystemDirectoryW(FileName, MAX_PATH); + if (GetCPFileNameFromRegistry(CodePage, + FileName + FileNamePos + 1, + MAX_PATH - FileNamePos - 1)) + { + FileName[FileNamePos] = L'\\'; + FileName[MAX_PATH] = 0; + FileHandle = CreateFileW(FileName, + FILE_GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + 0, + NULL); + + Status = NtCreateSection(&SectionHandle, + SECTION_MAP_READ, + &ObjectAttributes, + NULL, + PAGE_READONLY, + SEC_FILE, + FileHandle); + } + } + RtlFreeUnicodeString(&UnicodeName); + + if (!NT_SUCCESS(Status)) + { + RtlLeaveCriticalSection(&CodePageListLock); + return NULL; + } + + SectionMapping = MapViewOfFile(SectionHandle, FILE_MAP_READ, 0, 0, 0); + if (SectionMapping == NULL) + { + NtClose(SectionHandle); + RtlLeaveCriticalSection(&CodePageListLock); + return NULL; + } + + CodePageEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(CODEPAGE_ENTRY)); + if (CodePageEntry == NULL) + { + NtClose(SectionHandle); + RtlLeaveCriticalSection(&CodePageListLock); + return NULL; + } + + CodePageEntry->CodePage = CodePage; + CodePageEntry->SectionHandle = SectionHandle; + CodePageEntry->SectionMapping = SectionMapping; + + RtlInitCodePageTable((PUSHORT)SectionMapping, &CodePageEntry->CodePageTable); + + /* Insert the new entry to list and unlock. Uff. */ + InsertTailList(&CodePageListHead, &CodePageEntry->Entry); + RtlLeaveCriticalSection(&CodePageListLock); + + return CodePageEntry; } /** @@ -303,59 +332,63 @@ * @todo Add UTF8 validity checks. */ -static INT STDCALL +static +INT +STDCALL IntMultiByteToWideCharUTF8(DWORD Flags, - LPCSTR MultiByteString, INT MultiByteCount, - LPWSTR WideCharString, INT WideCharCount) -{ - LPCSTR MbsEnd; - UCHAR Char, Length; - WCHAR WideChar; - LONG Count; - - if (Flags != 0) - { - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - - /* Does caller query for output buffer size? */ - if (WideCharCount == 0) - { - MbsEnd = MultiByteString + MultiByteCount; - for (; MultiByteString < MbsEnd; WideCharCount++) - { - Char = *MultiByteString++; - if (Char < 0xC0) + LPCSTR MultiByteString, + INT MultiByteCount, + LPWSTR WideCharString, + INT WideCharCount) +{ + LPCSTR MbsEnd; + UCHAR Char, Length; + WCHAR WideChar; + LONG Count; + + if (Flags != 0) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + + /* Does caller query for output buffer size? */ + if (WideCharCount == 0) + { + MbsEnd = MultiByteString + MultiByteCount; + for (; MultiByteString < MbsEnd; WideCharCount++) + { + Char = *MultiByteString++; + if (Char < 0xC0) + continue; + MultiByteString += UTF8Length[Char - 0x80]; + } + return WideCharCount; + } + + MbsEnd = MultiByteString + MultiByteCount; + for (Count = 0; Count < WideCharCount && MultiByteString < MbsEnd; Count++) + { + Char = *MultiByteString++; + if (Char < 0x80) + { + *WideCharString++ = Char; continue; - MultiByteString += UTF8Length[Char - 0x80]; - } - return WideCharCount; - } - - MbsEnd = MultiByteString + MultiByteCount; - for (Count = 0; Count < WideCharCount && MultiByteString < MbsEnd; Count++) - { - Char = *MultiByteString++; - if (Char < 0x80) - { - *WideCharString++ = Char; - continue; - } - Length = UTF8Length[Char - 0x80]; - WideChar = Char & UTF8Mask[Length]; - while (Length && MultiByteString < MbsEnd) - { - WideChar = (WideChar << 6) | *MultiByteString++; - Length--; - } - *WideCharString++ = WideChar; - } - - if (MultiByteString < MbsEnd) - SetLastError(ERROR_INSUFFICIENT_BUFFER); - - return Count; + } + Length = UTF8Length[Char - 0x80]; + WideChar = Char & UTF8Mask[Length]; + while (Length && MultiByteString < MbsEnd) + { + WideChar = (WideChar << 6) | *MultiByteString++; + Length--; + } + *WideCharString++ = WideChar; + } + + if (MultiByteString < MbsEnd) + SetLastError(ERROR_INSUFFICIENT_BUFFER); + + return Count; } /** @@ -368,314 +401,329 @@ * DBCS codepages. */ -static INT STDCALL -IntMultiByteToWideCharCP(UINT CodePage, DWORD Flags, - LPCSTR MultiByteString, INT MultiByteCount, - LPWSTR WideCharString, INT WideCharCount) -{ - PCODEPAGE_ENTRY CodePageEntry; - PCPTABLEINFO CodePageTable; - LPCSTR TempString; - INT TempLength; - - /* Get code page table. */ - CodePageEntry = IntGetCodePageEntry(CodePage); - if (CodePageEntry == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - CodePageTable = &CodePageEntry->CodePageTable; - - /* Different handling for DBCS code pages. */ - if (CodePageTable->MaximumCharacterSize > 1) - { - /* FIXME */ - - UCHAR Char; - USHORT DBCSOffset; - LPCSTR MbsEnd = MultiByteString + MultiByteCount; - ULONG Count; - - /* Does caller query for output buffer size? */ - if (WideCharCount == 0) - { - for (; MultiByteString < MbsEnd; WideCharCount++) - { +static +INT +STDCALL +IntMultiByteToWideCharCP(UINT CodePage, + DWORD Flags, + LPCSTR MultiByteString, + INT MultiByteCount, + LPWSTR WideCharString, + INT WideCharCount) +{ + PCODEPAGE_ENTRY CodePageEntry; + PCPTABLEINFO CodePageTable; + LPCSTR TempString; + INT TempLength; + + /* Get code page table. */ + CodePageEntry = IntGetCodePageEntry(CodePage); + if (CodePageEntry == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + CodePageTable = &CodePageEntry->CodePageTable; + + /* Different handling for DBCS code pages. */ + if (CodePageTable->MaximumCharacterSize > 1) + { + /* FIXME */ + + UCHAR Char; + USHORT DBCSOffset; + LPCSTR MbsEnd = MultiByteString + MultiByteCount; + ULONG Count; + + /* Does caller query for output buffer size? */ + if (WideCharCount == 0) + { + for (; MultiByteString < MbsEnd; WideCharCount++) + { + Char = *MultiByteString++; + + if (Char < 0x80) + continue; + + DBCSOffset = CodePageTable->DBCSOffsets[Char]; + + if (!DBCSOffset) + continue; + + if (MultiByteString < MbsEnd) + MultiByteString++; + } + + return WideCharCount; + } + + for (Count = 0; Count < WideCharCount && MultiByteString < MbsEnd; Count++) + { Char = *MultiByteString++; if (Char < 0x80) - continue; + { + *WideCharString++ = Char; + continue; + } DBCSOffset = CodePageTable->DBCSOffsets[Char]; if (!DBCSOffset) - continue; + { + *WideCharString++ = CodePageTable->MultiByteTable[Char]; + continue; + } if (MultiByteString < MbsEnd) - MultiByteString++; - } - - return WideCharCount; - } - - for (Count = 0; Count < WideCharCount && MultiByteString < MbsEnd; Count++) - { - Char = *MultiByteString++; - - if (Char < 0x80) - { - *WideCharString++ = Char; + *WideCharString++ = CodePageTable->DBCSOffsets[DBCSOffset + *(PUCHAR)MultiByteString++]; + } + + if (MultiByteString < MbsEnd) + SetLastError(ERROR_INSUFFICIENT_BUFFER); + + return Count; + } + else /* Not DBCS code page */ + { + /* Check for invalid characters. */ + if (Flags & MB_ERR_INVALID_CHARS) + { + for (TempString = MultiByteString, TempLength = MultiByteCount; + TempLength > 0; + TempString++, TempLength--) + { + if (CodePageTable->MultiByteTable[(UCHAR)*TempString] == + CodePageTable->UniDefaultChar && + *TempString != CodePageEntry->CodePageTable.DefaultChar) + { + SetLastError(ERROR_NO_UNICODE_TRANSLATION); + return 0; + } + } + } + + /* Does caller query for output buffer size? */ + if (WideCharCount == 0) + return MultiByteCount; + + /* Adjust buffer size. Wine trick ;-) */ + if (WideCharCount < MultiByteCount) + { + MultiByteCount = WideCharCount; + SetLastError(ERROR_INSUFFICIENT_BUFFER); + } + + for (TempLength = MultiByteCount; + TempLength > 0; + MultiByteString++, TempLength--) + { + *WideCharString++ = CodePageTable->MultiByteTable[(UCHAR)*MultiByteString]; + } + + return MultiByteCount; + } +} + +/** + * @name IntMultiByteToWideCharSYMBOL + * + * Internal version of MultiByteToWideChar for SYMBOL. + * + * @see MultiByteToWideChar + */ + +static +INT +STDCALL +IntMultiByteToWideCharSYMBOL(DWORD Flags, + LPCSTR MultiByteString, + INT MultiByteCount, + LPWSTR WideCharString, + INT WideCharCount) +{ + LONG Count; + UCHAR Char; + INT WideCharMaxLen; + + + if (Flags != 0) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + + if (WideCharCount == 0) + { + return MultiByteCount; + } + + WideCharMaxLen = WideCharCount > MultiByteCount ? MultiByteCount : WideCharCount; + + for (Count = 0; Count < WideCharMaxLen; Count++) + { + Char = MultiByteString[Count]; + if ( Char < 0x20 ) + { + WideCharString[Count] = Char; + } + else + { + WideCharString[Count] = Char + 0xf000; + } + } + if (MultiByteCount > WideCharMaxLen) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + return WideCharMaxLen; +} + +/** + * @name IntWideCharToMultiByteSYMBOL + * + * Internal version of WideCharToMultiByte for SYMBOL. + * + * @see WideCharToMultiByte + */ + +static INT +STDCALL +IntWideCharToMultiByteSYMBOL(DWORD Flags, + LPCWSTR WideCharString, + INT WideCharCount, + LPSTR MultiByteString, + INT MultiByteCount) +{ + LONG Count; + INT MaxLen; + WCHAR Char; + + if (Flags!=0) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + + if (MultiByteCount == 0) + { + return WideCharCount; + } + + MaxLen = MultiByteCount > WideCharCount ? WideCharCount : MultiByteCount; + for (Count = 0; Count < MaxLen; Count++) + { + Char = WideCharString[Count]; + if (Char < 0x20) + { + MultiByteString[Count] = Char; + } + else + { + if ((Char>=0xf020)&&(Char<0xf100)) + { + MultiByteString[Count] = Char - 0xf000; + } + else + { + SetLastError(ERROR_NO_UNICODE_TRANSLATION); + return 0; + } + } + } + if (WideCharCount > MaxLen) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + return MaxLen; +} + +/** + * @name IntWideCharToMultiByteUTF8 + * + * Internal version of WideCharToMultiByte for UTF8. + * + * @see WideCharToMultiByte + */ + +static INT +STDCALL +IntWideCharToMultiByteUTF8(UINT CodePage, + DWORD Flags, + LPCWSTR WideCharString, + INT WideCharCount, + LPSTR MultiByteString, + INT MultiByteCount, + LPCSTR DefaultChar, + LPBOOL UsedDefaultChar) +{ + INT TempLength; + WCHAR Char; + + /* Does caller query for output buffer size? */ + if (MultiByteCount == 0) + { + for (TempLength = 0; WideCharCount; + WideCharCount--, WideCharString++) + { + TempLength++; + if (*WideCharString >= 0x80) + { + TempLength++; + if (*WideCharString >= 0x800) + TempLength++; + } + } + return TempLength; + } + + for (TempLength = MultiByteCount; WideCharCount; WideCharCount--, WideCharString++) + { + Char = *WideCharString; + if (Char < 0x80) + { + if (!TempLength) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + break; + } + TempLength--; + *MultiByteString++ = (CHAR)Char; continue; - } - - DBCSOffset = CodePageTable->DBCSOffsets[Char]; - - if (!DBCSOffset) - { - *WideCharString++ = CodePageTable->MultiByteTable[Char]; + } + + if (Char < 0x800) /* 0x80-0x7ff: 2 bytes */ + { + if (TempLength < 2) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + break; + } + MultiByteString[1] = 0x80 | (Char & 0x3f); Char >>= 6; + MultiByteString[0] = 0xc0 | Char; + MultiByteString += 2; + TempLength -= 2; continue; - } - - if (MultiByteString < MbsEnd) - *WideCharString++ = - CodePageTable->DBCSOffsets[DBCSOffset + *(PUCHAR)MultiByteString++]; - } - - if (MultiByteString < MbsEnd) - SetLastError(ERROR_INSUFFICIENT_BUFFER); - - return Count; - } - else /* Not DBCS code page */ - { - /* Check for invalid characters. */ - if (Flags & MB_ERR_INVALID_CHARS) - { - for (TempString = MultiByteString, TempLength = MultiByteCount; - TempLength > 0; - TempString++, TempLength--) - { - if (CodePageTable->MultiByteTable[(UCHAR)*TempString] == - CodePageTable->UniDefaultChar && - *TempString != CodePageEntry->CodePageTable.DefaultChar) - { - SetLastError(ERROR_NO_UNICODE_TRANSLATION); - return 0; - } - } - } - - /* Does caller query for output buffer size? */ - if (WideCharCount == 0) - return MultiByteCount; - - /* Adjust buffer size. Wine trick ;-) */ - if (WideCharCount < MultiByteCount) - { - MultiByteCount = WideCharCount; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - - for (TempLength = MultiByteCount; - TempLength > 0; - MultiByteString++, TempLength--) - { - *WideCharString++ = CodePageTable->MultiByteTable[(UCHAR)*MultiByteString]; - } - - return MultiByteCount; - } -} - -/** - * @name IntMultiByteToWideCharSYMBOL - * - * Internal version of MultiByteToWideChar for SYMBOL. - * - * @see MultiByteToWideChar - */ - -static INT STDCALL -IntMultiByteToWideCharSYMBOL(DWORD Flags, - LPCSTR MultiByteString, INT MultiByteCount, - LPWSTR WideCharString, INT WideCharCount) -{ - LONG Count; - UCHAR Char; - INT WideCharMaxLen; - - - if (Flags != 0) - { - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - - if (WideCharCount == 0) - { - return MultiByteCount; - } - - WideCharMaxLen = WideCharCount > MultiByteCount ? MultiByteCount : WideCharCount; - - for (Count = 0; Count < WideCharMaxLen; Count++) - { - Char = MultiByteString[Count]; - if ( Char < 0x20 ) - { - WideCharString[Count] = Char; - } - else - { - WideCharString[Count] = Char + 0xf000; - } - } - if (MultiByteCount > WideCharMaxLen) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return 0; - } - - return WideCharMaxLen; -} - -/** - * @name IntWideCharToMultiByteSYMBOL - * - * Internal version of WideCharToMultiByte for SYMBOL. - * - * @see WideCharToMultiByte - */ - -static INT STDCALL -IntWideCharToMultiByteSYMBOL(DWORD Flags, - LPCWSTR WideCharString, INT WideCharCount, - LPSTR MultiByteString, INT MultiByteCount) -{ - LONG Count; - INT MaxLen; - WCHAR Char; - - if (Flags!=0) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - - if( MultiByteCount == 0) - { - return WideCharCount; - } - - MaxLen = MultiByteCount>WideCharCount?WideCharCount:MultiByteCount; - for (Count = 0;Count<MaxLen;Count++) - { - Char = WideCharString[Count]; - if (Char<0x20) - { - MultiByteString[Count] = Char; - } - else - { - if ((Char>=0xf020)&&(Char<0xf100)) - { - MultiByteString[Count] = Char - 0xf000; - } - else - { - SetLastError(ERROR_NO_UNICODE_TRANSLATION); - return 0; - } - } - } - if ( WideCharCount > MaxLen) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return 0; - } - return MaxLen; -} - -/** - * @name IntWideCharToMultiByteUTF8 - * - * Internal version of WideCharToMultiByte for UTF8. - * - * @see WideCharToMultiByte - */ - -static INT STDCALL -IntWideCharToMultiByteUTF8(UINT CodePage, DWORD Flags, - LPCWSTR WideCharString, INT WideCharCount, - LPSTR MultiByteString, INT MultiByteCount, - LPCSTR DefaultChar, LPBOOL UsedDefaultChar) -{ - INT TempLength; - WCHAR Char; - - /* Does caller query for output buffer size? */ - if (MultiByteCount == 0) - { - for (TempLength = 0; WideCharCount; - WideCharCount--, WideCharString++) - { - TempLength++; - if (*WideCharString >= 0x80) - { - TempLength++; - if (*WideCharString >= 0x800) - TempLength++; - } - } - return TempLength; - } - - for (TempLength = MultiByteCount; WideCharCount; - WideCharCount--, WideCharString++) - { - Char = *WideCharString; - if (Char < 0x80) - { - if (!TempLength) - { + } + + /* 0x800-0xffff: 3 bytes */ + if (TempLength < 3) + { SetLastError(ERROR_INSUFFICIENT_BUFFER); break; - } - TempLength--; - *MultiByteString++ = (CHAR)Char; - continue; - } - - if (Char < 0x800) /* 0x80-0x7ff: 2 bytes */ - { - if (TempLength < 2) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - break; - } - MultiByteString[1] = 0x80 | (Char & 0x3f); Char >>= 6; - MultiByteString[0] = 0xc0 | Char; - MultiByteString += 2; - TempLength -= 2; - continue; - } - - /* 0x800-0xffff: 3 bytes */ - if (TempLength < 3) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - break; - } - MultiByteString[2] = 0x80 | (Char & 0x3f); Char >>= 6; - MultiByteString[1] = 0x80 | (Char & 0x3f); Char >>= 6; - MultiByteString[0] = 0xe0 | Char; - MultiByteString += 3; - TempLength -= 3; - } - - return MultiByteCount - TempLength; + } + MultiByteString[2] = 0x80 | (Char & 0x3f); Char >>= 6; + MultiByteString[1] = 0x80 | (Char & 0x3f); Char >>= 6; + MultiByteString[0] = 0xe0 | Char; + MultiByteString += 3; + TempLength -= 3; + } + + return MultiByteCount - TempLength; } /** @@ -685,19 +733,22 @@ * * @see IntWideCharToMultiByteCP */ -static inline BOOL +static +inline +BOOL IntIsValidSBCSMapping(PCPTABLEINFO CodePageTable, DWORD Flags, WCHAR wch, UCHAR ch) { - /* If the WC_NO_BEST_FIT_CHARS flag has been specified, the characters need to match exactly. */ - if(Flags & WC_NO_BEST_FIT_CHARS) - return (CodePageTable->MultiByteTable[ch] != wch); - - /* By default, all characters except TransDefaultChar apply as a valid mapping for ch (so also "nearest" characters) */ - if(ch != CodePageTable->TransDefaultChar) - return TRUE; - - /* The only possible left valid mapping is the default character itself */ - return (wch == CodePageTable->TransUniDefaultChar); + /* If the WC_NO_BEST_FIT_CHARS flag has been specified, the characters need to match exactly. */ + if (Flags & WC_NO_BEST_FIT_CHARS) + return (CodePageTable->MultiByteTable[ch] != wch); + + /* By default, all characters except TransDefaultChar apply as a valid mapping + for ch (so also "nearest" characters) */ + if (ch != CodePageTable->TransDefaultChar) + return TRUE; + + /* The only possible left valid mapping is the default character itself */ + return (wch == CodePageTable->TransUniDefaultChar); } /** @@ -710,24 +761,24 @@ static inline BOOL IntIsValidDBCSMapping(PCPTABLEINFO CodePageTable, DWORD Flags, WCHAR wch, USHORT ch) { - /* If ch is the default character, but the wch is not, it can't be a valid mapping */ - if(ch == CodePageTable->TransDefaultChar && wch != CodePageTable->TransUniDefaultChar) - return FALSE; - - /* If the WC_NO_BEST_FIT_CHARS flag has been specified, the characters need to match exactly. */ - if(Flags & WC_NO_BEST_FIT_CHARS) - { - if(ch & 0xff00) - { - UCHAR uOffset = CodePageTable->DBCSOffsets[ch >> 8]; - return (CodePageTable->MultiByteTable[(uOffset << 8) + (ch & 0xff)] == wch); - } - - return (CodePageTable->MultiByteTable[ch] == wch); - } - - /* If we're still here, we have a valid mapping */ - return TRUE; + /* If ch is the default character, but the wch is not, it can't be a valid mapping */ + if (ch == CodePageTable->TransDefaultChar && wch != CodePageTable->TransUniDefaultChar) + return FALSE; + + /* If the WC_NO_BEST_FIT_CHARS flag has been specified, the characters need to match exactly. */ + if (Flags & WC_NO_BEST_FIT_CHARS) + { + if(ch & 0xff00) + { + UCHAR uOffset = CodePageTable->DBCSOffsets[ch >> 8]; + return (CodePageTable->MultiByteTable[(uOffset << 8) + (ch & 0xff)] == wch); + } + + return (CodePageTable->MultiByteTable[ch] == wch); + } + + /* If we're still here, we have a valid mapping */ + return TRUE; } /** @@ -738,253 +789,270 @@ * @see WideCharToMultiByte * @todo Handle WC_COMPOSITECHECK */ -static INT STDCALL -IntWideCharToMultiByteCP(UINT CodePage, DWORD Flags, - LPCWSTR WideCharString, INT WideCharCount, - LPSTR MultiByteString, INT MultiByteCount, - LPCSTR DefaultChar, LPBOOL UsedDefaultChar) -{ - PCODEPAGE_ENTRY CodePageEntry; - PCPTABLEINFO CodePageTable; - INT TempLength; - - /* Get code page table. */ - CodePageEntry = IntGetCodePageEntry(CodePage); - if (CodePageEntry == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - CodePageTable = &CodePageEntry->CodePageTable; - - - /* Different handling for DBCS code pages. */ - if (CodePageTable->MaximumCharacterSize > 1) - { - /* If Flags, DefaultChar or UsedDefaultChar were given, we have to do some more work */ - if(Flags || DefaultChar || UsedDefaultChar) - { - BOOL TempUsedDefaultChar; - USHORT DefChar; - - /* If UsedDefaultChar is not set, set it to a temporary value, so we don't have to check on every character */ - if(!UsedDefaultChar) - UsedDefaultChar = &TempUsedDefaultChar; - - *UsedDefaultChar = FALSE; - - /* Use the CodePage's TransDefaultChar if none was given. Don't modify the DefaultChar pointer here. */ - if(DefaultChar) - DefChar = DefaultChar[1] ? ((DefaultChar[0] << 8) | DefaultChar[1]) : DefaultChar[0]; - else - DefChar = CodePageTable->TransDefaultChar; - - /* Does caller query for output buffer size? */ - if(!MultiByteCount) - { - for(TempLength = 0; WideCharCount; WideCharCount--, WideCharString++, TempLength++) - { - USHORT uChar; - - if((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) - { - /* FIXME: Handle WC_COMPOSITECHECK */ - } - - uChar = ((PUSHORT)CodePageTable->WideCharTable)[*WideCharString]; - - /* Verify if the mapping is valid for handling DefaultChar and UsedDefaultChar */ - if(!IntIsValidDBCSMapping(CodePageTable, Flags, *WideCharString, uChar)) - { - uChar = DefChar; - *UsedDefaultChar = TRUE; - } - - /* Increment TempLength again if this is a double-byte character */ - if(uChar & 0xff00) - TempLength++; +static +INT +STDCALL +IntWideCharToMultiByteCP(UINT CodePage, + DWORD Flags, + LPCWSTR WideCharString, + INT WideCharCount, + LPSTR MultiByteString, + INT MultiByteCount, + LPCSTR DefaultChar, + LPBOOL UsedDefaultChar) +{ + PCODEPAGE_ENTRY CodePageEntry; + PCPTABLEINFO CodePageTable; + INT TempLength; + + /* Get code page table. */ + CodePageEntry = IntGetCodePageEntry(CodePage); + if (CodePageEntry == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + CodePageTable = &CodePageEntry->CodePageTable; + + + /* Different handling for DBCS code pages. */ + if (CodePageTable->MaximumCharacterSize > 1) + { + /* If Flags, DefaultChar or UsedDefaultChar were given, we have to do some more work */ + if(Flags || DefaultChar || UsedDefaultChar) + { + BOOL TempUsedDefaultChar; + USHORT DefChar; + + /* If UsedDefaultChar is not set, set it to a temporary value, so we don't have + to check on every character */ + if(!UsedDefaultChar) + UsedDefaultChar = &TempUsedDefaultChar; + + *UsedDefaultChar = FALSE; + + /* Use the CodePage's TransDefaultChar if none was given. Don't modify the DefaultChar pointer here. */ + if(DefaultChar) + DefChar = DefaultChar[1] ? ((DefaultChar[0] << 8) | DefaultChar[1]) : DefaultChar[0]; + else + DefChar = CodePageTable->TransDefaultChar; + + /* Does caller query for output buffer size? */ + if(!MultiByteCount) + { + for(TempLength = 0; WideCharCount; WideCharCount--, WideCharString++, TempLength++) + { + USHORT uChar; + + if ((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) + { + /* FIXME: Handle WC_COMPOSITECHECK */ + } + + uChar = ((PUSHORT) CodePageTable->WideCharTable)[*WideCharString]; + + /* Verify if the mapping is valid for handling DefaultChar and UsedDefaultChar */ + if (!IntIsValidDBCSMapping(CodePageTable, Flags, *WideCharString, uChar)) + { + uChar = DefChar; + *UsedDefaultChar = TRUE; + } + + /* Increment TempLength again if this is a double-byte character */ + if (uChar & 0xff00) + TempLength++; + } + + return TempLength; + } + + /* Convert the WideCharString to the MultiByteString and verify if the mapping is valid */ + for(TempLength = MultiByteCount; + WideCharCount && TempLength; + TempLength--, WideCharString++, WideCharCount--) + { + USHORT uChar; + + if ((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) + { + /* FIXME: Handle WC_COMPOSITECHECK */ + } + + uChar = ((PUSHORT)CodePageTable->WideCharTable)[*WideCharString]; + + /* Verify if the mapping is valid for handling DefaultChar and UsedDefaultChar */ + if (!IntIsValidDBCSMapping(CodePageTable, Flags, *WideCharString, uChar)) + { + uChar = DefChar; + *UsedDefaultChar = TRUE; + } + + /* Handle double-byte characters */ + if (uChar & 0xff00) + { + /* Don't output a partial character */ + if (TempLength == 1) + break; + + TempLength--; + *MultiByteString++ = uChar >> 8; + } + + *MultiByteString++ = (char)uChar; + } + + /* WideCharCount should be 0 if all characters were converted */ + if (WideCharCount) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + return MultiByteCount - TempLength; + } + + /* Does caller query for output buffer size? */ + if (!MultiByteCount) + { + for (TempLength = 0; WideCharCount; WideCharCount--, WideCharString++, TempLength++) + { + /* Increment TempLength again if this is a double-byte character */ + if (((PWCHAR)CodePageTable->WideCharTable)[*WideCharString] & 0xff00) + TempLength++; } return TempLength; - } - - /* Convert the WideCharString to the MultiByteString and verify if the mapping is valid */ - for(TempLength = MultiByteCount; WideCharCount && TempLength; TempLength--, WideCharString++, WideCharCount--) - { - USHORT uChar; - - if((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) - { - /* FIXME: Handle WC_COMPOSITECHECK */ - } - - uChar = ((PUSHORT)CodePageTable->WideCharTable)[*WideCharString]; - - /* Verify if the mapping is valid for handling DefaultChar and UsedDefaultChar */ - if(!IntIsValidDBCSMapping(CodePageTable, Flags, *WideCharString, uChar)) - { - uChar = DefChar; - *UsedDefaultChar = TRUE; - } - - /* Handle double-byte characters */ - if(uChar & 0xff00) - { - /* Don't output a partial character */ - if(TempLength == 1) - break; - - TempLength--; - *MultiByteString++ = uChar >> 8; + } + + /* Convert the WideCharString to the MultiByteString */ + for (TempLength = MultiByteCount; + WideCharCount && TempLength; + TempLength--, WideCharString++, WideCharCount--) + { + USHORT uChar = ((PUSHORT) CodePageTable->WideCharTable)[*WideCharString]; + + /* Is this a double-byte character? */ + if (uChar & 0xff00) + { + /* Don't output a partial character */ + if (TempLength == 1) + break; + + TempLength--; + *MultiByteString++ = uChar >> 8; } *MultiByteString++ = (char)uChar; - } - - /* WideCharCount should be 0 if all characters were converted */ - if(WideCharCount) - { + } + + /* WideCharCount should be 0 if all characters were converted */ + if (WideCharCount) + { SetLastError(ERROR_INSUFFICIENT_BUFFER); return 0; - } - - return MultiByteCount - TempLength; - } - - /* Does caller query for output buffer size? */ - if(!MultiByteCount) - { - for(TempLength = 0; WideCharCount; WideCharCount--, WideCharString++, TempLength++) - { - /* Increment TempLength again if this is a double-byte character */ - if (((PWCHAR)CodePageTable->WideCharTable)[*WideCharString] & 0xff00) - TempLength++; - } - - return TempLength; - } - - /* Convert the WideCharString to the MultiByteString */ - for(TempLength = MultiByteCount; WideCharCount && TempLength; TempLength--, WideCharString++, WideCharCount--) - { - USHORT uChar = ((PUSHORT)CodePageTable->WideCharTable)[*WideCharString]; - - /* Is this a double-byte character? */ - if(uChar & 0xff00) - { - /* Don't output a partial character */ - if(TempLength == 1) - break; - - TempLength--; - *MultiByteString++ = uChar >> 8; - } - - *MultiByteString++ = (char)uChar; - } - - /* WideCharCount should be 0 if all characters were converted */ - if(WideCharCount) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return 0; - } - - return MultiByteCount - TempLength; - } - else /* Not DBCS code page */ - { - INT nReturn; - - /* If Flags, DefaultChar or UsedDefaultChar were given, we have to do some more work */ - if(Flags || DefaultChar || UsedDefaultChar) - { - BOOL TempUsedDefaultChar; - CHAR DefChar; - - /* If UsedDefaultChar is not set, set it to a temporary value, so we don't have to check on every character */ - if(!UsedDefaultChar) - UsedDefaultChar = &TempUsedDefaultChar; - - *UsedDefaultChar = FALSE; - - /* Does caller query for output buffer size? */ - if(!MultiByteCount) - { - /* Loop through the whole WideCharString and check if we can get a valid mapping for each character */ - for(TempLength = 0; WideCharCount; TempLength++, WideCharString++, WideCharCount--) - { - if((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) - { - /* FIXME: Handle WC_COMPOSITECHECK */ - } - - if(!*UsedDefaultChar) - *UsedDefaultChar = !IntIsValidSBCSMapping(CodePageTable, Flags, *WideCharString, ((PCHAR)CodePageTable->WideCharTable)[*WideCharString]); - } - - return TempLength; - } - - /* Use the CodePage's TransDefaultChar if none was given. Don't modify the DefaultChar pointer here. */ - if(DefaultChar) - DefChar = *DefaultChar; - else - DefChar = CodePageTable->TransDefaultChar; - - /* Convert the WideCharString to the MultiByteString and verify if the mapping is valid */ - for(TempLength = MultiByteCount; WideCharCount && TempLength; MultiByteString++, TempLength--, WideCharString++, WideCharCount--) - { - if((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) - { - /* FIXME: Handle WC_COMPOSITECHECK */ - } - + } + + return MultiByteCount - TempLength; + } + else /* Not DBCS code page */ + { + INT nReturn; + + /* If Flags, DefaultChar or UsedDefaultChar were given, we have to do some more work */ + if (Flags || DefaultChar || UsedDefaultChar) + { + BOOL TempUsedDefaultChar; + CHAR DefChar; + + /* If UsedDefaultChar is not set, set it to a temporary value, so we don't have + to check on every character */ + if (!UsedDefaultChar) + UsedDefaultChar = &TempUsedDefaultChar; + + *UsedDefaultChar = FALSE; + + /* Does caller query for output buffer size? */ + if (!MultiByteCount) + { + /* Loop through the whole WideCharString and check if we can get a valid mapping for each character */ + for (TempLength = 0; WideCharCount; TempLength++, WideCharString++, WideCharCount--) + { + if ((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) + { + /* FIXME: Handle WC_COMPOSITECHECK */ + } + + if (!*UsedDefaultChar) + *UsedDefaultChar = !IntIsValidSBCSMapping(CodePageTable, + Flags, + *WideCharString, + ((PCHAR)CodePageTable->WideCharTable)[*WideCharString]); + } + + return TempLength; + } + + /* Use the CodePage's TransDefaultChar if none was given. Don't modify the DefaultChar pointer here. */ + if (DefaultChar) + DefChar = *DefaultChar; + else + DefChar = CodePageTable->TransDefaultChar; + + /* Convert the WideCharString to the MultiByteString and verify if the mapping is valid */ + for (TempLength = MultiByteCount; + WideCharCount && TempLength; + MultiByteString++, TempLength--, WideCharString++, WideCharCount--) + { + if ((Flags & WC_COMPOSITECHECK) && WideCharCount > 1) + { + /* FIXME: Handle WC_COMPOSITECHECK */ + } + + *MultiByteString = ((PCHAR)CodePageTable->WideCharTable)[*WideCharString]; + + if (!IntIsValidSBCSMapping(CodePageTable, Flags, *WideCharString, *MultiByteString)) + { + *MultiByteString = DefChar; + *UsedDefaultChar = TRUE; + } + } + + /* WideCharCount should be 0 if all characters were converted */ + if (WideCharCount) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + return MultiByteCount - TempLength; + } + + /* Does caller query for output buffer size? */ + if (!MultiByteCount) + return WideCharCount; + + /* Is the buffer large enough? */ + if (MultiByteCount < WideCharCount) + { + /* Convert the string up to MultiByteCount and return 0 */ + WideCharCount = MultiByteCount; + SetLastError(ERROR_INSUFFICIENT_BUFFER); + nReturn = 0; + } + else + { + /* Otherwise WideCharCount will be the number of converted characters */ + nReturn = WideCharCount; + } + + /* Convert the WideCharString to the MultiByteString */ + for (TempLength = WideCharCount; --TempLength >= 0; WideCharString++, MultiByteString++) + { *MultiByteString = ((PCHAR)CodePageTable->WideCharTable)[*WideCharString]; - - if(!IntIsValidSBCSMapping(CodePageTable, Flags, *WideCharString, *MultiByteString)) - { - *MultiByteString = DefChar; - *UsedDefaultChar = TRUE; - } - } - - /* WideCharCount should be 0 if all characters were converted */ - if(WideCharCount) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return 0; - } - - return MultiByteCount - TempLength; - } - - /* Does caller query for output buffer size? */ - if(!MultiByteCount) - return WideCharCount; - - /* Is the buffer large enough? */ - if(MultiByteCount < WideCharCount) - { - /* Convert the string up to MultiByteCount and return 0 */ - WideCharCount = MultiByteCount; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - nReturn = 0; - } - else - { - /* Otherwise WideCharCount will be the number of converted characters */ - nReturn = WideCharCount; - } - - /* Convert the WideCharString to the MultiByteString */ - for(TempLength = WideCharCount; --TempLength >= 0; WideCharString++, MultiByteString++) - { - *MultiByteString = ((PCHAR)CodePageTable->WideCharTable)[*WideCharString]; - } - - return nReturn; - } + } + + return nReturn; + } } /** @@ -994,21 +1062,22 @@ * table. */ -static BOOL STDCALL +static BOOL +STDCALL IntIsLeadByte(PCPTABLEINFO TableInfo, BYTE Byte) { - UINT LeadByteNo; - - if (TableInfo->MaximumCharacterSize == 2) - { - for (LeadByteNo = 0; LeadByteNo < MAXIMUM_LEADBYTES; LeadByteNo++) - { - if (TableInfo->LeadByte[LeadByteNo] == Byte) - return TRUE; - } - } - - return FALSE; + UINT LeadByteNo; + + if (TableInfo->MaximumCharacterSize == 2) + { + for (LeadByteNo = 0; LeadByteNo < MAXIMUM_LEADBYTES; LeadByteNo++) + { + if (TableInfo->LeadByte[LeadByteNo] == Byte) + return TRUE; + } + } + + return FALSE; } /* PUBLIC FUNCTIONS ***********************************************************/ @@ -1040,26 +1109,31 @@ * @implemented */ -BOOL STDCALL -GetNlsSectionName(UINT CodePage, UINT Base, ULONG Unknown, - LPSTR BaseName, LPSTR Result, ULONG ResultSize) -{ - CHAR Integer[11]; - - if (!NT_SUCCESS(RtlIntegerToChar(CodePage, Base, sizeof(Integer), Integer))) - return FALSE; - - /* - * If the name including the terminating NULL character doesn't - * fit in the output buffer then fail. - */ - if (strlen(Integer) + strlen(BaseName) >= ResultSize) - return FALSE; - - lstrcpyA(Result, BaseName); - lstrcatA(Result, Integer); - - return TRUE; +BOOL +STDCALL +GetNlsSectionName(UINT CodePage, + UINT Base, + ULONG Unknown, + LPSTR BaseName, + LPSTR Result, + ULONG ResultSize) +{ + CHAR Integer[11]; + + if (!NT_SUCCESS(RtlIntegerToChar(CodePage, Base, sizeof(Integer), Integer))) + return FALSE; + + /* + * If the name including the terminating NULL character doesn't + * fit in the output buffer then fail. + */ + if (strlen(Integer) + strlen(BaseName) >= ResultSize) + return FALSE; + + lstrcpyA(Result, BaseName); + lstrcatA(Result, Integer); + + return TRUE; } /** @@ -1080,68 +1154,69 @@ * @implemented */ -BOOL STDCALL +BOOL +STDCALL GetCPFileNameFromRegistry(UINT CodePage, LPWSTR FileName, ULONG FileNameSize) { - WCHAR ValueNameBuffer[11]; - UNICODE_STRING KeyName, ValueName; - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - HANDLE KeyHandle; - PKEY_VALUE_PARTIAL_INFORMATION Kvpi; - DWORD KvpiSize; - BOOL bRetValue; - - bRetValue = FALSE; - - /* Convert the codepage number to string. */ - ValueName.Buffer = ValueNameBuffer; - ValueName.MaximumLength = sizeof(ValueNameBuffer); - if (!NT_SUCCESS(RtlIntegerToUnicodeString(CodePage, 10, &ValueName))) - return bRetValue; - - /* Open the registry key containing file name mappings. */ - RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\System\\" - L"CurrentControlSet\\Control\\Nls\\CodePage"); - InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, - NULL, NULL); - Status = NtOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - return bRetValue; - } - - /* Allocate buffer that will be used to query the value data. */ - KvpiSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + - (MAX_PATH * sizeof(WCHAR)); - Kvpi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, KvpiSize); - if (Kvpi == NULL) - { - NtClose(KeyHandle); - return bRetValue; - } - - /* Query the file name for our code page. */ - Status = NtQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation, - Kvpi, KvpiSize, &KvpiSize); - - NtClose(KeyHandle); - - /* Check if we succeded and the value is non-empty string. */ - if (NT_SUCCESS(Status) && Kvpi->Type == REG_SZ && - Kvpi->DataLength > sizeof(WCHAR)) - { - bRetValue = TRUE; - if (FileName != NULL) - { - lstrcpynW(FileName, (WCHAR*)Kvpi->Data, - min(Kvpi->DataLength / sizeof(WCHAR), FileNameSize)); - } - } - - /* free temporary buffer */ - HeapFree(GetProcessHeap(),0,Kvpi); - return bRetValue; + WCHAR ValueNameBuffer[11]; + UNICODE_STRING KeyName, ValueName; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + HANDLE KeyHandle; + PKEY_VALUE_PARTIAL_INFORMATION Kvpi; + DWORD KvpiSize; + BOOL bRetValue; + + bRetValue = FALSE; + + /* Convert the codepage number to string. */ + ValueName.Buffer = ValueNameBuffer; + ValueName.MaximumLength = sizeof(ValueNameBuffer); + + if (!NT_SUCCESS(RtlIntegerToUnicodeString(CodePage, 10, &ValueName))) + return bRetValue; + + /* Open the registry key containing file name mappings. */ + RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\System\\" + L"CurrentControlSet\\Control\\Nls\\CodePage"); + InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, + NULL, NULL); + Status = NtOpenKey(&KeyHandle, KEY_READ, &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return bRetValue; + } + + /* Allocate buffer that will be used to query the value data. */ + KvpiSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + (MAX_PATH * sizeof(WCHAR)); + Kvpi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, KvpiSize); + if (Kvpi == NULL) + { + NtClose(KeyHandle); + return bRetValue; + } + + /* Query the file name for our code page. */ + Status = NtQueryValueKey(KeyHandle, &ValueName, KeyValuePartialInformation, + Kvpi, KvpiSize, &KvpiSize); + + NtClose(KeyHandle); + + /* Check if we succeded and the value is non-empty string. */ + if (NT_SUCCESS(Status) && Kvpi->Type == REG_SZ && + Kvpi->DataLength > sizeof(WCHAR)) + { + bRetValue = TRUE; + if (FileName != NULL) + { + lstrcpynW(FileName, (WCHAR*)Kvpi->Data, + min(Kvpi->DataLength / sizeof(WCHAR), FileNameSize)); + } + } + + /* free temporary buffer */ + HeapFree(GetProcessHeap(),0,Kvpi); + return bRetValue; } /** @@ -1155,14 +1230,15 @@ * @return TRUE if code page is present. */ -BOOL STDCALL +BOOL +STDCALL IsValidCodePage(UINT CodePage) { - if (CodePage == CP_UTF8 || CodePage == CP_UTF7) - return TRUE; - if (IntGetLoadedCodePageEntry(CodePage)) - return TRUE; - return GetCPFileNameFromRegistry(CodePage, NULL, 0); + if (CodePage == CP_UTF8 || CodePage == CP_UTF7) + return TRUE; + if (IntGetLoadedCodePageEntry(CodePage)) + return TRUE; + return GetCPFileNameFromRegistry(CodePage, NULL, 0); } /** @@ -1196,46 +1272,57 @@ * @implemented */ -INT STDCALL -MultiByteToWideChar(UINT CodePage, DWORD Flags, - LPCSTR MultiByteString, INT MultiByteCount, - LPWSTR WideCharString, INT WideCharCount) -{ - /* Check the parameters. */ - if (MultiByteString == NULL || - (WideCharString == NULL && WideCharCount > 0) || - (PVOID)MultiByteString == (PVOID)WideCharString) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - /* Determine the input string length. */ - if (MultiByteCount < 0) - { - MultiByteCount = lstrlenA(MultiByteString) + 1; - } - - switch (CodePage) - { - case CP_UTF8: - return IntMultiByteToWideCharUTF8( - Flags, MultiByteString, MultiByteCount, - WideCharString, WideCharCount); - - case CP_UTF7: - DPRINT1("MultiByteToWideChar for CP_UTF7 is not implemented!\n"); - return 0; - - case CP_SYMBOL: - return IntMultiByteToWideCharSYMBOL( - Flags, MultiByteString, MultiByteCount, - WideCharString, WideCharCount); - default: - return IntMultiByteToWideCharCP( - CodePage, Flags, MultiByteString, MultiByteCount, - WideCharString, WideCharCount); - } +INT +STDCALL +MultiByteToWideChar(UINT CodePage, + DWORD Flags, + LPCSTR MultiByteString, + INT MultiByteCount, + LPWSTR WideCharString, + INT WideCharCount) +{ + /* Check the parameters. */ + if (MultiByteString == NULL || + (WideCharString == NULL && WideCharCount > 0) || + (PVOID)MultiByteString == (PVOID)WideCharString) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* Determine the input string length. */ + if (MultiByteCount < 0) + { + MultiByteCount = lstrlenA(MultiByteString) + 1; + } + + switch (CodePage) + { + case CP_UTF8: + return IntMultiByteToWideCharUTF8(Flags, + MultiByteString, + MultiByteCount, + WideCharString, + WideCharCount); + + case CP_UTF7: + DPRINT1("MultiByteToWideChar for CP_UTF7 is not implemented!\n"); + return 0; + + case CP_SYMBOL: + return IntMultiByteToWideCharSYMBOL(Flags, + MultiByteString, + MultiByteCount, + WideCharString, + WideCharCount); + default: + return IntMultiByteToWideCharCP(CodePage, + Flags, + MultiByteString, + MultiByteCount, + WideCharString, + WideCharCount); + } } /** @@ -1277,56 +1364,71 @@ * @implemented */ -INT STDCALL -WideCharToMultiByte(UINT CodePage, DWORD Flags, - LPCWSTR WideCharString, INT WideCharCount, - LPSTR MultiByteString, INT MultiByteCount, - LPCSTR DefaultChar, LPBOOL UsedDefaultChar) -{ - /* Check the parameters. */ - if (WideCharString == NULL || - (MultiByteString == NULL && MultiByteCount > 0) || - (PVOID)WideCharString == (PVOID)MultiByteString || - MultiByteCount < 0) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; +INT +STDCALL +WideCharToMultiByte(UINT CodePage, + DWORD Flags, + LPCWSTR WideCharString, + INT WideCharCount, + LPSTR MultiByteString, + INT MultiByteCount, + LPCSTR DefaultChar, + LPBOOL UsedDefaultChar) +{ + /* Check the parameters. */ + if (WideCharString == NULL || + (MultiByteString == NULL && MultiByteCount > 0) || + (PVOID)WideCharString == (PVOID)MultiByteString || + MultiByteCount < 0) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* Determine the input string length. */ + if (WideCharCount < 0) + { + WideCharCount = lstrlenW(WideCharString) + 1; + } + + switch (CodePage) + { + case CP_UTF8: + return IntWideCharToMultiByteUTF8(CodePage, + Flags, + WideCharString, + WideCharCount, + MultiByteString, + MultiByteCount, + DefaultChar, + UsedDefaultChar); + + case CP_UTF7: + DPRINT1("WideCharToMultiByte for CP_UTF7 is not implemented!\n"); + return 0; + + case CP_SYMBOL: + if ((DefaultChar!=NULL) || (UsedDefaultChar!=NULL)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + return IntWideCharToMultiByteSYMBOL(Flags, + WideCharString, + WideCharCount, + MultiByteString, + MultiByteCount); + + default: + return IntWideCharToMultiByteCP(CodePage, + Flags, + WideCharString, + WideCharCount, + MultiByteString, + MultiByteCount, + DefaultChar, + UsedDefaultChar); } - - /* Determine the input string length. */ - if (WideCharCount < 0) - { - WideCharCount = lstrlenW(WideCharString) + 1; - } - - switch (CodePage) - { - case CP_UTF8: - return IntWideCharToMultiByteUTF8( - CodePage, Flags, WideCharString, WideCharCount, - MultiByteString, MultiByteCount, DefaultChar, - UsedDefaultChar); - - case CP_UTF7: - DPRINT1("WideCharToMultiByte for CP_UTF7 is not implemented!\n"); - return 0; - - case CP_SYMBOL: - if ((DefaultChar!=NULL) || (UsedDefaultChar!=NULL)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - return IntWideCharToMultiByteSYMBOL( - Flags,WideCharString,WideCharCount,MultiByteString, - MultiByteCount); - - default: - return IntWideCharToMultiByteCP( - CodePage, Flags, WideCharString, WideCharCount, - MultiByteString, MultiByteCount, DefaultChar, - UsedDefaultChar); - } } /** @@ -1337,10 +1439,11 @@ * @implemented */ -UINT STDCALL +UINT +STDCALL GetACP(VOID) { - return AnsiCodePage.CodePageTable.CodePage; + return AnsiCodePage.CodePageTable.CodePage; } /** @@ -1351,10 +1454,11 @@ * @implemented */ -UINT STDCALL +UINT +STDCALL GetOEMCP(VOID) { - return OemCodePage.CodePageTable.CodePage; + return OemCodePage.CodePageTable.CodePage; } /** @@ -1365,17 +1469,18 @@ * @implemented */ -BOOL STDCALL +BOOL +STDCALL IsDBCSLeadByteEx(UINT CodePage, BYTE TestByte) { - PCODEPAGE_ENTRY CodePageEntry; - - CodePageEntry = IntGetCodePageEntry(CodePage); - if (CodePageEntry != NULL) - return IntIsLeadByte(&CodePageEntry->CodePageTable, TestByte); - - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; + PCODEPAGE_ENTRY CodePageEntry; + + CodePageEntry = IntGetCodePageEntry(CodePage); + if (CodePageEntry != NULL) + return IntIsLeadByte(&CodePageEntry->CodePageTable, TestByte); + + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; } /** @@ -1386,10 +1491,11 @@ * @implemented */ -BOOL STDCALL +BOOL +STDCALL IsDBCSLeadByte(BYTE TestByte) { - return IntIsLeadByte(&AnsiCodePage.CodePageTable, TestByte); + return IntIsLeadByte(&AnsiCodePage.CodePageTable, TestByte); } /* EOF */
16 years, 1 month
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
66
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Results per page:
10
25
50
100
200