void SweetDisplayStandby::timerTick() { LASTINPUTINFO LastInput = {}; LastInput.cbSize = sizeof(LastInput); GetLastInputInfo(&LastInput); int idleTime = (GetTickCount() - LastInput.dwTime) / 1000; if (idleTime>displayOffTime || forceDisplayTurnOff) { if (!displayWasTurnedOff) { EXECUTION_STATE cap; NTSTATUS status; status = CallNtPowerInformation(SystemExecutionState, NULL, 0, &cap, sizeof(cap)); if (!(cap & ES_DISPLAY_REQUIRED)) { addToQueue("turnOff"); displayWasTurnedOff = true; //lastInputTime = LastInput.dwTime; } } forceDisplayTurnOff = false; } else if (idleTime>displayDimTime && enableBrighnessManagement) { if (!displayWasDimmed) { EXECUTION_STATE cap; NTSTATUS status; status = CallNtPowerInformation(SystemExecutionState, NULL, 0, &cap, sizeof(cap)); if (!(cap & ES_DISPLAY_REQUIRED)) { addToQueue("dim"); displayWasDimmed = true; } } } else if (LastInput.dwTime > lastInputTime) { if (displayWasTurnedOff) { addToQueue("turnOn"); displayWasTurnedOff = false; } if (displayWasDimmed) { addToQueue("illuminate"); displayWasDimmed = false; } lastInputTime = LastInput.dwTime + 1000; //Give async function more time } }
void celero::DisableDynamicCPUScaling() { #ifdef WIN32 // http://stackoverflow.com/questions/3975551/how-to-disable-dynamic-frequency-scaling // https://msdn.microsoft.com/en-us/library/aa372675(v=vs.85).aspx // // NTSTATUS WINAPI CallNtPowerInformation( // _In_ POWER_INFORMATION_LEVEL InformationLevel, // _In_ PVOID lpInputBuffer, // _In_ ULONG nInputBufferSize, // _Out_ PVOID lpOutputBuffer, // _In_ ULONG nOutputBufferSize // ); // https://msdn.microsoft.com/en-us/library/aa373215(v=vs.85).aspx SYSTEM_POWER_CAPABILITIES spc; CallNtPowerInformation( SystemPowerCapabilities, NULL, NULL, &spc, sizeof(SYSTEM_POWER_CAPABILITIES)); if(spc.ProcessorThrottle == TRUE) { celero::print::Console("CPU supports processor throttling. Attempting to disable."); if(spc.ProcessorMinThrottle != 100) { spc.ProcessorMaxThrottle = 100; spc.ProcessorMinThrottle = 100; CallNtPowerInformation( SystemPowerCapabilities, &spc, sizeof(SYSTEM_POWER_CAPABILITIES), NULL, NULL); } celero::DisableDynamicCPUScaling(); } else { celero::print::Console("CPU processor throttling disabled."); } #else // The Linux kernel has full SpeedStep support // integrated since version 2.6. #endif }
/// <summary> /// Gets the current system power policy. /// </summary> /// <returns></returns> BOOL PowerSchemes::GetCurrentSystemPowerPolicy() { BOOL bSuccess = TRUE; SYSTEM_POWER_POLICY powerPolicy; DWORD status = CallNtPowerInformation(SystemPowerPolicyCurrent, NULL, 0, &powerPolicy, sizeof(SYSTEM_POWER_POLICY) ); switch (status) { case STATUS_BUFFER_TOO_SMALL: //printf("The output buffer is of insufficient size to contain the data to be returned. \n"); bSuccess = FALSE; break; case STATUS_ACCESS_DENIED: //printf("The caller had insufficient access rights to perform the requested action. \n"); bSuccess = FALSE; break; case STATUS_SUCCESS: //printf("OK: %d\n", 0); bSuccess = TRUE; break; default: //PrintErrorMessage(status); bSuccess = FALSE; break; } return bSuccess; }
PLUGIN_EXPORT double Update(void* data) { MeasureData* measure = (MeasureData*)data; SYSTEM_POWER_STATUS sps; if (GetSystemPowerStatus(&sps)) { switch (measure->type) { case POWER_ACLINE: return sps.ACLineStatus == 1 ? 1.0 : 0.0; case POWER_STATUS: if (sps.BatteryFlag & 128) { return 0.0; // No battery } else if (sps.BatteryFlag & 8) { return 1.0; // Charging } else if (sps.BatteryFlag & 4) { return 2.0; // Critical } else if (sps.BatteryFlag & 2) { return 3.0; // Low } else if (sps.BatteryFlag & 1) { return 4.0; // High } break; case POWER_STATUS2: return sps.BatteryFlag; case POWER_LIFETIME: return sps.BatteryLifeTime; case POWER_PERCENT: return sps.BatteryLifePercent == 255 ? 100.0 : sps.BatteryLifePercent; case POWER_MHZ: case POWER_HZ: if (g_NumOfProcessors > 0) { PROCESSOR_POWER_INFORMATION* ppi = new PROCESSOR_POWER_INFORMATION[g_NumOfProcessors]; memset(ppi, 0, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors); CallNtPowerInformation(ProcessorInformation, nullptr, 0, ppi, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors); double value = (measure->type == POWER_MHZ) ? ppi[0].CurrentMhz : ppi[0].CurrentMhz * 1000000.0; delete [] ppi; return value; } } } return 0.0; }
static VOID SetProcSpeed(HWND hwnd, HKEY hKey, LPTSTR Value, UINT uID) { TCHAR szBuf[64]; DWORD BufSize = sizeof(DWORD); DWORD Type = REG_SZ; PROCESSOR_POWER_INFORMATION ppi; ZeroMemory(&ppi, sizeof(ppi)); if ((CallNtPowerInformation(ProcessorInformation, NULL, 0, (PVOID)&ppi, sizeof(ppi)) == STATUS_SUCCESS && ppi.CurrentMhz != 0) || RegQueryValueEx(hKey, Value, NULL, &Type, (PBYTE)&ppi.CurrentMhz, &BufSize) == ERROR_SUCCESS) { if (ppi.CurrentMhz < 1000) { wsprintf(szBuf, _T("%lu MHz"), ppi.CurrentMhz); } else { double flt = ppi.CurrentMhz / 1000.0; MakeFloatValueString(&flt, szBuf, _T("GHz")); } SetDlgItemText(hwnd, uID, szBuf); } }
int CollectorWin::getHostCpuMHz(ULONG *mhz) { uint64_t uTotalMhz = 0; RTCPUID nProcessors = RTMpGetCount(); PPROCESSOR_POWER_INFORMATION ppi = (PPROCESSOR_POWER_INFORMATION)RTMemAllocZ(nProcessors * sizeof(PROCESSOR_POWER_INFORMATION)); if (!ppi) return VERR_NO_MEMORY; LONG ns = CallNtPowerInformation(ProcessorInformation, NULL, 0, ppi, nProcessors * sizeof(PROCESSOR_POWER_INFORMATION)); if (ns) { Log(("CallNtPowerInformation() -> %x\n", ns)); RTMemFree(ppi); return VERR_INTERNAL_ERROR; } /* Compute an average over all CPUs */ for (unsigned i = 0; i < nProcessors; i++) uTotalMhz += ppi[i].CurrentMhz; *mhz = (ULONG)(uTotalMhz / nProcessors); RTMemFree(ppi); LogFlowThisFunc(("mhz=%u\n", *mhz)); LogFlowThisFuncLeave(); return VINF_SUCCESS; }
static unsigned long getlastwaketime(void) { ULONGLONG lastwake; if (CallNtPowerInformation(LastWakeTime, NULL, 0, &lastwake, sizeof(lastwake)) == 0) { return (unsigned long)(lastwake/(1000000000/100)); } else { return (unsigned long)(GetTickCount64()/1000); } }
// This thread controls the CPU frequency measurements. void CCPUFrequencyMonitor::Sample() { // Get the actual number of CPUs, in case numCPUs_ was trimmed. // Otherwise CallNtPowerInformation won't return any data. SYSTEM_INFO systemInfo; GetSystemInfo(&systemInfo); DWORD actualNumberCPUs = systemInfo.dwNumberOfProcessors; // Ask Windows what frequency it thinks the CPUs are running at. std::vector<PROCESSOR_POWER_INFORMATION> processorInfo(actualNumberCPUs); NTSTATUS powerStatus = CallNtPowerInformation(ProcessorInformation, nullptr, 0, &processorInfo[0], sizeof(processorInfo[0]) * actualNumberCPUs); ULONG maxPromisedMHz = 0; // Most common failure result is: // #define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023L) if (powerStatus >= 0) { for (DWORD i = 0; i < actualNumberCPUs; ++i) { maxPromisedMHz = std::max(maxPromisedMHz, processorInfo[i].CurrentMhz); } } // Release all of the per-CPU measurement threads. This is not // actually guaranteed to wake up all of the threads - one thread // could 'absorb' all of the semaphores, but in practice this works // very well. Releasing numCPUs_ different semaphores would guarantee // that all of the individual threads would run, but would require // this thread to run more code (releasing individual semaphores) which // might cause more worrisome interference. ReleaseSemaphore(workStartSemaphore_, numCPUs_, nullptr); // Sleep a little while to give the calculation threads time to finish // without this thread interfering. Sleep(10); // Make sure the CPU frequency measurements are finished. for (unsigned i = 0; i < numCPUs_; ++i) WaitForSingleObject(resultsDoneSemaphore_, INFINITE); // Find the maximum measured frequencies. float maxActualFreq = threads_[0].frequency; for (DWORD i = 1; i < numCPUs_; ++i) { maxActualFreq = std::max(maxActualFreq, threads_[i].frequency); } float freqPercentage = maxActualFreq * 100.f / maxPromisedMHz; PCWSTR pStatus = L"Normal"; if (freqPercentage < 75) pStatus = L"Probably modest thermal throttling"; if (freqPercentage < 50) pStatus = L"Probably significant thermal throttling"; ETWMarkCPUThrottling(startFrequency_, maxActualFreq, static_cast<float>(maxPromisedMHz), freqPercentage, pStatus); }
float Windows::BatteryGetPercent() { #ifdef WIN32 SYSTEM_BATTERY_STATE btry; CallNtPowerInformation( SystemBatteryState, 0, 0, &btry, sizeof(btry) ); return ( btry.AcOnLine != 0 ? -1.0 : ((float)btry.RemainingCapacity / (float)btry.MaxCapacity) ); #else return -1.0; #endif }
INT_PTR Hib_SaveData(HWND hwndDlg) { BOOLEAN bHibernate; bHibernate = (BOOLEAN)(IsDlgButtonChecked(hwndDlg, IDC_HIBERNATEFILE) == BST_CHECKED); if (CallNtPowerInformation(SystemReserveHiberFile,&bHibernate, sizeof(bHibernate), NULL, 0) == STATUS_SUCCESS) { Pos_InitData(); Adv_InitDialog(); Hib_InitDialog(hwndDlg); return TRUE; } return FALSE; }
INT_PTR CALLBACK ProcessorDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam) { switch (uMessage) { case WM_INITDIALOG: { WCHAR szFeatures[MAX_PATH] = L""; WCHAR szModel[3]; WCHAR szStepping[3]; WCHAR szCurrentMhz[10]; BOOL bFirst = TRUE; SYSTEM_INFO SystemInfo; PROCESSOR_POWER_INFORMATION PowerInfo; if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE)) AddFeature(szFeatures, sizeof(szFeatures), L"MMX", &bFirst); if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE)) AddFeature(szFeatures, sizeof(szFeatures), L"SSE", &bFirst); if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE)) AddFeature(szFeatures, sizeof(szFeatures), L"SSE2", &bFirst); /*if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE)) AddFeature(szFeatures, sizeof(szFeatures), L"SSE3", &bFirst); */ if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE)) AddFeature(szFeatures, sizeof(szFeatures), L"3DNOW", &bFirst); SetDlgItemTextW(hDlg, IDC_FEATURES, szFeatures); GetSystemInfo(&SystemInfo); StringCbPrintfW(szModel, sizeof(szModel), L"%x", HIBYTE(SystemInfo.wProcessorRevision)); StringCbPrintfW(szStepping, sizeof(szStepping), L"%d", LOBYTE(SystemInfo.wProcessorRevision)); SetDlgItemTextW(hDlg, IDC_MODEL, szModel); SetDlgItemTextW(hDlg, IDC_STEPPING, szStepping); CallNtPowerInformation(11, NULL, 0, &PowerInfo, sizeof(PowerInfo)); StringCbPrintfW(szCurrentMhz, sizeof(szCurrentMhz), L"%ld %s", PowerInfo.CurrentMhz, L"MHz"); SetDlgItemTextW(hDlg, IDC_CORESPEED, szCurrentMhz); return TRUE; } } return FALSE; }
static BOOLEAN IsBatteryUsed(VOID) { SYSTEM_BATTERY_STATE sbs; if (CallNtPowerInformation(SystemBatteryState,NULL, (ULONG)0, &sbs, sizeof(SYSTEM_BATTERY_STATE)) == STATUS_SUCCESS) { if (sbs.BatteryPresent) { if (sbs.AcOnLine) { return FALSE; } return TRUE; } } return FALSE; }
void MachineInfo::make_info() { //FunctionHooks* FH = new FunctionHooks; DWORD size; size = MAX_COMPUTERNAME_LENGTH + 1; GetComputerNameA(this->PC_Name, &size); // Wpisanie nazwy komputera size = UNLEN + 1; GetUserNameA(this->Username, &size); // Wpisanie nazwy u¿ytkownika /*----------------Wpisanie informacji o maksymalnym taktowaniu CPU--------------------*/ SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); size = sysInfo.dwNumberOfProcessors * sizeof(PROCESSOR_POWER_INFORMATION); LPBYTE buf = new BYTE[size]; CallNtPowerInformation(ProcessorInformation, NULL, 0, buf, size); PPROCESSOR_POWER_INFORMATION cpuinfo = (PPROCESSOR_POWER_INFORMATION)buf; std::string full_cpu_ratio = intToStr(cpuinfo->MaxMhz) + "GHz"; full_cpu_ratio.erase(3, 1); full_cpu_ratio.insert(1, "."); memcpy(this->CPU_clock, full_cpu_ratio.c_str(), sizeof(full_cpu_ratio)); /*------------------------------------------------------------------------------------*/ /*-----------------------Sprawdzenie wersji systemu Windows---------------------------*/ if (IsWindows8Point1OrGreater())memcpy(this->OS, "Windows 8.1", sizeof("Windows 8.1")); else if (IsWindows7OrGreater())memcpy(this->OS, "Windows 7", sizeof("Windows 7")); else if (IsWindowsVistaOrGreater())memcpy(this->OS, "Windows Vista", sizeof("Windows Vista")); else if (IsWindowsXPOrGreater())memcpy(this->OS, "Windows XP", sizeof("Windows XP")); /*------------------------------------------------------------------------------------*/ }
/// <summary> /// Gets the cpu power information. /// </summary> /// <param name="MaxMhz">The maximum MHZ.</param> /// <param name="CurrentMhz">The current MHZ.</param> /// <param name="MhzLimit">The MHZ limit.</param> /// <returns></returns> BOOL PowerSchemes::GetCpuPowerInfo(DWORD &MaxMhz, DWORD &CurrentMhz, DWORD &MhzLimit) { BOOL bSuccess = TRUE; // Find out how many processors we have in the system DWORD numCore = sysInfo.dwNumberOfProcessors; PROCESSOR_POWER_INFORMATION *cpuInfo = new PROCESSOR_POWER_INFORMATION[numCore]; // get CPU stats int status = CallNtPowerInformation(ProcessorInformation, NULL, 0, &cpuInfo[0], numCore * sizeof(PROCESSOR_POWER_INFORMATION) ); switch (status) { case STATUS_BUFFER_TOO_SMALL: //printf("The output buffer is of insufficient size to contain the data to be returned. \n"); bSuccess = FALSE; break; case STATUS_ACCESS_DENIED: //printf("The caller had insufficient access rights to perform the requested action. \n"); bSuccess = FALSE; break; case STATUS_SUCCESS: //printf("Number: %d\n", cpuInfo->Number); //printf("MaxMhz: %d\n", cpuInfo->MaxMhz); //printf("CurrentMhz: %d \n", cpuInfo->CurrentMhz); //printf("MhzLimit: %d\n", cpuInfo->MhzLimit); //printf("MaxIdleState: %d\n", cpuInfo->MaxIdleState); //printf("CurrentIdleState: %d\n", cpuInfo->CurrentIdleState); MaxMhz = cpuInfo->MaxMhz; CurrentMhz = cpuInfo->CurrentMhz; MhzLimit = cpuInfo->MhzLimit; break; } return bSuccess; }
LRESULT CALLBACK HostPowerServiceWin::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_POWERBROADCAST: { HostPowerServiceWin *pPowerObj; pPowerObj = (HostPowerServiceWin *)GetWindowLongPtr(hwnd, 0); if (pPowerObj) { switch(wParam) { case PBT_APMSUSPEND: pPowerObj->notify(Reason_HostSuspend); break; case PBT_APMRESUMEAUTOMATIC: pPowerObj->notify(Reason_HostResume); break; case PBT_APMPOWERSTATUSCHANGE: { SYSTEM_POWER_STATUS SystemPowerStatus; Log(("PBT_APMPOWERSTATUSCHANGE\n")); if (GetSystemPowerStatus(&SystemPowerStatus) == TRUE) { Log(("PBT_APMPOWERSTATUSCHANGE ACLineStatus=%d BatteryFlag=%d\n", SystemPowerStatus.ACLineStatus, SystemPowerStatus.BatteryFlag)); if (SystemPowerStatus.ACLineStatus == 0) /* offline */ { if (SystemPowerStatus.BatteryFlag == 2 /* low > 33% */) { LONG rc; SYSTEM_BATTERY_STATE BatteryState; rc = CallNtPowerInformation(SystemBatteryState, NULL, 0, (PVOID)&BatteryState, sizeof(BatteryState)); #ifdef LOG_ENABLED if (rc == 0 /* STATUS_SUCCESS */) Log(("CallNtPowerInformation claims %d seconds of power left\n", BatteryState.EstimatedTime)); #endif if ( rc == 0 /* STATUS_SUCCESS */ && BatteryState.EstimatedTime < 60*5) { pPowerObj->notify(Reason_HostBatteryLow); } } else /* If the machine has less than 5% battery left (and is not connected * to the AC), then we should save the state. */ if (SystemPowerStatus.BatteryFlag == 4 /* critical battery status; less than 5% */) { pPowerObj->notify(Reason_HostBatteryLow); } } } break; } default: return DefWindowProc(hwnd, msg, wParam, lParam); } } return TRUE; } default: return DefWindowProc(hwnd, msg, wParam, lParam); } }
//---------------------------------------------------------------------------- // Function: SystemInfo // // Description: // Returns the resource information about the machine // // Returns: // EXIT_SUCCESS: On success // EXIT_FAILURE: otherwise int SystemInfo() { size_t vmemSize, vmemFree, memSize, memFree; PERFORMANCE_INFORMATION memInfo; SYSTEM_INFO sysInfo; FILETIME idleTimeFt, kernelTimeFt, userTimeFt; ULARGE_INTEGER idleTime, kernelTime, userTime; ULONGLONG cpuTimeMs; size_t size; LPBYTE pBuffer; PROCESSOR_POWER_INFORMATION const *ppi; ULONGLONG cpuFrequencyKhz; NTSTATUS status; ZeroMemory(&memInfo, sizeof(PERFORMANCE_INFORMATION)); memInfo.cb = sizeof(PERFORMANCE_INFORMATION); if(!GetPerformanceInfo(&memInfo, sizeof(PERFORMANCE_INFORMATION))) { ReportErrorCode(L"GetPerformanceInfo", GetLastError()); return EXIT_FAILURE; } vmemSize = memInfo.CommitLimit*memInfo.PageSize; vmemFree = vmemSize - memInfo.CommitTotal*memInfo.PageSize; memSize = memInfo.PhysicalTotal*memInfo.PageSize; memFree = memInfo.PhysicalAvailable*memInfo.PageSize; GetSystemInfo(&sysInfo); if(!GetSystemTimes(&idleTimeFt, &kernelTimeFt, &userTimeFt)) { ReportErrorCode(L"GetSystemTimes", GetLastError()); return EXIT_FAILURE; } idleTime.HighPart = idleTimeFt.dwHighDateTime; idleTime.LowPart = idleTimeFt.dwLowDateTime; kernelTime.HighPart = kernelTimeFt.dwHighDateTime; kernelTime.LowPart = kernelTimeFt.dwLowDateTime; userTime.HighPart = userTimeFt.dwHighDateTime; userTime.LowPart = userTimeFt.dwLowDateTime; cpuTimeMs = (kernelTime.QuadPart - idleTime.QuadPart + userTime.QuadPart)/10000; // allocate buffer to get info for each processor size = sysInfo.dwNumberOfProcessors * sizeof(PROCESSOR_POWER_INFORMATION); pBuffer = (BYTE*) LocalAlloc(LPTR, size); if(!pBuffer) { ReportErrorCode(L"LocalAlloc", GetLastError()); return EXIT_FAILURE; } status = CallNtPowerInformation(ProcessorInformation, NULL, 0, pBuffer, (long)size); if(0 != status) { fwprintf_s(stderr, L"Error in CallNtPowerInformation. Err:%d\n", status); LocalFree(pBuffer); return EXIT_FAILURE; } ppi = (PROCESSOR_POWER_INFORMATION const *)pBuffer; cpuFrequencyKhz = ppi->MaxMhz*1000; LocalFree(pBuffer); fwprintf_s(stdout, L"%Iu,%Iu,%Iu,%Iu,%u,%I64u,%I64u\n", vmemSize, memSize, vmemFree, memFree, sysInfo.dwNumberOfProcessors, cpuFrequencyKhz, cpuTimeMs); return EXIT_SUCCESS; }
void CPowerCapabilities::setVars() { yes.LoadStringW( IDS_PINF19 ); no.LoadStringW( IDS_PINF20 ); BOOL x = (CallNtPowerInformation(SystemPowerCapabilities, NULL, 0, &spc, sizeof(spc)) == ERROR_SUCCESS); if( x ) { m_szPowerButton = (spc.PowerButtonPresent ? yes : no ); m_szSleepButton = (spc.SleepButtonPresent ? yes : no ); m_szLidSwitch = (spc.LidPresent ? yes : no ); wchar_t text[128] = _T(""); bool first = true; if( spc.SystemS1 ) { _tcscat_s( text, _T("S1") ); first = false; } if( spc.SystemS2 ) { if( !first ) _tcscat_s( text, _T(", ") ); _tcscat_s( text, _T("S2") ); first = false; } if( spc.SystemS3 ) { if( !first ) _tcscat_s( text, _T(", ") ); _tcscat_s( text, _T("S3") ); first = false; } if( spc.SystemS4 ) { if( !first ) _tcscat_s( text, _T(", ") ); _tcscat_s( text, _T("S4") ); first = false; } if( spc.SystemS5 ) { if( !first ) _tcscat_s( text, _T(", ") ); _tcscat_s( text, _T("S5") ); first = false; } m_szSStates = text; m_szHiberFile = (spc.HiberFilePresent ? yes : no ); m_szWakeSupport = (spc.FullWake ? yes : no ); m_szVideoDim = (spc.VideoDimPresent ? yes : no ); m_szAPMBios = (spc.ApmPresent ? yes : no ); m_szUPSPresent = (spc.UpsPresent ? yes : no ); m_szThermalZones = (spc.ThermalControl ? yes : no ); BOOLEAN throttle = spc.ProcessorThrottle; m_szThrottle = (throttle ? yes : no); if( throttle ) { m_szThrottleMax.Format( _T("%d"), spc.ProcessorMinThrottle ); m_szThrottleMin.Format( _T("%d"), spc.ProcessorMaxThrottle ); } else { m_szThrottleMax = _T("---"); m_szThrottleMin = _T("---"); } m_szSpinDown = (spc.DiskSpinDown ? yes : no ); m_szSystemBatteries = (spc.SystemBatteriesPresent ? yes : no ); m_szShortTermBatteries = (spc.BatteriesAreShortTerm ? yes : no ); } }