00001 /* 00002 * BEEN: Benchmarking Environment 00003 * ============================== 00004 * 00005 * File author: Branislav Repcek 00006 * 00007 * GNU Lesser General Public License Version 2.1 00008 * --------------------------------------------- 00009 * Copyright (C) 2004-2006 Distributed Systems Research Group, 00010 * Faculty of Mathematics and Physics, Charles University in Prague 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License version 2.1, as published by the Free Software Foundation. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00024 * MA 02111-1307 USA 00025 */ 00026 00058 #ifndef WINDOWS_DETECTOR_INCLUDED 00059 #define WINDOWS_DETECTOR_INCLUDED 00060 00061 #include <wbemidl.h> 00062 #include "../Common/UnicodeString.h" 00063 #include "../Common/Detector.h" 00064 #include "../Common/XMLFileOutput.h" 00065 #include "../Common/MessageReporter.h" 00066 #include "../Common/CheckedResult.h" 00067 #include "../Common/DiskDrive.h" 00068 00069 namespace hwdet 00070 { 00071 00087 class WindowsDetector : public Detector 00088 { 00089 public: 00091 WindowsDetector(void); 00092 00094 ~WindowsDetector(void); 00095 00097 bool Initialize(void); 00098 00100 bool Detect(void); 00101 00103 bool Destroy(void); 00104 00106 String GetOutputString(void) const; 00107 00109 bool WriteToStream(OStream &stream) const; 00110 00111 private: 00112 00114 IWbemServices *Services; 00115 00117 bool DetectOS(void); 00118 00120 bool DetectCPU(void); 00121 00123 bool DetectMemory(void); 00124 00126 bool DetectDrives(void); 00127 00129 bool DetectHDD(XMLElement *drives); 00130 00132 bool DetectPartitions(DiskDrive *disk_drive); 00133 00135 bool DetectCDRom(XMLElement *drives); 00136 00138 bool DetectOtherDrives(XMLElement *drives); 00139 00141 bool DetectNetwork(void); 00142 00144 bool DetectProducts(void); 00145 00154 template< typename T > 00155 bool TestAndReport(const CheckedResult< T > &cr, const String &message) 00156 { 00157 if (cr.Failed()) 00158 { 00159 ReportMessage(message); 00160 } 00161 return cr.Succeeded(); 00162 } 00163 }; 00164 } 00165 00166 #endif