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 2019
----- 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
32 participants
240 discussions
Start a n
N
ew thread
[reactos] 01/02: [POWERCFG] Use a list of power schemes (power policy, id, name and description) rather than a bare array of power policies. This will simplify adding and deleting schemes quite a lot.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f62a4b2015bada8ce80c5…
commit f62a4b2015bada8ce80c5be1a50a7563277bb0dc Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Apr 20 22:48:38 2019 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Apr 20 22:48:38 2019 +0200 [POWERCFG] Use a list of power schemes (power policy, id, name and description) rather than a bare array of power policies. This will simplify adding and deleting schemes quite a lot. --- dll/cpl/powercfg/powercfg.h | 2 +- dll/cpl/powercfg/powershemes.c | 454 +++++++++++++++++++++++++++-------------- 2 files changed, 298 insertions(+), 158 deletions(-) diff --git a/dll/cpl/powercfg/powercfg.h b/dll/cpl/powercfg/powercfg.h index 16e0e18bc8..29011c67af 100644 --- a/dll/cpl/powercfg/powercfg.h +++ b/dll/cpl/powercfg/powercfg.h @@ -16,6 +16,7 @@ #include <shlobj.h> #include <shlwapi.h> #include <powrprof.h> +#include <ndk/rtlfuncs.h> #include "resource.h" @@ -30,7 +31,6 @@ typedef struct extern HINSTANCE hApplet; extern GLOBAL_POWER_POLICY gGPP; extern POWER_POLICY gPP[]; -extern UINT guiIndex; #define MAX_POWER_PAGES 32 diff --git a/dll/cpl/powercfg/powershemes.c b/dll/cpl/powercfg/powershemes.c index 3b6d1f32b2..64a90bb540 100644 --- a/dll/cpl/powercfg/powershemes.c +++ b/dll/cpl/powercfg/powershemes.c @@ -11,6 +11,24 @@ #include "powercfg.h" + +typedef struct _POWER_SCHEME +{ + LIST_ENTRY ListEntry; + UINT uId; + LPTSTR pszName; + LPTSTR pszDescription; + POWER_POLICY PowerPolicy; +} POWER_SCHEME, *PPOWER_SCHEME; + + +typedef struct _POWER_SCHEMES_PAGE_DATA +{ + LIST_ENTRY PowerSchemesList; + PPOWER_SCHEME pActivePowerScheme; +} POWER_SCHEMES_PAGE_DATA, *PPOWER_SCHEMES_PAGE_DATA; + + UINT Sec[]= { 60, @@ -31,20 +49,125 @@ UINT Sec[]= 0 }; -HWND hList = 0; -HWND hPos = 0; -unsigned aps = 0; +static +PPOWER_SCHEME +AddPowerScheme( + PPOWER_SCHEMES_PAGE_DATA pPageData, + UINT uId, + DWORD dwName, + LPTSTR pszName, + DWORD dwDescription, + LPWSTR pszDescription, + PPOWER_POLICY pp) +{ + PPOWER_SCHEME pScheme; + + pScheme = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(POWER_SCHEME)); + if (pScheme == NULL) + return NULL; + + pScheme->pszName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwName + sizeof(TCHAR)); + + pScheme->pszDescription = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwDescription + sizeof(TCHAR)); + if (pScheme->pszName == NULL || pScheme->pszDescription == NULL) + { + HeapFree(GetProcessHeap(), 0, pScheme->pszName); + HeapFree(GetProcessHeap(), 0, pScheme->pszDescription); + HeapFree(GetProcessHeap(), 0, pScheme); + return NULL; + } + + pScheme->uId = uId; + _tcscpy(pScheme->pszName, pszName); + _tcscpy(pScheme->pszDescription, pszDescription); + + CopyMemory(&pScheme->PowerPolicy, pp, sizeof(POWER_POLICY)); -#define MAX_POWER_POLICY 20 + InsertTailList(&pPageData->PowerSchemesList, &pScheme->ListEntry); -POWER_POLICY gPP[MAX_POWER_POLICY]; -UINT guiIndex = 0; -HWND hwndDialog; + return pScheme; +} + + +static +VOID +DeletePowerScheme( + PPOWER_SCHEME pScheme) +{ + RemoveEntryList(&pScheme->ListEntry); + + HeapFree(GetProcessHeap(), 0, pScheme->pszName); + HeapFree(GetProcessHeap(), 0, pScheme->pszDescription); + HeapFree(GetProcessHeap(), 0, pScheme); +} +static BOOLEAN -Pos_InitData(VOID) +CALLBACK +EnumPowerSchemeCallback( + UINT uiIndex, + DWORD dwName, + LPTSTR pszName, + DWORD dwDesc, + LPWSTR pszDesc, + PPOWER_POLICY pp, + LPARAM lParam) +{ + if (ValidatePowerPolicies(0, pp)) + { + AddPowerScheme((PPOWER_SCHEMES_PAGE_DATA)lParam, + uiIndex, + dwName, + pszName, + dwDesc, + pszDesc, + pp); + } + + return TRUE; +} + +static +VOID +BuildSchemesList( + PPOWER_SCHEMES_PAGE_DATA pPageData) +{ + InitializeListHead(&pPageData->PowerSchemesList); + + EnumPwrSchemes(EnumPowerSchemeCallback, (LPARAM)pPageData); +} + + +static +VOID +DestroySchemesList( + PPOWER_SCHEMES_PAGE_DATA pPageData) +{ + PLIST_ENTRY ListEntry; + PPOWER_SCHEME pScheme; + + while (!IsListEmpty(&pPageData->PowerSchemesList)) + { + ListEntry = pPageData->PowerSchemesList.Flink; + pScheme = CONTAINING_RECORD(ListEntry, POWER_SCHEME, ListEntry); + DeletePowerScheme(pScheme); + } + + pPageData->pActivePowerScheme = NULL; +} + + +BOOLEAN +Pos_InitData( + HWND hwndDlg) { SYSTEM_POWER_CAPABILITIES spc; /* @@ -52,49 +175,49 @@ Pos_InitData(VOID) LONG movetop = 0; LONG moveright = 0; - if (GetWindowRect(hPos,&rectDlg)) + if (GetWindowRect(hwndDlg,&rectDlg)) { - if (GetWindowRect(GetDlgItem(hPos, IDC_SAT),&rectCtl2)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_SAT),&rectCtl2)) { - if (GetWindowRect(GetDlgItem(hPos, IDC_MONITOR),&rectCtl)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_MONITOR),&rectCtl)) { movetop=rectCtl.top - rectCtl2.top; - MoveWindow(GetDlgItem(hPos, IDC_MONITOR),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); - if (GetWindowRect(GetDlgItem(hPos, IDC_DISK),&rectCtl)) + MoveWindow(GetDlgItem(hwndDlg, IDC_MONITOR),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_DISK),&rectCtl)) { - MoveWindow(GetDlgItem(hPos, IDC_DISK),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); + MoveWindow(GetDlgItem(hwndDlg, IDC_DISK),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); } - if (GetWindowRect(GetDlgItem(hPos, IDC_STANDBY),&rectCtl)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_STANDBY),&rectCtl)) { - MoveWindow(GetDlgItem(hPos, IDC_STANDBY),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); + MoveWindow(GetDlgItem(hwndDlg, IDC_STANDBY),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); } - if (GetWindowRect(GetDlgItem(hPos, IDC_HYBERNATE),&rectCtl)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_HYBERNATE),&rectCtl)) { - MoveWindow(GetDlgItem(hPos, IDC_HYBERNATE),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); + MoveWindow(GetDlgItem(hwndDlg, IDC_HYBERNATE),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); } - if (GetWindowRect(GetDlgItem(hPos, IDC_MONITORDCLIST),&rectCtl2)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_MONITORDCLIST),&rectCtl2)) { movetop=movetop-8; - if (GetWindowRect(GetDlgItem(hPos, IDC_MONITORACLIST),&rectCtl)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_MONITORACLIST),&rectCtl)) { moveright=rectCtl.right - rectCtl2.right; - MoveWindow(GetDlgItem(hPos, IDC_MONITORACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); - if (GetWindowRect(GetDlgItem(hPos, IDC_DISKACLIST),&rectCtl)) + MoveWindow(GetDlgItem(hwndDlg, IDC_MONITORACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_DISKACLIST),&rectCtl)) { - MoveWindow(GetDlgItem(hPos, IDC_DISKACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); + MoveWindow(GetDlgItem(hwndDlg, IDC_DISKACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); } - if (GetWindowRect(GetDlgItem(hPos, IDC_STANDBYACLIST),&rectCtl)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_STANDBYACLIST),&rectCtl)) { - MoveWindow(GetDlgItem(hPos, IDC_STANDBYACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); + MoveWindow(GetDlgItem(hwndDlg, IDC_STANDBYACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); } - if (GetWindowRect(GetDlgItem(hPos, IDC_HYBERNATEACLIST),&rectCtl)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST),&rectCtl)) { - MoveWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); + MoveWindow(GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top-movetop,rectCtl.right-rectCtl.left-moveright,rectCtl.bottom-rectCtl.top,FALSE); } } - if (GetWindowRect(GetDlgItem(hPos, IDC_GRPDETAIL),&rectCtl)) + if (GetWindowRect(GetDlgItem(hwndDlg, IDC_GRPDETAIL),&rectCtl)) { - MoveWindow(GetDlgItem(hPos, IDC_GRPDETAIL),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); + MoveWindow(GetDlgItem(hwndDlg, IDC_GRPDETAIL),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); } } } @@ -110,71 +233,76 @@ Pos_InitData(VOID) if (!spc.SystemBatteriesPresent) { - ShowWindow(GetDlgItem(hPos, IDC_SAT), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_IAC), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_SAC), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_IDC), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_SDC), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_MONITORDCLIST), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_DISKDCLIST), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST), FALSE); - ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST), spc.HiberFilePresent); + ShowWindow(GetDlgItem(hwndDlg, IDC_SAT), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_IAC), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SAC), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_IDC), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_SDC), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_MONITORDCLIST), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_DISKDCLIST), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST), spc.HiberFilePresent); } else { - ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST), spc.HiberFilePresent); - ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST), spc.HiberFilePresent); + ShowWindow(GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST), FALSE); } if (!(spc.SystemS1 ||spc.SystemS2 || spc.SystemS3)) { - ShowWindow(GetDlgItem(hPos, IDC_STANDBYACLIST), TRUE); - ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST), TRUE); - ShowWindow(GetDlgItem(hPos, IDC_STANDBY), TRUE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYACLIST), TRUE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), TRUE); + ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBY), TRUE); } - ShowWindow(GetDlgItem(hPos, IDC_HYBERNATE), spc.HiberFilePresent); + ShowWindow(GetDlgItem(hwndDlg, IDC_HYBERNATE), spc.HiberFilePresent); return TRUE; } -static VOID -LoadConfig(HWND hwndDlg) +static +VOID +LoadConfig( + HWND hwndDlg) { + PPOWER_SCHEME pScheme; INT i = 0, iCurSel = 0; - UINT uiIndex; - TCHAR szProfile[MAX_PATH]; TCHAR szTemp[MAX_PATH]; TCHAR szConfig[MAX_PATH]; - POWER_POLICY pp; + PPOWER_POLICY pp; - iCurSel = (INT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, - CB_GETCURSEL, - 0, - 0); + iCurSel = (INT)SendDlgItemMessage(hwndDlg, + IDC_ENERGYLIST, + CB_GETCURSEL, + 0, + 0); if (iCurSel == CB_ERR) return; - memcpy(&pp, &gPP[iCurSel], sizeof(POWER_POLICY)); + pScheme = (PPOWER_SCHEME)SendDlgItemMessage(hwndDlg, + IDC_ENERGYLIST, + CB_GETITEMDATA, + (WPARAM)iCurSel, + 0); + if (pScheme == (PPOWER_SCHEME)CB_ERR) + return; - uiIndex = (UINT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETCURSEL, 0, 0); - if (uiIndex != (UINT)CB_ERR) + if (LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH)) { - SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETLBTEXT, uiIndex, (LPARAM)szProfile); - if (LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH)) - { - _stprintf(szConfig,szTemp,szProfile); - SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL), szConfig); - } + _stprintf(szConfig, szTemp, pScheme->pszName); + SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL), szConfig); } + pp = &pScheme->PowerPolicy; + for (i = 0; i < 16; i++) { - if (Sec[i] == pp.user.VideoTimeoutAc) + if (Sec[i] == pp->user.VideoTimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_MONITORACLIST, CB_SETCURSEL, @@ -182,7 +310,7 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i] == pp.user.VideoTimeoutDc) + if (Sec[i] == pp->user.VideoTimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, CB_SETCURSEL, @@ -190,7 +318,7 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i] == pp.user.SpindownTimeoutAc) + if (Sec[i] == pp->user.SpindownTimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_DISKACLIST, CB_SETCURSEL, @@ -198,7 +326,7 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i] == pp.user.SpindownTimeoutDc) // IdleTimeoutDc) + if (Sec[i] == pp->user.SpindownTimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST, CB_SETCURSEL, @@ -206,7 +334,7 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i] == pp.user.IdleTimeoutAc) + if (Sec[i] == pp->user.IdleTimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST, CB_SETCURSEL, @@ -214,7 +342,7 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i] == pp.user.IdleTimeoutDc) + if (Sec[i] == pp->user.IdleTimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST, CB_SETCURSEL, @@ -222,7 +350,7 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i] == pp.mach.DozeS4TimeoutAc) + if (Sec[i] == pp->mach.DozeS4TimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST, CB_SETCURSEL, @@ -230,7 +358,7 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i] == pp.mach.DozeS4TimeoutDc) + if (Sec[i] == pp->mach.DozeS4TimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST, CB_SETCURSEL, @@ -241,56 +369,6 @@ LoadConfig(HWND hwndDlg) } -BOOLEAN CALLBACK -callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPTSTR sName, DWORD dwDesc, - LPWSTR sDesc, PPOWER_POLICY pp, LPARAM lParam) -{ - int index; - - UNREFERENCED_PARAMETER(lParam); - UNREFERENCED_PARAMETER(sDesc); - UNREFERENCED_PARAMETER(dwDesc); - UNREFERENCED_PARAMETER(dwName); - - if (ValidatePowerPolicies(0, pp)) - { - if (guiIndex >= MAX_POWER_POLICY) - { - // FIXME: - // Implement store power policy dynamically - return FALSE; - } - - - memcpy(&gPP[guiIndex], pp, sizeof(POWER_POLICY)); - guiIndex++; - - index = (int)SendMessage(hList, - CB_ADDSTRING, - 0, - (LPARAM)sName); - if (index == CB_ERR) - return FALSE; - - SendMessage(hList, - CB_SETITEMDATA, - index, - (LPARAM)uiIndex); - - if (aps == uiIndex) - { - SendMessage(hList, - CB_SELECTSTRING, - TRUE, - (LPARAM)sName); - LoadConfig(GetParent(hList)); - } - } - - return TRUE; -} - - static VOID Pos_InitPage(HWND hwndDlg) { @@ -386,22 +464,32 @@ Pos_InitPage(HWND hwndDlg) static VOID Pos_SaveData(HWND hwndDlg) { - INT iCurSel = 0, tmp = 0; - - iCurSel = (INT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, - CB_GETCURSEL, - 0, - 0); + PPOWER_SCHEME pScheme; + INT iCurSel, tmp; + + iCurSel = (INT)SendDlgItemMessage(hwndDlg, + IDC_ENERGYLIST, + CB_GETCURSEL, + 0, + 0); if (iCurSel == CB_ERR) return; + pScheme = (PPOWER_SCHEME)SendDlgItemMessage(hwndDlg, + IDC_ENERGYLIST, + CB_GETITEMDATA, + (WPARAM)iCurSel, + 0); + if (pScheme == (PPOWER_SCHEME)CB_ERR) + return; + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_MONITORACLIST, CB_GETCURSEL, 0, (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.VideoTimeoutAc = Sec[tmp]; + pScheme->PowerPolicy.user.VideoTimeoutAc = Sec[tmp]; } tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, @@ -410,7 +498,7 @@ Pos_SaveData(HWND hwndDlg) (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.VideoTimeoutDc = Sec[tmp]; + pScheme->PowerPolicy.user.VideoTimeoutDc = Sec[tmp]; } tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_DISKACLIST, @@ -419,7 +507,7 @@ Pos_SaveData(HWND hwndDlg) (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.SpindownTimeoutAc = Sec[tmp + 2]; + pScheme->PowerPolicy.user.SpindownTimeoutAc = Sec[tmp + 2]; } tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST, @@ -428,7 +516,7 @@ Pos_SaveData(HWND hwndDlg) (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.SpindownTimeoutDc = Sec[tmp + 2]; + pScheme->PowerPolicy.user.SpindownTimeoutDc = Sec[tmp + 2]; } tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST, @@ -437,7 +525,7 @@ Pos_SaveData(HWND hwndDlg) (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.IdleTimeoutAc = Sec[tmp]; + pScheme->PowerPolicy.user.IdleTimeoutAc = Sec[tmp]; } tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST, @@ -446,7 +534,7 @@ Pos_SaveData(HWND hwndDlg) (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.IdleTimeoutDc = Sec[tmp]; + pScheme->PowerPolicy.user.IdleTimeoutDc = Sec[tmp]; } tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST, @@ -455,7 +543,7 @@ Pos_SaveData(HWND hwndDlg) (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].mach.DozeS4TimeoutAc = Sec[tmp]; + pScheme->PowerPolicy.mach.DozeS4TimeoutAc = Sec[tmp]; } tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST, @@ -464,21 +552,21 @@ Pos_SaveData(HWND hwndDlg) (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].mach.DozeS4TimeoutDc = Sec[tmp]; + pScheme->PowerPolicy.mach.DozeS4TimeoutDc = Sec[tmp]; } - SetActivePwrScheme(iCurSel, NULL, &gPP[iCurSel]); + SetActivePwrScheme(iCurSel, NULL, &pScheme->PowerPolicy); LoadConfig(hwndDlg); } -static BOOLEAN +static BOOL DelScheme(HWND hwnd) { INT iCurSel; HWND hList; TCHAR szBuf[1024], szBufT[1024]; - UINT DelScheme; + PPOWER_SCHEME pScheme; hList = GetDlgItem(hwnd, IDC_ENERGYLIST); @@ -488,8 +576,8 @@ DelScheme(HWND hwnd) SendMessage(hList, CB_SETCURSEL, iCurSel, 0); - DelScheme = SendMessage(hList, CB_GETITEMDATA, (WPARAM)iCurSel, 0); - if (DelScheme == (UINT)CB_ERR) + pScheme = (PPOWER_SCHEME)SendMessage(hList, CB_GETITEMDATA, (WPARAM)iCurSel, 0); + if (pScheme == (PPOWER_SCHEME)CB_ERR) return FALSE; LoadString(hApplet, IDS_DEL_SCHEME_TITLE, szBufT, sizeof(szBufT) / sizeof(TCHAR)); @@ -503,11 +591,11 @@ DelScheme(HWND hwnd) { SendMessage(hList, CB_SETCURSEL, (WPARAM)0, 0); SendMessage(hList, CB_DELETESTRING, (WPARAM)iCurSel, 0); - if (Current == DelScheme) + if (Current == pScheme->uId) Pos_SaveData(hwnd); } - if (DeletePwrScheme(DelScheme) != 0) + if (DeletePwrScheme(pScheme->uId) != 0) return TRUE; } @@ -515,14 +603,20 @@ DelScheme(HWND hwnd) } -static BOOLEAN -CreateEnergyList(HWND hwnd) +static BOOL +CreateEnergyList( + HWND hwndDlg, + PPOWER_SCHEMES_PAGE_DATA pPageData) { - BOOLEAN retval; + PLIST_ENTRY ListEntry; + PPOWER_SCHEME pScheme; + INT index; POWER_POLICY pp; SYSTEM_POWER_CAPABILITIES spc; + HWND hwndList; + unsigned aps = 0; - hList = hwnd; + hwndList = GetDlgItem(hwndDlg, IDC_ENERGYLIST); if (!GetActivePwrScheme(&aps)) return FALSE; @@ -550,20 +644,48 @@ CreateEnergyList(HWND hwnd) // Enable write / delete powerscheme button } - Pos_InitPage(GetParent(hwnd)); + Pos_InitPage(hwndDlg); if (!GetActivePwrScheme(&aps)) return FALSE; - retval = EnumPwrSchemes(callback_EnumPwrScheme, aps); + ListEntry = pPageData->PowerSchemesList.Flink; + while (ListEntry != &pPageData->PowerSchemesList) + { + pScheme = CONTAINING_RECORD(ListEntry, POWER_SCHEME, ListEntry); + + index = (int)SendMessage(hwndList, + CB_ADDSTRING, + 0, + (LPARAM)pScheme->pszName); + if (index == CB_ERR) + break; + + SendMessage(hwndList, + CB_SETITEMDATA, + index, + (LPARAM)pScheme); + + if (aps == pScheme->uId) + { + SendMessage(hwndList, + CB_SELECTSTRING, + TRUE, + (LPARAM)pScheme->pszName); + + LoadConfig(hwndDlg); + } - if (SendMessage(hwnd, CB_GETCOUNT, 0, 0) > 0) + ListEntry = ListEntry->Flink; + } + + if (SendMessage(hwndList, CB_GETCOUNT, 0, 0) > 0) { - EnableWindow(GetDlgItem(hwndDialog, IDC_DELETE_BTN), TRUE); - EnableWindow(GetDlgItem(hwndDialog, IDC_SAVEAS_BTN), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_BTN), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_SAVEAS_BTN), TRUE); } - return retval; + return TRUE; } @@ -575,12 +697,21 @@ PowerSchemesDlgProc( WPARAM wParam, LPARAM lParam) { - switch(uMsg) + PPOWER_SCHEMES_PAGE_DATA pPageData; + + pPageData = (PPOWER_SCHEMES_PAGE_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); + + switch (uMsg) { case WM_INITDIALOG: - hPos = hwndDlg; - hwndDialog = hwndDlg; - if (!Pos_InitData()) + pPageData = (PPOWER_SCHEMES_PAGE_DATA)HeapAlloc(GetProcessHeap(), + 0, + sizeof(PPOWER_SCHEMES_PAGE_DATA)); + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPageData); + + BuildSchemesList(pPageData); + + if (!Pos_InitData(hwndDlg)) { // TODO: // Initialization failed @@ -588,7 +719,7 @@ PowerSchemesDlgProc( MessageBox(hwndDlg,_T("Pos_InitData failed\n"), NULL, MB_OK); } - if (!CreateEnergyList(GetDlgItem(hwndDlg, IDC_ENERGYLIST))) + if (!CreateEnergyList(hwndDlg, pPageData)) { // TODO: // Initialization failed @@ -597,6 +728,15 @@ PowerSchemesDlgProc( } return TRUE; + case WM_DESTROY: + if (pPageData) + { + DestroySchemesList(pPageData); + HeapFree(GetProcessHeap(), 0, pPageData); + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)NULL); + } + break; + case WM_COMMAND: switch(LOWORD(wParam)) {
5 years, 8 months
1
0
0
0
[reactos] 01/01: [POWERCFG] Fix the undue change of monitor switch off time
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=889670656667549dbbd30…
commit 889670656667549dbbd30b92ff3c9fa66a7ffa8f Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Apr 20 14:43:16 2019 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Apr 20 14:43:16 2019 +0200 [POWERCFG] Fix the undue change of monitor switch off time CORE-12495 --- dll/cpl/powercfg/powershemes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dll/cpl/powercfg/powershemes.c b/dll/cpl/powercfg/powershemes.c index cb6d16f64b..3b6d1f32b2 100644 --- a/dll/cpl/powercfg/powershemes.c +++ b/dll/cpl/powercfg/powershemes.c @@ -395,7 +395,7 @@ Pos_SaveData(HWND hwndDlg) if (iCurSel == CB_ERR) return; - tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_MONITORACLIST, CB_GETCURSEL, 0, (LPARAM)0);
5 years, 8 months
1
0
0
0
[reactos] 01/01: [POWERCFG] Fix coding style and indentation. No code changes!
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a117331947799926270f4…
commit a117331947799926270f4b2023e6ff262e95f011 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sat Apr 20 14:36:22 2019 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sat Apr 20 14:36:22 2019 +0200 [POWERCFG] Fix coding style and indentation. No code changes! --- dll/cpl/powercfg/powershemes.c | 334 ++++++++++++++++++++++------------------- 1 file changed, 180 insertions(+), 154 deletions(-) diff --git a/dll/cpl/powercfg/powershemes.c b/dll/cpl/powercfg/powershemes.c index 104d68de55..cb6d16f64b 100644 --- a/dll/cpl/powercfg/powershemes.c +++ b/dll/cpl/powercfg/powershemes.c @@ -110,15 +110,15 @@ Pos_InitData(VOID) if (!spc.SystemBatteriesPresent) { - ShowWindow(GetDlgItem(hPos, IDC_SAT),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_IAC),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_SAC),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_IDC),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_SDC),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_MONITORDCLIST),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_DISKDCLIST),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST),FALSE); - ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST),FALSE); + ShowWindow(GetDlgItem(hPos, IDC_SAT), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_IAC), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_SAC), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_IDC), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_SDC), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_MONITORDCLIST), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_DISKDCLIST), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_STANDBYDCLIST), FALSE); + ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST), FALSE); ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEACLIST), spc.HiberFilePresent); } @@ -145,7 +145,7 @@ Pos_InitData(VOID) static VOID LoadConfig(HWND hwndDlg) { - INT i=0, iCurSel=0; + INT i = 0, iCurSel = 0; UINT uiIndex; TCHAR szProfile[MAX_PATH]; TCHAR szTemp[MAX_PATH]; @@ -162,19 +162,19 @@ LoadConfig(HWND hwndDlg) memcpy(&pp, &gPP[iCurSel], sizeof(POWER_POLICY)); uiIndex = (UINT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETCURSEL, 0, 0); - if(uiIndex != (UINT)CB_ERR) + if (uiIndex != (UINT)CB_ERR) { SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETLBTEXT, uiIndex, (LPARAM)szProfile); - if(LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH)) + if (LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH)) { _stprintf(szConfig,szTemp,szProfile); - SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL),szConfig); + SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL), szConfig); } } - for(i=0;i<16;i++) + for (i = 0; i < 16; i++) { - if (Sec[i]==pp.user.VideoTimeoutAc) + if (Sec[i] == pp.user.VideoTimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_MONITORACLIST, CB_SETCURSEL, @@ -182,35 +182,39 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i]==pp.user.VideoTimeoutDc) + if (Sec[i] == pp.user.VideoTimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, CB_SETCURSEL, i, (LPARAM)0); } - if (Sec[i]==pp.user.SpindownTimeoutAc) + + if (Sec[i] == pp.user.SpindownTimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_DISKACLIST, CB_SETCURSEL, - i-2, + i - 2, (LPARAM)0); } - if (Sec[i]==pp.user.SpindownTimeoutDc) // IdleTimeoutDc) + + if (Sec[i] == pp.user.SpindownTimeoutDc) // IdleTimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST, CB_SETCURSEL, - i-2, + i - 2, (LPARAM)0); } - if (Sec[i]==pp.user.IdleTimeoutAc) + + if (Sec[i] == pp.user.IdleTimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST, CB_SETCURSEL, i, (LPARAM)0); } - if (Sec[i]==pp.user.IdleTimeoutDc) + + if (Sec[i] == pp.user.IdleTimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST, CB_SETCURSEL, @@ -218,14 +222,15 @@ LoadConfig(HWND hwndDlg) (LPARAM)0); } - if (Sec[i]==pp.mach.DozeS4TimeoutAc) + if (Sec[i] == pp.mach.DozeS4TimeoutAc) { SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST, CB_SETCURSEL, i, (LPARAM)0); } - if (Sec[i]==pp.mach.DozeS4TimeoutDc) + + if (Sec[i] == pp.mach.DozeS4TimeoutDc) { SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST, CB_SETCURSEL, @@ -238,7 +243,7 @@ LoadConfig(HWND hwndDlg) BOOLEAN CALLBACK callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPTSTR sName, DWORD dwDesc, - LPWSTR sDesc, PPOWER_POLICY pp,LPARAM lParam) + LPWSTR sDesc, PPOWER_POLICY pp, LPARAM lParam) { int index; @@ -247,7 +252,7 @@ callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPTSTR sName, DWORD dwDesc, UNREFERENCED_PARAMETER(dwDesc); UNREFERENCED_PARAMETER(dwName); - if (ValidatePowerPolicies(0,pp)) + if (ValidatePowerPolicies(0, pp)) { if (guiIndex >= MAX_POWER_POLICY) { @@ -260,7 +265,7 @@ callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPTSTR sName, DWORD dwDesc, memcpy(&gPP[guiIndex], pp, sizeof(POWER_POLICY)); guiIndex++; - index = (int) SendMessage(hList, + index = (int)SendMessage(hList, CB_ADDSTRING, 0, (LPARAM)sName); @@ -281,6 +286,7 @@ callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPTSTR sName, DWORD dwDesc, LoadConfig(GetParent(hList)); } } + return TRUE; } @@ -288,51 +294,60 @@ callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPTSTR sName, DWORD dwDesc, static VOID Pos_InitPage(HWND hwndDlg) { - int ifrom=0,i=0,imin=0; + int ifrom = 0, i = 0, imin = 0; HWND hwnd = NULL; TCHAR szName[MAX_PATH]; LRESULT index; - for(i=1;i<9;i++) + for (i = 1; i < 9; i++) { - switch(i) + switch (i) { - case 1: - hwnd=GetDlgItem(hwndDlg, IDC_MONITORACLIST); - imin=IDS_TIMEOUT1; - break; - case 2: - hwnd=GetDlgItem(hwndDlg, IDC_STANDBYACLIST); - imin=IDS_TIMEOUT1; - break; - case 3: - hwnd=GetDlgItem(hwndDlg, IDC_DISKACLIST); - imin=IDS_TIMEOUT3; - break; - case 4: - hwnd=GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST); - imin=IDS_TIMEOUT3; - break; - case 5: - hwnd=GetDlgItem(hwndDlg, IDC_MONITORDCLIST); - imin=IDS_TIMEOUT1; - break; - case 6: - hwnd=GetDlgItem(hwndDlg, IDC_STANDBYDCLIST); - imin=IDS_TIMEOUT1; - break; - case 7: - hwnd=GetDlgItem(hwndDlg, IDC_DISKDCLIST); - imin=IDS_TIMEOUT3; - break; - case 8: - hwnd=GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST); - imin=IDS_TIMEOUT3; - break; - default: - return; + case 1: + hwnd = GetDlgItem(hwndDlg, IDC_MONITORACLIST); + imin = IDS_TIMEOUT1; + break; + + case 2: + hwnd = GetDlgItem(hwndDlg, IDC_STANDBYACLIST); + imin = IDS_TIMEOUT1; + break; + + case 3: + hwnd = GetDlgItem(hwndDlg, IDC_DISKACLIST); + imin = IDS_TIMEOUT3; + break; + + case 4: + hwnd = GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST); + imin = IDS_TIMEOUT3; + break; + + case 5: + hwnd = GetDlgItem(hwndDlg, IDC_MONITORDCLIST); + imin = IDS_TIMEOUT1; + break; + + case 6: + hwnd = GetDlgItem(hwndDlg, IDC_STANDBYDCLIST); + imin = IDS_TIMEOUT1; + break; + + case 7: + hwnd = GetDlgItem(hwndDlg, IDC_DISKDCLIST); + imin = IDS_TIMEOUT3; + break; + + case 8: + hwnd = GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST); + imin = IDS_TIMEOUT3; + break; + + default: + return; } - for (ifrom=imin;ifrom<(IDS_TIMEOUT15+1);ifrom++) + + for (ifrom = imin; ifrom < (IDS_TIMEOUT15 + 1); ifrom++) { if (LoadString(hApplet, ifrom, szName, MAX_PATH)) { @@ -340,16 +355,16 @@ Pos_InitPage(HWND hwndDlg) CB_ADDSTRING, 0, (LPARAM)szName); - if (index == CB_ERR) return; SendMessage(hwnd, CB_SETITEMDATA, index, - (LPARAM)Sec[ifrom-IDS_TIMEOUT16]); + (LPARAM)Sec[ifrom - IDS_TIMEOUT16]); } } + if (LoadString(hApplet, IDS_TIMEOUT16, szName, MAX_PATH)) { index = SendMessage(hwnd, @@ -371,16 +386,16 @@ Pos_InitPage(HWND hwndDlg) static VOID Pos_SaveData(HWND hwndDlg) { - INT iCurSel=0,tmp=0; + INT iCurSel = 0, tmp = 0; - iCurSel = (INT) SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, + iCurSel = (INT)SendDlgItemMessage(hwndDlg, IDC_ENERGYLIST, CB_GETCURSEL, 0, 0); if (iCurSel == CB_ERR) return; - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, CB_GETCURSEL, 0, (LPARAM)0); @@ -388,7 +403,8 @@ Pos_SaveData(HWND hwndDlg) { gPP[iCurSel].user.VideoTimeoutAc = Sec[tmp]; } - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, + + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_MONITORDCLIST, CB_GETCURSEL, 0, (LPARAM)0); @@ -396,23 +412,26 @@ Pos_SaveData(HWND hwndDlg) { gPP[iCurSel].user.VideoTimeoutDc = Sec[tmp]; } - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_DISKACLIST, + + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_DISKACLIST, CB_GETCURSEL, 0, (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.SpindownTimeoutAc = Sec[tmp+2]; + gPP[iCurSel].user.SpindownTimeoutAc = Sec[tmp + 2]; } - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST, + + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_DISKDCLIST, CB_GETCURSEL, 0, (LPARAM)0); if (tmp > 0 && tmp < 16) { - gPP[iCurSel].user.SpindownTimeoutDc = Sec[tmp+2]; + gPP[iCurSel].user.SpindownTimeoutDc = Sec[tmp + 2]; } - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST, + + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_STANDBYACLIST, CB_GETCURSEL, 0, (LPARAM)0); @@ -420,7 +439,8 @@ Pos_SaveData(HWND hwndDlg) { gPP[iCurSel].user.IdleTimeoutAc = Sec[tmp]; } - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST, + + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_STANDBYDCLIST, CB_GETCURSEL, 0, (LPARAM)0); @@ -428,7 +448,8 @@ Pos_SaveData(HWND hwndDlg) { gPP[iCurSel].user.IdleTimeoutDc = Sec[tmp]; } - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST, + + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_HYBERNATEACLIST, CB_GETCURSEL, 0, (LPARAM)0); @@ -436,7 +457,8 @@ Pos_SaveData(HWND hwndDlg) { gPP[iCurSel].mach.DozeS4TimeoutAc = Sec[tmp]; } - tmp = (INT) SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST, + + tmp = (INT)SendDlgItemMessage(hwndDlg, IDC_HYBERNATEDCLIST, CB_GETCURSEL, 0, (LPARAM)0); @@ -445,7 +467,7 @@ Pos_SaveData(HWND hwndDlg) gPP[iCurSel].mach.DozeS4TimeoutDc = Sec[tmp]; } - SetActivePwrScheme(iCurSel,NULL,&gPP[iCurSel]); + SetActivePwrScheme(iCurSel, NULL, &gPP[iCurSel]); LoadConfig(hwndDlg); } @@ -461,12 +483,14 @@ DelScheme(HWND hwnd) hList = GetDlgItem(hwnd, IDC_ENERGYLIST); iCurSel = SendMessage(hList, CB_GETCURSEL, 0, 0); - if (iCurSel == CB_ERR) return FALSE; + if (iCurSel == CB_ERR) + return FALSE; SendMessage(hList, CB_SETCURSEL, iCurSel, 0); DelScheme = SendMessage(hList, CB_GETITEMDATA, (WPARAM)iCurSel, 0); - if (DelScheme == (UINT)CB_ERR) return FALSE; + if (DelScheme == (UINT)CB_ERR) + return FALSE; LoadString(hApplet, IDS_DEL_SCHEME_TITLE, szBufT, sizeof(szBufT) / sizeof(TCHAR)); LoadString(hApplet, IDS_DEL_SCHEME, szBuf, sizeof(szBuf) / sizeof(TCHAR)); @@ -479,10 +503,12 @@ DelScheme(HWND hwnd) { SendMessage(hList, CB_SETCURSEL, (WPARAM)0, 0); SendMessage(hList, CB_DELETESTRING, (WPARAM)iCurSel, 0); - if (Current == DelScheme) Pos_SaveData(hwnd); + if (Current == DelScheme) + Pos_SaveData(hwnd); } - if (DeletePwrScheme(DelScheme) != 0) return TRUE; + if (DeletePwrScheme(DelScheme) != 0) + return TRUE; } return FALSE; @@ -504,14 +530,14 @@ CreateEnergyList(HWND hwnd) if (!ReadGlobalPwrPolicy(&gGPP)) return FALSE; - if (!ReadPwrScheme(aps,&pp)) + if (!ReadPwrScheme(aps, &pp)) return FALSE; - if (!ValidatePowerPolicies(&gGPP,0)) + if (!ValidatePowerPolicies(&gGPP, 0)) return FALSE; /* - if (!SetActivePwrScheme(aps,&gGPP,&pp)) + if (!SetActivePwrScheme(aps, &gGPP, &pp)) return FALSE; */ @@ -531,10 +557,10 @@ CreateEnergyList(HWND hwnd) retval = EnumPwrSchemes(callback_EnumPwrScheme, aps); - if(SendMessage(hwnd, CB_GETCOUNT, 0, 0) > 0) + if (SendMessage(hwnd, CB_GETCOUNT, 0, 0) > 0) { - EnableWindow(GetDlgItem(hwndDialog, IDC_DELETE_BTN),TRUE); - EnableWindow(GetDlgItem(hwndDialog, IDC_SAVEAS_BTN),TRUE); + EnableWindow(GetDlgItem(hwndDialog, IDC_DELETE_BTN), TRUE); + EnableWindow(GetDlgItem(hwndDialog, IDC_SAVEAS_BTN), TRUE); } return retval; @@ -544,78 +570,78 @@ CreateEnergyList(HWND hwnd) /* Property page dialog callback */ INT_PTR CALLBACK PowerSchemesDlgProc( - HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam -) + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) { - switch(uMsg) - { - case WM_INITDIALOG: - hPos = hwndDlg; - hwndDialog = hwndDlg; - if (!Pos_InitData()) - { - // TODO: - // Initialization failed - // Handle error - MessageBox(hwndDlg,_T("Pos_InitData failed\n"), NULL, MB_OK); + switch(uMsg) + { + case WM_INITDIALOG: + hPos = hwndDlg; + hwndDialog = hwndDlg; + if (!Pos_InitData()) + { + // TODO: + // Initialization failed + // Handle error + MessageBox(hwndDlg,_T("Pos_InitData failed\n"), NULL, MB_OK); + } - } - if (!CreateEnergyList(GetDlgItem(hwndDlg, IDC_ENERGYLIST))) - { - // TODO: - // Initialization failed - // Handle error - MessageBox(hwndDlg,_T("CreateEnergyList failed\n"), NULL, MB_OK); - } - return TRUE; - case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDC_ENERGYLIST: - if (HIWORD(wParam) == CBN_SELCHANGE) + if (!CreateEnergyList(GetDlgItem(hwndDlg, IDC_ENERGYLIST))) { - LoadConfig(hwndDlg); - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + // TODO: + // Initialization failed + // Handle error + MessageBox(hwndDlg,_T("CreateEnergyList failed\n"), NULL, MB_OK); } - break; - case IDC_DELETE_BTN: - { - DelScheme(hwndDlg); - } - break; - case IDC_SAVEAS_BTN: - { + return TRUE; - } - break; - case IDC_MONITORACLIST: - case IDC_MONITORDCLIST: - case IDC_DISKACLIST: - case IDC_DISKDCLIST: - case IDC_STANDBYACLIST: - case IDC_STANDBYDCLIST: - case IDC_HYBERNATEACLIST: - case IDC_HYBERNATEDCLIST: - if (HIWORD(wParam) == CBN_SELCHANGE) + case WM_COMMAND: + switch(LOWORD(wParam)) { - PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + case IDC_ENERGYLIST: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + LoadConfig(hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + + case IDC_DELETE_BTN: + DelScheme(hwndDlg); + break; + + case IDC_SAVEAS_BTN: + break; + + case IDC_MONITORACLIST: + case IDC_MONITORDCLIST: + case IDC_DISKACLIST: + case IDC_DISKDCLIST: + case IDC_STANDBYACLIST: + case IDC_STANDBYDCLIST: + case IDC_HYBERNATEACLIST: + case IDC_HYBERNATEDCLIST: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; } break; - } - break; - case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - if (lpnm->code == (UINT)PSN_APPLY) + + case WM_NOTIFY: { - Pos_SaveData(hwndDlg); + LPNMHDR lpnm = (LPNMHDR)lParam; + if (lpnm->code == (UINT)PSN_APPLY) + { + Pos_SaveData(hwndDlg); + } + return TRUE; } - return TRUE; - } - break; - } - return FALSE; + break; + } + + return FALSE; }
5 years, 8 months
1
0
0
0
[reactos] 01/01: [NTOSKRNL] Drop the useless Timestamp field
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=335b906ca844fec37324c…
commit 335b906ca844fec37324c278e577e414f7d1f3c9 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Apr 20 11:31:59 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Apr 20 11:31:59 2019 +0200 [NTOSKRNL] Drop the useless Timestamp field --- ntoskrnl/include/internal/cc.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ntoskrnl/include/internal/cc.h b/ntoskrnl/include/internal/cc.h index 42b24e2572..11bf97c270 100644 --- a/ntoskrnl/include/internal/cc.h +++ b/ntoskrnl/include/internal/cc.h @@ -188,7 +188,6 @@ typedef struct _ROS_SHARED_CACHE_MAP /* ROS specific */ LIST_ENTRY CacheMapVacbListHead; - ULONG TimeStamp; BOOLEAN PinAccess; KSPIN_LOCK CacheMapLock; #if DBG
5 years, 8 months
1
0
0
0
[reactos] 02/02: [GDI32] Reduce verbosity on debug builds
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=610cc5a6b6485f9516d5f…
commit 610cc5a6b6485f9516d5fdffe6ed77c57ec45582 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Apr 20 11:24:54 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Apr 20 11:24:54 2019 +0200 [GDI32] Reduce verbosity on debug builds --- win32ss/gdi/gdi32/objects/font.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/gdi/gdi32/objects/font.c b/win32ss/gdi/gdi32/objects/font.c index 7a7c23b0b5..8789223183 100644 --- a/win32ss/gdi/gdi32/objects/font.c +++ b/win32ss/gdi/gdi32/objects/font.c @@ -1804,7 +1804,7 @@ CreateFontIndirectW( CONST LOGFONTW *lplf ) { -#if DBG +#if 0 static BOOL bDidTest = FALSE; if (!bDidTest) {
5 years, 8 months
1
0
0
0
[reactos] 01/02: [NTOSKRNL] Don't set VACB dirty on release if already dirty
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=77b6899d89eb812a2b71c…
commit 77b6899d89eb812a2b71c7fb6fffdae449f0f571 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Apr 20 11:23:35 2019 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Apr 20 11:23:35 2019 +0200 [NTOSKRNL] Don't set VACB dirty on release if already dirty CORE-15954 --- ntoskrnl/cc/view.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 890c75e99c..7e92c0bd81 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -1138,7 +1138,7 @@ CcFlushCache ( } } - CcRosReleaseVacb(SharedCacheMap, current, current->Valid, current->Dirty, FALSE); + CcRosReleaseVacb(SharedCacheMap, current, current->Valid, FALSE, FALSE); } Offset.QuadPart += VACB_MAPPING_GRANULARITY;
5 years, 8 months
1
0
0
0
[reactos] 01/01: [ATL][ATLTEST] Adapt to RATL and improvements (#1501)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c714b7fd677fd3ff6b199…
commit c714b7fd677fd3ff6b199b4a7bab2fc3e341a618 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Apr 20 08:35:39 2019 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Apr 20 08:35:39 2019 +0900 [ATL][ATLTEST] Adapt to RATL and improvements (#1501) - Modify atldef.h for non-ReactOS environments. - Update ATL testcase project files (from v120_xp to v140_xp). - #define HAVE_APITEST and use it. - s/NULL/0/ --- modules/rostests/CMakeLists.txt | 2 ++ modules/rostests/apitests/atl/CAtlFileMapping.cpp | 4 ++-- modules/rostests/apitests/atl/CComObject.cpp | 4 ++-- modules/rostests/apitests/atl/CComQIPtr.cpp | 6 ++++-- modules/rostests/apitests/atl/CImage.cpp | 4 ++-- modules/rostests/apitests/atl/CSimpleArray.cpp | 4 ++-- modules/rostests/apitests/atl/CSimpleMap.cpp | 4 ++-- modules/rostests/apitests/atl/CString.cpp | 6 +++--- modules/rostests/apitests/atl/devenv/CComObject.vcxproj | 8 ++++---- modules/rostests/apitests/atl/devenv/CComQIPtr.vcxproj | 8 ++++---- modules/rostests/apitests/atl/devenv/CImage.vcxproj | 8 ++++---- modules/rostests/apitests/atl/devenv/CSimpleArray.vcxproj | 8 ++++---- modules/rostests/apitests/atl/devenv/CSimpleMap.vcxproj | 8 ++++---- modules/rostests/apitests/atl/devenv/CString.vcxproj | 8 ++++---- sdk/lib/atl/atlbase.h | 10 +++++----- sdk/lib/atl/atldef.h | 4 ++++ sdk/lib/atl/atlfile.h | 2 +- 17 files changed, 53 insertions(+), 45 deletions(-) diff --git a/modules/rostests/CMakeLists.txt b/modules/rostests/CMakeLists.txt index 1635a64c82..e30252f5fe 100644 --- a/modules/rostests/CMakeLists.txt +++ b/modules/rostests/CMakeLists.txt @@ -1,6 +1,8 @@ start_module_group(rostests) +add_definitions(-DHAVE_APITEST) + if(MSVC_IDE) add_definitions(-DWINETEST_MSVC_IDE_FORMATTING) endif() diff --git a/modules/rostests/apitests/atl/CAtlFileMapping.cpp b/modules/rostests/apitests/atl/CAtlFileMapping.cpp index 49997474c1..0e0ef5909c 100644 --- a/modules/rostests/apitests/atl/CAtlFileMapping.cpp +++ b/modules/rostests/apitests/atl/CAtlFileMapping.cpp @@ -7,7 +7,7 @@ #include <atlfile.h> -#ifdef __REACTOS__ +#ifdef HAVE_APITEST #include <apitest.h> #else #include <stdlib.h> @@ -247,7 +247,7 @@ START_TEST(CAtlFileMapping) test_SharedMem(); test_FileMapping(); -#ifndef __REACTOS__ +#ifndef HAVE_APITEST printf("CAtlFile: %i tests executed (0 marked as todo, %i failures), %i skipped.\n", g_tests_executed, g_tests_failed, g_tests_skipped); return g_tests_failed; #endif diff --git a/modules/rostests/apitests/atl/CComObject.cpp b/modules/rostests/apitests/atl/CComObject.cpp index 9703267df6..e40e0b8f69 100644 --- a/modules/rostests/apitests/atl/CComObject.cpp +++ b/modules/rostests/apitests/atl/CComObject.cpp @@ -9,7 +9,7 @@ #include <atlbase.h> #include <atlcom.h> -#ifdef __REACTOS__ +#ifdef HAVE_APITEST #include <apitest.h> #else #include <stdlib.h> @@ -142,7 +142,7 @@ START_TEST(CComObject) ok(g_BLIND == 1, "Expected 1, got %lu\n", g_BLIND); } -#ifndef __REACTOS__ +#ifndef HAVE_APITEST printf("CComObject: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); return g_tests_failed; #endif diff --git a/modules/rostests/apitests/atl/CComQIPtr.cpp b/modules/rostests/apitests/atl/CComQIPtr.cpp index f9fedb6898..677e623189 100644 --- a/modules/rostests/apitests/atl/CComQIPtr.cpp +++ b/modules/rostests/apitests/atl/CComQIPtr.cpp @@ -8,7 +8,7 @@ #include <atlbase.h> #include <atlcom.h> -#ifdef __REACTOS__ +#ifdef HAVE_APITEST #include <apitest.h> #else #include <stdlib.h> @@ -98,6 +98,8 @@ public: // Yes this sucks, but we have to support GCC. (CORE-12710) #ifdef __REACTOS__ #define DECLARE_QIPTR(type) CComQIIDPtr<I_ID(type)> +#elif defined(__GNUC__) +#define DECLARE_QIPTR(type) CComQIIDPtr<I_ID(type)> #else #define DECLARE_QIPTR(type) CComQIPtr<type> #endif @@ -153,7 +155,7 @@ START_TEST(CComQIPtr) ok(g_QI == 5, "Expected g_QI 5, got %lu\n", g_QI); } -#ifndef __REACTOS__ +#ifndef HAVE_APITEST printf("CComQIPtr: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); return g_tests_failed; #endif diff --git a/modules/rostests/apitests/atl/CImage.cpp b/modules/rostests/apitests/atl/CImage.cpp index 5daebaf3d9..1692cd71a4 100644 --- a/modules/rostests/apitests/atl/CImage.cpp +++ b/modules/rostests/apitests/atl/CImage.cpp @@ -8,7 +8,7 @@ #include <atlimage.h> #include "resource.h" -#ifdef __REACTOS__ +#ifdef HAVE_APITEST #include <apitest.h> #else #include <stdlib.h> @@ -332,7 +332,7 @@ START_TEST(CImage) "The exporter filter string is bad, was: %s\n", psz); #endif -#ifndef __REACTOS__ +#ifndef HAVE_APITEST printf("CImage: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); return g_tests_failed; #endif diff --git a/modules/rostests/apitests/atl/CSimpleArray.cpp b/modules/rostests/apitests/atl/CSimpleArray.cpp index a287a5c156..8060306644 100644 --- a/modules/rostests/apitests/atl/CSimpleArray.cpp +++ b/modules/rostests/apitests/atl/CSimpleArray.cpp @@ -5,7 +5,7 @@ * PROGRAMMER: Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ -#ifdef __REACTOS__ +#ifdef HAVE_APITEST #include <apitest.h> #else #include <stdlib.h> @@ -179,7 +179,7 @@ START_TEST(CSimpleArray) ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n"); ok(array1.GetSize() == 0, "Expected array1.GetSize() is 0, was: %d\n", array1.GetSize()); -#ifndef __REACTOS__ +#ifndef HAVE_APITEST printf("CSimpleArray: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); return g_tests_failed; #endif diff --git a/modules/rostests/apitests/atl/CSimpleMap.cpp b/modules/rostests/apitests/atl/CSimpleMap.cpp index eac6a2d54f..2d1afb9c8d 100644 --- a/modules/rostests/apitests/atl/CSimpleMap.cpp +++ b/modules/rostests/apitests/atl/CSimpleMap.cpp @@ -5,7 +5,7 @@ * PROGRAMMER: Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ -#ifdef __REACTOS__ +#ifdef HAVE_APITEST #include <apitest.h> #else #include <stdlib.h> @@ -199,7 +199,7 @@ START_TEST(CSimpleMap) ok(!!map1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n"); ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize()); -#ifndef __REACTOS__ +#ifndef HAVE_APITEST printf("CSimpleMap: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed); return g_tests_failed; #endif diff --git a/modules/rostests/apitests/atl/CString.cpp b/modules/rostests/apitests/atl/CString.cpp index c5f5a74b91..22ce8dfc0d 100644 --- a/modules/rostests/apitests/atl/CString.cpp +++ b/modules/rostests/apitests/atl/CString.cpp @@ -9,7 +9,7 @@ #include <atlstr.h> #include "resource.h" -#ifdef __REACTOS__ +#ifdef HAVE_APITEST #include <apitest.h> #else #include <stdlib.h> @@ -171,7 +171,7 @@ static void test_basetypes() // Allocation strategy seems to differ a bit between us and MS's atl. // if someone cares enough to find out why, feel free to change the macro below. -#ifdef __REACTOS__ +#ifdef __GNUC__ #define ALLOC_EXPECT(a, b) b #else #define ALLOC_EXPECT(a, b) a @@ -257,7 +257,7 @@ START_TEST(CString) test_bstrW(); test_bstrA(); -#ifndef __REACTOS__ +#ifndef HAVE_APITEST printf("CString: %i tests executed (0 marked as todo, %i failures), %i skipped.\n", g_tests_executed, g_tests_failed, g_tests_skipped); return g_tests_failed; #endif diff --git a/modules/rostests/apitests/atl/devenv/CComObject.vcxproj b/modules/rostests/apitests/atl/devenv/CComObject.vcxproj index 97903a9250..ea8c77d5f1 100644 --- a/modules/rostests/apitests/atl/devenv/CComObject.vcxproj +++ b/modules/rostests/apitests/atl/devenv/CComObject.vcxproj @@ -27,25 +27,25 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/modules/rostests/apitests/atl/devenv/CComQIPtr.vcxproj b/modules/rostests/apitests/atl/devenv/CComQIPtr.vcxproj index 345f1d8ea1..ffb3bbcb0d 100644 --- a/modules/rostests/apitests/atl/devenv/CComQIPtr.vcxproj +++ b/modules/rostests/apitests/atl/devenv/CComQIPtr.vcxproj @@ -27,25 +27,25 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/modules/rostests/apitests/atl/devenv/CImage.vcxproj b/modules/rostests/apitests/atl/devenv/CImage.vcxproj index 80984b87c9..88298e542b 100644 --- a/modules/rostests/apitests/atl/devenv/CImage.vcxproj +++ b/modules/rostests/apitests/atl/devenv/CImage.vcxproj @@ -27,25 +27,25 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>Unicode</CharacterSet> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/modules/rostests/apitests/atl/devenv/CSimpleArray.vcxproj b/modules/rostests/apitests/atl/devenv/CSimpleArray.vcxproj index 76b03d7598..57b074d139 100644 --- a/modules/rostests/apitests/atl/devenv/CSimpleArray.vcxproj +++ b/modules/rostests/apitests/atl/devenv/CSimpleArray.vcxproj @@ -27,25 +27,25 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/modules/rostests/apitests/atl/devenv/CSimpleMap.vcxproj b/modules/rostests/apitests/atl/devenv/CSimpleMap.vcxproj index 03862264d7..0926e8c8b1 100644 --- a/modules/rostests/apitests/atl/devenv/CSimpleMap.vcxproj +++ b/modules/rostests/apitests/atl/devenv/CSimpleMap.vcxproj @@ -27,25 +27,25 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/modules/rostests/apitests/atl/devenv/CString.vcxproj b/modules/rostests/apitests/atl/devenv/CString.vcxproj index 8772a16814..0aa91ae4ee 100644 --- a/modules/rostests/apitests/atl/devenv/CString.vcxproj +++ b/modules/rostests/apitests/atl/devenv/CString.vcxproj @@ -27,25 +27,25 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v120_xp</PlatformToolset> + <PlatformToolset>v140_xp</PlatformToolset> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> diff --git a/sdk/lib/atl/atlbase.h b/sdk/lib/atl/atlbase.h index ae4c6ef03f..fc0755c174 100644 --- a/sdk/lib/atl/atlbase.h +++ b/sdk/lib/atl/atlbase.h @@ -1074,11 +1074,11 @@ public: ATLASSERT(lpszKeyName); HKEY hKey = NULL; - LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, NULL, samDesired, &hKey); + LONG lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey); if (lRes != ERROR_SUCCESS) { samDesired |= KEY_WOW64_64KEY; - lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, NULL, samDesired, &hKey); + lRes = ::RegOpenKeyEx(hKeyParent, lpszKeyName, 0, samDesired, &hKey); } if (lRes == ERROR_SUCCESS) { @@ -1099,13 +1099,13 @@ public: ATLASSERT(lpszKeyName); HKEY hKey = NULL; - LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, NULL, lpszClass, + LONG lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass, dwOptions, samDesired, lpSecAttr, &hKey, lpdwDisposition); if (lRes != ERROR_SUCCESS) { samDesired |= KEY_WOW64_64KEY; - lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, NULL, lpszClass, + lRes = ::RegCreateKeyEx(hKeyParent, lpszKeyName, 0, lpszClass, dwOptions, samDesired, lpSecAttr, &hKey, lpdwDisposition); } @@ -1213,7 +1213,7 @@ public: LONG SetValue(LPCTSTR pszValueName, DWORD dwType, const void* pValue, ULONG nBytes) throw() { ATLASSERT(m_hKey); - return ::RegSetValueEx(m_hKey, pszValueName, NULL, dwType, (const BYTE*)pValue, nBytes); + return ::RegSetValueEx(m_hKey, pszValueName, 0, dwType, (const BYTE*)pValue, nBytes); } LONG SetDWORDValue(LPCTSTR pszValueName, DWORD dwValue) throw() diff --git a/sdk/lib/atl/atldef.h b/sdk/lib/atl/atldef.h index 4ab2fec45d..a78987099e 100644 --- a/sdk/lib/atl/atldef.h +++ b/sdk/lib/atl/atldef.h @@ -7,6 +7,10 @@ #pragma once +#ifndef __REACTOS__ + #include <cstddef> + #include <pseh/pseh2.h> +#endif #define _ATL_PACKING 8 diff --git a/sdk/lib/atl/atlfile.h b/sdk/lib/atl/atlfile.h index cff0614d1c..d204cce5e1 100644 --- a/sdk/lib/atl/atlfile.h +++ b/sdk/lib/atl/atlfile.h @@ -89,7 +89,7 @@ public: m_nOffset.QuadPart = orig.m_nOffset.QuadPart; m_dwViewDesiredAccess = orig.m_dwViewDesiredAccess; - if (::DuplicateHandle(GetCurrentProcess(), orig.m_hMapping, GetCurrentProcess(), &m_hMapping, NULL, TRUE, DUPLICATE_SAME_ACCESS)) + if (::DuplicateHandle(GetCurrentProcess(), orig.m_hMapping, GetCurrentProcess(), &m_hMapping, 0, TRUE, DUPLICATE_SAME_ACCESS)) { m_pData = ::MapViewOfFile(m_hMapping, m_dwViewDesiredAccess, m_nOffset.HighPart, m_nOffset.LowPart, m_nMappingSize); if (!m_pData)
5 years, 8 months
1
0
0
0
[reactos] 01/01: [HIDCLASS] Implement IOCTL_HID_GET_FEATURE/IOCTL_HID_SET_FEATURE
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=501116b68f1da4e380f56…
commit 501116b68f1da4e380f5630672b0fe099f22ab55 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Fri Apr 19 22:40:32 2019 +0200 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Fri Apr 19 22:46:03 2019 +0200 [HIDCLASS] Implement IOCTL_HID_GET_FEATURE/IOCTL_HID_SET_FEATURE --- drivers/hid/hidclass/hidclass.c | 114 ++++++++++++++++++++++++++++++++++++++++ drivers/hid/hidclass/pdo.c | 26 +++++++++ drivers/hid/hidclass/precomp.h | 5 ++ 3 files changed, 145 insertions(+) diff --git a/drivers/hid/hidclass/hidclass.c b/drivers/hid/hidclass/hidclass.c index 6d21f14b70..30d6f8d409 100644 --- a/drivers/hid/hidclass/hidclass.c +++ b/drivers/hid/hidclass/hidclass.c @@ -934,6 +934,120 @@ HidClass_DeviceControl( IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_SUCCESS; } + case IOCTL_HID_GET_FEATURE: + { + PIRP SubIrp; + KEVENT Event; + IO_STATUS_BLOCK IoStatusBlock; + HID_XFER_PACKET XferPacket; + NTSTATUS Status; + PHIDP_REPORT_IDS ReportDescription; + + if (IoStack->Parameters.DeviceIoControl.InputBufferLength < 1) + { + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } + ReportDescription = HidClassPDO_GetReportDescriptionByReportID(&PDODeviceExtension->Common.DeviceDescription, ((PUCHAR)Irp->AssociatedIrp.SystemBuffer)[0]); + if (!ReportDescription || IoStack->Parameters.DeviceIoControl.OutputBufferLength < ReportDescription->FeatureLength) + { + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } + + RtlZeroMemory(&XferPacket, sizeof(XferPacket)); + XferPacket.reportBufferLen = ReportDescription->FeatureLength; + XferPacket.reportBuffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); + XferPacket.reportId = ((PUCHAR)Irp->AssociatedIrp.SystemBuffer)[0]; + if (!XferPacket.reportBuffer) + { + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INSUFFICIENT_RESOURCES; + } + + SubIrp = IoBuildDeviceIoControlRequest( + IOCTL_HID_GET_FEATURE, + CommonDeviceExtension->HidDeviceExtension.NextDeviceObject, + NULL, 0, + NULL, 0, + TRUE, + &Event, + &IoStatusBlock); + if (!SubIrp) + { + Irp->IoStatus.Status = STATUS_NO_MEMORY; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_NOT_IMPLEMENTED; + } + SubIrp->UserBuffer = &XferPacket; + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + Status = IoCallDriver(CommonDeviceExtension->HidDeviceExtension.NextDeviceObject, SubIrp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + Status = IoStatusBlock.Status; + } + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } + case IOCTL_HID_SET_FEATURE: + { + PIRP SubIrp; + KEVENT Event; + IO_STATUS_BLOCK IoStatusBlock; + HID_XFER_PACKET XferPacket; + NTSTATUS Status; + PHIDP_REPORT_IDS ReportDescription; + + if (IoStack->Parameters.DeviceIoControl.InputBufferLength < 1) + { + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } + ReportDescription = HidClassPDO_GetReportDescriptionByReportID(&PDODeviceExtension->Common.DeviceDescription, ((PUCHAR)Irp->AssociatedIrp.SystemBuffer)[0]); + if (!ReportDescription || IoStack->Parameters.DeviceIoControl.InputBufferLength < ReportDescription->FeatureLength) + { + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } + + RtlZeroMemory(&XferPacket, sizeof(XferPacket)); + XferPacket.reportBufferLen = ReportDescription->FeatureLength; + XferPacket.reportBuffer = Irp->AssociatedIrp.SystemBuffer; + XferPacket.reportId = XferPacket.reportBuffer[0]; + + SubIrp = IoBuildDeviceIoControlRequest( + IOCTL_HID_SET_FEATURE, + CommonDeviceExtension->HidDeviceExtension.NextDeviceObject, + NULL, 0, + NULL, 0, + TRUE, + &Event, + &IoStatusBlock); + if (!SubIrp) + { + Irp->IoStatus.Status = STATUS_NO_MEMORY; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_NOT_IMPLEMENTED; + } + SubIrp->UserBuffer = &XferPacket; + KeInitializeEvent(&Event, SynchronizationEvent, FALSE); + Status = IoCallDriver(CommonDeviceExtension->HidDeviceExtension.NextDeviceObject, SubIrp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + Status = IoStatusBlock.Status; + } + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } default: { DPRINT1("[HIDCLASS] DeviceControl IoControlCode 0x%x not implemented\n", IoStack->Parameters.DeviceIoControl.IoControlCode); diff --git a/drivers/hid/hidclass/pdo.c b/drivers/hid/hidclass/pdo.c index 761cb24d92..f629ebd411 100644 --- a/drivers/hid/hidclass/pdo.c +++ b/drivers/hid/hidclass/pdo.c @@ -67,6 +67,32 @@ HidClassPDO_GetReportDescription( return NULL; } +PHIDP_REPORT_IDS +HidClassPDO_GetReportDescriptionByReportID( + PHIDP_DEVICE_DESC DeviceDescription, + UCHAR ReportID) +{ + ULONG Index; + + for (Index = 0; Index < DeviceDescription->ReportIDsLength; Index++) + { + if (DeviceDescription->ReportIDs[Index].ReportID == ReportID) + { + // + // found report id + // + return &DeviceDescription->ReportIDs[Index]; + } + } + + // + // failed to find report id + // + DPRINT1("[HIDCLASS] GetReportDescriptionByReportID ReportID %x not found\n", ReportID); + ASSERT(FALSE); + return NULL; +} + NTSTATUS HidClassPDO_HandleQueryDeviceId( IN PDEVICE_OBJECT DeviceObject, diff --git a/drivers/hid/hidclass/precomp.h b/drivers/hid/hidclass/precomp.h index afaa571d7d..d3b0be8133 100644 --- a/drivers/hid/hidclass/precomp.h +++ b/drivers/hid/hidclass/precomp.h @@ -213,4 +213,9 @@ HidClassPDO_GetReportDescription( PHIDP_DEVICE_DESC DeviceDescription, ULONG CollectionNumber); +PHIDP_REPORT_IDS +HidClassPDO_GetReportDescriptionByReportID( + PHIDP_DEVICE_DESC DeviceDescription, + UCHAR ReportID); + #endif /* _HIDCLASS_PCH_ */
5 years, 8 months
1
0
0
0
[reactos] 02/02: [KERNEL32] GetSystemPowerStatus(): Set the BATTERY_FLAG_CRITICAL flag if the battery life gets lower than 5 percent.
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=afca8367ea2a77aa47636…
commit afca8367ea2a77aa476361ec770c6e39267f8236 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Fri Apr 19 22:30:46 2019 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Fri Apr 19 22:30:46 2019 +0200 [KERNEL32] GetSystemPowerStatus(): Set the BATTERY_FLAG_CRITICAL flag if the battery life gets lower than 5 percent. --- dll/win32/kernel32/client/power.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dll/win32/kernel32/client/power.c b/dll/win32/kernel32/client/power.c index e25d25a4e2..4a486fe94a 100644 --- a/dll/win32/kernel32/client/power.c +++ b/dll/win32/kernel32/client/power.c @@ -61,6 +61,9 @@ GetSystemPowerStatus(IN LPSYSTEM_POWER_STATUS PowerStatus) PowerStatus->BatteryLifePercent = 100; } + if (PowerStatus->BatteryLifePercent <= 4) + PowerStatus->BatteryFlag |= BATTERY_FLAG_CRITICAL; + if (PowerStatus->BatteryLifePercent <= 32) PowerStatus->BatteryFlag |= BATTERY_FLAG_LOW;
5 years, 8 months
1
0
0
0
[reactos] 01/02: [KERNEL32] GetSystemPowerStatus(): Fix coding style. No code changes!
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=333eb16f308a027839f21…
commit 333eb16f308a027839f21e8144d3b39cff3e96e3 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Fri Apr 19 22:28:11 2019 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Fri Apr 19 22:28:11 2019 +0200 [KERNEL32] GetSystemPowerStatus(): Fix coding style. No code changes! --- dll/win32/kernel32/client/power.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/dll/win32/kernel32/client/power.c b/dll/win32/kernel32/client/power.c index 542e4f7375..e25d25a4e2 100644 --- a/dll/win32/kernel32/client/power.c +++ b/dll/win32/kernel32/client/power.c @@ -35,7 +35,6 @@ GetSystemPowerStatus(IN LPSYSTEM_POWER_STATUS PowerStatus) 0, &BattState, sizeof(SYSTEM_BATTERY_STATE)); - if (!NT_SUCCESS(Status)) { BaseSetLastNTError(Status); @@ -62,17 +61,24 @@ GetSystemPowerStatus(IN LPSYSTEM_POWER_STATUS PowerStatus) PowerStatus->BatteryLifePercent = 100; } - if (PowerStatus->BatteryLifePercent <= 32) PowerStatus->BatteryFlag |= BATTERY_FLAG_LOW; - if (PowerStatus->BatteryLifePercent >= 67) PowerStatus->BatteryFlag |= BATTERY_FLAG_HIGH; + if (PowerStatus->BatteryLifePercent <= 32) + PowerStatus->BatteryFlag |= BATTERY_FLAG_LOW; + + if (PowerStatus->BatteryLifePercent >= 67) + PowerStatus->BatteryFlag |= BATTERY_FLAG_HIGH; } - if (!BattState.BatteryPresent) PowerStatus->BatteryFlag |= BATTERY_FLAG_NO_BATTERY; + if (!BattState.BatteryPresent) + PowerStatus->BatteryFlag |= BATTERY_FLAG_NO_BATTERY; - if (BattState.Charging) PowerStatus->BatteryFlag |= BATTERY_FLAG_CHARGING; + if (BattState.Charging) + PowerStatus->BatteryFlag |= BATTERY_FLAG_CHARGING; - if (!(BattState.AcOnLine) && (BattState.BatteryPresent)) PowerStatus->ACLineStatus = AC_LINE_OFFLINE; + if (!(BattState.AcOnLine) && (BattState.BatteryPresent)) + PowerStatus->ACLineStatus = AC_LINE_OFFLINE; - if (BattState.EstimatedTime) PowerStatus->BatteryLifeTime = BattState.EstimatedTime; + if (BattState.EstimatedTime) + PowerStatus->BatteryLifeTime = BattState.EstimatedTime; return TRUE; }
5 years, 8 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
24
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
Results per page:
10
25
50
100
200