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
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
June 2006
----- 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
19 participants
595 discussions
Start a n
N
ew thread
[janderwald] 22363: add powercfg to build
by janderwald@svn.reactos.org
Author: janderwald Date: Thu Jun 15 18:10:11 2006 New Revision: 22363 URL:
http://svn.reactos.ru/svn/reactos?rev=22363&view=rev
Log: add powercfg to build Modified: trunk/reactos/dll/cpl/cpl.rbuild Modified: trunk/reactos/dll/cpl/cpl.rbuild URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/cpl.rbuild?rev=2236…
============================================================================== --- trunk/reactos/dll/cpl/cpl.rbuild (original) +++ trunk/reactos/dll/cpl/cpl.rbuild Thu Jun 15 18:10:11 2006 @@ -19,6 +19,9 @@ <directory name="ncpa"> <xi:include href="ncpa/ncpa.rbuild" /> </directory> +<directory name="powercfg"> + <xi:include href="powercfg/powercfg.rbuild" /> +</directory> <directory name="sysdm"> <xi:include href="sysdm/sysdm.rbuild" /> </directory>
18 years, 5 months
1
0
0
0
[janderwald] 22362: * implementation of Power Panel Control Applet * developed by Alex Wurzinger, Johannes Anderwald & Martin Rottensteiner
by janderwald@svn.reactos.org
Author: janderwald Date: Thu Jun 15 18:07:08 2006 New Revision: 22362 URL:
http://svn.reactos.ru/svn/reactos?rev=22362&view=rev
Log: * implementation of Power Panel Control Applet * developed by Alex Wurzinger, Johannes Anderwald & Martin Rottensteiner Added: trunk/reactos/dll/cpl/powercfg/ trunk/reactos/dll/cpl/powercfg/advanced.c trunk/reactos/dll/cpl/powercfg/alarms.c trunk/reactos/dll/cpl/powercfg/de.rc trunk/reactos/dll/cpl/powercfg/en.rc trunk/reactos/dll/cpl/powercfg/hibernate.c trunk/reactos/dll/cpl/powercfg/powercfg.c trunk/reactos/dll/cpl/powercfg/powercfg.def trunk/reactos/dll/cpl/powercfg/powercfg.h trunk/reactos/dll/cpl/powercfg/powercfg.rbuild trunk/reactos/dll/cpl/powercfg/powercfg.rc trunk/reactos/dll/cpl/powercfg/powershemes.c trunk/reactos/dll/cpl/powercfg/resource.h trunk/reactos/dll/cpl/powercfg/resources/ trunk/reactos/dll/cpl/powercfg/resources/ac.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/acdc.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batterycharging.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batterychargingcritical.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batterycharginghalf.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batterycharginghigh.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batterycharginglow.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batterycritical.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batteryfull.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batteryhalf.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batteryhigh.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batterylow.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/batteryunknown.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/dc.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/nobattery.ico (with props) trunk/reactos/dll/cpl/powercfg/resources/screen.ico (with props) Added: trunk/reactos/dll/cpl/powercfg/advanced.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/advanced.c…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/advanced.c (added) +++ trunk/reactos/dll/cpl/powercfg/advanced.c Thu Jun 15 18:07:08 2006 @@ -1,0 +1,531 @@ +/* $Id: advanced.c 21500 2006-04-07 10:20:39Z janderwald $ + * + * PROJECT: ReactOS Power Configuration Applet + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/cpl/powercfg/advanced.c + * PURPOSE: advanced tab of applet + * PROGRAMMERS: Alexander Wurzinger (Lohnegrim at gmx dot net) + * Johannes Anderwald (johannes.anderwald(a)student.tugraz.at) + * Martin Rottensteiner + */ + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include <windows.h> +#include <commctrl.h> +#include <cpl.h> +#include "resource.h" +#include "powercfg.h" +#include "powrprof.h" + +HWND hAdv=0; + +void Adv_InitDialog(); +void Adv_SaveData(HWND hwndDlg); + +static POWER_ACTION g_SystemBatteries[3]; +static POWER_ACTION g_PowerButton[5]; +static POWER_ACTION g_SleepButton[5]; + +/* Property page dialog callback */ +INT_PTR CALLBACK +advancedProc( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + switch(uMsg) + { + case WM_INITDIALOG: + hAdv = hwndDlg; + Adv_InitDialog(); + return TRUE; + break; + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDC_SYSTRAYBATTERYMETER: + case IDC_PASSWORDLOGON: + case IDC_VIDEODIMDISPLAY: + if (HIWORD(wParam) == BN_CLICKED) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + case IDC_LIDCLOSE: + case IDC_POWERBUTTON: + case IDC_SLEEPBUTTON: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + } + break; + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + if (lpnm->code == (UINT)PSN_APPLY) + { + Adv_SaveData(hwndDlg); + } + return TRUE; + } + } + return FALSE; +} + +static void AddItem(HWND hDlgCtrl, int ResourceId, LPARAM lParam, POWER_ACTION * lpAction) +{ + TCHAR szBuffer[MAX_PATH]; + LRESULT Index; + if (LoadString(hApplet, ResourceId, szBuffer, MAX_PATH) < MAX_PATH) + { + Index = SendMessage(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)szBuffer); + if (Index != CB_ERR) + { + SendMessage(hDlgCtrl, CB_SETITEMDATA, (WPARAM)Index, lParam); + lpAction[Index] = (POWER_ACTION)lParam; + } + } +} + +static int FindActionIndex(POWER_ACTION * lpAction, DWORD dwActionSize, POWER_ACTION poAction) +{ + int Index; + + for (Index = 0; Index < dwActionSize; Index++) + { + if (lpAction[Index] == poAction) + return Index; + } + + return -1; +} + +static BOOLEAN IsBatteryUsed() +{ + SYSTEM_BATTERY_STATE sbs; + + if (CallNtPowerInformation(SystemBatteryState,NULL, (ULONG)NULL, &sbs, sizeof(SYSTEM_BATTERY_STATE)) == STATUS_SUCCESS) + { + if (sbs.BatteryPresent) + { + if (sbs.AcOnLine) + { + return FALSE; + } + return TRUE; + } + return FALSE; + } + + return FALSE; +} + +POWER_ACTION GetPowerActionFromPolicy(POWER_ACTION_POLICY * Policy) +{ + POWER_ACTION poAction = PowerActionNone; + /* + + TCHAR szBuffer[MAX_PATH]; + + // Note: Windows XP SP2+ does not return the PowerAction code + // for PowerActionWarmEject + PowerActionShutdown but sets it + // to PowerActionNone and sets the Flags & EventCode + + + swprintf(szBuffer, L"Action: %x EventCode %x Flags %x",Policy->Action, Policy->EventCode, Policy->Flags); + MessageBoxW(NULL, szBuffer, NULL, MB_OK); + + */ + + if (Policy->Action == PowerActionNone) + { + if (Policy->Flags == (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED)) + { + if (Policy->EventCode == POWER_FORCE_TRIGGER_RESET) + { + poAction = PowerActionNone; + } + else if (Policy->EventCode == POWER_USER_NOTIFY_BUTTON) + { + poAction = PowerActionWarmEject; + } + else if (Policy->EventCode == POWER_USER_NOTIFY_SHUTDOWN) + { + poAction = PowerActionShutdown; + } + } + } + else + { + poAction = Policy->Action; + } + + return poAction; +} + +void ShowCurrentPowerActionPolicy(HWND hDlgCtrl, + POWER_ACTION * lpAction, + DWORD dwActionSize, + POWER_ACTION_POLICY * Policy) +{ + int poActionIndex; + POWER_ACTION poAction; + + poAction = GetPowerActionFromPolicy(Policy); + poActionIndex = FindActionIndex(lpAction, dwActionSize, poAction); + + if (poActionIndex < 0) + { + return; + } + + SendMessage(hDlgCtrl, CB_SETCURSEL, (WPARAM)poActionIndex, (LPARAM)0); +} + +BOOLEAN SaveCurrentPowerActionPolicy(IN HWND hDlgCtrl, + OUT POWER_ACTION_POLICY * Policy) +{ + LRESULT Index; + LRESULT ItemData; + + Index = SendMessage(hDlgCtrl, CB_GETCURSEL, 0, 0); + if (Index == CB_ERR) + return FALSE; + + ItemData = SendMessage(hDlgCtrl, CB_GETITEMDATA, (WPARAM)Index, 0); + if (ItemData == CB_ERR) + return FALSE; + + switch(ItemData) + { + case PowerActionNone: + Policy->Action = PowerActionNone; + Policy->EventCode = POWER_FORCE_TRIGGER_RESET; + break; + case PowerActionWarmEject: + Policy->Action = PowerActionNone; + Policy->EventCode = POWER_USER_NOTIFY_BUTTON; + break; + case PowerActionShutdown: + Policy->Action = PowerActionNone; + Policy->EventCode = POWER_USER_NOTIFY_SHUTDOWN; + break; + case PowerActionSleep: + case PowerActionHibernate: + Policy->Action = (POWER_ACTION)ItemData; + Policy->EventCode = 0; + break; + default: + return FALSE; + } + Policy->Flags = (POWER_ACTION_UI_ALLOWED | POWER_ACTION_QUERY_ALLOWED); + + return TRUE; +} + + + + +//------------------------------------------------------------------- + +void ShowCurrentPowerActionPolicies(HWND hwndDlg) +{ + TCHAR szAction[MAX_PATH]; + + if (!IsBatteryUsed()) + { +#if 0 + /* expiremental code */ +// ShowCurrentPowerButtonAcAction(hList2, + ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), + g_SystemBatteries, + sizeof(g_SystemBatteries) / sizeof(POWER_ACTION), + &gGPP.user.LidCloseAc); +#else + if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.LidCloseAc.Action, szAction, MAX_PATH)) + { + SendMessage(GetDlgItem(hwndDlg, IDC_LIDCLOSE), + CB_SELECTSTRING, + TRUE, + (LPARAM)szAction); + } +#endif + ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), + g_PowerButton, + sizeof(g_PowerButton) / sizeof(POWER_ACTION), + &gGPP.user.PowerButtonAc); + +#if 0 + /* expiremental code */ + ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), + g_SleepButton, + sizeof(g_SleepButton) / sizeof(POWER_ACTION), + &gGPP.user.SleepButtonAc); +#else + if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.SleepButtonAc.Action, szAction, MAX_PATH)) + { + SendMessage(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), + CB_SELECTSTRING, + TRUE, + (LPARAM)szAction); + } +#endif + } + else + { +#if 0 + + ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE), + g_SleepButton, + sizeof(g_SleepButton) / sizeof(POWER_ACTION), + &gGPP.user.LidCloseDc); + + ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), + g_SleepButton, + sizeof(g_SleepButton) / sizeof(POWER_ACTION), + &gGPP.user.PowerButtonDc); + + ShowCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), + g_SleepButton, + sizeof(g_SleepButton) / sizeof(POWER_ACTION), + &gGPP.user.SleepButtonDc); +#else + if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.LidCloseDc.Action, szAction, MAX_PATH)) + { + SendMessage(GetDlgItem(hwndDlg, IDC_LIDCLOSE), + CB_SELECTSTRING, + TRUE, + (LPARAM)szAction); + } + if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.PowerButtonDc.Action, szAction, MAX_PATH)) + { + SendMessage(GetDlgItem(hwndDlg, IDC_POWERBUTTON), + CB_SELECTSTRING, + TRUE, + (LPARAM)szAction); + } + if (LoadString(hApplet, IDS_PowerActionNone1+gGPP.user.SleepButtonDc.Action, szAction, MAX_PATH)) + { + SendMessage(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), + CB_SELECTSTRING, + TRUE, + (LPARAM)szAction); + } +#endif + } +} + +void Adv_InitDialog() +{ + HWND hList1; + HWND hList2; + HWND hList3; + + BOOLEAN bSuspend = FALSE; + BOOLEAN bHibernate; + BOOLEAN bShutdown; + + SYSTEM_POWER_CAPABILITIES spc; + + SendMessage(GetDlgItem(hAdv, IDC_SYSTRAYBATTERYMETER), + BM_SETCHECK, + (gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter ? BST_CHECKED : BST_UNCHECKED), + (LPARAM)0); + SendMessage(GetDlgItem(hAdv, IDC_PASSWORDLOGON), + BM_SETCHECK, + (gGPP.user.GlobalFlags & EnablePasswordLogon ? BST_CHECKED : BST_UNCHECKED), + (LPARAM)0); + SendMessage(GetDlgItem(hAdv, IDC_VIDEODIMDISPLAY), + BM_SETCHECK, + (gGPP.user.GlobalFlags & EnableVideoDimDisplay ? BST_CHECKED : BST_UNCHECKED), + (LPARAM)0); + + GetPwrCapabilities(&spc); + + if (spc.SystemS1 || spc.SystemS2 || spc.SystemS3) + bSuspend=TRUE; + + bHibernate = spc.HiberFilePresent; + bShutdown = spc.SystemS5; + + hList1 = GetDlgItem(hAdv, IDC_LIDCLOSE); + SendMessage(hList1, CB_RESETCONTENT, 0, 0); + + memset(g_SystemBatteries, 0x0, sizeof(g_SystemBatteries)); + if (spc.SystemBatteriesPresent) + { + AddItem(hList1, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_SystemBatteries); + + if (bSuspend) + { + AddItem(hList1, IDS_PowerActionSleep, (LPARAM)PowerActionSleep, g_SystemBatteries); + } + + if (bHibernate) + { + AddItem(hList1, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate, g_SystemBatteries); + } + } + else + { + ShowWindow(GetDlgItem(hAdv, IDC_SLIDCLOSE), FALSE); + ShowWindow(hList1, FALSE); + } + + hList2 = GetDlgItem(hAdv, IDC_POWERBUTTON); + SendMessage(hList2, CB_RESETCONTENT, 0, 0); + + memset(g_PowerButton, 0x0, sizeof(g_PowerButton)); + if (spc.PowerButtonPresent) + { + AddItem(hList2, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_PowerButton); + AddItem(hList2, IDS_PowerActionWarmEject, (LPARAM)PowerActionWarmEject, g_PowerButton); + + if (bSuspend) + { + AddItem(hList2, IDS_PowerActionSleep, (LPARAM)PowerActionSleep, g_PowerButton); + } + + if (bHibernate) + { + AddItem(hList2, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate, g_PowerButton); + + } + if (bShutdown) + { + AddItem(hList2, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown, g_PowerButton); + } + } + else + { + ShowWindow(GetDlgItem(hAdv, IDC_SPOWERBUTTON), FALSE); + ShowWindow(hList2, FALSE); + } + + hList3=GetDlgItem(hAdv, IDC_SLEEPBUTTON); + SendMessage(hList3, CB_RESETCONTENT, 0, 0); + memset(g_SleepButton, 0x0, sizeof(g_SleepButton)); + + if (spc.SleepButtonPresent) + { + AddItem(hList3, IDS_PowerActionNone1, (LPARAM)PowerActionNone, g_SleepButton); + AddItem(hList3, IDS_PowerActionWarmEject, (LPARAM)PowerActionWarmEject, g_SleepButton); + + if (bSuspend) + { + AddItem(hList3, IDS_PowerActionSleep, (LPARAM)PowerActionSleep, g_SleepButton); + } + + if (bHibernate) + { + AddItem(hList3, IDS_PowerActionHibernate, (LPARAM)PowerActionHibernate, g_SleepButton); + } + + if (bShutdown) + { + AddItem(hList3, IDS_PowerActionShutdown, (LPARAM)PowerActionShutdown, g_SleepButton); + } + } + else + { + ShowWindow(GetDlgItem(hAdv, IDC_SSLEEPBUTTON), FALSE); + ShowWindow(hList3, FALSE); + } + + if (ReadGlobalPwrPolicy(&gGPP)) + { + ShowCurrentPowerActionPolicies(hAdv); + } +} + + +void Adv_SaveData(HWND hwndDlg) +{ + BOOLEAN bSystrayBatteryMeter; + BOOLEAN bPasswordLogon; + BOOLEAN bVideoDimDisplay; + + bSystrayBatteryMeter = (BOOLEAN)SendMessage(GetDlgItem(hwndDlg, IDC_SYSTRAYBATTERYMETER), + BM_GETCHECK, + (WPARAM)0, + (LPARAM)0); + bPasswordLogon = (BOOLEAN)SendMessage(GetDlgItem(hwndDlg, IDC_PASSWORDLOGON), + BM_GETCHECK, + (WPARAM)0, + (LPARAM)0); + bVideoDimDisplay = (BOOLEAN)SendMessage(GetDlgItem(hwndDlg, IDC_VIDEODIMDISPLAY), + BM_GETCHECK, + (WPARAM)0, + (LPARAM)0); + + if (bSystrayBatteryMeter) + { + if (!(gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter)) + { + gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnableSysTrayBatteryMeter; + } + } + else + { + if ((gGPP.user.GlobalFlags & EnableSysTrayBatteryMeter)) + { + gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnableSysTrayBatteryMeter; + } + } + if (bPasswordLogon) + { + if (!(gGPP.user.GlobalFlags & EnablePasswordLogon)) + { + gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnablePasswordLogon; + } + } + else + { + if ((gGPP.user.GlobalFlags & EnablePasswordLogon)) + { + gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnablePasswordLogon; + } + } + if (bVideoDimDisplay) + { + if (!(gGPP.user.GlobalFlags & EnableVideoDimDisplay)) + { + gGPP.user.GlobalFlags = gGPP.user.GlobalFlags + EnableVideoDimDisplay; + } + } + else + { + if ((gGPP.user.GlobalFlags & EnableVideoDimDisplay)) + { + gGPP.user.GlobalFlags = gGPP.user.GlobalFlags - EnableVideoDimDisplay; + } + } + if (!IsBatteryUsed()) + { + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonAc); +#if 0 + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE), &gGPP.user.LidCloseAc); + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonAc); +#endif + } + else + { +#if 0 + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_POWERBUTTON), &gGPP.user.PowerButtonDc); + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_LIDCLOSE), &gGPP.user.LidCloseDc); + SaveCurrentPowerActionPolicy(GetDlgItem(hwndDlg, IDC_SLEEPBUTTON), &gGPP.user.SleepButtonDc); +#endif + } + + if (!WriteGlobalPwrPolicy(&gGPP)) + { + MessageBox(hwndDlg, L"WriteGlobalPwrPolicy failed", NULL, MB_OK); + } + + Adv_InitDialog(hwndDlg); +} Added: trunk/reactos/dll/cpl/powercfg/alarms.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/alarms.c?r…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/alarms.c (added) +++ trunk/reactos/dll/cpl/powercfg/alarms.c Thu Jun 15 18:07:08 2006 @@ -1,0 +1,200 @@ +/* $Id: alarms.c 21500 2006-04-07 10:20:39Z janderwald $ + * + * PROJECT: ReactOS Power Configuration Applet + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/cpl/powercfg/alarms.c + * PURPOSE: alarms tab of applet + * PROGRAMMERS: Alexander Wurzinger (Lohnegrim at gmx dot net) + * Johannes Anderwald (johannes.anderwald(a)student.tugraz.at) + * Martin Rottensteiner + */ + + +#include <windows.h> +#include <commctrl.h> +#include <cpl.h> +#include <stdio.h> + +#include "resource.h" +#include "powercfg.h" +#include "powrprof.h" + +BOOLEAN Ala_InitData(HWND); + +/* Property page dialog callback */ +INT_PTR CALLBACK +alarmsProc( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + switch(uMsg) + { + case WM_INITDIALOG: + if (!Ala_InitData(hwndDlg)) + { + //TODO + //handle initialization error + } + return TRUE; + default: + break; + } + return FALSE; +} + +BOOLEAN Ala_InitData(HWND hwndDlg) +{ + TCHAR szAction[MAX_PATH]; + TCHAR szText[MAX_PATH]; + TCHAR szSound[MAX_PATH]; + TCHAR szMessage[MAX_PATH]; + TCHAR szTemp[MAX_PATH]; + TCHAR szBatteryLevel[MAX_PATH]; + TCHAR szProgram[MAX_PATH]; + + if (!ReadGlobalPwrPolicy(&gGPP)) + { + return FALSE; + } + + if (gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].Enable) + { + SendMessage(GetDlgItem(hwndDlg, IDC_ALARM1), + BM_SETCHECK, + (gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].Enable ? BST_CHECKED : BST_UNCHECKED), + (LPARAM)0); + + if (LoadString(hApplet, IDS_PROCENT, szTemp, MAX_PATH)) + { + swprintf(szBatteryLevel,szTemp,gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].BatteryLevel); + SetWindowText(GetDlgItem(hwndDlg, IDC_ALARMVALUE1),szBatteryLevel); + } + + SendMessageW(GetDlgItem(hwndDlg, IDC_ALARMBAR1), + TBM_SETRANGE, + (WPARAM)TRUE, + (LPARAM)MAKELONG(0, 100)); + SendMessageW(GetDlgItem(hwndDlg, IDC_ALARMBAR1), + TBM_SETTICFREQ, + (WPARAM)TRUE, + (LPARAM)20); + SendMessageW(GetDlgItem(hwndDlg, IDC_ALARMBAR1), + TBM_SETPOS, + (WPARAM)TRUE, + (LPARAM)gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].BatteryLevel); + + if (LoadString(hApplet, gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.Action+IDS_PowerActionNone1, szAction, MAX_PATH)) + { + SetWindowText(GetDlgItem(hwndDlg, IDC_ALARMAKTION1),szAction); + } + + memset(szMessage, 0x0, sizeof(szMessage)); + LoadString(hApplet, IDS_NOACTION, szMessage, MAX_PATH); + + if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode) & POWER_LEVEL_USER_NOTIFY_TEXT) + { + if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode) & POWER_LEVEL_USER_NOTIFY_SOUND) + { + if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH) && LoadString(hApplet, IDS_TEXT, szText, MAX_PATH)) + { + swprintf(szMessage,L"%s, %s",szSound,szText); + } + } + else + { + if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH)) + { + swprintf(szMessage,L"%s",szText); + } + } + } + else + { + if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_LOW].PowerPolicy.EventCode) & POWER_LEVEL_USER_NOTIFY_SOUND) + { + if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH)) + { + swprintf(szMessage,L"%s",szSound); + } + } + } + + SetWindowText(GetDlgItem(hwndDlg, IDC_ALARMMSG1),szMessage); + + if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, MAX_PATH)) + { + SetWindowText(GetDlgItem(hwndDlg, IDC_ALARMPROG1),szProgram); + } + } + if (gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].Enable) + { + SendMessageW(GetDlgItem(hwndDlg, IDC_ALARM2), + BM_SETCHECK, + (gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].Enable ? BST_CHECKED : BST_UNCHECKED), + (LPARAM)0); + if (LoadString(hApplet, IDS_PROCENT, szTemp, MAX_PATH)) + { + swprintf(szBatteryLevel,szTemp,gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].BatteryLevel); + SetWindowText(GetDlgItem(hwndDlg, IDC_ALARMVALUE2),szBatteryLevel); + } + + SendMessageW(GetDlgItem(hwndDlg, IDC_ALARMBAR2), + TBM_SETRANGE, + (WPARAM)TRUE, + (LPARAM)MAKELONG(0, 100)); + SendMessageW(GetDlgItem(hwndDlg, IDC_ALARMBAR2), + TBM_SETPOS, + (WPARAM)TRUE, + (LPARAM)gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].BatteryLevel); + + if (LoadString(hApplet, gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.Action+IDS_PowerActionNone1, szAction, MAX_PATH)) + { + SendMessageW(GetDlgItem(hwndDlg, IDC_ALARMAKTION2), + WM_SETTEXT, + (WPARAM)0, + (LPARAM)szAction); + } + + memset(szMessage, 0x0, sizeof(szMessage)); + LoadString(hApplet, IDS_NOACTION, szMessage, MAX_PATH); + + if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode) & POWER_LEVEL_USER_NOTIFY_TEXT) + { + if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode) & POWER_LEVEL_USER_NOTIFY_SOUND) + { + if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH) && LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH)) + { + swprintf(szMessage,L"%s, %s",szSound,szText); + } + } + else + { + if (LoadString(hApplet, IDS_TEXT, szText, MAX_PATH)) + { + swprintf(szMessage,L"%s",szText); + } + } + } + else + { + if (LOWORD(gGPP.user.DischargePolicy[DISCHARGE_POLICY_CRITICAL].PowerPolicy.EventCode) & POWER_LEVEL_USER_NOTIFY_SOUND) + { + if (LoadString(hApplet, IDS_SOUND, szSound, MAX_PATH)) + { + swprintf(szMessage,L"%s",szSound); + } + } + } + + SetWindowText(GetDlgItem(hwndDlg, IDC_ALARMMSG2),szMessage); + + if (LoadString(hApplet, IDS_PowerActionNone2, szProgram, MAX_PATH)) + { + SetWindowText(GetDlgItem(hwndDlg, IDC_ALARMPROG2),szProgram); + } + } + return TRUE; +} Added: trunk/reactos/dll/cpl/powercfg/de.rc URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/de.rc?rev=…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/de.rc (added) +++ trunk/reactos/dll/cpl/powercfg/de.rc Thu Jun 15 18:07:08 2006 @@ -1,0 +1,162 @@ +// German (De) resources by Lohegrim (Lohnegrim at gmx dot net) + +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 252, 218 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Energieschemas" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_ACDC, IDI_ACDC, 7,7,28,22 + LTEXT "Wählen Sie das Energieschema mit den am besten zu diesem Computer passenden Einstellungen. Bedenken Sie, dass die Einstellungen das unten ausgewählte Schema modifizieren.", + -1,45,13,194,36 + GROUPBOX "&Energieschemen", -1, 7,57,240,46 + COMBOBOX IDC_ENERGYLIST, 14,70,224,92, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "Speichern &unter...", -1, 100,85,75,15,WS_DISABLED + PUSHBUTTON "&Löschen", -1, 180,85,55,15,WS_DISABLED + GROUPBOX "Unbekannt", IDC_GRPDETAIL, 7,108,240,105 + LTEXT "Bei:",IDC_SAT,15,120,60,10 + LTEXT "Netzbetrieb",IDC_SAC,100,120,45,15 + ICON IDI_AC, IDC_IAC, 75,115,25,15 + LTEXT "Batteriebetrieb",IDC_SDC,197,120,45,15 + ICON IDI_DC, IDC_IDC, 165,115,25,15 + LTEXT "&Monitor ausschalten:",IDC_MONITOR,15,145,80,10 + COMBOBOX IDC_MONITORACLIST, 100,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_MONITORDCLIST, 175,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Festplatten ausschalten:",IDC_DISK,15,160,80,10 + COMBOBOX IDC_DISKACLIST, 100,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_DISKDCLIST, 175,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Standby:",IDC_STANDBY,15,180,55,10 + COMBOBOX IDC_STANDBYACLIST, 100,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_STANDBYDCLIST, 175,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Ruhezustand:",IDC_HYBERNATE,15,195,55,10 + COMBOBOX IDC_HYBERNATEACLIST, 100,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_HYBERNATEDCLIST, 175,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +END + +IDD_PROPPAGEALARMS DIALOG DISCARDABLE 0, 0, 250, 220 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Alarme" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Alarm bei niedrigem Batteriestand",-1,10,15,235,95 + CONTROL "Alarm bei folgendem &Energiestand auslösen:",IDC_ALARM1, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,25,180,15 + LTEXT "Unbekannt",IDC_ALARMVALUE1,200,25,40,10 + LTEXT "0%",-1,20,40,15,15 + CONTROL "Slider1",IDC_ALARMBAR1,"msctls_trackbar32",TBS_HORZ | + TBS_AUTOTICKS | WS_TABSTOP,30,40,170,15 + LTEXT "100%",-1,215,40,25,10 + PUSHBUTTON "Alar&m Action...",-1,20,70,70,15,WS_DISABLED + LTEXT "Benachrichtigung:",-1,95,70,50,10 + LTEXT "Unbekannt",IDC_ALARMMSG1,145,70,95,10 + LTEXT "Aktion:",-1,95,80,45,10 + LTEXT "Unbekannt",IDC_ALARMAKTION1,145,80,95,10 + LTEXT "Ausführen:",-1,95,90,50,10 + LTEXT "Unbekannt",IDC_ALARMPROG1,150,90,40,10 + + GROUPBOX "Alarm bei kritischem Batteriestand",-1,10,115,235,95 + CONTROL "Alarm bei folgendem &Energiestand auslösen:",IDC_ALARM2, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,180,15 + LTEXT "Unbekannt",IDC_ALARMVALUE2,200,125,40,10 + LTEXT "0%",-1,20,140,15,15 + CONTROL "Slider1",IDC_ALARMBAR2,"msctls_trackbar32",TBS_HORZ | + TBS_AUTOTICKS | WS_TABSTOP,30,140,170,15 + LTEXT "100%",-1,215,140,25,10 + PUSHBUTTON "Alar&m Action...",-1,20,170,70,15,WS_DISABLED + LTEXT "Benachrichtigung:",-1,95,170,50,10 + LTEXT "Unbekannt",IDC_ALARMMSG2,145,170,95,10 + LTEXT "Aktion:",-1,95,180,45,10 + LTEXT "Unbekannt",IDC_ALARMAKTION2,145,180,95,10 + LTEXT "Ausführen:",-1,95,190,50,10 + LTEXT "Unbekannt",IDC_ALARMPROG2,150,190,40,10 +END + +IDD_PROPPAGEADVANCED DIALOG DISCARDABLE 0, 0, 250, 220 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Erweitert" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_ACDC,IDI_ACDC,5,5,20,20 + LTEXT "Wählen Sie die Energiesparoptionen aus, die Sie verwenden möchten.",-1,30,5,205,20 + GROUPBOX "Optionen",-1,5,35,225,55 + CONTROL "&Symbol in der Taskleiste anzeigen",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,45,200,10 + CONTROL "&Kennwort beim Reaktivieren aus dem Standbymodus anfordern",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,55,200,10 + CONTROL "&Helligkeit der Anzeige beim Batteriebetrieb verringern",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,65,200,10 + GROUPBOX "Netzschaltervorgänge",-1,5,100,230,105 + LTEXT "Beim Schließen des &Laptops:", IDC_SLIDCLOSE,10,110,210,10 + COMBOBOX IDC_LIDCLOSE,10,120,220,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + LTEXT "Beim Drücken des &Netzschalters am Computer:", IDC_SPOWERBUTTON,10,135,210,10 + COMBOBOX IDC_POWERBUTTON,10,150,220,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + LTEXT "Beim Drücken des Schalters für den &Ruhezustand am Computer:", IDC_SSLEEPBUTTON,10,165,210,10 + COMBOBOX IDC_SLEEPBUTTON,10,180,220,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP +END + +IDD_PROPPAGEHIBERNATE DIALOG DISCARDABLE 0, 0, 250, 220 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ruhezustand" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_SCREEN,IDI_SCREEN,5,5,20,20 + LTEXT "Wenn der Computer in den Ruhezustand wechselt, wird der Inhalt des Arbeitsspeichers gespeichert und der Computer heruntergefahren. Wenn er wieder gestartet wird, kehrt er zum vorherigen Zustand zurück.", + -1,35,5,195,35 + GROUPBOX "Ruhezustand",-1,5,45,235,25 + CONTROL "&Ruhezustand aktivieren",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,55,210,10 + GROUPBOX "Speicherplatz für den Ruhezustand",-1,5,80,240,60 + LTEXT "Freier Speicherplatz:",-1,10,90,100,10 + LTEXT "Unbekannt",IDC_FREESPACE,120,90,70,10 + LTEXT "Für Ruhezustand benötigt:",-1,10,100,115,10 + LTEXT "Unbekannt",IDC_SPACEFORHIBERNATEFILE,120,100,55,10 + LTEXT "Geben Sie Speicherplatz frei, bevor Sie den Computer in den Ruhezustand versetzen.",IDC_TOLESSFREESPACE,10,115,220,20 +END + +STRINGTABLE +BEGIN + IDS_CPLNAME_1 "Energieoptionen" + IDS_CPLDESCRIPTION_1 "Konfiguriert die Energiespareinstellungen für den Computer." + IDS_PROCENT "%i%%" + IDS_SOUND "Sound" + IDS_TEXT "Text" + IDS_CONFIG1 "Einstellungen für Energieschema %s." + IDS_CONFIG2 "Erweiterte Einstellungen für %s." + + IDS_SIZEBYTS "%i Bytes" + IDS_SIZEMB "%i MB" + + IDS_NOACTION "Nichts unternehmen" + + IDS_PowerActionNone1 "Keine Aktion" + IDS_PowerActionUnknown "Unbekannt" + IDS_PowerActionSleep "In den Standbymodus wechseln" + IDS_PowerActionHibernate "In den Ruhezustand wechseln" + IDS_PowerActionShutdown "Computer herunterfahren" + IDS_PowerActionRestart "Computer neu starten" + IDS_PowerActionShutdownOff "Computer ausschalten" + IDS_PowerActionWarmEject "Zur Vorgangsauswahl auffordern" + IDS_PowerActionNone2 "Kein" + + IDS_TIMEOUT1 "Nach 1 Min." + IDS_TIMEOUT2 "Nach 2 Min." + IDS_TIMEOUT3 "Nach 3 Min." + IDS_TIMEOUT4 "Nach 5 Min." + IDS_TIMEOUT5 "Nach 10 Min." + IDS_TIMEOUT6 "Nach 15 Min." + IDS_TIMEOUT7 "Nach 20 Min." + IDS_TIMEOUT8 "Nach 25 Min." + IDS_TIMEOUT9 "Nach 30 Min." + IDS_TIMEOUT10 "Nach 45 Min." + IDS_TIMEOUT11 "Nach 1 Stunde" + IDS_TIMEOUT12 "Nach 2 Stunden" + IDS_TIMEOUT13 "Nach 3 Stunden" + IDS_TIMEOUT14 "Nach 4 Stunden" + IDS_TIMEOUT15 "Nach 5 Stunden" + IDS_TIMEOUT16 "Nie" + +END Added: trunk/reactos/dll/cpl/powercfg/en.rc URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/en.rc?rev=…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/en.rc (added) +++ trunk/reactos/dll/cpl/powercfg/en.rc Thu Jun 15 18:07:08 2006 @@ -1,0 +1,162 @@ +// English (en) resources by Lohegrim (Lohnegrim at gmx dot net) + +LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL + +IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 250, 220 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Power Schemes" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_ACDC, IDI_ACDC, 7,7,28,22 + LTEXT "Select the power scheme with the most appropriate settings for this computer. Note that changing the settings below will modify the selected scheme.", + -1,45,13,194,36 + GROUPBOX "P&ower schemes", -1, 7,57,240,46 + COMBOBOX IDC_ENERGYLIST, 14,70,224,92, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Save As...", -1, 100,85,75,15,WS_DISABLED + PUSHBUTTON "&Delete", -1, 180,85,55,15,WS_DISABLED + GROUPBOX "Unknown", IDC_GRPDETAIL, 7,108,240,105 + LTEXT "When computer is:",IDC_SAT,15,120,60,10 + LTEXT "Plugged in",IDC_SAC,100,120,45,15 + ICON IDI_AC, IDC_IAC, 75,115,25,15 + LTEXT "Running on batteries",IDC_SDC,197,120,45,15 + ICON IDI_DC, IDC_IDC, 165,115,25,15 + LTEXT "Turn off &monitor:",IDC_MONITOR,15,145,80,10 + COMBOBOX IDC_MONITORACLIST, 100,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_MONITORDCLIST, 175,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Turn off hard d&isks:",IDC_DISK,15,160,80,10 + COMBOBOX IDC_DISKACLIST, 100,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_DISKDCLIST, 175,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "System s&tandby:",IDC_STANDBY,15,180,80,10 + COMBOBOX IDC_STANDBYACLIST, 100,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_STANDBYDCLIST, 175,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "System &hibernates:",IDC_HYBERNATE,15,195,80,10 + COMBOBOX IDC_HYBERNATEACLIST, 100,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_HYBERNATEDCLIST, 175,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +END + +IDD_PROPPAGEALARMS DIALOG DISCARDABLE 0, 0, 250, 220 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Alarms" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Low battery alarm",-1,10,15,235,95 + CONTROL "Activate &low battery alarm when power level reaches:",IDC_ALARM1, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,25,180,15 + LTEXT "unknown",IDC_ALARMVALUE1,200,25,40,10 + LTEXT "0%",-1,20,40,15,15 + CONTROL "Slider1",IDC_ALARMBAR1,"msctls_trackbar32",TBS_HORZ | + TBS_AUTOTICKS | WS_TABSTOP,30,40,170,15 + LTEXT "100%",-1,215,40,25,10 + PUSHBUTTON "Alar&m Action...",-1,20,70,70,15,WS_DISABLED + LTEXT "Notification:",-1,95,70,50,10 + LTEXT "Unknown",IDC_ALARMMSG1,145,70,95,10 + LTEXT "Action:",-1,95,80,45,10 + LTEXT "Unknown",IDC_ALARMAKTION1,145,80,95,10 + LTEXT "Run Program:",-1,95,90,50,10 + LTEXT "Unknown",IDC_ALARMPROG1,150,90,40,10 + + GROUPBOX "Critical battery alarm",-1,10,115,235,95 + CONTROL "Activate &low battery alarm when power level reaches:",IDC_ALARM2, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,180,15 + LTEXT "unknown",IDC_ALARMVALUE2,200,125,40,10 + LTEXT "0%",-1,20,140,15,15 + CONTROL "Slider1",IDC_ALARMBAR2,"msctls_trackbar32",TBS_HORZ | + TBS_AUTOTICKS | WS_TABSTOP,30,140,170,15 + LTEXT "100%",-1,215,140,25,10 + PUSHBUTTON "Alar&m Action...",-1,20,170,70,15,WS_DISABLED + LTEXT "Notification:",-1,95,170,50,10 + LTEXT "Unknown",IDC_ALARMMSG2,145,170,95,10 + LTEXT "Action:",-1,95,180,45,10 + LTEXT "Unknown",IDC_ALARMAKTION2,145,180,95,10 + LTEXT "Run Program:",-1,95,190,50,10 + LTEXT "Unknown",IDC_ALARMPROG2,150,190,40,10 +END + +IDD_PROPPAGEADVANCED DIALOG DISCARDABLE 0, 0, 250, 220 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Advanced" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_ACDC,IDI_ACDC,5,5,20,20 + LTEXT "Select the power-saving settings you want to use.",-1,30,5,205,20 + GROUPBOX "Options",-1,5,35,225,55 + CONTROL "Alway&s show icon on the taskbar",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,45,200,10 + CONTROL "&Prompt for password when computer resumes from standby",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,55,200,10 + CONTROL "&Dim display when running on batteries.",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,15,65,200,10 + GROUPBOX "Power buttons",-1,5,100,230,105 + LTEXT "&When I close the lid of my portable computer:", IDC_SLIDCLOSE,10,110,210,10 + COMBOBOX IDC_LIDCLOSE,10,120,220,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + LTEXT "Wh&en I press the power button on my computer:", IDC_SPOWERBUTTON,10,135,210,10 + COMBOBOX IDC_POWERBUTTON,10,150,220,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + LTEXT "Whe&n I press the sleep button on my computer:", IDC_SSLEEPBUTTON,10,165,210,10 + COMBOBOX IDC_SLEEPBUTTON,10,180,220,90,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP +END + +IDD_PROPPAGEHIBERNATE DIALOG DISCARDABLE 0, 0, 250, 220 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Hibernate" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDI_SCREEN,IDI_SCREEN,5,5,20,20 + LTEXT "When your computer hibernates, it stores whatever it has in memory on your hard disk and then shuts down. When your computer comes out of hibernation, it returns to its previous state. ", + -1,35,5,195,35 + GROUPBOX "Hibernate",-1,5,45,235,25 + CONTROL "Enable &hibernation",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,10,55,210,10 + GROUPBOX "Disk space for hibernation",-1,5,80,240,60 + LTEXT "Free disk space:",-1,10,90,100,10 + LTEXT "Unknown",IDC_FREESPACE,120,90,70,10 + LTEXT "Disk space required to hibernate:",-1,10,100,115,10 + LTEXT "Unknown",IDC_SPACEFORHIBERNATEFILE,120,100,55,10 + LTEXT "You must free some disk space before your computer can hibernate. ",IDC_TOLESSFREESPACE,10,115,220,20 +END + +STRINGTABLE +BEGIN + IDS_CPLNAME_1 "Power Options" + IDS_CPLDESCRIPTION_1 "Configure energy-saving settings for your computer." + IDS_PROCENT "%i%%" + IDS_SOUND "Sound" + IDS_TEXT "Text" + IDS_CONFIG1 "Settings for %1 power scheme" + IDS_CONFIG2 "Advanced settings for %1" + + IDS_SIZEBYTS "%i bytes" + IDS_SIZEMB "%i MB" + + IDS_NOACTION "Do nothing" + + IDS_PowerActionNone1 "No action" + IDS_PowerActionUnknown "Unknown" + IDS_PowerActionSleep "Stand by" + IDS_PowerActionHibernate "Hibernate" + IDS_PowerActionShutdown "Shut down" + IDS_PowerActionRestart "Restart" + IDS_PowerActionShutdownOff "Shutdown and Turn the Power Off" + IDS_PowerActionWarmEject "Ask me what to do" + IDS_PowerActionNone2 "None" + + IDS_TIMEOUT1 "After 1 min" + IDS_TIMEOUT2 "After 2 mins" + IDS_TIMEOUT3 "After 3 mins" + IDS_TIMEOUT4 "After 5 mins" + IDS_TIMEOUT5 "After 10 mins" + IDS_TIMEOUT6 "After 15 mins" + IDS_TIMEOUT7 "After 20 mins" + IDS_TIMEOUT8 "After 25 mins" + IDS_TIMEOUT9 "After 30 mins" + IDS_TIMEOUT10 "After 45 mins" + IDS_TIMEOUT11 "After 1 hour" + IDS_TIMEOUT12 "After 2 hours" + IDS_TIMEOUT13 "After 3 hours" + IDS_TIMEOUT14 "After 4 hours" + IDS_TIMEOUT15 "After 5 hours" + IDS_TIMEOUT16 "Never" +END + Added: trunk/reactos/dll/cpl/powercfg/hibernate.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/hibernate.…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/hibernate.c (added) +++ trunk/reactos/dll/cpl/powercfg/hibernate.c Thu Jun 15 18:07:08 2006 @@ -1,0 +1,167 @@ +/* $Id: hibernate.c 21500 2006-04-07 10:20:39Z janderwald $ + * + * PROJECT: ReactOS Power Configuration Applet + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/cpl/powercfg/hibernate.c + * PURPOSE: hibernate tab of applet + * PROGRAMMERS: Alexander Wurzinger (Lohnegrim at gmx dot net) + * Johannes Anderwald (johannes.anderwald(a)student.tugraz.at) + * Martin Rottensteiner + */ + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include <windows.h> +#include <commctrl.h> +#include <cpl.h> +#include <stdio.h> + +#include "resource.h" +#include "powercfg.h" +#include "powrprof.h" + +void Hib_InitDialog(HWND); +INT_PTR Hib_SaveData(HWND); +BOOLEAN Pos_InitData(); +void Adv_InitDialog(); + +/* Property page dialog callback */ +INT_PTR CALLBACK +hibernateProc( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + switch(uMsg) + { + case WM_INITDIALOG: + Hib_InitDialog(hwndDlg); + return TRUE; + case WM_COMMAND: + switch(LOWORD(wParam)) + { + case IDC_HIBERNATEFILE: + if (HIWORD(wParam) == BN_CLICKED) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + } + break; + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + if (lpnm->code == (UINT)PSN_APPLY) + { + return Hib_SaveData(hwndDlg); + } + } + } + return FALSE; +} + +void Hib_InitDialog(HWND hwndDlg) +{ + SYSTEM_POWER_CAPABILITIES PowerCaps; + MEMORYSTATUSEX msex; + WCHAR szSize[MAX_PATH]; + WCHAR szTemp[MAX_PATH]; + ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes; + + if (GetPwrCapabilities(&PowerCaps)) + { + if (PowerCaps.HiberFilePresent) + { + SendMessageW(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), + BM_SETCHECK, + (WPARAM)BST_CHECKED, + (LPARAM)0); + } + else + { + SendMessageW(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), + BM_SETCHECK, + (WPARAM)BST_UNCHECKED, + (LPARAM)0); + } + + msex.dwLength = sizeof(msex); + if (!GlobalMemoryStatusEx(&msex)) + { + return; //FIXME + } + + if (GetWindowsDirectory(szTemp,MAX_PATH)) + { + if (!GetDiskFreeSpaceEx(szTemp,&FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) + TotalNumberOfFreeBytes.QuadPart = 0; + } + else + { + if (!GetDiskFreeSpaceEx(NULL,&FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)) + TotalNumberOfFreeBytes.QuadPart = 0; + } + if (TotalNumberOfFreeBytes.QuadPart > 0x100000) + { + if (LoadString(hApplet, IDS_SIZEMB, szTemp, MAX_PATH)) + { + swprintf(szSize,szTemp,TotalNumberOfFreeBytes.QuadPart / 0x100000); + SetWindowText(GetDlgItem(hwndDlg, IDC_FREESPACE),szSize); + } + } + else + { + if (LoadString(hApplet, IDS_SIZEBYTS, szTemp, MAX_PATH)) + { + swprintf(szSize,szTemp,TotalNumberOfFreeBytes.QuadPart); + SetWindowText(GetDlgItem(hwndDlg, IDC_FREESPACE),szSize); + } + } + + if (msex.ullTotalPhys>0x100000) + { + if (LoadString(hApplet, IDS_SIZEMB, szTemp, MAX_PATH)) + { + swprintf(szSize,szTemp,msex.ullTotalPhys/0x100000); + SetWindowText(GetDlgItem(hwndDlg, IDC_SPACEFORHIBERNATEFILE),szSize); + } + } + else + { + if (LoadString(hApplet, IDS_SIZEBYTS, szTemp, MAX_PATH)) + { + swprintf(szSize,szTemp,msex.ullTotalPhys); + SetWindowText(GetDlgItem(hwndDlg, IDC_SPACEFORHIBERNATEFILE),szSize); + } + } + if (TotalNumberOfFreeBytes.QuadPart < msex.ullTotalPhys && !PowerCaps.HiberFilePresent) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), FALSE); + ShowWindow(GetDlgItem(hwndDlg, IDC_TOLESSFREESPACE), TRUE); + } + else + { + ShowWindow(GetDlgItem(hwndDlg, IDC_TOLESSFREESPACE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), TRUE); + } + } +} + +INT_PTR Hib_SaveData(HWND hwndDlg) +{ + BOOLEAN bHibernate; + + bHibernate = (BOOLEAN)SendMessageW(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), + BM_GETCHECK, + (WPARAM)0, + (LPARAM)0); + if (CallNtPowerInformation(SystemReserveHiberFile,&bHibernate, sizeof(bHibernate), NULL, 0) == STATUS_SUCCESS) + { + Pos_InitData(); + Adv_InitDialog(); + Hib_InitDialog(hwndDlg); + return TRUE; + } + return FALSE; +} Added: trunk/reactos/dll/cpl/powercfg/powercfg.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.c…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/powercfg.c (added) +++ trunk/reactos/dll/cpl/powercfg/powercfg.c Thu Jun 15 18:07:08 2006 @@ -1,0 +1,177 @@ +/* $Id: powercfg.c 21500 2006-04-07 10:20:39Z janderwald $ + * + * PROJECT: ReactOS Power Configuration Applet + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/cpl/powercfg/powershemes.c + * PURPOSE: initialization of applet + * PROGRAMMERS: Alexander Wurzinger (Lohnegrim at gmx dot net) + * Johannes Anderwald (johannes.anderwald(a)student.tugraz.at) + * Martin Rottensteiner + */ + +#include <windows.h> +#include <commctrl.h> +#include <cpl.h> + +#include "resource.h" +#include "powercfg.h" +#include "powrprof.h" + +#define NUM_APPLETS (1) + +LONG APIENTRY Applet1(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam); +INT_PTR CALLBACK powershemesProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK alarmsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK advancedProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK hibernateProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + +HINSTANCE hApplet = 0; +GLOBAL_POWER_POLICY gGPP; +WCHAR langSel[255]; + +/* Applets */ +APPLET Applets[NUM_APPLETS] = +{ + {IDC_CPLICON_1, IDS_CPLNAME_1, IDS_CPLDESCRIPTION_1, Applet1} +}; + +static void +InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc) +{ + ZeroMemory(psp, sizeof(PROPSHEETPAGE)); + psp->dwSize = sizeof(PROPSHEETPAGE); + psp->dwFlags = PSP_DEFAULT; + psp->hInstance = hApplet; + psp->pszTemplate = MAKEINTRESOURCE(idDlg); + psp->pfnDlgProc = DlgProc; +} + + +/* Property Sheet Callback */ +int CALLBACK +PropSheetProc( + HWND hwndDlg, + UINT uMsg, + LPARAM lParam +) +{ + switch(uMsg) + { + case PSCB_BUTTONPRESSED: + switch(lParam) + { + case PSBTN_OK: /* OK */ + break; + case PSBTN_CANCEL: /* Cancel */ + break; + case PSBTN_APPLYNOW: /* Apply now */ + break; + case PSBTN_FINISH: /* Close */ + break; + default: + return FALSE; + } + break; + + case PSCB_INITIALIZED: + break; + } + return TRUE; +} + +/* First Applet */ +LONG APIENTRY +Applet1(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam) +{ + PROPSHEETPAGE psp[5]; + PROPSHEETHEADER psh; + TCHAR Caption[1024]; + SYSTEM_POWER_CAPABILITIES spc; + INT i=0; + + memset(Caption, 0x0, sizeof(Caption)); + LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR)); + + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE; + psh.hwndParent = NULL; + psh.hInstance = hApplet; + psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_1)); + psh.pszCaption = Caption; + psh.nPages = 3; + psh.nStartPage = 0; + psh.ppsp = psp; + psh.pfnCallback = PropSheetProc; + + InitPropSheetPage(&psp[i++], IDD_PROPPAGEPOWERSHEMES, powershemesProc); + if (GetPwrCapabilities(&spc)) + { + if (spc.SystemBatteriesPresent) + { + InitPropSheetPage(&psp[i++], IDD_PROPPAGEALARMS, alarmsProc); + psh.nPages += 1; + } + } + InitPropSheetPage(&psp[i++], IDD_PROPPAGEADVANCED, advancedProc); + InitPropSheetPage(&psp[i++], IDD_PROPPAGEHIBERNATE, hibernateProc); + + return (LONG)(PropertySheet(&psh) != -1); +} + +/* Control Panel Callback */ +LONG CALLBACK +CPlApplet( + HWND hwndCPl, + UINT uMsg, + LPARAM lParam1, + LPARAM lParam2) +{ + int i = (int)lParam1; + + switch(uMsg) + { + case CPL_INIT: + { + return TRUE; + } + case CPL_GETCOUNT: + { + return NUM_APPLETS; + } + case CPL_INQUIRE: + { + CPLINFO *CPlInfo = (CPLINFO*)lParam2; + CPlInfo->lData = 0; + CPlInfo->idIcon = Applets[i].idIcon; + CPlInfo->idName = Applets[i].idName; + CPlInfo->idInfo = Applets[i].idDescription; + break; + } + case CPL_DBLCLK: + { + Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2); + break; + } + } + return FALSE; +} + + +BOOLEAN +WINAPI +DllMain( + HINSTANCE hinstDLL, + DWORD dwReason, + LPVOID lpvReserved) +{ + switch(dwReason) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + hApplet = hinstDLL; + break; + } + return TRUE; +} + Added: trunk/reactos/dll/cpl/powercfg/powercfg.def URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.d…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/powercfg.def (added) +++ trunk/reactos/dll/cpl/powercfg/powercfg.def Thu Jun 15 18:07:08 2006 @@ -1,0 +1,6 @@ +LIBRARY powercfg.cpl + +EXPORTS +CPlApplet@16 + +; EOF Added: trunk/reactos/dll/cpl/powercfg/powercfg.h URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.h…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/powercfg.h (added) +++ trunk/reactos/dll/cpl/powercfg/powercfg.h Thu Jun 15 18:07:08 2006 @@ -1,0 +1,21 @@ +#ifndef POWERCFG_H +#define POWERCFG_H + +#include "powrprof.h" + +typedef struct +{ + int idIcon; + int idName; + int idDescription; + APPLET_PROC AppletProc; +} APPLET, *PAPPLET; + +extern HINSTANCE hApplet; +extern GLOBAL_POWER_POLICY gGPP; +extern POWER_POLICY gPP[]; +extern UINT guiIndex; + +#endif /* __CPL_SAMPLE_H */ + +/* EOF */ Added: trunk/reactos/dll/cpl/powercfg/powercfg.rbuild URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.r…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/powercfg.rbuild (added) +++ trunk/reactos/dll/cpl/powercfg/powercfg.rbuild Thu Jun 15 18:07:08 2006 @@ -1,0 +1,22 @@ +<module name="powercfg" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_PWRCFG}" installbase="system32" installname="powercfg.cpl" allowwarnings="true"> + <importlibrary definition="powercfg.def" /> + <include base="powercfg">.</include> + <include base="ReactOS">include/wine</include> + <define name="UNICODE" /> + <define name="_UNICODE" /> + <define name="__REACTOS__" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <library>kernel32</library> + <library>user32</library> + <library>powrprof</library> + <library>comctl32</library> + <library>rtl</library> + <file>powercfg.c</file> + <file>powershemes.c</file> + <file>alarms.c</file> + <file>advanced.c</file> + <file>hibernate.c</file> + <file>powercfg.rc</file> +</module> Added: trunk/reactos/dll/cpl/powercfg/powercfg.rc URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.r…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/powercfg.rc (added) +++ trunk/reactos/dll/cpl/powercfg/powercfg.rc Thu Jun 15 18:07:08 2006 @@ -1,0 +1,18 @@ +/* $Id: powercfg.rc 21982 2006-05-22 21:33:22Z janderwald $ */ + +#include <windows.h> +#include "resource.h" + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Powermanagement Control Panel\0" +#define REACTOS_STR_INTERNAL_NAME "powercfg\0" +#define REACTOS_STR_ORIGINAL_FILENAME "powercfg.cpl\0" +#include <reactos/version.rc> + +IDI_AC ICON "resources/ac.ico" +IDI_ACDC ICON "resources/acdc.ico" +IDI_DC ICON "resources/dc.ico" +IDI_SCREEN ICON "resources/screen.ico" + +#include "en.rc" +#include "de.rc" Added: trunk/reactos/dll/cpl/powercfg/powershemes.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/powersheme…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/powershemes.c (added) +++ trunk/reactos/dll/cpl/powercfg/powershemes.c Thu Jun 15 18:07:08 2006 @@ -1,0 +1,556 @@ +/* $Id: powershemes.c 21500 2006-04-07 10:20:39Z janderwald $ + * + * PROJECT: ReactOS Power Configuration Applet + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/cpl/powercfg/powershemes.c + * PURPOSE: powerschemes tab of applet + * PROGRAMMERS: Alexander Wurzinger (Lohnegrim at gmx dot net) + * Johannes Anderwald (johannes.anderwald(a)student.tugraz.at) + * Martin Rottensteiner + */ + +#include <windows.h> +#include <commctrl.h> +#include <cpl.h> +#include <tchar.h> +#include "resource.h" +#include "powercfg.h" +#include "stdio.h" + +UINT Sec[]= +{ + 60, + 120, + 180, + 300, + 600, + 900, + 1200, + 1500, + 1800, + 2700, + 3600, + 7200, + 10800, + 14400, + 18000, + 0 +}; + +HWND hList = 0; +HWND hPos = 0; + +unsigned aps = 0; + +#define MAX_POWER_POLICY 20 + +POWER_POLICY gPP[MAX_POWER_POLICY]; +UINT guiIndex = 0; + +void LoadConfig(HWND hwndDlg); +void Pos_InitPage(HWND hwndDlg); +BOOLEAN Pos_InitData(); +void Pos_SaveData(HWND hwndDlg); + + +BOOLEAN CreateEnergyList(HWND hwnd); + +/* Property page dialog callback */ +INT_PTR CALLBACK +powershemesProc( + HWND hwndDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam +) +{ + switch(uMsg) + { + case WM_INITDIALOG: + hPos = 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) + { + LoadConfig(hwndDlg); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + 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; + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + if (lpnm->code == (UINT)PSN_APPLY) + { + Pos_SaveData(hwndDlg); + } + return TRUE; + } + break; + } + return FALSE; +} + +BOOLEAN Pos_InitData() +{ + SYSTEM_POWER_CAPABILITIES spc; +/* + RECT rectCtl, rectDlg, rectCtl2; + LONG movetop = 0; + LONG moveright = 0; + + if (GetWindowRect(hPos,&rectDlg)) + { + if (GetWindowRect(GetDlgItem(hPos, IDC_SAT),&rectCtl2)) + { + if (GetWindowRect(GetDlgItem(hPos, 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(hPos, 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)) + { + MoveWindow(GetDlgItem(hPos, 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)) + { + MoveWindow(GetDlgItem(hPos, 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)) + { + movetop=movetop-8; + if (GetWindowRect(GetDlgItem(hPos, 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(hPos, 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)) + { + MoveWindow(GetDlgItem(hPos, 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)) + { + MoveWindow(GetDlgItem(hPos, 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)) + { + MoveWindow(GetDlgItem(hPos, IDC_GRPDETAIL),rectCtl.left-rectDlg.left,rectCtl.top-rectDlg.top,rectCtl.right-rectCtl.left,rectCtl.bottom-rectCtl.top,FALSE); + } + } + } + } + } + } +*/ + + if (!GetPwrCapabilities(&spc)) + { + return FALSE; + } + + 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); + + } + else + { + ShowWindow(GetDlgItem(hPos, IDC_HYBERNATEDCLIST), spc.HiberFilePresent); + ShowWindow(GetDlgItem(hPos, 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(hPos, IDC_HYBERNATE), spc.HiberFilePresent); + + return TRUE; +} + +BOOLEAN CALLBACK callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPWSTR sName, DWORD dwDesc, + LPWSTR sDesc, PPOWER_POLICY pp,LPARAM lParam ) +{ + int index; + 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 = SendMessageW(hList, + CB_ADDSTRING, + 0, + (LPARAM)sName); + if (index == CB_ERR) + return FALSE; + + SendMessageW(hList, + CB_SETITEMDATA, + index, + (LPARAM)uiIndex); + + if (aps == uiIndex) + { + SendMessageW(hList, + CB_SELECTSTRING, + TRUE, + (LPARAM)sName); + LoadConfig(GetParent(hList)); + } + } + return TRUE; +} + +BOOLEAN CreateEnergyList(HWND hwnd) +{ + BOOLEAN retval; + POWER_POLICY pp; + SYSTEM_POWER_CAPABILITIES spc; + + hList = hwnd; + + if (!GetActivePwrScheme(&aps)) + return FALSE; + + if (!ReadGlobalPwrPolicy(&gGPP)) + return FALSE; + + if (!ReadPwrScheme(aps,&pp)) + return FALSE; + + if (!ValidatePowerPolicies(&gGPP,0)) + return FALSE; + + if (!SetActivePwrScheme(aps,&gGPP,&pp)) + return FALSE; + + if (!GetPwrCapabilities(&spc)) + return FALSE; + + if (CanUserWritePwrScheme()) + { + //TODO + // enable write / delete powerscheme button + } + + Pos_InitPage(GetParent(hwnd)); + + if (!GetActivePwrScheme(&aps)) + return FALSE; + + retval = EnumPwrSchemes(callback_EnumPwrScheme, aps); + + return retval; +} + +void Pos_InitPage(HWND hwndDlg) +{ + int ifrom=0,i=0,imin=0; + HWND hwnd = NULL; + WCHAR szName[MAX_PATH]; + LRESULT index; + + for(i=1;i<9;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; + } + for (ifrom=imin;ifrom<(IDS_TIMEOUT15+1);ifrom++) + { + if (LoadString(hApplet, ifrom, szName, MAX_PATH)) + { + index = SendMessageW(hwnd, + CB_ADDSTRING, + 0, + (LPARAM)szName); + + if (index == CB_ERR) + return; + + SendMessageW(hwnd, + CB_SETITEMDATA, + index, + (LPARAM)Sec[ifrom-IDS_TIMEOUT16]); + } + } + if (LoadString(hApplet, IDS_TIMEOUT16, szName, MAX_PATH)) + { + index = SendMessageW(hwnd, + CB_ADDSTRING, + 0, + (LPARAM)szName); + if (index == CB_ERR) + return; + + SendMessageW(hwnd, + CB_SETITEMDATA, + index, + (LPARAM)Sec[0]); + } + } +} + +void LoadConfig(HWND hwndDlg) +{ + INT i=0, iCurSel=0; + UINT uiIndex; + WCHAR szProfile[MAX_PATH]; + WCHAR szTemp[MAX_PATH]; + WCHAR szConfig[MAX_PATH]; + POWER_POLICY pp; + + iCurSel = SendMessageW(GetDlgItem(hwndDlg, IDC_ENERGYLIST), + CB_GETCURSEL, + 0, + 0); + if (iCurSel == CB_ERR) + return; + + memcpy(&pp, &gPP[iCurSel], sizeof(POWER_POLICY)); + + uiIndex = SendMessage(GetDlgItem(hwndDlg, IDC_ENERGYLIST), CB_GETCURSEL, 0, 0); + if(uiIndex != CB_ERR) + { + SendMessage(GetDlgItem(hwndDlg, IDC_ENERGYLIST), CB_GETLBTEXT, uiIndex, (LPARAM)szProfile); + if(LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH)) + { + swprintf(szConfig,szTemp,szProfile); + SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL),szConfig); + } + } + for(i=0;i<17;i++) + { + if (Sec[i]==pp.user.VideoTimeoutAc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_MONITORACLIST), + CB_SETCURSEL, + i, + (LPARAM)0); + } + if (Sec[i]==pp.user.VideoTimeoutDc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_MONITORDCLIST), + CB_SETCURSEL, + i, + (LPARAM)0); + } + if (Sec[i]==pp.user.SpindownTimeoutAc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_DISKACLIST), + CB_SETCURSEL, + i-2, + (LPARAM)0); + } + if (Sec[i]==pp.user.SpindownTimeoutDc)//IdleTimeoutDc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_DISKDCLIST), + CB_SETCURSEL, + i-2, + (LPARAM)0); + } + if (Sec[i]==pp.user.IdleTimeoutAc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_STANDBYACLIST), + CB_SETCURSEL, + i, + (LPARAM)0); + } + if (Sec[i]==pp.user.IdleTimeoutDc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), + CB_SETCURSEL, + i, + (LPARAM)0); + } + + if (Sec[i]==pp.mach.DozeS4TimeoutAc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST), + CB_SETCURSEL, + i, + (LPARAM)0); + } + if (Sec[i]==pp.mach.DozeS4TimeoutDc) + { + SendMessage(GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST), + CB_SETCURSEL, + i, + (LPARAM)0); + } + } + +} + +void Pos_SaveData(HWND hwndDlg) +{ + INT iCurSel=0,tmp=0; + + iCurSel = SendMessageW(GetDlgItem(hwndDlg, IDC_ENERGYLIST), + CB_GETCURSEL, + 0, + 0); + if (iCurSel == CB_ERR) + return; + + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_MONITORDCLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].user.VideoTimeoutAc = Sec[tmp]; + } + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_MONITORDCLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].user.VideoTimeoutDc = Sec[tmp]; + } + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_DISKACLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].user.SpindownTimeoutAc = Sec[tmp+2]; + } + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_DISKDCLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].user.SpindownTimeoutDc = Sec[tmp+2]; + } + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_STANDBYACLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].user.IdleTimeoutAc = Sec[tmp]; + } + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].user.IdleTimeoutDc = Sec[tmp]; + } + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_HYBERNATEACLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].mach.DozeS4TimeoutAc = Sec[tmp]; + } + tmp = SendMessage(GetDlgItem(hwndDlg, IDC_HYBERNATEDCLIST), + CB_GETCURSEL, + 0, + (LPARAM)0); + if (tmp > 0 && tmp < 16) + { + gPP[iCurSel].mach.DozeS4TimeoutDc = Sec[tmp]; + } + + SetActivePwrScheme(iCurSel,NULL,&gPP[iCurSel]); + LoadConfig(hwndDlg); +} Added: trunk/reactos/dll/cpl/powercfg/resource.h URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resource.h…
============================================================================== --- trunk/reactos/dll/cpl/powercfg/resource.h (added) +++ trunk/reactos/dll/cpl/powercfg/resource.h Thu Jun 15 18:07:08 2006 @@ -1,0 +1,123 @@ +#ifndef __CPL_RESOURCE_H +#define __CPL_RESOURCE_H + +/* metrics */ +#define PROPSHEETWIDTH 246 +#define PROPSHEETHEIGHT 228 +#define PROPSHEETPADDING 6 +#define SYSTEM_COLUMN (18 * PROPSHEETPADDING) +#define LABELLINE(x) (((PROPSHEETPADDING + 2) * x) + (x + 2)) +#define ICONSIZE 16 + +/* ids */ +#define IDC_CPLICON_1 1 + +#define IDS_PROCENT 49 +#define IDS_SOUND 50 +#define IDS_TEXT 51 +#define IDS_CONFIG1 53 +#define IDS_CONFIG2 54 +#define IDS_SIZEBYTS 55 +#define IDS_SIZEMB 56 + +#define IDD_PROPPAGEPOWERSHEMES 70 +#define IDD_PROPPAGEALARMS 71 +#define IDD_PROPPAGEPOWERMETER 72 +#define IDD_PROPPAGEADVANCED 73 +#define IDD_PROPPAGEHIBERNATE 74 + +#define IDS_NOACTION 100 +#define IDS_PowerActionNone1 114 +#define IDS_PowerActionUnknown 115 +#define IDS_PowerActionSleep 116 +#define IDS_PowerActionHibernate 117 +#define IDS_PowerActionShutdown 118 +#define IDS_PowerActionRestart 119 +#define IDS_PowerActionShutdownOff 120 +#define IDS_PowerActionWarmEject 121 +#define IDS_PowerActionNone2 122 +#define IDS_TIMEOUT16 150 +#define IDS_TIMEOUT1 151 +#define IDS_TIMEOUT2 152 +#define IDS_TIMEOUT3 153 +#define IDS_TIMEOUT4 154 +#define IDS_TIMEOUT5 155 +#define IDS_TIMEOUT6 156 +#define IDS_TIMEOUT7 157 +#define IDS_TIMEOUT8 158 +#define IDS_TIMEOUT9 159 +#define IDS_TIMEOUT10 160 +#define IDS_TIMEOUT11 161 +#define IDS_TIMEOUT12 162 +#define IDS_TIMEOUT13 163 +#define IDS_TIMEOUT14 164 +#define IDS_TIMEOUT15 165 + +#define IDI_AC 175 +#define IDI_DC 176 +#define IDI_ACDC 177 +#define IDI_SCREEN 178 + +#define IDS_CPLNAME_1 190 +#define IDC_ENERGYLIST 200 +#define IDC_GRPDETAIL 201 +#define IDC_SAT 202 +#define IDC_IAC 203 +#define IDC_SAC 204 +#define IDC_IDC 205 +#define IDC_SDC 206 +#define IDC_STANDBYACLIST 207 +#define IDC_STANDBYDCLIST 208 +#define IDC_MONITORACLIST 209 +#define IDC_MONITORDCLIST 210 +#define IDC_DISKACLIST 216 +#define IDC_DISKDCLIST 217 +#define IDC_DISK 218 +#define IDC_HYBERNATEACLIST 219 +#define IDC_HYBERNATEDCLIST 220 +#define IDC_HYBERNATE 221 + +#define IDC_STANDBY 211 +#define IDC_MONITOR 212 +#define IDC_GRPPOWERSTATUS 213 +#define IDC_MULTIBATTERYDISPLAY 214 + +#define IDC_ALARMMSG1 301 +#define IDC_ALARMBAR1 302 +#define IDC_ALARMBAR2 303 +#define IDC_ALARMVALUE1 304 +#define IDC_ALARMVALUE2 305 +#define IDC_ALARM1 306 +#define IDC_ALARM2 307 +#define IDC_ALARMAKTION1 320 +#define IDC_ALARMPROG1 322 +#define IDC_ALARMMSG2 324 +#define IDC_ALARMAKTION2 323 +#define IDC_ALARMPROG2 325 + +#define IDC_SYSTRAYBATTERYMETER 400 +#define IDC_PASSWORDLOGON 401 +#define IDC_VIDEODIMDISPLAY 402 +#define IDC_SLIDCLOSE 403 +#define IDC_LIDCLOSE 404 +#define IDC_SPOWERBUTTON 405 +#define IDC_POWERBUTTON 406 +#define IDC_SSLEEPBUTTON 407 +#define IDC_SLEEPBUTTON 408 + +#define IDC_HIBERNATEFILE 500 +#define IDC_FREESPACE 501 +#define IDC_SPACEFORHIBERNATEFILE 502 +#define IDC_TOLESSFREESPACE 503 + +#define IDS_ALPERTLOWENERGY 715 +#define IDS_ALPERTCRITICLEENERGY 716 +#define IDS_CRITCLENERGY 717 +#define IDS_LOWENERGY 718 +#define IDS_UNKNOWN 719 + +#define IDS_CPLDESCRIPTION_1 901 + +#endif /* __CPL_RESOURCE_H */ + +/* EOF */ Added: trunk/reactos/dll/cpl/powercfg/resources/ac.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/ac.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/acdc.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/acdc.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batterycharging.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batterycharging.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batterychargingcritical.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batterychargingcritical.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batterycharginghalf.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batterycharginghalf.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batterycharginghigh.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batterycharginghigh.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batterycharginglow.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batterycharginglow.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batterycritical.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batterycritical.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batteryfull.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batteryfull.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batteryhalf.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batteryhalf.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batteryhigh.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batteryhigh.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batterylow.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batterylow.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/batteryunknown.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/batteryunknown.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/dc.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/dc.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/nobattery.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/nobattery.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/cpl/powercfg/resources/screen.ico URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/cpl/powercfg/resources/…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/cpl/powercfg/resources/screen.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
18 years, 5 months
1
0
0
0
[mbosma] 22361: Fix sweeping the handle table on process shutdown. Patch by w3seek.
by mbosma@svn.reactos.org
Author: mbosma Date: Thu Jun 15 17:16:29 2006 New Revision: 22361 URL:
http://svn.reactos.ru/svn/reactos?rev=22361&view=rev
Log: Fix sweeping the handle table on process shutdown. Patch by w3seek. Modified: trunk/reactos/ntoskrnl/ob/obhandle.c Modified: trunk/reactos/ntoskrnl/ob/obhandle.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/ob/obhandle.c (original) +++ trunk/reactos/ntoskrnl/ob/obhandle.c Thu Jun 15 17:16:29 2006 @@ -1009,7 +1009,6 @@ IN HANDLE Handle, IN PVOID Context) { -#if 0 POBP_CLOSE_HANDLE_CONTEXT CloseContext = (POBP_CLOSE_HANDLE_CONTEXT)Context; /* Simply decrement the handle count */ @@ -1018,7 +1017,6 @@ Handle, CloseContext->AccessMode, TRUE); -#endif } /*++ @@ -1163,7 +1161,7 @@ /* Sweep the handle table to close all handles */ ExSweepHandleTable(HandleTable, ObpCloseHandleCallback, - Process); + &Context); /* Destroy the table and leave the critical region */ ExDestroyHandleTable(HandleTable);
18 years, 5 months
1
0
0
0
[amunger] 22360: Remove gradient change committed by frik85.
by amunger@svn.reactos.org
Author: amunger Date: Thu Jun 15 17:16:12 2006 New Revision: 22360 URL:
http://svn.reactos.ru/svn/reactos?rev=22360&view=rev
Log: Remove gradient change committed by frik85. Modified: trunk/reactos/dll/win32/user32/windows/nonclient.c Modified: trunk/reactos/dll/win32/user32/windows/nonclient.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/user32/windows/no…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/nonclient.c (original) +++ trunk/reactos/dll/win32/user32/windows/nonclient.c Thu Jun 15 17:16:12 2006 @@ -1149,8 +1149,8 @@ { if (uFlags & DC_GRADIENT) { - static GRADIENT_RECT gcap [] = {{0, 1}, {2, 3}}; - TRIVERTEX vert[4]; + static GRADIENT_RECT gcap = {0, 1}; + TRIVERTEX vert[2]; COLORREF Colors[2]; LONG xx; @@ -1184,27 +1184,13 @@ vert[0].Alpha = 0; vert[1].x = r.right; - vert[1].y = (lprc->bottom - lprc->top) >> 1; + vert[1].y = lprc->bottom - lprc->top; vert[1].Red = GetRValue(Colors[1]) << 8; vert[1].Green = GetGValue(Colors[1]) << 8; vert[1].Blue = GetBValue(Colors[1]) << 8; vert[1].Alpha = 0; - vert[2].x = r.left; - vert[2].y = (lprc->bottom - lprc->top) >> 1; - vert[2].Red = GetRValue(Colors[1]) << 8; - vert[2].Green = GetGValue(Colors[1]) << 8; - vert[2].Blue = GetBValue(Colors[1]) << 8; - vert[2].Alpha = 0; - - vert[3].x = r.right; - vert[3].y = (lprc->bottom - lprc->top); - vert[3].Red = GetRValue(Colors[0]) << 8; - vert[3].Green = GetGValue(Colors[0]) << 8; - vert[3].Blue = GetBValue(Colors[0]) << 8; - vert[3].Alpha = 0; - - GdiGradientFill(MemDC, vert, 4, &gcap, 2, GRADIENT_FILL_RECT_V); + GdiGradientFill(MemDC, vert, 2, &gcap, 1, GRADIENT_FILL_RECT_V); if ((uFlags & DC_ICON) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP)) {
18 years, 5 months
1
0
0
0
[hpoussin] 22359: Cast size_t to long, before applying the unary - operator
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Jun 15 16:54:31 2006 New Revision: 22359 URL:
http://svn.reactos.ru/svn/reactos?rev=22359&view=rev
Log: Cast size_t to long, before applying the unary - operator Modified: trunk/reactos/lib/recyclebin/recyclebin_v5.c Modified: trunk/reactos/lib/recyclebin/recyclebin_v5.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/lib/recyclebin/recyclebin_v…
============================================================================== --- trunk/reactos/lib/recyclebin/recyclebin_v5.c (original) +++ trunk/reactos/lib/recyclebin/recyclebin_v5.c Thu Jun 15 16:54:31 2006 @@ -340,7 +340,7 @@ /* Update INFO2 */ /* 1) If not last entry, copy last entry to the current one */ - if (SetFilePointer(bin->hInfo, -sizeof(DELETED_FILE_RECORD), NULL, FILE_END) == INVALID_SET_FILE_POINTER) + if (SetFilePointer(bin->hInfo, -(LONG)sizeof(DELETED_FILE_RECORD), NULL, FILE_END) == INVALID_SET_FILE_POINTER) goto cleanup; if (!ReadFile(bin->hInfo, &LastFile, sizeof(DELETED_FILE_RECORD), &bytesRead, NULL)) goto cleanup; @@ -374,7 +374,7 @@ goto cleanup; } /* 3) Truncate file */ - if (SetFilePointer(bin->hInfo, -sizeof(DELETED_FILE_RECORD), NULL, FILE_END) == INVALID_SET_FILE_POINTER) + if (SetFilePointer(bin->hInfo, -(LONG)sizeof(DELETED_FILE_RECORD), NULL, FILE_END) == INVALID_SET_FILE_POINTER) goto cleanup; if (!SetEndOfFile(bin->hInfo)) goto cleanup;
18 years, 5 months
1
0
0
0
[hpoussin] 22358: Add some unit tests for setupapi
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Jun 15 16:49:04 2006 New Revision: 22358 URL:
http://svn.reactos.ru/svn/reactos?rev=22358&view=rev
Log: Add some unit tests for setupapi Added: trunk/reactos/regtests/winetests/setupapi/devclass.c (with props) trunk/reactos/regtests/winetests/setupapi/install.c (with props) Modified: trunk/reactos/regtests/winetests/setupapi/parser.c trunk/reactos/regtests/winetests/setupapi/setupapi.rbuild trunk/reactos/regtests/winetests/setupapi/testlist.c Added: trunk/reactos/regtests/winetests/setupapi/devclass.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/setupapi…
============================================================================== --- trunk/reactos/regtests/winetests/setupapi/devclass.c (added) +++ trunk/reactos/regtests/winetests/setupapi/devclass.c Thu Jun 15 16:49:04 2006 @@ -1,0 +1,346 @@ +/* + * SetupAPI device class-related functions tests + * + * Copyright 2006 Hervé Poussineau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <assert.h> +#include <stdarg.h> +#include <stdio.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "cfgmgr32.h" +#include "setupapi.h" + +#include "wine/test.h" + +static GUID test_class_guid = { 0x4d36e967, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; +static char test_class_name[MAX_CLASS_NAME_LEN] = "DiskDrive"; + +static const char *debugstr_guid(const GUID *guid) +{ + static char guidSTR1[39]; + static char guidSTR2[39]; + char* guidSTR; + static BOOL index; + + if (!guid) return NULL; + + index = !index; + guidSTR = index ? guidSTR1 : guidSTR2; + + snprintf(guidSTR, sizeof(guidSTR1), + "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + guid->Data1, guid->Data2, guid->Data3, + guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], + guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); + return guidSTR; +} + +static void test_SetupDiBuildClassInfoList(void) +{ + LPGUID guid_list = NULL; + DWORD required_size, size; + + SetLastError( 0xdeadbeef ); + ok( !SetupDiBuildClassInfoList( 0, NULL, 0, NULL ), + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() ); + + SetLastError( 0xdeadbeef ); + ok( !SetupDiBuildClassInfoList( 0, NULL, 0, &required_size ), + "Fail expected" ); + ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() ); + + guid_list = HeapAlloc( GetProcessHeap(), 0, ( required_size + 1 ) * sizeof( GUID ) ); + if ( !guid_list ) + return; + + SetLastError( 0xdeadbeef ); + ok( SetupDiBuildClassInfoList( 0, guid_list, required_size, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + SetLastError( 0xdeadbeef ); + ok( SetupDiBuildClassInfoList( 0, guid_list, required_size + 1, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + + if ( size > 0 ) + { + /* That's better to use the first class found, as we know for sure that it exists */ + memcpy(&test_class_guid, &guid_list[0], sizeof( GUID ) ); + SetupDiClassNameFromGuidA( &test_class_guid, test_class_name, sizeof( test_class_name ), NULL ); + } + HeapFree( GetProcessHeap(), 0, guid_list ); +} + +static void test_SetupDiClassGuidsFromNameA(void) +{ + LPGUID guid_list = NULL; + DWORD required_size, size; + + SetLastError( 0xdeadbeef ); + ok( !SetupDiClassGuidsFromNameA( NULL, NULL, 0, NULL ), + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() ); + + SetLastError( 0xdeadbeef ); + ok( !SetupDiClassGuidsFromNameA( NULL, NULL, 0, &required_size ), + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() ); + + SetLastError( 0xdeadbeef ); + ok( SetupDiClassGuidsFromNameA( "", NULL, 0, &required_size ), + "Error reported %lx", GetLastError() ); + ok( required_size == 0, "Expected 0, got %lu", required_size ); + + SetLastError( 0xdeadbeef ); + ok( !SetupDiClassGuidsFromNameA( test_class_name, NULL, 0, &required_size ), + "Fail expected" ); + SetLastError( 0xdeadbeef ); + ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() ); + ok( required_size > 0, "Expected > 0, got %lu", required_size ); + + guid_list = HeapAlloc( GetProcessHeap(), 0, ( required_size + 1 ) * sizeof( GUID ) ); + if ( !guid_list ) + return; + + SetLastError( 0xdeadbeef ); + ok( SetupDiClassGuidsFromNameA( test_class_name, guid_list, required_size, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + ok( IsEqualIID( &guid_list[0], &test_class_guid ), + "Expected %s, got %s", debugstr_guid( &test_class_guid ), debugstr_guid( &guid_list[0] ) ); + SetLastError( 0xdeadbeef ); + ok( SetupDiClassGuidsFromNameA( test_class_name, guid_list, required_size + 1, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + ok( IsEqualIID( &guid_list[0], &test_class_guid ), + "Expected %s, got %s", debugstr_guid( &test_class_guid ), debugstr_guid( &guid_list[0] ) ); + + HeapFree( GetProcessHeap(), 0, guid_list ); +} + +static void test_SetupDiClassNameFromGuidA(void) +{ + CHAR* class_name = NULL; + DWORD required_size, size; + + SetLastError( 0xdeadbeef ); + ok( !SetupDiClassNameFromGuidA( NULL, NULL, 0, NULL ), + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_CLASS, + "Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() ); + + SetLastError( 0xdeadbeef ); + ok( !SetupDiClassNameFromGuidA( NULL, NULL, 0, &required_size ), + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_CLASS, + "Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() ); + + SetLastError( 0xdeadbeef ); + ok( !SetupDiClassNameFromGuidA( &test_class_guid, NULL, 0, &required_size ), + "Fail expected" ); + ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() ); + ok( required_size > 0, "Expected > 0, got %lu", required_size ); + ok( required_size < MAX_CLASS_NAME_LEN, "Expected < %u, got %lu", MAX_CLASS_NAME_LEN, required_size ); + + class_name = HeapAlloc( GetProcessHeap(), 0, required_size ); + if ( !class_name ) + return; + + SetLastError( 0xdeadbeef ); + ok( SetupDiClassNameFromGuidA( &test_class_guid, class_name, required_size, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + ok( !strcmp( class_name, test_class_name ), + "Expected %s, got %s", test_class_name, class_name ); + SetLastError( 0xdeadbeef ); + ok( SetupDiClassNameFromGuidA( &test_class_guid, class_name, required_size + 1, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + ok( !strcmp( class_name, test_class_name ), + "Expected %s, got %s", test_class_name, class_name ); + + HeapFree( GetProcessHeap(), 0, class_name ); +} + +static void test_SetupDiGetClassDescriptionA(void) +{ + CHAR* class_desc = NULL; + DWORD required_size, size; + + SetLastError( 0xdeadbeef ); + ok( !SetupDiGetClassDescriptionA( NULL, NULL, 0, NULL ), + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() ); + + SetLastError( 0xdeadbeef ); + ok( !SetupDiGetClassDescriptionA( NULL, NULL, 0, &required_size ), + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() ); + + SetLastError( 0xdeadbeef ); + ok( !SetupDiGetClassDescriptionA( &test_class_guid, NULL, 0, &required_size ), + "Fail expected" ); + ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "Expected error %lx, got %lx", ERROR_INSUFFICIENT_BUFFER, GetLastError() ); + ok( required_size > 0, "Expected > 0, got %lu", required_size ); + ok( required_size < LINE_LEN, "Expected < %u, got %lu", LINE_LEN, required_size ); + + class_desc = HeapAlloc( GetProcessHeap(), 0, required_size ); + if ( !class_desc ) + return; + + SetLastError( 0xdeadbeef ); + ok( SetupDiGetClassDescriptionA( &test_class_guid, class_desc, required_size, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + SetLastError( 0xdeadbeef ); + ok( SetupDiGetClassDescriptionA( &test_class_guid, class_desc, required_size + 1, &size ), + "Error reported %lx", GetLastError() ); + ok( size == required_size, "Expected size %lu, got %lu", required_size, size ); + + HeapFree( GetProcessHeap(), 0, class_desc ); +} + +static void test_SetupDiGetClassDevsA(void) +{ + HDEVINFO device_info; + + SetLastError( 0xdeadbeef ); + device_info = SetupDiGetClassDevs( NULL, NULL, NULL, 0 ); + ok( device_info == INVALID_HANDLE_VALUE, + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() ); + + SetLastError( 0xdeadbeef ); + device_info = SetupDiGetClassDevs( NULL, NULL, NULL, DIGCF_ALLCLASSES ); + ok( device_info != INVALID_HANDLE_VALUE, + "Error reported %lx", GetLastError() ); + SetLastError( 0xdeadbeef ); + ok( SetupDiDestroyDeviceInfoList( device_info ), + "Error reported %lx", GetLastError() ); + + SetLastError( 0xdeadbeef ); + device_info = SetupDiGetClassDevs( NULL, NULL, NULL, DIGCF_DEVICEINTERFACE ); + ok( device_info == INVALID_HANDLE_VALUE, + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_PARAMETER, + "Expected error %lx, got %lx", ERROR_INVALID_PARAMETER, GetLastError() ); + + SetLastError( 0xdeadbeef ); + device_info = SetupDiGetClassDevs( &test_class_guid, NULL, NULL, 0 ); + ok( device_info != INVALID_HANDLE_VALUE, + "Error reported %lx", GetLastError() ); + SetLastError( 0xdeadbeef ); + ok( SetupDiDestroyDeviceInfoList( device_info ), + "Error reported %lx", GetLastError() ); + + SetLastError( 0xdeadbeef ); + device_info = SetupDiGetClassDevs( NULL, "(invalid enumerator)", NULL, DIGCF_ALLCLASSES ); + ok( device_info == INVALID_HANDLE_VALUE, + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_DATA, + "Expected error %lx, got %lx", ERROR_INVALID_DATA, GetLastError() ); + + SetLastError( 0xdeadbeef ); + device_info = SetupDiGetClassDevs( NULL, "Root", NULL, DIGCF_ALLCLASSES ); + ok( device_info != INVALID_HANDLE_VALUE, + "Error reported %lx", GetLastError() ); + SetLastError( 0xdeadbeef ); + ok( SetupDiDestroyDeviceInfoList( device_info ), + "Error reported %lx", GetLastError() ); +} + +static void test_SetupDiOpenClassRegKeyExA(void) +{ + HKEY hkey; + LONG err; + + SetLastError( 0xdeadbeef ); + hkey = SetupDiOpenClassRegKeyExA( NULL, 0, 0, NULL, NULL ); + ok( hkey == INVALID_HANDLE_VALUE, + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_FLAGS, + "Expected error %lx, got %lx", ERROR_INVALID_FLAGS, GetLastError() ); + + SetLastError( 0xdeadbeef ); + hkey = SetupDiOpenClassRegKeyExA( NULL, 0, DIOCR_INSTALLER | DIOCR_INTERFACE, NULL, NULL ); + ok( hkey == INVALID_HANDLE_VALUE, + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_FLAGS, + "Expected error %lx, got %lx", ERROR_INVALID_FLAGS, GetLastError() ); + + SetLastError( 0xdeadbeef ); + hkey = SetupDiOpenClassRegKeyExA( NULL, 0, DIOCR_INSTALLER, NULL, NULL ); + ok( hkey == INVALID_HANDLE_VALUE, + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_CLASS, + "Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() ); + + SetLastError( 0xdeadbeef ); + hkey = SetupDiOpenClassRegKeyExA( NULL, 0, DIOCR_INTERFACE, NULL, NULL ); + ok( hkey == INVALID_HANDLE_VALUE, + "Fail expected" ); + ok( GetLastError() == ERROR_INVALID_CLASS, + "Expected error %x, got %lx", ERROR_INVALID_CLASS, GetLastError() ); + + SetLastError( 0xdeadbeef ); + hkey = SetupDiOpenClassRegKeyExA( NULL, KEY_QUERY_VALUE, DIOCR_INSTALLER, NULL, NULL ); + ok( hkey != INVALID_HANDLE_VALUE, "Got error %lx", GetLastError() ); + err = RegCloseKey( hkey ); + ok( err == ERROR_SUCCESS, "Got error %lx", err ); + + SetLastError( 0xdeadbeef ); + hkey = SetupDiOpenClassRegKeyExA( NULL, KEY_QUERY_VALUE, DIOCR_INTERFACE, NULL, NULL ); + ok( hkey != INVALID_HANDLE_VALUE, "Got error %lx", GetLastError() ); + err = RegCloseKey( hkey ); + ok( err == ERROR_SUCCESS, "Got error %lx", err ); + + SetLastError( 0xdeadbeef ); + hkey = SetupDiOpenClassRegKeyExA( &test_class_guid, KEY_QUERY_VALUE, DIOCR_INSTALLER, NULL, NULL ); + ok( hkey != INVALID_HANDLE_VALUE, "Got error %lx", GetLastError() ); + err = RegCloseKey( hkey ); + ok( err == ERROR_SUCCESS, "Got error %lx", err ); + + err = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Class", 0, KEY_SET_VALUE, &hkey); + ok( err == ERROR_SUCCESS, "Got error %lx", err ); +} + +START_TEST(devclass) +{ + test_SetupDiBuildClassInfoList(); + test_SetupDiClassGuidsFromNameA(); + test_SetupDiClassNameFromGuidA(); + test_SetupDiGetClassDescriptionA(); + test_SetupDiGetClassDevsA(); + test_SetupDiOpenClassRegKeyExA(); +} Propchange: trunk/reactos/regtests/winetests/setupapi/devclass.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/regtests/winetests/setupapi/install.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/setupapi…
============================================================================== --- trunk/reactos/regtests/winetests/setupapi/install.c (added) +++ trunk/reactos/regtests/winetests/setupapi/install.c Thu Jun 15 16:49:04 2006 @@ -1,0 +1,117 @@ +/* + * INF file parsing tests + * + * Copyright 2006 Hervé Poussineau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public Licence as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <assert.h> +#include <stdarg.h> +#include <unistd.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "setupapi.h" + +#include "wine/test.h" + +#define TMPFILE ".\\tmp.inf" + +#define STD_HEADER "[Version]\r\nSignature=\"$CHICAGO$\"\r\n" + +/* create a new file with specified contents and open it */ +static HINF test_file_contents( const char *data, UINT *err_line ) +{ + DWORD res; + HANDLE handle = CreateFileA( TMPFILE, GENERIC_READ|GENERIC_WRITE, + FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, 0 ); + if (handle == INVALID_HANDLE_VALUE) return 0; + if (!WriteFile( handle, data, strlen(data), &res, NULL )) trace( "write error\n" ); + CloseHandle( handle ); + return SetupOpenInfFileA( TMPFILE, 0, INF_STYLE_WIN4, err_line ); +} + +static void test_InstallHinfSectionA(void) +{ + char buffer[MAX_INF_STRING_LENGTH]; + UINT err_line; + HINF hinf; + DWORD err; + DWORD len; + + SetLastError( 0xdeadbeef ); + hinf = test_file_contents( STD_HEADER + "[s]\r\nAddReg=s.Reg\r\n[s.Reg]\r\nHKCU,,Test,,none\r\n" + "[s.Win]\r\nAddReg=sWin.Reg\r\n[sWin.Reg]\r\nHKCU,,Test,,win\r\n" + "[s.NT]\r\nAddReg=sNT.Reg\r\n[sNT.Reg]\r\nHKCU,,Test,,nt\r\n" + , &err_line ); + ok( hinf != INVALID_HANDLE_VALUE, "open failed err %lx", GetLastError() ); + if ( hinf == INVALID_HANDLE_VALUE ) return; + + system( "rundll32.exe setupapi,InstallHinfSection s 128 " TMPFILE ); + + len = sizeof( buffer ); + err = RegQueryValueExA( HKEY_CURRENT_USER, "Test", NULL, NULL, (LPBYTE)buffer, &len ); + ok( err == ERROR_SUCCESS, "error %lx", err); + + if (GetVersion() & 0x80000000) + ok( !strcmp( buffer, "win" ), "bad section %s/win\n", buffer ); + else + ok( !strcmp( buffer, "nt" ), "bad section %s/nt\n", buffer ); + + err = RegDeleteValue( HKEY_CURRENT_USER, "Test" ); + ok( err == ERROR_SUCCESS, "error %lx", err); +} + +static void test_SetupInstallFromInfSectionA(void) +{ + char buffer[MAX_INF_STRING_LENGTH]; + UINT err_line; + HINF hinf; + DWORD err; + DWORD len; + + SetLastError( 0xdeadbeef ); + hinf = test_file_contents( STD_HEADER + "[s]\r\nAddReg=s.Reg\r\n[s.Reg]\r\nHKR,,Test,,none\r\n" + "[s.Win]\r\nAddReg=sWin.Reg\r\n[sWin.Reg]\r\nHKR,,Test,,win\r\n" + "[s.NT]\r\nAddReg=sNT.Reg\r\n[sNT.Reg]\r\nHKR,,Test,,nt\r\n" + , &err_line ); + ok( hinf != INVALID_HANDLE_VALUE, "open failed err %lx", GetLastError() ); + if (hinf == INVALID_HANDLE_VALUE) return; + + SetLastError( 0xdeadbeef ); + ok ( SetupInstallFromInfSectionA( NULL, hinf, "s", SPINST_REGISTRY, HKEY_CURRENT_USER, NULL, 0, NULL, NULL, NULL, NULL ), + "Error code set to %lx", GetLastError() ); + + len = sizeof( buffer ); + err = RegQueryValueExA( HKEY_CURRENT_USER, "Test", NULL, NULL, (LPBYTE)buffer, &len ); + ok( err == ERROR_SUCCESS, "error %lx", err); + ok( !strcmp( buffer, "none" ), "bad value %s/none", buffer ); + + err = RegDeleteValue( HKEY_CURRENT_USER, "Test" ); + ok( err == ERROR_SUCCESS, "error %lx", err); +} + +START_TEST(install) +{ + test_InstallHinfSectionA(); + test_SetupInstallFromInfSectionA(); + DeleteFileA( TMPFILE ); +} Propchange: trunk/reactos/regtests/winetests/setupapi/install.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/regtests/winetests/setupapi/parser.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/setupapi…
============================================================================== --- trunk/reactos/regtests/winetests/setupapi/parser.c (original) +++ trunk/reactos/regtests/winetests/setupapi/parser.c Thu Jun 15 16:49:04 2006 @@ -387,10 +387,18 @@ } +static void test_SetupCloseInfFile(void) +{ + /* try to close with invalid handles */ + SetupCloseInfFile( NULL ); + SetupCloseInfFile( INVALID_HANDLE_VALUE ); +} + START_TEST(parser) { test_invalid_files(); test_section_names(); test_key_names(); + test_SetupCloseInfFile(); DeleteFileA( tmpfile ); } Modified: trunk/reactos/regtests/winetests/setupapi/setupapi.rbuild URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/setupapi…
============================================================================== --- trunk/reactos/regtests/winetests/setupapi/setupapi.rbuild (original) +++ trunk/reactos/regtests/winetests/setupapi/setupapi.rbuild Thu Jun 15 16:49:04 2006 @@ -3,6 +3,8 @@ <define name="__USE_W32API" /> <library>ntdll</library> <library>setupapi</library> + <file>devclass.c</file> + <file>install.c</file> <file>parser.c</file> <file>query.c</file> <file>stringtable.c</file> Modified: trunk/reactos/regtests/winetests/setupapi/testlist.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/regtests/winetests/setupapi…
============================================================================== --- trunk/reactos/regtests/winetests/setupapi/testlist.c (original) +++ trunk/reactos/regtests/winetests/setupapi/testlist.c Thu Jun 15 16:49:04 2006 @@ -6,12 +6,16 @@ #define STANDALONE #include "wine/test.h" +extern void func_devclass(void); +extern void func_install(void); extern void func_parser(void); extern void func_query(void); extern void func_stringtable(void); const struct test winetest_testlist[] = { + { "devclass", func_devclass }, + { "install", func_install }, { "parser", func_parser }, { "query", func_query }, { "stringtable", func_stringtable },
18 years, 5 months
1
0
0
0
[hpoussin] 22357: Set svn:eol-style to native
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Jun 15 16:41:57 2006 New Revision: 22357 URL:
http://svn.reactos.ru/svn/reactos?rev=22357&view=rev
Log: Set svn:eol-style to native Modified: trunk/reactos/regtests/winetests/setupapi/parser.c (props changed) trunk/reactos/regtests/winetests/setupapi/query.c (props changed) trunk/reactos/regtests/winetests/setupapi/testlist.c (props changed) Propchange: trunk/reactos/regtests/winetests/setupapi/parser.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/regtests/winetests/setupapi/parser.c ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: trunk/reactos/regtests/winetests/setupapi/query.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/regtests/winetests/setupapi/query.c ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: trunk/reactos/regtests/winetests/setupapi/testlist.c ------------------------------------------------------------------------------ --- svn:executable (original) +++ svn:executable (removed) @@ -1,1 +1,0 @@ -*
18 years, 5 months
1
0
0
0
[hpoussin] 22356: Create configuration list only once (in MSVCBackend::Process) and use it everywhere. Remove dead code
by hpoussin@svn.reactos.org
Author: hpoussin Date: Thu Jun 15 16:33:47 2006 New Revision: 22356 URL:
http://svn.reactos.ru/svn/reactos?rev=22356&view=rev
Log: Create configuration list only once (in MSVCBackend::Process) and use it everywhere. Remove dead code Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp trunk/reactos/tools/rbuild/backend/msvc/msvc.h trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/m…
============================================================================== --- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp (original) +++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp Thu Jun 15 16:33:47 2006 @@ -56,6 +56,27 @@ void MSVCBackend::Process() { + // TODO FIXME wine hack? + bool only_msvc_headers = false; + + while ( m_configurations.size () > 0 ) + { + const MSVCConfiguration* cfg = m_configurations.back(); + m_configurations.pop_back(); + delete cfg; + } + + m_configurations.push_back ( new MSVCConfiguration( Debug )); + m_configurations.push_back ( new MSVCConfiguration( Release )); + m_configurations.push_back ( new MSVCConfiguration( Speed )); + + if (!only_msvc_headers) + { + m_configurations.push_back ( new MSVCConfiguration( Debug, WineHeaders )); + m_configurations.push_back ( new MSVCConfiguration( Release, WineHeaders )); + m_configurations.push_back ( new MSVCConfiguration( Speed, WineHeaders )); + } + if ( configuration.CleanAsYouGo ) { _clean_project_files(); return; @@ -65,20 +86,11 @@ return; } string filename_sln ( ProjectNode.name ); - //string filename_rules = "gccasm.rules"; if ( configuration.VSProjectVersion == "6.00" ) filename_sln += "_auto.dsw"; - else { + else filename_sln += "_auto.sln"; - - //m_rulesFile = fopen ( filename_rules.c_str(), "wb" ); - //if ( m_rulesFile ) - //{ - // _generate_rules_file ( m_rulesFile ); - //} - //fclose ( m_rulesFile ); - } printf ( "Creating MSVC workspace: %s\n", filename_sln.c_str() ); @@ -112,14 +124,6 @@ _generate_dsp ( module ); else _generate_vcproj ( module ); - - - /*for(size_t k = 0; k < module.non_if_data.files.size(); k++) - { - File &file = *module.non_if_data.files[k]; - - ProcessFile(file.name); - }*/ } } Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.h URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/m…
============================================================================== --- trunk/reactos/tools/rbuild/backend/msvc/msvc.h (original) +++ trunk/reactos/tools/rbuild/backend/msvc/msvc.h Thu Jun 15 16:33:47 2006 @@ -86,7 +86,7 @@ std::string SuoFileName ( const Module& module ) const; std::string NcbFileName ( const Module& module ) const; - + std::vector<MSVCConfiguration*> m_configurations; std::vector<FileUnit> m_fileUnits; std::vector<std::string> m_folders; Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/v…
============================================================================== --- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp (original) +++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp Thu Jun 15 16:33:47 2006 @@ -100,23 +100,6 @@ bool console = exe && (module.type == Win32CUI); - // TODO FIXME - not sure if the count here is right... - int parts = 0; - const char* p = strpbrk ( vcproj_file.c_str(), "/\\" ); - while ( p ) - { - ++parts; - p = strpbrk ( p+1, "/\\" ); - } - string msvc_wine_dir = ".."; - while ( --parts ) - msvc_wine_dir += "\\.."; - - string wine_include_dir = msvc_wine_dir + "\\include"; - - //$progress_current++; - //$output->progress("$dsp_file (file $progress_current of $progress_max)"); - string vcproj_path = module.GetBasePath(); vector<string> source_files, resource_files, includes, includes_wine, libraries; StringSet common_defines; @@ -194,22 +177,6 @@ vector<string> header_files; - // TODO FIXME wine hack? - bool no_msvc_headers = true; - - std::vector<MSVCConfiguration*> cfgs; - - cfgs.push_back ( new MSVCConfiguration( Debug )); - cfgs.push_back ( new MSVCConfiguration( Release )); - cfgs.push_back ( new MSVCConfiguration( Speed )); - - if (!no_msvc_headers) - { - cfgs.push_back ( new MSVCConfiguration( Debug, WineHeaders )); - cfgs.push_back ( new MSVCConfiguration( Release, WineHeaders )); - cfgs.push_back ( new MSVCConfiguration( Speed, WineHeaders )); - } - string include_string; fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" ); @@ -243,9 +210,9 @@ std::string output_dir; fprintf ( OUT, "\t<Configurations>\r\n" ); - for ( size_t icfg = 0; icfg < cfgs.size(); icfg++ ) - { - const MSVCConfiguration& cfg = *cfgs[icfg]; + for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ ) + { + const MSVCConfiguration& cfg = *m_configurations[icfg]; bool debug = ( cfg.optimization == Debug ); bool release = ( cfg.optimization == Release ); @@ -272,7 +239,6 @@ { if ( multiple_includes ) fprintf ( OUT, ";" ); - fprintf ( OUT, "%s", include.c_str() ); include_string += " /I " + include; multiple_includes = true; @@ -523,9 +489,9 @@ fprintf ( OUT, "\t\t\t<File\r\n" ); fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", source_file.c_str() ); - for ( size_t iconfig = 0; iconfig < cfgs.size(); iconfig++ ) - { - const MSVCConfiguration& config = *cfgs[iconfig]; + for ( size_t iconfig = 0; iconfig < m_configurations.size(); iconfig++ ) + { + const MSVCConfiguration& config = *m_configurations[iconfig]; if (( isrcfile == 0 ) && ( module.pch != NULL )) { @@ -635,31 +601,6 @@ return version; } - -//void -//MSVCBackend::_generate_rules_file ( FILE* OUT ) -//{ -// fprintf ( OUT, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" ); -// fprintf ( OUT, "<VisualStudioToolFile\r\n" ); -// fprintf ( OUT, "\tName=\"GCC Assembler\"\r\n" ); -// fprintf ( OUT, "\tVersion=\"%s\"\r\n", _get_solution_verion().c_str() ); -// fprintf ( OUT, "\t>\r\n" ); -// fprintf ( OUT, "\t<Rules>\r\n" ); -// fprintf ( OUT, "\t\t<CustomBuildRule\r\n" ); -// fprintf ( OUT, "\t\t\tName=\"Assembler\"\r\n" ); -// fprintf ( OUT, "\t\t\tDisplayName=\"Assembler Files\"\r\n" ); -// fprintf ( OUT, "\t\t\tCommandLine=\"cl /E "$(InputPath)" | as -o "$(OutDir)\\$(InputName).obj"\"\r\n" ); -// fprintf ( OUT, "\t\t\tOutputs=\"$(OutDir)\\$(InputName).obj\"\r\n" ); -// fprintf ( OUT, "\t\t\tFileExtensions=\"*.S\"\r\n" ); -// fprintf ( OUT, "\t\t\tExecutionDescription=\"asm\"\r\n" ); -// fprintf ( OUT, "\t\t\t>\r\n" ); -// fprintf ( OUT, "\t\t\t<Properties>\r\n" ); -// fprintf ( OUT, "\t\t\t</Properties>\r\n" ); -// fprintf ( OUT, "\t\t</CustomBuildRule>\r\n" ); -// fprintf ( OUT, "\t</Rules>\r\n" ); -// fprintf ( OUT, "</VisualStudioToolFile>\r\n" ); -//} - void MSVCBackend::_generate_sln_header ( FILE* OUT ) { @@ -703,8 +644,8 @@ { fprintf ( OUT, "Global\r\n" ); fprintf ( OUT, "\tGlobalSection(SolutionConfiguration) = preSolution\r\n" ); - fprintf ( OUT, "\t\tDebug = Debug\r\n" ); - fprintf ( OUT, "\t\tRelease = Release\r\n" ); + for ( size_t i = 0; i < m_configurations.size(); i++ ) + fprintf ( OUT, "\t\t%s = %s\r\n", m_configurations[i]->name.c_str(), m_configurations[i]->name.c_str() ); fprintf ( OUT, "\tEndGlobalSection\r\n" ); fprintf ( OUT, "\tGlobalSection(ProjectConfiguration) = postSolution\r\n" ); for ( size_t i = 0; i < ProjectNode.modules.size(); i++ ) @@ -739,10 +680,12 @@ void MSVCBackend::_generate_sln_configurations ( FILE* OUT, std::string vcproj_guid ) { - fprintf ( OUT, "\t\t%s.Debug|Win32.ActiveCfg = Debug|Win32\r\n", vcproj_guid.c_str() ); - fprintf ( OUT, "\t\t%s.Debug|Win32.Build.0 = Debug|Win32\r\n", vcproj_guid.c_str() ); - fprintf ( OUT, "\t\t%s.Release|Win32.ActiveCfg = Release|Win32\r\n", vcproj_guid.c_str() ); - fprintf ( OUT, "\t\t%s.Release|Win32.Build.0 = Release|Win32\r\n", vcproj_guid.c_str() ); + for ( size_t i = 0; i < m_configurations.size (); i++) + { + const MSVCConfiguration& cfg = *m_configurations[i]; + fprintf ( OUT, "\t\t%s.%s|Win32.ActiveCfg = %s|Win32\r\n", vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() ); + fprintf ( OUT, "\t\t%s.%s|Win32.Build.0 = %s|Win32\r\n", vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() ); + } } void
18 years, 5 months
1
0
0
0
[janderwald] 22355: remove endless loop
by janderwald@svn.reactos.org
Author: janderwald Date: Thu Jun 15 15:12:22 2006 New Revision: 22355 URL:
http://svn.reactos.ru/svn/reactos?rev=22355&view=rev
Log: remove endless loop Modified: trunk/reactos/ntoskrnl/po/power.c Modified: trunk/reactos/ntoskrnl/po/power.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/po/power.c?rev=223…
============================================================================== --- trunk/reactos/ntoskrnl/po/power.c (original) +++ trunk/reactos/ntoskrnl/po/power.c Thu Jun 15 15:12:22 2006 @@ -373,7 +373,6 @@ Status = STATUS_NOT_IMPLEMENTED; DPRINT1("PowerInformationLevel 0x%x is UNIMPLEMENTED! Have a nice day.\n", PowerInformationLevel); - for (;;); break; }
18 years, 5 months
1
0
0
0
[fireball] 22354: [FORMATTING] Generalize formatting a bit, normalize file's header
by fireball@svn.reactos.org
Author: fireball Date: Thu Jun 15 12:33:38 2006 New Revision: 22354 URL:
http://svn.reactos.ru/svn/reactos?rev=22354&view=rev
Log: [FORMATTING] Generalize formatting a bit, normalize file's header Modified: trunk/reactos/base/system/autochk/autochk.c Modified: trunk/reactos/base/system/autochk/autochk.c URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/system/autochk/autochk…
============================================================================== --- trunk/reactos/base/system/autochk/autochk.c (original) +++ trunk/reactos/base/system/autochk/autochk.c Thu Jun 15 12:33:38 2006 @@ -1,28 +1,9 @@ -/* - * ReactOS kernel - * Copyright (C) 2002 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ /* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: apps/system/autochk/autochk.c - * PURPOSE: Filesystem checker - * PROGRAMMER: Eric Kohl + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/autochk/autochk.c + * PURPOSE: Filesystem checker + * PROGRAMMERS: Eric Kohl */ /* INCLUDES *****************************************************************/ @@ -38,68 +19,69 @@ void DisplayString(LPCWSTR lpwString) { - UNICODE_STRING us; + UNICODE_STRING us; - RtlInitUnicodeString(&us, lpwString); - NtDisplayString(&us); + RtlInitUnicodeString(&us, lpwString); + NtDisplayString(&us); } - void PrintString(char* fmt,...) { - char buffer[512]; - va_list ap; - UNICODE_STRING UnicodeString; - ANSI_STRING AnsiString; + char buffer[512]; + va_list ap; + UNICODE_STRING UnicodeString; + ANSI_STRING AnsiString; - va_start(ap, fmt); - vsprintf(buffer, fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsprintf(buffer, fmt, ap); + va_end(ap); - RtlInitAnsiString(&AnsiString, buffer); - RtlAnsiStringToUnicodeString(&UnicodeString, - &AnsiString, - TRUE); - NtDisplayString(&UnicodeString); - RtlFreeUnicodeString(&UnicodeString); + RtlInitAnsiString(&AnsiString, buffer); + RtlAnsiStringToUnicodeString(&UnicodeString, + &AnsiString, + TRUE); + NtDisplayString(&UnicodeString); + RtlFreeUnicodeString(&UnicodeString); } /* Native image's entry point */ - -int _cdecl +int +_cdecl _main(int argc, char *argv[], char *envp[], int DebugFlag) { - PROCESS_DEVICEMAP_INFORMATION DeviceMap; - ULONG i; - NTSTATUS Status; + PROCESS_DEVICEMAP_INFORMATION DeviceMap; + ULONG i; + NTSTATUS Status; - PrintString("Autochk 0.0.1\n"); + PrintString("Autochk 0.0.1\n"); - Status = NtQueryInformationProcess(NtCurrentProcess(), - ProcessDeviceMap, - &DeviceMap.Query, - sizeof(DeviceMap.Query), - NULL); - if(NT_SUCCESS(Status)) - { - for (i = 0; i < 26; i++) - { - if ((DeviceMap.Query.DriveMap & (1 << i)) && - (DeviceMap.Query.DriveType[i] == DOSDEVICE_DRIVE_FIXED)) - { - PrintString(" Checking drive %c:", 'A'+i); - PrintString(" OK\n"); - } - } - PrintString("\n"); - return 0; - } - return 1; + Status = NtQueryInformationProcess(NtCurrentProcess(), + ProcessDeviceMap, + &DeviceMap.Query, + sizeof(DeviceMap.Query), + NULL); + + if(NT_SUCCESS(Status)) + { + for (i = 0; i < 26; i++) + { + if ((DeviceMap.Query.DriveMap & (1 << i)) && + (DeviceMap.Query.DriveType[i] == DOSDEVICE_DRIVE_FIXED)) + { + PrintString(" Checking drive %c:", 'A'+i); + PrintString(" OK\n"); + } + } + PrintString("\n"); + return 0; + } + + return 1; } /* EOF */
18 years, 5 months
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
60
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Results per page:
10
25
50
100
200