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
April 2018
----- 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
26 participants
247 discussions
Start a n
N
ew thread
01/01: [MODE] Use more translated strings. CORE-12178
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=84e78e6a15680cf2e5979…
commit 84e78e6a15680cf2e59796f8554a1fd2dd28e128 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun Apr 29 16:56:33 2018 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Apr 29 16:57:11 2018 +0200 [MODE] Use more translated strings. CORE-12178 --- base/applications/cmdutils/mode/lang/de-DE.rc | 14 +++++----- base/applications/cmdutils/mode/lang/en-US.rc | 14 +++++----- base/applications/cmdutils/mode/lang/ro-RO.rc | 13 +++++---- base/applications/cmdutils/mode/lang/ru-RU.rc | 13 +++++---- base/applications/cmdutils/mode/lang/tr-TR.rc | 14 +++++----- base/applications/cmdutils/mode/lang/zh-CN.rc | 14 +++++----- base/applications/cmdutils/mode/mode.c | 33 ++++++++++++----------- base/applications/cmdutils/mode/resource.h | 38 ++++++++++++++------------- 8 files changed, 86 insertions(+), 67 deletions(-) diff --git a/base/applications/cmdutils/mode/lang/de-DE.rc b/base/applications/cmdutils/mode/lang/de-DE.rc index 48ae8bcacb..883bc567ae 100644 --- a/base/applications/cmdutils/mode/lang/de-DE.rc +++ b/base/applications/cmdutils/mode/lang/de-DE.rc @@ -56,13 +56,15 @@ STRINGTABLE BEGIN IDS_ERROR_QUERY_DEVICES "ERROR: Unable to query DOS devices (0x%lx).\n" IDS_ERROR_QUERY_DEVICES_FORM " QueryDosDeviceW(%s) returned unrecognised form %s.\n" - IDS_ERROR_SET_PARALLEL_STATE "SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" - IDS_ERROR_INVALID_PARAMETER "ERROR: Unzulässiger Parameter - %s\n" - IDS_ERROR_ILLEGAL_DEVICE_NAME "ERROR: Unzulässiger Gerätename - %s (0x%lx)\n" - IDS_ERROR_STATUS_GET_DEVICE "ERROR: Failed to get the status for device COM%d:\n" - IDS_ERROR_STATUS_SET_DEVICE "ERROR: Failed to set the status for device COM%d:\n" + IDS_ERROR_SET_PARALLEL_STATE "ERROR: SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" + IDS_ERROR_INVALID_PARAMETER "Unzulässiger Parameter - %s\n" + IDS_ERROR_ILLEGAL_DEVICE_NAME "Unzulässiger Gerätename - %s (0x%lx)\n" + IDS_ERROR_STATUS_GET_DEVICE "Failed to get the status for device %s:\n" + IDS_ERROR_STATUS_SET_DEVICE "Failed to set the status for device %s:\n" + IDS_ERROR_TIMEOUT_GET_DEVICE "Failed to get the timeout for device %s:\n" + IDS_ERROR_TIMEOUT_SET_DEVICE "Failed to set the timeout for device %s:\n" IDS_ERROR_INVALID_PARITY_BITS "ERROR: Invalid value for Parity Bits %d:\n" IDS_ERROR_INVALID_STOP_BITS "ERROR: Invalid value for Stop Bits %d:\n" IDS_ERROR_NO_MEMORY "ERROR: Not enough memory.\n" - IDS_ERROR_SCREEN_LINES_COL "ERROR: The screen cannot be set to the number of lines and columns specified.\n" + IDS_ERROR_SCREEN_LINES_COL "The screen cannot be set to the number of lines and columns specified.\n" END diff --git a/base/applications/cmdutils/mode/lang/en-US.rc b/base/applications/cmdutils/mode/lang/en-US.rc index 36cb76a573..9663215a3b 100644 --- a/base/applications/cmdutils/mode/lang/en-US.rc +++ b/base/applications/cmdutils/mode/lang/en-US.rc @@ -56,13 +56,15 @@ STRINGTABLE BEGIN IDS_ERROR_QUERY_DEVICES "ERROR: Unable to query DOS devices (0x%lx).\n" IDS_ERROR_QUERY_DEVICES_FORM " QueryDosDeviceW(%s) returned unrecognised form %s.\n" - IDS_ERROR_SET_PARALLEL_STATE "SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" - IDS_ERROR_INVALID_PARAMETER "ERROR: Invalid parameter - %s\n" - IDS_ERROR_ILLEGAL_DEVICE_NAME "ERROR: Illegal device name - %s (0x%lx)\n" - IDS_ERROR_STATUS_GET_DEVICE "ERROR: Failed to get the status for device COM%d:\n" - IDS_ERROR_STATUS_SET_DEVICE "ERROR: Failed to set the status for device COM%d:\n" + IDS_ERROR_SET_PARALLEL_STATE "ERROR: SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" + IDS_ERROR_INVALID_PARAMETER "Invalid parameter - %s\n" + IDS_ERROR_ILLEGAL_DEVICE_NAME "Illegal device name - %s (0x%lx)\n" + IDS_ERROR_STATUS_GET_DEVICE "Failed to get the status for device %s:\n" + IDS_ERROR_STATUS_SET_DEVICE "Failed to set the status for device %s:\n" + IDS_ERROR_TIMEOUT_GET_DEVICE "Failed to get the timeout for device %s:\n" + IDS_ERROR_TIMEOUT_SET_DEVICE "Failed to set the timeout for device %s:\n" IDS_ERROR_INVALID_PARITY_BITS "ERROR: Invalid value for Parity Bits %d:\n" IDS_ERROR_INVALID_STOP_BITS "ERROR: Invalid value for Stop Bits %d:\n" IDS_ERROR_NO_MEMORY "ERROR: Not enough memory.\n" - IDS_ERROR_SCREEN_LINES_COL "ERROR: The screen cannot be set to the number of lines and columns specified.\n" + IDS_ERROR_SCREEN_LINES_COL "The screen cannot be set to the number of lines and columns specified.\n" END diff --git a/base/applications/cmdutils/mode/lang/ro-RO.rc b/base/applications/cmdutils/mode/lang/ro-RO.rc index 72822afcbe..6f92acd9db 100644 --- a/base/applications/cmdutils/mode/lang/ro-RO.rc +++ b/base/applications/cmdutils/mode/lang/ro-RO.rc @@ -64,12 +64,15 @@ STRINGTABLE BEGIN IDS_ERROR_QUERY_DEVICES "EROARE: Dispozitivul DOS (0x%lx) nu poate fi interogat.\n" IDS_ERROR_QUERY_DEVICES_FORM " QueryDosDeviceW(%s) a returnat un formular nerecunoscut %s.\n" - IDS_ERROR_SET_PARALLEL_STATE "SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" - IDS_ERROR_INVALID_PARAMETER "EROARE: Parametru nevalid - %s\n" - IDS_ERROR_ILLEGAL_DEVICE_NAME "EROARE: Nume eronat de dispozitiv - %s (0x%lx)\n" - IDS_ERROR_STATUS_GET_DEVICE "EROARE: Nu poate fi determinată starea dispozitivului COM%d:\n" - IDS_ERROR_STATUS_SET_DEVICE "EROARE: Nu poate fi schimbată starea pentru dispozitivul COM%d:\n" + IDS_ERROR_SET_PARALLEL_STATE "EROARE: SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" + IDS_ERROR_INVALID_PARAMETER "Parametru nevalid - %s\n" + IDS_ERROR_ILLEGAL_DEVICE_NAME "Nume eronat de dispozitiv - %s (0x%lx)\n" + IDS_ERROR_STATUS_GET_DEVICE "Nu poate fi determinată starea dispozitivului %s:\n" + IDS_ERROR_STATUS_SET_DEVICE "Nu poate fi schimbată starea pentru dispozitivul %s:\n" + IDS_ERROR_TIMEOUT_GET_DEVICE "Failed to get the timeout for device %s:\n" + IDS_ERROR_TIMEOUT_SET_DEVICE "Failed to set the timeout for device %s:\n" IDS_ERROR_INVALID_PARITY_BITS "EROARE: Valoare eronată pentru biții de paritate %d:\n" IDS_ERROR_INVALID_STOP_BITS "EROARE: Valoare eronată pentru biții delimitori %d:\n" IDS_ERROR_NO_MEMORY "ERAORE: Nu există suficientă memorie.\n" + IDS_ERROR_SCREEN_LINES_COL "The screen cannot be set to the number of lines and columns specified.\n" END diff --git a/base/applications/cmdutils/mode/lang/ru-RU.rc b/base/applications/cmdutils/mode/lang/ru-RU.rc index 01c96d7fd0..7ef70b2368 100644 --- a/base/applications/cmdutils/mode/lang/ru-RU.rc +++ b/base/applications/cmdutils/mode/lang/ru-RU.rc @@ -56,12 +56,15 @@ STRINGTABLE BEGIN IDS_ERROR_QUERY_DEVICES "ОШИБКА: Не удалось опросить DOS устройства (0x%lx).\n" IDS_ERROR_QUERY_DEVICES_FORM " QueryDosDeviceW(%s) возвратила не опознанное состояние %s.\n" - IDS_ERROR_SET_PARALLEL_STATE "SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" - IDS_ERROR_INVALID_PARAMETER "ОШИБКА: Неверный параметр - %s\n" - IDS_ERROR_ILLEGAL_DEVICE_NAME "ОШИБКА: Недопустимое имя устройства - %s (0x%lx)\n" - IDS_ERROR_STATUS_GET_DEVICE "ОШИБКА: Не удалось получить состояние устройства COM%d:\n" - IDS_ERROR_STATUS_SET_DEVICE "ОШИБКА: Не удалось установить состояние устройства COM%d:\n" + IDS_ERROR_SET_PARALLEL_STATE "ОШИБКА: SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" + IDS_ERROR_INVALID_PARAMETER "Неверный параметр - %s\n" + IDS_ERROR_ILLEGAL_DEVICE_NAME "Недопустимое имя устройства - %s (0x%lx)\n" + IDS_ERROR_STATUS_GET_DEVICE "Не удалось получить состояние устройства %s:\n" + IDS_ERROR_STATUS_SET_DEVICE "Не удалось установить состояние устройства %s:\n" + IDS_ERROR_TIMEOUT_GET_DEVICE "Failed to get the timeout for device %s:\n" + IDS_ERROR_TIMEOUT_SET_DEVICE "Failed to set the timeout for device %s:\n" IDS_ERROR_INVALID_PARITY_BITS "ОШИБКА: Неверное значение битов четности %d:\n" IDS_ERROR_INVALID_STOP_BITS "ОШИБКА: Неверное значение стоповых битов %d:\n" IDS_ERROR_NO_MEMORY "ОШИБКА: Недостаточно памяти.\n" + IDS_ERROR_SCREEN_LINES_COL "The screen cannot be set to the number of lines and columns specified.\n" END diff --git a/base/applications/cmdutils/mode/lang/tr-TR.rc b/base/applications/cmdutils/mode/lang/tr-TR.rc index 07003fc7d0..aa919dac56 100644 --- a/base/applications/cmdutils/mode/lang/tr-TR.rc +++ b/base/applications/cmdutils/mode/lang/tr-TR.rc @@ -58,13 +58,15 @@ STRINGTABLE BEGIN IDS_ERROR_QUERY_DEVICES "YANLIŞLIK: (0x%lx) DOS aygıtı sorgulanamaz.\n" IDS_ERROR_QUERY_DEVICES_FORM " QueryDosDeviceW(%s), %s tanınmamış biçim döndürdü.\n" - IDS_ERROR_SET_PARALLEL_STATE "SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" - IDS_ERROR_INVALID_PARAMETER "YANLIŞLIK: Geçersiz değişken - %s\n" - IDS_ERROR_ILLEGAL_DEVICE_NAME "YANLIŞLIK: Geçersiz aygıt adı - %s (0x%lx)\n" - IDS_ERROR_STATUS_GET_DEVICE "YANLIŞLIK: COM%d aygıtının durumu alınamıyor:\n" - IDS_ERROR_STATUS_SET_DEVICE "YANLIŞLIK: COM%d aygıtının durumu ayarlanamıyor:\n" + IDS_ERROR_SET_PARALLEL_STATE "YANLIŞLIK: SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" + IDS_ERROR_INVALID_PARAMETER "Geçersiz değişken - %s\n" + IDS_ERROR_ILLEGAL_DEVICE_NAME "Geçersiz aygıt adı - %s (0x%lx)\n" + IDS_ERROR_STATUS_GET_DEVICE "%s: aygıtının durumu alınamıyor\n" + IDS_ERROR_STATUS_SET_DEVICE "%s: aygıtının durumu ayarlanamıyor\n" + IDS_ERROR_TIMEOUT_GET_DEVICE "Failed to get the timeout for device %s:\n" + IDS_ERROR_TIMEOUT_SET_DEVICE "Failed to set the timeout for device %s:\n" IDS_ERROR_INVALID_PARITY_BITS "YANLIŞLIK: %d Eşlik İkilleri için geçersiz değer:\n" IDS_ERROR_INVALID_STOP_BITS "YANLIŞLIK: %d Durma İkilleri için geçersiz değer:\n" IDS_ERROR_NO_MEMORY "YANLIŞLIK: Yeterli bellek yok.\n" - IDS_ERROR_SCREEN_LINES_COL "YANLIŞLIK: Görüntülük, belirtilen yataç ve dikeç sayısına ayarlanamıyor.\n" + IDS_ERROR_SCREEN_LINES_COL "Görüntülük, belirtilen yataç ve dikeç sayısına ayarlanamıyor.\n" END diff --git a/base/applications/cmdutils/mode/lang/zh-CN.rc b/base/applications/cmdutils/mode/lang/zh-CN.rc index 6d752557a7..99bf6f6802 100644 --- a/base/applications/cmdutils/mode/lang/zh-CN.rc +++ b/base/applications/cmdutils/mode/lang/zh-CN.rc @@ -56,13 +56,15 @@ STRINGTABLE BEGIN IDS_ERROR_QUERY_DEVICES "错误: 无法查询 DOS 设备 (0x%lx)。\n" IDS_ERROR_QUERY_DEVICES_FORM " QueryDosDeviceW(%s) 返回无法识别的表格 %s。\n" - IDS_ERROR_SET_PARALLEL_STATE "SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" - IDS_ERROR_INVALID_PARAMETER "错误: 无效参数 - %s\n" - IDS_ERROR_ILLEGAL_DEVICE_NAME "错误: 非法设备名 - %s (0x%lx)\n" - IDS_ERROR_STATUS_GET_DEVICE "错误: 无法获得设备 COM%d 的状态:\n" - IDS_ERROR_STATUS_SET_DEVICE "错误: 无法设置设备 COM%d 的状态:\n" + IDS_ERROR_SET_PARALLEL_STATE "错误: SetParallelState(%d) - DefineDosDevice(%s) (0x%lx)\n" + IDS_ERROR_INVALID_PARAMETER "无效参数 - %s\n" + IDS_ERROR_ILLEGAL_DEVICE_NAME "非法设备名 - %s (0x%lx)\n" + IDS_ERROR_STATUS_GET_DEVICE "无法获得设备 %s: 的状态\n" + IDS_ERROR_STATUS_SET_DEVICE "无法设置设备 %s: 的状态\n" + IDS_ERROR_TIMEOUT_GET_DEVICE "Failed to get the timeout for device %s:\n" + IDS_ERROR_TIMEOUT_SET_DEVICE "Failed to set the timeout for device %s:\n" IDS_ERROR_INVALID_PARITY_BITS "错误: 奇偶位 %d 值无效:\n" IDS_ERROR_INVALID_STOP_BITS "错误: 终止位 %d 值无效:\n" IDS_ERROR_NO_MEMORY "错误: 内存不足。\n" - IDS_ERROR_SCREEN_LINES_COL "错误: 屏幕无法被设置成指定的行数和列数。\n" + IDS_ERROR_SCREEN_LINES_COL "屏幕无法被设置成指定的行数和列数。\n" END diff --git a/base/applications/cmdutils/mode/mode.c b/base/applications/cmdutils/mode/mode.c index 1d17ff7f00..f571549dfb 100644 --- a/base/applications/cmdutils/mode/mode.c +++ b/base/applications/cmdutils/mode/mode.c @@ -167,7 +167,7 @@ int ShowParallelStatus(INT nPortNum) } else { - ConPrintf(StdErr, L" QueryDosDeviceW(%s) returned unrecognised form %s.\n", szPortName, buffer); + ConResPrintf(StdErr, IDS_ERROR_QUERY_DEVICES_FORM, szPortName, buffer); } } else @@ -187,7 +187,7 @@ int SetParallelState(INT nPortNum) swprintf(szTargetPath, L"COM%d", nPortNum); if (!DefineDosDeviceW(DDD_REMOVE_DEFINITION, szPortName, szTargetPath)) { - ConPrintf(StdErr, L"SetParallelState(%d) - DefineDosDevice(%s) failed: 0x%lx\n", nPortNum, szPortName, GetLastError()); + ConPrintf(StdErr, L"ERROR: SetParallelState(%d) - DefineDosDevice(%s) failed: 0x%lx\n", nPortNum, szPortName, GetLastError()); } ShowParallelStatus(nPortNum); @@ -408,12 +408,12 @@ int SetConsoleStateOld(IN PCWSTR ArgStr) Quit: ClearScreen(hConOut, &csbi); if (!ResizeTextConsole(hConOut, &csbi, Resolution)) - ConPuts(StdErr, L"The screen cannot be set to the number of lines and columns specified.\n"); + ConResPuts(StdErr, IDS_ERROR_SCREEN_LINES_COL); return 0; invalid_parameter: - ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr); + ConResPrintf(StdErr, IDS_ERROR_INVALID_PARAMETER, ArgStr); return 1; } @@ -486,7 +486,7 @@ int SetConsoleState(IN PCWSTR ArgStr) else { invalid_parameter: - ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr); + ConResPrintf(StdErr, IDS_ERROR_INVALID_PARAMETER, ArgStr); return 1; } } @@ -495,7 +495,7 @@ invalid_parameter: { ClearScreen(hConOut, &csbi); if (!ResizeTextConsole(hConOut, &csbi, Resolution)) - ConPuts(StdErr, L"The screen cannot be set to the number of lines and columns specified.\n"); + ConResPuts(StdErr, IDS_ERROR_SCREEN_LINES_COL); } else if (kbdMode) { @@ -537,7 +537,7 @@ int SetConsoleCPState(IN PCWSTR ArgStr) else { invalid_parameter: - ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr); + ConResPrintf(StdErr, IDS_ERROR_INVALID_PARAMETER, ArgStr); return 1; } @@ -570,8 +570,7 @@ SerialPortQuery(INT nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWr if (hPort == INVALID_HANDLE_VALUE) { - ConPrintf(StdErr, L"Illegal device name - %s\n", szPortName); - ConPrintf(StdErr, L"Last error = 0x%lx\n", GetLastError()); + ConResPrintf(StdErr, IDS_ERROR_ILLEGAL_DEVICE_NAME, szPortName, GetLastError()); return FALSE; } @@ -579,7 +578,9 @@ SerialPortQuery(INT nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWr : GetCommState(hPort, pDCB); if (!Success) { - ConPrintf(StdErr, L"Failed to %s the status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum); + ConResPrintf(StdErr, + bWrite ? IDS_ERROR_STATUS_SET_DEVICE : IDS_ERROR_STATUS_GET_DEVICE, + szPortName); goto Quit; } @@ -587,7 +588,9 @@ SerialPortQuery(INT nPortNum, LPDCB pDCB, LPCOMMTIMEOUTS pCommTimeouts, BOOL bWr : GetCommTimeouts(hPort, pCommTimeouts); if (!Success) { - ConPrintf(StdErr, L"Failed to %s timeout status for device COM%d:\n", bWrite ? L"set" : L"get", nPortNum); + ConResPrintf(StdErr, + bWrite ? IDS_ERROR_TIMEOUT_SET_DEVICE : IDS_ERROR_TIMEOUT_GET_DEVICE, + szPortName); goto Quit; } @@ -619,12 +622,12 @@ int ShowSerialStatus(INT nPortNum) } if (dcb.Parity >= ARRAYSIZE(parity_strings)) { - ConPrintf(StdErr, L"ERROR: Invalid value for Parity Bits %d:\n", dcb.Parity); + ConResPrintf(StdErr, IDS_ERROR_INVALID_PARITY_BITS, dcb.Parity); dcb.Parity = 0; } if (dcb.StopBits >= ARRAYSIZE(stopbit_strings)) { - ConPrintf(StdErr, L"ERROR: Invalid value for Stop Bits %d:\n", dcb.StopBits); + ConResPrintf(StdErr, IDS_ERROR_INVALID_STOP_BITS, dcb.StopBits); dcb.StopBits = 0; } @@ -1087,7 +1090,7 @@ int SetSerialState(INT nPortNum, IN PCWSTR ArgStr) if (!Success) { - ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr); + ConResPrintf(StdErr, IDS_ERROR_INVALID_PARAMETER, ArgStr); return 1; } @@ -1282,7 +1285,7 @@ show_status: goto Quit; invalid_parameter: - ConPrintf(StdErr, L"Invalid parameter - %s\n", ArgStr); + ConResPrintf(StdErr, IDS_ERROR_INVALID_PARAMETER, ArgStr); goto Quit; Quit: diff --git a/base/applications/cmdutils/mode/resource.h b/base/applications/cmdutils/mode/resource.h index dac782113a..c54e8ac31e 100644 --- a/base/applications/cmdutils/mode/resource.h +++ b/base/applications/cmdutils/mode/resource.h @@ -18,20 +18,20 @@ #define IDS_COM_STATUS_PARITY 7 #define IDS_COM_STATUS_DATA_BITS 8 #define IDS_COM_STATUS_STOP_BITS 9 -#define IDS_COM_STATUS_TIMEOUT 10 -#define IDS_COM_STATUS_XON_XOFF 11 -#define IDS_COM_STATUS_CTS_HANDSHAKING 12 -#define IDS_COM_STATUS_DSR_HANDSHAKING 13 -#define IDS_COM_STATUS_DSR_SENSITIVITY 14 -#define IDS_COM_STATUS_DTR_CIRCUIT 15 -#define IDS_COM_STATUS_RTS_CIRCUIT 16 -#define IDS_CONSOLE_STATUS_LINES 17 -#define IDS_CONSOLE_STATUS_COLS 18 -#define IDS_CONSOLE_KBD_RATE 19 -#define IDS_CONSOLE_KBD_DELAY 20 -#define IDS_CONSOLE_CODEPAGE 21 -#define IDS_PRINTER_OUTPUT_NOT_REROUTED 22 -#define IDS_PRINTER_OUTPUT_REROUTED_SERIAL 23 +#define IDS_COM_STATUS_TIMEOUT 10 +#define IDS_COM_STATUS_XON_XOFF 11 +#define IDS_COM_STATUS_CTS_HANDSHAKING 12 +#define IDS_COM_STATUS_DSR_HANDSHAKING 13 +#define IDS_COM_STATUS_DSR_SENSITIVITY 14 +#define IDS_COM_STATUS_DTR_CIRCUIT 15 +#define IDS_COM_STATUS_RTS_CIRCUIT 16 +#define IDS_CONSOLE_STATUS_LINES 17 +#define IDS_CONSOLE_STATUS_COLS 18 +#define IDS_CONSOLE_KBD_RATE 19 +#define IDS_CONSOLE_KBD_DELAY 20 +#define IDS_CONSOLE_CODEPAGE 21 +#define IDS_PRINTER_OUTPUT_NOT_REROUTED 22 +#define IDS_PRINTER_OUTPUT_REROUTED_SERIAL 23 #define IDS_ERROR_QUERY_DEVICES 24 #define IDS_ERROR_QUERY_DEVICES_FORM 25 @@ -40,9 +40,11 @@ #define IDS_ERROR_ILLEGAL_DEVICE_NAME 28 #define IDS_ERROR_STATUS_GET_DEVICE 29 #define IDS_ERROR_STATUS_SET_DEVICE 30 -#define IDS_ERROR_INVALID_PARITY_BITS 31 -#define IDS_ERROR_INVALID_STOP_BITS 32 -#define IDS_ERROR_NO_MEMORY 33 -#define IDS_ERROR_SCREEN_LINES_COL 34 +#define IDS_ERROR_TIMEOUT_GET_DEVICE 31 +#define IDS_ERROR_TIMEOUT_SET_DEVICE 32 +#define IDS_ERROR_INVALID_PARITY_BITS 33 +#define IDS_ERROR_INVALID_STOP_BITS 34 +#define IDS_ERROR_NO_MEMORY 35 +#define IDS_ERROR_SCREEN_LINES_COL 36 #endif /* RESOURCE_H */
6 years, 7 months
1
0
0
0
01/01: [SYSSETUP] Close the device key after the property sheet page has been released.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b6ebd50d3f75e61f098b0…
commit b6ebd50d3f75e61f098b08b7fd23841c642c267c Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Apr 29 15:41:03 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Apr 29 15:41:38 2018 +0200 [SYSSETUP] Close the device key after the property sheet page has been released. --- dll/win32/syssetup/proppage.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dll/win32/syssetup/proppage.c b/dll/win32/syssetup/proppage.c index 4072b224fd..0c1fcb08d1 100644 --- a/dll/win32/syssetup/proppage.c +++ b/dll/win32/syssetup/proppage.c @@ -490,9 +490,15 @@ MouseCallback( UINT uMsg, LPPROPSHEETPAGE ppsp) { + PMOUSE_INFO pMouseInfo; + + pMouseInfo = (PMOUSE_INFO)ppsp->lParam; + if (uMsg == PSPCB_RELEASE) { - HeapFree(GetProcessHeap(), 0, (PMOUSE_INFO)ppsp->lParam); + if (pMouseInfo->hDeviceKey != NULL) + RegCloseKey(pMouseInfo->hDeviceKey); + HeapFree(GetProcessHeap(), 0, pMouseInfo); } return 1;
6 years, 7 months
1
0
0
0
01/01: [CALC][CLIPBRD][SOLITAIRE][SPIDER][NOTEPAD][REGEDIT][TASKMGR] Disable help menu/button
by Bișoc George
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6c16f12de5268d7b46501…
commit 6c16f12de5268d7b46501622842e80d82902040f Author: Bișoc George <fraizeraust99(a)gmail.com> AuthorDate: Tue Apr 24 19:58:46 2018 +0200 Commit: David Quintana <gigaherz(a)gmail.com> CommitDate: Sun Apr 29 15:24:11 2018 +0200 [CALC][CLIPBRD][SOLITAIRE][SPIDER][NOTEPAD][REGEDIT][TASKMGR] Disable help menu/button --- base/applications/calc/winmain.c | 2 ++ base/applications/charmap/charmap.c | 2 ++ base/applications/clipbrd/clipbrd.c | 4 ++++ base/applications/games/solitaire/solitaire.cpp | 6 ++++++ base/applications/games/spider/spider.cpp | 3 +++ base/applications/notepad/main.c | 3 +++ base/applications/regedit/framewnd.c | 2 ++ base/applications/taskmgr/taskmgr.c | 2 ++ 8 files changed, 24 insertions(+) diff --git a/base/applications/calc/winmain.c b/base/applications/calc/winmain.c index 02c93a5959..e976131996 100644 --- a/base/applications/calc/winmain.c +++ b/base/applications/calc/winmain.c @@ -1269,6 +1269,8 @@ static INT_PTR CALLBACK DlgMainProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) return SubclassButtonProc(hWnd, wp, lp); case WM_INITDIALOG: + // For now, the Help dialog is disabled because of lacking of HTML Help support + EnableMenuItem(GetMenu(hWnd), IDM_HELP_HELP, MF_BYCOMMAND | MF_GRAYED); calc.hWnd=hWnd; #ifdef USE_KEYBOARD_HOOK diff --git a/base/applications/charmap/charmap.c b/base/applications/charmap/charmap.c index 85378ecc95..35cc8e6f9f 100644 --- a/base/applications/charmap/charmap.c +++ b/base/applications/charmap/charmap.c @@ -490,6 +490,8 @@ PanelWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_CREATE: + // For now, the Help push button is disabled because of lacking of HTML Help support + EnableWindow(GetDlgItem(hWnd, IDC_CMHELP), FALSE); return PanelOnCreate(hWnd, wParam, lParam); case WM_CLOSE: diff --git a/base/applications/clipbrd/clipbrd.c b/base/applications/clipbrd/clipbrd.c index bef831cd8b..f46daeb6e4 100644 --- a/base/applications/clipbrd/clipbrd.c +++ b/base/applications/clipbrd/clipbrd.c @@ -349,6 +349,10 @@ static LRESULT WINAPI MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP { Globals.hMenu = GetMenu(hWnd); Globals.hWndNext = SetClipboardViewer(hWnd); + + // For now, the Help dialog item is disabled because of lacking of HTML support + EnableMenuItem(Globals.hMenu, CMD_HELP, MF_BYCOMMAND | MF_GRAYED); + UpdateDisplayMenu(); SetDisplayFormat(0); break; diff --git a/base/applications/games/solitaire/solitaire.cpp b/base/applications/games/solitaire/solitaire.cpp index a5b9da40a7..84895cb570 100644 --- a/base/applications/games/solitaire/solitaire.cpp +++ b/base/applications/games/solitaire/solitaire.cpp @@ -277,6 +277,9 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar switch (uMsg) { case WM_INITDIALOG: + // For now, the Help dialog item is disabled because of lacking of HTML Help support + EnableMenuItem(GetMenu(hDlg), IDM_HELP_CONTENTS, MF_BYCOMMAND | MF_GRAYED); + CheckRadioButton(hDlg, IDC_OPT_DRAWONE, IDC_OPT_DRAWTHREE, (dwOptions & OPTION_THREE_CARDS) ? IDC_OPT_DRAWTHREE : IDC_OPT_DRAWONE); @@ -603,6 +606,9 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) int parts[] = { 150, -1 }; RECT rcStatus; + // For now, the Help dialog item is disabled because of lacking of HTML Help support + EnableMenuItem(GetMenu(hwnd), IDM_HELP_CONTENTS, MF_BYCOMMAND | MF_GRAYED); + hwndStatus = CreateStatusWindow(WS_CHILD | WS_VISIBLE | CCS_BOTTOM | SBARS_SIZEGRIP, _T("Ready"), hwnd, 0); //SendMessage(hwndStatus, SB_SIMPLE, (WPARAM)TRUE, 0); diff --git a/base/applications/games/spider/spider.cpp b/base/applications/games/spider/spider.cpp index 8b5ab8b9e2..a301254bc2 100644 --- a/base/applications/games/spider/spider.cpp +++ b/base/applications/games/spider/spider.cpp @@ -310,6 +310,9 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { case WM_CREATE: { + // For now, the Help dialog is disabled because of lacking of HTML Help support + EnableMenuItem(GetMenu(hwnd), IDM_HELP_CONTENTS, MF_BYCOMMAND | MF_GRAYED); + SpiderWnd.Create(hwnd, 0, WS_CHILD | WS_VISIBLE, 0, 0, 100, 100); dwDifficulty = IDC_DIF_ONECOLOR; CreateSpider(); diff --git a/base/applications/notepad/main.c b/base/applications/notepad/main.c index 60d453ccb5..1540b73635 100644 --- a/base/applications/notepad/main.c +++ b/base/applications/notepad/main.c @@ -353,6 +353,9 @@ NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_CREATE: Globals.hMenu = GetMenu(hWnd); + + // For now, the "Help" dialog is disabled due to the lack of HTML Help support + EnableMenuItem(Globals.hMenu, CMD_HELP_CONTENTS, MF_BYCOMMAND | MF_GRAYED); break; case WM_COMMAND: diff --git a/base/applications/regedit/framewnd.c b/base/applications/regedit/framewnd.c index a16019ede2..7bddbf8158 100644 --- a/base/applications/regedit/framewnd.c +++ b/base/applications/regedit/framewnd.c @@ -1306,6 +1306,8 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa switch (message) { case WM_CREATE: + // For now, the Help dialog item is disabled because of lacking of HTML Help support + EnableMenuItem(GetMenu(hWnd), ID_HELP_HELPTOPICS, MF_BYCOMMAND | MF_GRAYED); CreateWindowExW(0, szChildClass, NULL, WS_CHILD | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWnd, (HMENU)0, hInst, 0); diff --git a/base/applications/taskmgr/taskmgr.c b/base/applications/taskmgr/taskmgr.c index edd50326ed..29afc59d4d 100644 --- a/base/applications/taskmgr/taskmgr.c +++ b/base/applications/taskmgr/taskmgr.c @@ -210,6 +210,8 @@ TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_INITDIALOG: + // For now, the Help dialog menu item is disabled because of lacking of HTML Help support + EnableMenuItem(GetMenu(hDlg), ID_HELP_TOPICS, MF_BYCOMMAND | MF_GRAYED); hMainWnd = hDlg; return OnCreate(hDlg);
6 years, 7 months
1
0
0
0
01/01: [SYSSETUP] Read driver settings from and write them to the registry
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1cb019bd21d09f6645a3f…
commit 1cb019bd21d09f6645a3f57a710e4f9ed28c180b Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Apr 29 14:55:57 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Apr 29 14:55:57 2018 +0200 [SYSSETUP] Read driver settings from and write them to the registry - Read the driver settings from the registry. - Write the driver settings to the registry. - Make the read-only edit control for the input buffer length look like a non-read-only one because it is controlled by the up-down control. --- dll/win32/syssetup/proppage.c | 306 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 292 insertions(+), 14 deletions(-) diff --git a/dll/win32/syssetup/proppage.c b/dll/win32/syssetup/proppage.c index eb38cf988f..4072b224fd 100644 --- a/dll/win32/syssetup/proppage.c +++ b/dll/win32/syssetup/proppage.c @@ -11,8 +11,22 @@ #define NDEBUG #include <debug.h> +typedef struct _MOUSE_INFO +{ + HKEY hDeviceKey; + DWORD dwSampleRateIndex; + DWORD dwWheelDetection; + DWORD dwInputBufferLength; + DWORD dwInitPolled; +} MOUSE_INFO, *PMOUSE_INFO; + DWORD MouseSampleRates[] = {20, 40, 60, 80, 100, 200}; +#define DEFAULT_SAMPLERATEINDEX 4 +#define DEFAULT_WHEELDETECTION 2 +#define DEFAULT_INPUTBUFFERSIZE 100 +#define DEFAULT_MINBUFFERSIZE 100 +#define DEFAULT_MAXBUFFERSIZE 300 /* * @implemented @@ -80,13 +94,42 @@ LegacyDriverPropPageProvider( static -VOID +DWORD +MouseGetSampleRateIndex( + DWORD dwSampleRate) +{ + DWORD i; + + for (i = 0; i < ARRAYSIZE(MouseSampleRates); i++) + { + if (MouseSampleRates[i] == dwSampleRate) + return i; + } + + return DEFAULT_SAMPLERATEINDEX; +} + + +static +BOOL MouseOnDialogInit( HWND hwndDlg, LPARAM lParam) { + PMOUSE_INFO pMouseInfo; WCHAR szBuffer[64]; UINT i; + DWORD dwType, dwSize; + DWORD dwSampleRate; + LONG lError; + + /* Get the pointer to the mouse info struct */ + pMouseInfo = (PMOUSE_INFO)((LPPROPSHEETPAGE)lParam)->lParam; + if (pMouseInfo == NULL) + return FALSE; + + /* Keep the pointer to the mouse info struct */ + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (DWORD_PTR)pMouseInfo); /* Add the sample rates */ for (i = 0; i < ARRAYSIZE(MouseSampleRates); i++) @@ -99,6 +142,31 @@ MouseOnDialogInit( (LPARAM)szBuffer); } + /* Read the SampleRate parameter */ + dwSize = sizeof(DWORD); + lError = RegQueryValueExW(pMouseInfo->hDeviceKey, + L"SampleRate", + NULL, + &dwType, + (LPBYTE)&dwSampleRate, + &dwSize); + if (lError == ERROR_SUCCESS && dwType == REG_DWORD && dwSize == sizeof(DWORD)) + { + pMouseInfo->dwSampleRateIndex = MouseGetSampleRateIndex(dwSampleRate); + } + else + { + /* Set the default sample rate (100 samples per second) */ + pMouseInfo->dwSampleRateIndex = DEFAULT_SAMPLERATEINDEX; + } + + /* Set the sample rate */ + SendDlgItemMessageW(hwndDlg, + IDC_PS2MOUSESAMPLERATE, + CB_SETCURSEL, + pMouseInfo->dwSampleRateIndex, + 0); + /* Add the detection options */ for (i = IDS_DETECTIONDISABLED; i <= IDS_ASSUMEPRESENT; i++) { @@ -110,18 +178,77 @@ MouseOnDialogInit( (LPARAM)szBuffer); } + /* Read the EnableWheelDetection parameter */ + dwSize = sizeof(DWORD); + lError = RegQueryValueExW(pMouseInfo->hDeviceKey, + L"EnableWheelDetection", + NULL, + &dwType, + (LPBYTE)&pMouseInfo->dwWheelDetection, + &dwSize); + if (lError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD)) + { + /* Set the default wheel detection parameter */ + pMouseInfo->dwWheelDetection = DEFAULT_WHEELDETECTION; + } + + /* Set the wheel detection parameter */ + SendDlgItemMessageW(hwndDlg, + IDC_PS2MOUSEWHEEL, + CB_SETCURSEL, + pMouseInfo->dwWheelDetection, + 0); + /* Set the input buffer length range: 100-300 */ SendDlgItemMessageW(hwndDlg, IDC_PS2MOUSEINPUTUPDN, UDM_SETRANGE32, - 100, - 300); + DEFAULT_MINBUFFERSIZE, + DEFAULT_MAXBUFFERSIZE); + + /* Read the MouseDataQueueSize parameter */ + dwSize = sizeof(DWORD); + lError = RegQueryValueExW(pMouseInfo->hDeviceKey, + L"MouseDataQueueSize", + NULL, + &dwType, + (LPBYTE)&pMouseInfo->dwInputBufferLength, + &dwSize); + if (lError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD)) + { + /* Set the default input buffer length (100 packets) */ + pMouseInfo->dwInputBufferLength = DEFAULT_INPUTBUFFERSIZE; + } + /* Set the input buffer length */ SendDlgItemMessageW(hwndDlg, IDC_PS2MOUSEINPUTUPDN, UDM_SETPOS32, 0, - 100); + pMouseInfo->dwInputBufferLength); + + /* Read the MouseInitializePolled parameter */ + dwSize = sizeof(DWORD); + lError = RegQueryValueExW(pMouseInfo->hDeviceKey, + L"MouseInitializePolled", + NULL, + &dwType, + (LPBYTE)&pMouseInfo->dwInitPolled, + &dwSize); + if (lError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD)) + { + /* Set the default init polled value (FALSE) */ + pMouseInfo->dwInitPolled = 0; + } + + /* Set the fast initialization option */ + SendDlgItemMessage(hwndDlg, + IDC_PS2MOUSEFASTINIT, + BM_SETCHECK, + (pMouseInfo->dwInitPolled == 0) ? BST_CHECKED : 0, + 0); + + return TRUE; } @@ -153,14 +280,14 @@ MouseOnCommand( SendDlgItemMessageW(hwndDlg, IDC_PS2MOUSESAMPLERATE, CB_SETCURSEL, - 4, + DEFAULT_SAMPLERATEINDEX, 0); /* Wheel detection: Assume wheel present */ SendDlgItemMessageW(hwndDlg, IDC_PS2MOUSEWHEEL, CB_SETCURSEL, - 2, + DEFAULT_WHEELDETECTION, 0); /* Input buffer length: 100 packets */ @@ -168,7 +295,7 @@ MouseOnCommand( IDC_PS2MOUSEINPUTUPDN, UDM_SETPOS32, 0, - 100); + DEFAULT_INPUTBUFFERSIZE); /* Fast Initialization: Checked */ SendDlgItemMessage(hwndDlg, @@ -188,6 +315,100 @@ MouseOnCommand( } +static +VOID +MouseOnApply( + HWND hwndDlg) +{ + PMOUSE_INFO pMouseInfo; + DWORD dwSampleRateIndex = 0; + DWORD dwSampleRate, dwWheelDetection; + DWORD dwInputBufferLength; + DWORD dwInitPolled; + UINT uValue; + BOOL bFailed; + INT nIndex; + + pMouseInfo = (PMOUSE_INFO)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + + /* Get the sample rate setting and store it if it was changed */ + nIndex = SendDlgItemMessageW(hwndDlg, IDC_PS2MOUSESAMPLERATE, + CB_GETCURSEL, 0, 0); + if (nIndex == CB_ERR) + dwSampleRateIndex = DEFAULT_SAMPLERATEINDEX; + else + dwSampleRateIndex = (DWORD)nIndex; + + if (dwSampleRateIndex != pMouseInfo->dwSampleRateIndex) + { + dwSampleRate = MouseSampleRates[dwSampleRateIndex]; + RegSetValueExW(pMouseInfo->hDeviceKey, + L"SampleRate", + 0, + REG_DWORD, + (LPBYTE)&dwSampleRate, + sizeof(dwSampleRate)); + } + + /* Get the wheel detection setting and store it if it was changed */ + nIndex = SendDlgItemMessageW(hwndDlg, IDC_PS2MOUSEWHEEL, + CB_GETCURSEL, 0, 0); + if (nIndex == CB_ERR) + dwWheelDetection = DEFAULT_WHEELDETECTION; + else + dwWheelDetection = (DWORD)nIndex; + + if (dwWheelDetection != pMouseInfo->dwWheelDetection) + { + RegSetValueExW(pMouseInfo->hDeviceKey, + L"EnableWheelDetection", + 0, + REG_DWORD, + (LPBYTE)&dwWheelDetection, + sizeof(dwWheelDetection)); + } + + /* Get the input buffer length setting and store it if it was changed */ + uValue = SendDlgItemMessageW(hwndDlg, + IDC_PS2MOUSEINPUTUPDN, + UDM_GETPOS32, + 0, + (LPARAM)&bFailed); + if (bFailed) + dwInputBufferLength = DEFAULT_INPUTBUFFERSIZE; + else + dwInputBufferLength = (DWORD)uValue; + + if (dwInputBufferLength != pMouseInfo->dwInputBufferLength) + { + RegSetValueExW(pMouseInfo->hDeviceKey, + L"MouseDataQueueSize", + 0, + REG_DWORD, + (LPBYTE)&dwInputBufferLength, + sizeof(dwInputBufferLength)); + } + + /* Get the fast initialization setting and store it if it was changed */ + uValue = SendDlgItemMessage(hwndDlg, + IDC_PS2MOUSEFASTINIT, + BM_GETCHECK, + 0, + 0); + dwInitPolled = (uValue == BST_CHECKED) ? 0 : 1; + + if (dwInitPolled != pMouseInfo->dwInitPolled) + { + RegSetValueExW(pMouseInfo->hDeviceKey, + L"MouseInitializePolled", + 0, + REG_DWORD, + (LPBYTE)&dwInitPolled, + sizeof(dwInitPolled)); + } +} + + static BOOL MouseOnNotify( @@ -195,21 +416,41 @@ MouseOnNotify( WPARAM wParam, LPARAM lParam) { - switch (((LPNMHDR)lParam)->idFrom) + switch (((LPNMHDR)lParam)->code) { - case IDC_PS2MOUSEINPUTUPDN: - if (((LPNMHDR)lParam)->code == UDN_DELTAPOS) + case UDN_DELTAPOS: + if (((LPNMHDR)lParam)->idFrom == IDC_PS2MOUSEINPUTUPDN) { ((LPNMUPDOWN)lParam)->iDelta *= 10; return FALSE; } break; + + case PSN_APPLY: + MouseOnApply(hwndDlg); + return TRUE; } return FALSE; } +static +INT_PTR +MouseOnCtrlColorStatic( + HWND hwndDlg, + WPARAM wParam, + LPARAM lParam) +{ + if ((HWND)lParam != GetDlgItem(hwndDlg, IDC_PS2MOUSEINPUTLEN)) + return 0; + + SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); + SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW)); + return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); +} + + static INT_PTR CALLBACK @@ -224,8 +465,7 @@ MouseDlgProc( switch (uMsg) { case WM_INITDIALOG: - MouseOnDialogInit(hwndDlg, lParam); - return TRUE; + return MouseOnDialogInit(hwndDlg, lParam); case WM_COMMAND: MouseOnCommand(hwndDlg, wParam, lParam); @@ -234,12 +474,30 @@ MouseDlgProc( case WM_NOTIFY: return MouseOnNotify(hwndDlg, wParam, lParam); + case WM_CTLCOLORSTATIC: + return MouseOnCtrlColorStatic(hwndDlg, wParam, lParam); } return FALSE; } +static +UINT +CALLBACK +MouseCallback( + HWND hWnd, + UINT uMsg, + LPPROPSHEETPAGE ppsp) +{ + if (uMsg == PSPCB_RELEASE) + { + HeapFree(GetProcessHeap(), 0, (PMOUSE_INFO)ppsp->lParam); + } + + return 1; +} + /* * @implemented @@ -253,6 +511,7 @@ PS2MousePropPageProvider( { PROPSHEETPAGEW PropSheetPage; HPROPSHEETPAGE hPropSheetPage; + PMOUSE_INFO pMouseInfo; DPRINT("PS2MousePropPageProvider(%p %p %lx)\n", lpPropSheetPageRequest, lpfnAddPropSheetPageProc, lParam); @@ -260,18 +519,36 @@ PS2MousePropPageProvider( if (lpPropSheetPageRequest->PageRequested != SPPSR_ENUM_ADV_DEVICE_PROPERTIES) return FALSE; + pMouseInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MOUSE_INFO)); + if (pMouseInfo == NULL) + return FALSE; + + pMouseInfo->hDeviceKey = SetupDiOpenDevRegKey(lpPropSheetPageRequest->DeviceInfoSet, + lpPropSheetPageRequest->DeviceInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DEV, + KEY_ALL_ACCESS); + if (pMouseInfo->hDeviceKey == INVALID_HANDLE_VALUE) + { + DPRINT1("SetupDiOpenDevRegKey() failed (Error %lu)\n", GetLastError()); + HeapFree(GetProcessHeap(), 0, pMouseInfo); + return FALSE; + } + PropSheetPage.dwSize = sizeof(PROPSHEETPAGEW); PropSheetPage.dwFlags = 0; PropSheetPage.hInstance = hDllInstance; PropSheetPage.pszTemplate = MAKEINTRESOURCE(IDD_PS2MOUSEPROPERTIES); PropSheetPage.pfnDlgProc = MouseDlgProc; - PropSheetPage.lParam = 0; - PropSheetPage.pfnCallback = NULL; + PropSheetPage.lParam = (LPARAM)pMouseInfo; + PropSheetPage.pfnCallback = MouseCallback; hPropSheetPage = CreatePropertySheetPageW(&PropSheetPage); if (hPropSheetPage == NULL) { DPRINT1("CreatePropertySheetPageW() failed!\n"); + HeapFree(GetProcessHeap(), 0, pMouseInfo); return FALSE; } @@ -279,6 +556,7 @@ PS2MousePropPageProvider( { DPRINT1("lpfnAddPropSheetPageProc() failed!\n"); DestroyPropertySheetPage(hPropSheetPage); + HeapFree(GetProcessHeap(), 0, pMouseInfo); return FALSE; }
6 years, 7 months
1
0
0
0
02/02: [FASTFAT] Reduce the number of local declaration.
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=00e843b1edf2e20272169…
commit 00e843b1edf2e20272169ac80be3268d7db64112 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sun Apr 29 12:33:53 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Apr 29 12:33:53 2018 +0200 [FASTFAT] Reduce the number of local declaration. --- drivers/filesystems/fastfat/iface.c | 14 -------------- drivers/filesystems/fastfat/vfat.h | 8 ++++++++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/filesystems/fastfat/iface.c b/drivers/filesystems/fastfat/iface.c index 903b1af3d6..41653a2549 100644 --- a/drivers/filesystems/fastfat/iface.c +++ b/drivers/filesystems/fastfat/iface.c @@ -30,24 +30,10 @@ #define NDEBUG #include <debug.h> -#ifdef KDBG -#include <ndk/kdfuncs.h> -#include <reactos/kdros.h> -#endif - #if defined(ALLOC_PRAGMA) #pragma alloc_text(INIT, DriverEntry) #endif -#ifdef KDBG -BOOLEAN -NTAPI -vfatKdbgHandler( - IN PCHAR Command, - IN ULONG Argc, - IN PCH Argv[]); -#endif - /* GLOBALS *****************************************************************/ PVFAT_GLOBAL_DATA VfatGlobalData; diff --git a/drivers/filesystems/fastfat/vfat.h b/drivers/filesystems/fastfat/vfat.h index 0de6a486a0..5bb5289feb 100644 --- a/drivers/filesystems/fastfat/vfat.h +++ b/drivers/filesystems/fastfat/vfat.h @@ -5,6 +5,10 @@ #include <ntdddisk.h> #include <dos.h> #include <pseh/pseh2.h> +#ifdef KDBG +#include <ndk/kdfuncs.h> +#include <reactos/kdros.h> +#endif #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) @@ -1042,6 +1046,10 @@ DriverEntry( PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath); +#ifdef KDBG +/* kdbg.c */ +KDBG_CLI_ROUTINE vfatKdbgHandler; +#endif /* misc.c */
6 years, 7 months
1
0
0
0
01/02: [SDK] Enforce callback type for KdRosRegisterCliCallback(), KdRosDeregisterCliCallback().
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3dc4d408b2d04cb953c73…
commit 3dc4d408b2d04cb953c7361a9ad5b428f77c4669 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sun Apr 29 12:33:14 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Apr 29 12:33:14 2018 +0200 [SDK] Enforce callback type for KdRosRegisterCliCallback(), KdRosDeregisterCliCallback(). --- sdk/include/reactos/kdros.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/include/reactos/kdros.h b/sdk/include/reactos/kdros.h index 30d85b64e6..50ede783eb 100644 --- a/sdk/include/reactos/kdros.h +++ b/sdk/include/reactos/kdros.h @@ -46,10 +46,18 @@ KdRosDumpStackFrames( } #if defined(KDBG) +typedef +BOOLEAN +(NTAPI KDBG_CLI_ROUTINE)( + IN PCHAR Command, + IN ULONG Argc, + IN PCH Argv[]); +typedef KDBG_CLI_ROUTINE *PKDBG_CLI_ROUTINE; + FORCEINLINE ULONG KdRosRegisterCliCallback( - PVOID Callback) + PKDBG_CLI_ROUTINE Callback) { return KdSystemDebugControl('RbdK', Callback, FALSE, 0, 0, 0, 0); } @@ -57,7 +65,7 @@ KdRosRegisterCliCallback( FORCEINLINE VOID KdRosDeregisterCliCallback( - PVOID Callback) + PKDBG_CLI_ROUTINE Callback) { KdSystemDebugControl('RbdK', Callback, TRUE, 0, 0, 0, 0); }
6 years, 7 months
1
0
0
0
02/02: [FASTFAT] Use KdRosRegisterCliCallback() to register in KDBG.
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fd8197645f583d58fcc7e…
commit fd8197645f583d58fcc7e63267872be2e08a63fb Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sun Apr 29 12:23:18 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Apr 29 12:23:18 2018 +0200 [FASTFAT] Use KdRosRegisterCliCallback() to register in KDBG. --- drivers/filesystems/fastfat/iface.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/filesystems/fastfat/iface.c b/drivers/filesystems/fastfat/iface.c index b73854dbcd..903b1af3d6 100644 --- a/drivers/filesystems/fastfat/iface.c +++ b/drivers/filesystems/fastfat/iface.c @@ -30,21 +30,16 @@ #define NDEBUG #include <debug.h> +#ifdef KDBG +#include <ndk/kdfuncs.h> +#include <reactos/kdros.h> +#endif + #if defined(ALLOC_PRAGMA) #pragma alloc_text(INIT, DriverEntry) #endif #ifdef KDBG -NTSTATUS -NTAPI -KdSystemDebugControl(IN ULONG Command, - IN PVOID InputBuffer, - IN ULONG InputBufferLength, - OUT PVOID OutputBuffer, - IN ULONG OutputBufferLength, - IN OUT PULONG ReturnLength, - IN KPROCESSOR_MODE PreviousMode); - BOOLEAN NTAPI vfatKdbgHandler( @@ -160,7 +155,7 @@ DriverEntry( { BOOLEAN Registered; - Registered = KdSystemDebugControl('RbdK', vfatKdbgHandler, FALSE, NULL, 0, NULL, KernelMode); + Registered = KdRosRegisterCliCallback(vfatKdbgHandler); DPRINT1("FastFAT KDBG extension registered: %s\n", (Registered ? "yes" : "no")); } #endif
6 years, 7 months
1
0
0
0
01/02: [SDK] Make KdRosRegisterCliCallback() return status from KdSystemDebugControl().
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=de8861159020249b6403e…
commit de8861159020249b6403e547ea8e3a9f3c024bb6 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sun Apr 29 12:19:21 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Apr 29 12:19:21 2018 +0200 [SDK] Make KdRosRegisterCliCallback() return status from KdSystemDebugControl(). --- sdk/include/reactos/kdros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/include/reactos/kdros.h b/sdk/include/reactos/kdros.h index 94aa5adc8f..30d85b64e6 100644 --- a/sdk/include/reactos/kdros.h +++ b/sdk/include/reactos/kdros.h @@ -47,11 +47,11 @@ KdRosDumpStackFrames( #if defined(KDBG) FORCEINLINE -VOID +ULONG KdRosRegisterCliCallback( PVOID Callback) { - KdSystemDebugControl('RbdK', Callback, FALSE, 0, 0, 0, 0); + return KdSystemDebugControl('RbdK', Callback, FALSE, 0, 0, 0, 0); } FORCEINLINE
6 years, 7 months
1
0
0
0
01/01: [FASTFAT] Introduce a KDBG extension.
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c5a35ecd3761b9a4dbdc8…
commit c5a35ecd3761b9a4dbdc87c66447b70fb9d4e785 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Apr 28 09:34:10 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Apr 29 12:15:11 2018 +0200 [FASTFAT] Introduce a KDBG extension. This is a PoC of what it's possible to realize thanks to an already existing hack in ntoskrnl :-). With this extension, on the kdb:> prompt, you're able to type in commands that will be handled by the FastFAT driver and not by the kernel, allowing internal debug, not possible otherwise. So far, three commands exist: - ?fat.vols: lists all the mounted volumes by FastFAT - ?fat.files: lists all the files on a specific volume (with their attributes) - ?fat.setdbgfile: allows watching on specifics files lifetime This is obviously only the begin and could be greatly improved. For instance, this is what allowed to debug CORE-14557 --- drivers/filesystems/fastfat/CMakeLists.txt | 1 + drivers/filesystems/fastfat/cleanup.c | 3 + drivers/filesystems/fastfat/close.c | 3 + drivers/filesystems/fastfat/fcb.c | 70 ++++++++++++- drivers/filesystems/fastfat/iface.c | 28 +++++ drivers/filesystems/fastfat/kdbg.c | 161 +++++++++++++++++++++++++++++ drivers/filesystems/fastfat/vfat.h | 35 ++++++- 7 files changed, 297 insertions(+), 4 deletions(-) diff --git a/drivers/filesystems/fastfat/CMakeLists.txt b/drivers/filesystems/fastfat/CMakeLists.txt index 087f9e3f62..cc69334b01 100644 --- a/drivers/filesystems/fastfat/CMakeLists.txt +++ b/drivers/filesystems/fastfat/CMakeLists.txt @@ -15,6 +15,7 @@ list(APPEND SOURCE flush.c fsctl.c iface.c + kdbg.c misc.c pnp.c rw.c diff --git a/drivers/filesystems/fastfat/cleanup.c b/drivers/filesystems/fastfat/cleanup.c index 580ed807a3..3ab4a101d1 100644 --- a/drivers/filesystems/fastfat/cleanup.c +++ b/drivers/filesystems/fastfat/cleanup.c @@ -138,6 +138,9 @@ VfatCleanupFile( } FileObject->Flags |= FO_CLEANUP_COMPLETE; +#ifdef KDBG + pFcb->Flags |= FCB_CLEANED_UP; +#endif ExReleaseResourceLite(&pFcb->PagingIoResource); ExReleaseResourceLite(&pFcb->MainResource); diff --git a/drivers/filesystems/fastfat/close.c b/drivers/filesystems/fastfat/close.c index b4e5fda308..992ccac4c2 100644 --- a/drivers/filesystems/fastfat/close.c +++ b/drivers/filesystems/fastfat/close.c @@ -48,6 +48,9 @@ VfatCloseFile( } else { +#ifdef KDBG + pFcb->Flags |= FCB_CLOSED; +#endif vfatReleaseFCB(DeviceExt, pFcb); } diff --git a/drivers/filesystems/fastfat/fcb.c b/drivers/filesystems/fastfat/fcb.c index f6734a675e..33124bc51b 100644 --- a/drivers/filesystems/fastfat/fcb.c +++ b/drivers/filesystems/fastfat/fcb.c @@ -24,6 +24,10 @@ #define TAG_FCB 'BCFV' +#ifdef KDBG +extern UNICODE_STRING DebugFile; +#endif + /* -------------------------------------------------------- PUBLICS */ static @@ -267,6 +271,13 @@ VOID vfatDestroyFCB( PVFATFCB pFCB) { +#ifdef KDBG + if (DebugFile.Buffer != NULL && FsRtlIsNameInExpression(&DebugFile, &pFCB->LongNameU, FALSE, NULL)) + { + DPRINT1("Destroying: %p (%wZ) %d\n", pFCB, &pFCB->PathNameU, pFCB->RefCount); + } +#endif + FsRtlUninitializeFileLock(&pFCB->FileLock); if (!vfatFCBIsRoot(pFCB) && !BooleanFlagOn(pFCB->Flags, FCB_IS_FAT) && !BooleanFlagOn(pFCB->Flags, FCB_IS_VOLUME)) @@ -288,10 +299,28 @@ vfatFCBIsRoot( } VOID +#ifndef KDBG vfatGrabFCB( +#else +_vfatGrabFCB( +#endif PDEVICE_EXTENSION pVCB, - PVFATFCB pFCB) + PVFATFCB pFCB +#ifdef KDBG + , + PCSTR File, + ULONG Line, + PCSTR Func +#endif +) { +#ifdef KDBG + if (DebugFile.Buffer != NULL && FsRtlIsNameInExpression(&DebugFile, &pFCB->LongNameU, FALSE, NULL)) + { + DPRINT1("Inc ref count (%d, oc: %d) for: %p (%wZ) at: %s(%d) %s\n", pFCB->RefCount, pFCB->OpenHandleCount, pFCB, &pFCB->PathNameU, File, Line, Func); + } +#endif + ASSERT(ExIsResourceAcquiredExclusive(&pVCB->DirResource)); ASSERT(pFCB != pVCB->VolumeFcb); @@ -300,14 +329,32 @@ vfatGrabFCB( } VOID +#ifndef KDBG vfatReleaseFCB( +#else +_vfatReleaseFCB( +#endif PDEVICE_EXTENSION pVCB, - PVFATFCB pFCB) + PVFATFCB pFCB +#ifdef KDBG + , + PCSTR File, + ULONG Line, + PCSTR Func +#endif +) { PVFATFCB tmpFcb; +#ifdef KDBG + if (DebugFile.Buffer != NULL && FsRtlIsNameInExpression(&DebugFile, &pFCB->LongNameU, FALSE, NULL)) + { + DPRINT1("Dec ref count (%d, oc: %d) for: %p (%wZ) at: %s(%d) %s\n", pFCB->RefCount, pFCB->OpenHandleCount, pFCB, &pFCB->PathNameU, File, Line, Func); + } +#else DPRINT("releasing FCB at %p: %wZ, refCount:%d\n", pFCB, &pFCB->PathNameU, pFCB->RefCount); +#endif ASSERT(ExIsResourceAcquiredExclusive(&pVCB->DirResource)); @@ -605,6 +652,13 @@ vfatFCBInitializeCacheFromVolume( fileObject = IoCreateStreamFileObject (NULL, vcb->StorageDevice); +#ifdef KDBG + if (DebugFile.Buffer != NULL && FsRtlIsNameInExpression(&DebugFile, &fcb->LongNameU, FALSE, NULL)) + { + DPRINT1("Attaching %p to %p (%d)\n", fcb, fileObject, fcb->RefCount); + } +#endif + newCCB = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList); if (newCCB == NULL) { @@ -762,6 +816,13 @@ vfatAttachFCBToFileObject( UNREFERENCED_PARAMETER(vcb); +#ifdef KDBG + if (DebugFile.Buffer != NULL && FsRtlIsNameInExpression(&DebugFile, &fcb->LongNameU, FALSE, NULL)) + { + DPRINT1("Attaching %p to %p (%d)\n", fcb, fileObject, fcb->RefCount); + } +#endif + newCCB = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList); if (newCCB == NULL) { @@ -774,6 +835,11 @@ vfatAttachFCBToFileObject( fileObject->FsContext2 = newCCB; DPRINT("file open: fcb:%p PathName:%wZ\n", fcb, &fcb->PathNameU); +#ifdef KDBG + fcb->Flags &= ~FCB_CLEANED_UP; + fcb->Flags &= ~FCB_CLOSED; +#endif + return STATUS_SUCCESS; } diff --git a/drivers/filesystems/fastfat/iface.c b/drivers/filesystems/fastfat/iface.c index 02e570ea45..b73854dbcd 100644 --- a/drivers/filesystems/fastfat/iface.c +++ b/drivers/filesystems/fastfat/iface.c @@ -34,6 +34,24 @@ #pragma alloc_text(INIT, DriverEntry) #endif +#ifdef KDBG +NTSTATUS +NTAPI +KdSystemDebugControl(IN ULONG Command, + IN PVOID InputBuffer, + IN ULONG InputBufferLength, + OUT PVOID OutputBuffer, + IN ULONG OutputBufferLength, + IN OUT PULONG ReturnLength, + IN KPROCESSOR_MODE PreviousMode); + +BOOLEAN +NTAPI +vfatKdbgHandler( + IN PCHAR Command, + IN ULONG Argc, + IN PCH Argv[]); +#endif /* GLOBALS *****************************************************************/ @@ -137,6 +155,16 @@ DriverEntry( ExInitializeResourceLite(&VfatGlobalData->VolumeListLock); InitializeListHead(&VfatGlobalData->VolumeListHead); IoRegisterFileSystem(DeviceObject); + +#ifdef KDBG + { + BOOLEAN Registered; + + Registered = KdSystemDebugControl('RbdK', vfatKdbgHandler, FALSE, NULL, 0, NULL, KernelMode); + DPRINT1("FastFAT KDBG extension registered: %s\n", (Registered ? "yes" : "no")); + } +#endif + return STATUS_SUCCESS; } diff --git a/drivers/filesystems/fastfat/kdbg.c b/drivers/filesystems/fastfat/kdbg.c new file mode 100644 index 0000000000..b278329299 --- /dev/null +++ b/drivers/filesystems/fastfat/kdbg.c @@ -0,0 +1,161 @@ +/* +* FILE: drivers/filesystems/fastfat/kdbg.c +* PURPOSE: KDBG extension. +* COPYRIGHT: See COPYING in the top level directory +* PROJECT: ReactOS kernel +* PROGRAMMER: Pierre Schweitzer (pierre(a)reactos.org) +*/ + +/* ------------------------------------------------------- INCLUDES */ + +#include "vfat.h" + +#define NDEBUG +#include <debug.h> + +#include <stdio.h> + +/* -------------------------------------------------------- DEFINES */ + +#ifdef KDBG +UNICODE_STRING DebugFile = {0, 0, NULL}; + +BOOLEAN +NTAPI +vfatKdbgHandler( + IN PCHAR Command, + IN ULONG Argc, + IN PCH Argv[]) +{ + ULONG Len; + + Len = strlen(Command); + if (Len < sizeof("?fat.")) + { + return FALSE; + } + + if (Command[0] != '?' || Command[1] != 'f' || + Command[2] != 'a' || Command[3] != 't' || + Command[4] != '.') + { + return FALSE; + } + + Command += (sizeof("?fat.") - sizeof(ANSI_NULL)); + if (strcmp(Command, "vols") == 0) + { + ULONG Count = 0; + PLIST_ENTRY ListEntry; + PDEVICE_EXTENSION DeviceExt; + + for (ListEntry = VfatGlobalData->VolumeListHead.Flink; + ListEntry != &VfatGlobalData->VolumeListHead; + ListEntry = ListEntry->Flink) + { + DeviceExt = CONTAINING_RECORD(ListEntry, DEVICE_EXTENSION, VolumeListEntry); + DPRINT1("Volume: %p with VCB: %p\n", DeviceExt->VolumeDevice, DeviceExt); + ++Count; + } + + if (Count == 0) + { + DPRINT1("No volume found\n"); + } + } + else if (strcmp(Command, "files") == 0) + { + if (Argc != 2) + { + DPRINT1("Please provide a volume or a VCB!\n"); + } + else + { + PLIST_ENTRY ListEntry; + PDEVICE_EXTENSION DeviceExt; + + for (ListEntry = VfatGlobalData->VolumeListHead.Flink; + ListEntry != &VfatGlobalData->VolumeListHead; + ListEntry = ListEntry->Flink) + { + CHAR Volume[17]; + + DeviceExt = CONTAINING_RECORD(ListEntry, DEVICE_EXTENSION, VolumeListEntry); + sprintf(Volume, "%p", DeviceExt); + if (strcmp(Volume, Argv[1]) == 0) + { + break; + } + + sprintf(Volume, "%p", DeviceExt->VolumeDevice); + if (strcmp(Volume, Argv[1]) == 0) + { + break; + } + + DeviceExt = NULL; + } + + if (DeviceExt == NULL) + { + DPRINT1("No volume %s found!\n", Argv[1]); + } + else + { + PVFATFCB Fcb; + + for (ListEntry = DeviceExt->FcbListHead.Flink; + ListEntry != &DeviceExt->FcbListHead; + ListEntry = ListEntry->Flink) + { + Fcb = CONTAINING_RECORD(ListEntry, VFATFCB, FcbListEntry); + DPRINT1("FCB %p (ref: %d, oc: %d %s %s) for FO %p with path: %.*S\n", + Fcb, Fcb->RefCount, Fcb->OpenHandleCount, + ((Fcb->Flags & FCB_CLEANED_UP) ? "U" : "NU"), + ((Fcb->Flags & FCB_CLOSED) ? "C" : "NC"), + Fcb->FileObject, Fcb->PathNameU.Length, Fcb->PathNameU.Buffer); + } + } + } + } + else if (strcmp(Command, "setdbgfile") == 0) + { + if (Argc < 2) + { + if (DebugFile.Buffer != NULL) + { + ExFreePool(DebugFile.Buffer); + DebugFile.Length = 0; + DebugFile.MaximumLength = 0; + } + + DPRINT1("Debug file reset\n"); + } + else + { + NTSTATUS Status; + ANSI_STRING Source; + + if (DebugFile.Buffer != NULL) + { + ExFreePool(DebugFile.Buffer); + DebugFile.Length = 0; + DebugFile.MaximumLength = 0; + } + + RtlInitAnsiString(&Source, Argv[1]); + Status = RtlAnsiStringToUnicodeString(&DebugFile, &Source, TRUE); + if (NT_SUCCESS(Status)) + { + DPRINT1("Debug file set to: %.*S\n", DebugFile.Length, DebugFile.Buffer); + } + } + } + else + { + DPRINT1("Unknown command: %s\n", Command); + } + + return TRUE; +} +#endif diff --git a/drivers/filesystems/fastfat/vfat.h b/drivers/filesystems/fastfat/vfat.h index 429120c804..0de6a486a0 100644 --- a/drivers/filesystems/fastfat/vfat.h +++ b/drivers/filesystems/fastfat/vfat.h @@ -409,6 +409,10 @@ extern PVFAT_GLOBAL_DATA VfatGlobalData; #define FCB_IS_PAGE_FILE 0x0008 #define FCB_IS_VOLUME 0x0010 #define FCB_IS_DIRTY 0x0020 +#ifdef KDBG +#define FCB_CLEANED_UP 0x0040 +#define FCB_CLOSED 0x0080 +#endif #define NODE_TYPE_FCB ((CSHORT)0x0502) @@ -898,14 +902,41 @@ vfatDestroyCCB( PVFATCCB pCcb); VOID +#ifndef KDBG vfatGrabFCB( +#else +_vfatGrabFCB( +#endif PDEVICE_EXTENSION pVCB, - PVFATFCB pFCB); + PVFATFCB pFCB +#ifdef KDBG + , + PCSTR File, + ULONG Line, + PCSTR Func +#endif + ); VOID +#ifndef KDBG vfatReleaseFCB( +#else +_vfatReleaseFCB( +#endif PDEVICE_EXTENSION pVCB, - PVFATFCB pFCB); + PVFATFCB pFCB +#ifdef KDBG + , + PCSTR File, + ULONG Line, + PCSTR Func +#endif + ); + +#ifdef KDBG +#define vfatGrabFCB(v, f) _vfatGrabFCB(v, f, __FILE__, __LINE__, __FUNCTION__) +#define vfatReleaseFCB(v, f) _vfatReleaseFCB(v, f, __FILE__, __LINE__, __FUNCTION__) +#endif PVFATFCB vfatGrabFCBFromTable(
6 years, 7 months
1
0
0
0
01/01: [WINLOGON] Usability enhancement for the RPC SystemShutdown functionality.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cb20bf8c903f42b64bb39…
commit cb20bf8c903f42b64bb397477b857b5cf4e4eb71 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Apr 28 18:14:53 2018 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Apr 29 01:02:05 2018 +0200 [WINLOGON] Usability enhancement for the RPC SystemShutdown functionality. - Perform an immediate system shutdown if the timeout is zero, otherwise display the countdown shutdown dialog. - Cleanup pShutdownParams->pszMessage as soon as the dialog goes away. - It actually appears (tested on Windows 2000 and 2003) that sending WM_CLOSE messages from a user-mode app to the shutdown dialog really do nothing (and in particular does not cancel the shutdown!), so modify the code to take this fact into account. --- base/system/winlogon/shutdown.c | 98 +++++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 33 deletions(-) diff --git a/base/system/winlogon/shutdown.c b/base/system/winlogon/shutdown.c index 42452ca067..d3b86aa140 100644 --- a/base/system/winlogon/shutdown.c +++ b/base/system/winlogon/shutdown.c @@ -30,7 +30,6 @@ typedef struct _SYS_SHUTDOWN_PARAMS BOOLEAN bForceAppsClosed; DWORD dwReason; - HWND hShutdownDialog; BOOLEAN bShuttingDown; } SYS_SHUTDOWN_PARAMS, *PSYS_SHUTDOWN_PARAMS; @@ -42,6 +41,36 @@ SYS_SHUTDOWN_PARAMS g_ShutdownParams; /* FUNCTIONS *****************************************************************/ +static +BOOL +DoSystemShutdown( + IN PSYS_SHUTDOWN_PARAMS pShutdownParams) +{ + BOOL Success; + + if (pShutdownParams->pszMessage) + { + HeapFree(GetProcessHeap(), 0, pShutdownParams->pszMessage); + pShutdownParams->pszMessage = NULL; + } + + /* If shutdown has been cancelled, bail out now */ + if (!pShutdownParams->bShuttingDown) + return TRUE; + + Success = ExitWindowsEx((pShutdownParams->bRebootAfterShutdown ? EWX_REBOOT : EWX_SHUTDOWN) | + (pShutdownParams->bForceAppsClosed ? EWX_FORCE : 0), + pShutdownParams->dwReason); + if (!Success) + { + /* Something went wrong, cancel shutdown */ + pShutdownParams->bShuttingDown = FALSE; + } + + return Success; +} + + static VOID OnTimer( @@ -51,6 +80,13 @@ OnTimer( WCHAR szBuffer[12]; INT iSeconds, iMinutes, iHours, iDays; + if (!pShutdownParams->bShuttingDown) + { + /* Shutdown has been cancelled, close the dialog and bail out */ + EndDialog(hwndDlg, 0); + return; + } + if (pShutdownParams->dwTimeout < SECONDS_PER_DAY) { iSeconds = (INT)pShutdownParams->dwTimeout; @@ -64,17 +100,17 @@ OnTimer( else { iDays = (INT)(pShutdownParams->dwTimeout / SECONDS_PER_DAY); - swprintf(szBuffer, L"%d days", iDays); + swprintf(szBuffer, L"%d days", iDays); // FIXME: Localize } SetDlgItemTextW(hwndDlg, IDC_SYSSHUTDOWNTIMELEFT, szBuffer); if (pShutdownParams->dwTimeout == 0) { - PostMessage(hwndDlg, WM_CLOSE, 0, 0); - ExitWindowsEx((pShutdownParams->bRebootAfterShutdown ? EWX_REBOOT : EWX_SHUTDOWN) | - (pShutdownParams->bForceAppsClosed ? EWX_FORCE : 0), - pShutdownParams->dwReason); + /* Close the dialog and perform the system shutdown */ + EndDialog(hwndDlg, 0); + DoSystemShutdown(pShutdownParams); + return; } pShutdownParams->dwTimeout--; @@ -97,11 +133,10 @@ ShutdownDialogProc( switch (uMsg) { case WM_INITDIALOG: + { pShutdownParams = (PSYS_SHUTDOWN_PARAMS)lParam; SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pShutdownParams); - pShutdownParams->hShutdownDialog = hwndDlg; - if (pShutdownParams->pszMessage) { SetDlgItemTextW(hwndDlg, @@ -109,26 +144,17 @@ ShutdownDialogProc( pShutdownParams->pszMessage); } - RemoveMenu(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND); + DeleteMenu(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND); SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); PostMessage(hwndDlg, WM_TIMER, 0, 0); SetTimer(hwndDlg, SHUTDOWN_TIMER_ID, 1000, NULL); break; + } - case WM_CLOSE: - pShutdownParams->hShutdownDialog = NULL; - pShutdownParams->bShuttingDown = FALSE; - + /* NOTE: Do not handle WM_CLOSE */ + case WM_DESTROY: KillTimer(hwndDlg, SHUTDOWN_TIMER_ID); - - if (pShutdownParams->pszMessage) - { - HeapFree(GetProcessHeap(), 0, pShutdownParams->pszMessage); - pShutdownParams->pszMessage = NULL; - } - - EndDialog(hwndDlg, 0); break; case WM_TIMER: @@ -159,10 +185,6 @@ InitiateSystemShutdownThread( NULL, ShutdownDialogProc, (LPARAM)pShutdownParams); - if (status >= 0) - { - return ERROR_SUCCESS; - } if (pShutdownParams->pszMessage) { @@ -170,8 +192,10 @@ InitiateSystemShutdownThread( pShutdownParams->pszMessage = NULL; } - pShutdownParams->bShuttingDown = FALSE; + if (status >= 0) + return ERROR_SUCCESS; + pShutdownParams->bShuttingDown = FALSE; return GetLastError(); } @@ -179,10 +203,10 @@ InitiateSystemShutdownThread( DWORD TerminateSystemShutdown(VOID) { - if (g_ShutdownParams.bShuttingDown == FALSE) + if (_InterlockedCompareExchange8((volatile char*)&g_ShutdownParams.bShuttingDown, FALSE, TRUE) == FALSE) return ERROR_NO_SHUTDOWN_IN_PROGRESS; - return PostMessage(g_ShutdownParams.hShutdownDialog, WM_CLOSE, 0, 0) ? ERROR_SUCCESS : GetLastError(); + return ERROR_SUCCESS; } @@ -228,11 +252,20 @@ StartSystemShutdown( g_ShutdownParams.bRebootAfterShutdown = bRebootAfterShutdown; g_ShutdownParams.dwReason = dwReason; - hThread = CreateThread(NULL, 0, InitiateSystemShutdownThread, (PVOID)&g_ShutdownParams, 0, NULL); - if (hThread) + /* If dwTimeout is zero perform an immediate system shutdown, otherwise display the countdown shutdown dialog */ + if (g_ShutdownParams.dwTimeout == 0) { - CloseHandle(hThread); - return ERROR_SUCCESS; + if (DoSystemShutdown(&g_ShutdownParams)) + return ERROR_SUCCESS; + } + else + { + hThread = CreateThread(NULL, 0, InitiateSystemShutdownThread, (PVOID)&g_ShutdownParams, 0, NULL); + if (hThread) + { + CloseHandle(hThread); + return ERROR_SUCCESS; + } } if (g_ShutdownParams.pszMessage) @@ -242,7 +275,6 @@ StartSystemShutdown( } g_ShutdownParams.bShuttingDown = FALSE; - return GetLastError(); }
6 years, 7 months
1
0
0
0
← Newer
1
2
3
4
5
...
25
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
Results per page:
10
25
50
100
200