home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 March / PCpro_2005_03.ISO / files / systools / speedswitchxp / sswitchxp14.exe / Typical / speedswitch.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-01-14  |  2.8 KB  |  97 lines

  1. /*
  2.    SpeedswitchXP V1.4
  3.    - Windows XP CPU Frequency Control for Notebooks -
  4.  
  5.    Copyright(c) 2002-2004 Christian Diefer
  6.  
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License version 2 as 
  9.    published by the Free Software Foundation.
  10.    
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.    
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #ifndef SPEEDSWITCH_H
  22. #define SPEEDSWITCH_H
  23.  
  24. extern "C" {
  25. #include <windows.h>
  26. #include <winnt.h>
  27. #include <powrprof.h>
  28. };
  29.  
  30. typedef struct _PROCESSOR_POWER_INFORMATION {
  31.   ULONG  Number;
  32.   ULONG  MaxMhz;
  33.   ULONG  CurrentMhz;
  34.   ULONG  MhzLimit;
  35.   ULONG  MaxIdleState;
  36.   ULONG  CurrentIdleState;
  37. } PROCESSOR_POWER_INFORMATION , *PPROCESSOR_POWER_INFORMATION ;
  38.  
  39. int detectProfile();
  40. int createProfile();
  41. void updateStates();
  42. BOOL setState( BOOL ac, BYTE policy );
  43. char* throttleString( UCHAR throttle );         // CPU throttle state to string
  44. char* sysPwrState( SYSTEM_POWER_STATE state );  // power state to string
  45. char* pwrAction( POWER_ACTION action );         // power action to string
  46. DWORD cpuUsageNT();
  47. int writePolicies( BOOL power, BOOL cpu );
  48. BOOL checkProfile( int check );
  49.  
  50. extern int acThrottle;
  51. extern int dcThrottle;
  52. extern POWER_POLICY internalPolicy;           // our own profile policy
  53. extern MACHINE_PROCESSOR_POWER_POLICY mach;   // our own cpu policy
  54.  
  55. #define SystemBasicInformation       0
  56. #define SystemPerformanceInformation 2
  57. #define SystemTimeInformation        3
  58.  
  59. #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + (double)((x).LowPart))
  60.  
  61. typedef struct
  62. {
  63.     DWORD   dwUnknown1;
  64.     ULONG   uKeMaximumIncrement;
  65.     ULONG   uPageSize;
  66.     ULONG   uMmNumberOfPhysicalPages;
  67.     ULONG   uMmLowestPhysicalPage;
  68.     ULONG   uMmHighestPhysicalPage;
  69.     ULONG   uAllocationGranularity;
  70.     PVOID   pLowestUserAddress;
  71.     PVOID   pMmHighestUserAddress;
  72.     ULONG   uKeActiveProcessors;
  73.     BYTE    bKeNumberProcessors;
  74.     BYTE    bUnknown2;
  75.     WORD    wUnknown3;
  76. } SYSTEM_BASIC_INFORMATION;
  77.  
  78. typedef struct
  79. {
  80.     LARGE_INTEGER   liIdleTime;
  81.     DWORD           dwSpare[76];
  82. } SYSTEM_PERFORMANCE_INFORMATION;
  83.  
  84. typedef struct
  85. {
  86.     LARGE_INTEGER liKeBootTime;
  87.     LARGE_INTEGER liKeSystemTime;
  88.     LARGE_INTEGER liExpTimeZoneBias;
  89.     ULONG         uCurrentTimeZoneId;
  90.     DWORD         dwReserved;
  91. } SYSTEM_TIME_INFORMATION;
  92.  
  93. typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
  94.  
  95.  
  96. #endif
  97.