Subversion Repositories ALCASAR

Rev

Rev 2976 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
Line 26... Line 26...
26
 * @link      http://phpsysinfo.sourceforge.net
26
 * @link      http://phpsysinfo.sourceforge.net
27
 */
27
 */
28
class WINNT extends OS
28
class WINNT extends OS
29
{
29
{
30
    /**
30
    /**
-
 
31
     * holds codepage for chcp
-
 
32
     *
-
 
33
     * @var int
-
 
34
     */
-
 
35
    private static $_cp = null;
-
 
36
 
-
 
37
    /**
31
     * holds the data from WMI Win32_OperatingSystem
38
     * holds the data from WMI Win32_OperatingSystem
32
     *
39
     *
33
     * @var array
40
     * @var array
34
     */
41
     */
35
    private $_Win32_OperatingSystem = null;
42
    private static $_Win32_OperatingSystem = null;
36
 
43
 
37
    /**
44
    /**
38
     * holds the data from WMI Win32_ComputerSystem
45
     * holds the data from WMI Win32_ComputerSystem
39
     *
46
     *
40
     * @var array
47
     * @var array
Line 44... Line 51...
44
    /**
51
    /**
45
     * holds the data from WMI Win32_Processor
52
     * holds the data from WMI Win32_Processor
46
     *
53
     *
47
     * @var array
54
     * @var array
48
     */
55
     */
49
    private $_Win32_Processor = null;
56
    private static $_Win32_Processor = null;
-
 
57
 
-
 
58
    /**
-
 
59
     * holds the data from WMI Win32_PhysicalMemory
-
 
60
     *
-
 
61
     * @var array
-
 
62
     */
-
 
63
    private static $_Win32_PhysicalMemory = null;
50
 
64
 
51
     /**
65
     /**
52
     * holds the data from WMI Win32_PerfFormattedData_PerfOS_Processor
66
     * holds the data from WMI Win32_PerfFormattedData_PerfOS_Processor
53
     *
67
     *
54
     * @var array
68
     * @var array
Line 65... Line 79...
65
    /**
79
    /**
66
     * holds the COM object that we pull WMI root\CIMv2 data from
80
     * holds the COM object that we pull WMI root\CIMv2 data from
67
     *
81
     *
68
     * @var Object
82
     * @var Object
69
     */
83
     */
70
    private $_wmi = null;
84
    private static $_wmi = null;
71
 
85
 
72
    /**
86
    /**
73
     * holds the COM object that we pull all the EnumKey and RegRead data from
87
     * holds the COM object that we pull all the EnumKey and RegRead data from
74
     *
88
     *
75
     * @var Object
89
     * @var Object
Line 82... Line 96...
82
     * @var string
96
     * @var string
83
     */
97
     */
84
    private $_ver = "";
98
    private $_ver = "";
85
 
99
 
86
    /**
100
    /**
-
 
101
     * holds system manufacturer
-
 
102
     *
-
 
103
     * @var string
-
 
104
     */
-
 
105
    private $_Manufacturer = "";
-
 
106
 
-
 
107
    /**
-
 
108
     * holds system model
-
 
109
     *
-
 
110
     * @var string
-
 
111
     */
-
 
112
    private $_Model = "";
-
 
113
 
-
 
114
    /**
87
     * holds all devices, which are in the system
115
     * holds all devices, which are in the system
88
     *
116
     *
89
     * @var array
117
     * @var array
90
     */
118
     */
91
    private $_wmidevices = array();
119
    private $_wmidevices = null;
92
 
120
 
93
    /**
121
    /**
94
     * holds all disks, which are in the system
122
     * holds all disks, which are in the system
95
     *
123
     *
96
     * @var array
124
     * @var array
Line 110... Line 138...
110
     * @var string
138
     * @var string
111
     */
139
     */
112
    private $_syslang = null;
140
    private $_syslang = null;
113
 
141
 
114
    /**
142
    /**
-
 
143
     * value of checking run as administrator
-
 
144
     *
-
 
145
     * @var boolean
-
 
146
     */
-
 
147
    private static $_asadmin = null;
-
 
148
 
-
 
149
    /**
-
 
150
     * returns codepage for chcp
-
 
151
     *
-
 
152
     * @return int
-
 
153
     */
-
 
154
    public static function getcp()
-
 
155
    {
-
 
156
        return self::$_cp;
-
 
157
    }
-
 
158
 
-
 
159
    /**
-
 
160
     * returns the COM object that we pull WMI root\CIMv2 data from
-
 
161
     *
-
 
162
     * @return Object
-
 
163
     */
-
 
164
    public static function getcimv2wmi()
-
 
165
    {
-
 
166
        return self::$_wmi;
-
 
167
    }
-
 
168
 
-
 
169
    /**
115
     * reads the data from WMI Win32_OperatingSystem
170
     * reads the data from WMI Win32_OperatingSystem
116
     *
171
     *
117
     * @return array
172
     * @return array
118
     */
173
     */
119
    private function _get_Win32_OperatingSystem()
174
    public static function _get_Win32_OperatingSystem()
120
    {
175
    {
121
        if ($this->_Win32_OperatingSystem === null) $this->_Win32_OperatingSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_OperatingSystem', array('CodeSet', 'Locale', 'LastBootUpTime', 'LocalDateTime', 'Version', 'ServicePackMajorVersion', 'Caption', 'OSArchitecture', 'TotalVisibleMemorySize', 'FreePhysicalMemory'));
176
        if (self::$_Win32_OperatingSystem === null) self::$_Win32_OperatingSystem = self::getWMI(self::$_wmi, 'Win32_OperatingSystem', array('CodeSet', 'Locale', 'LastBootUpTime', 'LocalDateTime', 'Version', 'ServicePackMajorVersion', 'Caption', 'TotalVisibleMemorySize', 'FreePhysicalMemory'));
122
        return $this->_Win32_OperatingSystem;
177
        return self::$_Win32_OperatingSystem;
123
    }
178
    }
124
 
179
 
125
    /**
180
    /**
126
     * reads the data from WMI Win32_ComputerSystem
181
     * reads the data from WMI Win32_ComputerSystem
127
     *
182
     *
128
     * @return array
183
     * @return array
129
     */
184
     */
130
    private function _get_Win32_ComputerSystem()
185
    private function _get_Win32_ComputerSystem()
131
    {
186
    {
132
        if ($this->_Win32_ComputerSystem === null) $this->_Win32_ComputerSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_ComputerSystem', array('Name', 'Manufacturer', 'Model', 'SystemFamily'));
187
        if ($this->_Win32_ComputerSystem === null) $this->_Win32_ComputerSystem = self::getWMI(self::$_wmi, 'Win32_ComputerSystem', array('Name', 'Manufacturer', 'Model', 'SystemFamily'));
133
        return $this->_Win32_ComputerSystem;
188
        return $this->_Win32_ComputerSystem;
134
    }
189
    }
135
 
190
 
136
    /**
191
    /**
137
     * reads the data from WMI Win32_Processor
192
     * reads the data from WMI Win32_Processor
138
     *
193
     *
139
     * @return array
194
     * @return array
140
     */
195
     */
-
 
196
    public static function _get_Win32_Processor()
-
 
197
    {
141
    private function _get_Win32_Processor()
198
        if (self::$_Win32_Processor === null) self::$_Win32_Processor = self::getWMI(self::$_wmi, 'Win32_Processor', array('DeviceID', 'LoadPercentage', 'AddressWidth', 'Name', 'L2CacheSize', 'L3CacheSize', 'CurrentClockSpeed', 'ExtClock', 'NumberOfCores', 'NumberOfLogicalProcessors', 'MaxClockSpeed', 'Manufacturer', 'Architecture', 'Caption', 'CurrentVoltage'));
-
 
199
        return self::$_Win32_Processor;
-
 
200
    }
-
 
201
 
-
 
202
    /**
-
 
203
     * reads the data from WMI Win32_PhysicalMemory
-
 
204
     *
-
 
205
     * @return array
-
 
206
     */
-
 
207
    public static function _get_Win32_PhysicalMemory()
142
    {
208
    {
143
        if ($this->_Win32_Processor === null) $this->_Win32_Processor = CommonFunctions::getWMI($this->_wmi, 'Win32_Processor', array('LoadPercentage', 'AddressWidth', 'Name', 'L2CacheSize', 'L3CacheSize', 'CurrentClockSpeed', 'ExtClock', 'NumberOfCores', 'NumberOfLogicalProcessors', 'MaxClockSpeed', 'Manufacturer'));
209
        if (self::$_Win32_PhysicalMemory === null) self::$_Win32_PhysicalMemory = self::getWMI(self::$_wmi, 'Win32_PhysicalMemory', array('PartNumber', 'DeviceLocator', 'Capacity', 'Manufacturer', 'SerialNumber', 'Speed', 'ConfiguredClockSpeed', 'ConfiguredVoltage', 'MemoryType', 'SMBIOSMemoryType', 'FormFactor', 'DataWidth', 'TotalWidth', 'BankLabel', 'MinVoltage', 'MaxVoltage'));
144
        return $this->_Win32_Processor;
210
        return self::$_Win32_PhysicalMemory;
145
    }
211
    }
146
 
212
 
147
    /**
213
    /**
148
     * reads the data from WMI Win32_PerfFormattedData_PerfOS_Processor
214
     * reads the data from WMI Win32_PerfFormattedData_PerfOS_Processor
149
     *
215
     *
Line 153... Line 219...
153
    {
219
    {
154
        if ($this->_Win32_PerfFormattedData_PerfOS_Processor === null) {
220
        if ($this->_Win32_PerfFormattedData_PerfOS_Processor === null) {
155
            $this->_Win32_PerfFormattedData_PerfOS_Processor = array();
221
            $this->_Win32_PerfFormattedData_PerfOS_Processor = array();
156
            $buffer = $this->_get_Win32_OperatingSystem();
222
            $buffer = $this->_get_Win32_OperatingSystem();
157
            if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "5.1", ">=")) { // minimal windows 2003 or windows XP
223
            if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "5.1", ">=")) { // minimal windows 2003 or windows XP
158
                $cpubuffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfFormattedData_PerfOS_Processor', array('Name', 'PercentProcessorTime'));
224
                $cpubuffer = self::getWMI(self::$_wmi, 'Win32_PerfFormattedData_PerfOS_Processor', array('Name', 'PercentProcessorTime'));
159
                if ($cpubuffer) foreach ($cpubuffer as $cpu) {
225
                foreach ($cpubuffer as $cpu) {
160
                    if (isset($cpu['Name']) && isset($cpu['PercentProcessorTime'])) {
226
                    if (isset($cpu['Name']) && isset($cpu['PercentProcessorTime'])) {
161
                        $this->_Win32_PerfFormattedData_PerfOS_Processor['cpu'.$cpu['Name']] = $cpu['PercentProcessorTime'];
227
                        $this->_Win32_PerfFormattedData_PerfOS_Processor['cpu'.$cpu['Name']] = $cpu['PercentProcessorTime'];
162
                    }
228
                    }
163
                }
229
                }
164
            }
230
            }
Line 181... Line 247...
181
            return '';
247
            return '';
182
        }
248
        }
183
    }
249
    }
184
 
250
 
185
    /**
251
    /**
-
 
252
     * checks WINNT and 'run as Administrator' mode
-
 
253
     *
-
 
254
     * @return boolean
-
 
255
     */
-
 
256
    public static function isAdmin()
-
 
257
    {
-
 
258
        if (self::$_asadmin == null) {
-
 
259
            if (PSI_OS == 'WINNT') {
-
 
260
                $strBuf = '';
-
 
261
                CommonFunctions::executeProgram('sfc', '2>&1', $strBuf, false); // 'net session' for detection does not work if "Server" (LanmanServer) service is stopped
-
 
262
                if (preg_match('/^\/SCANNOW\s/m', preg_replace('/(\x00)/', '', $strBuf))) { // SCANNOW checking - also if Unicode
-
 
263
                    self::$_asadmin = true;
-
 
264
                } else {
-
 
265
                    self::$_asadmin = false;
-
 
266
                }
-
 
267
            } else {
-
 
268
                self::$_asadmin = false;
-
 
269
            }
-
 
270
        }
-
 
271
 
-
 
272
        return self::$_asadmin;
-
 
273
    }
-
 
274
 
-
 
275
    /**
-
 
276
     * function for getting a list of values in the specified context
-
 
277
     * optionally filter this list, based on the list from third parameter
-
 
278
     *
-
 
279
     * @param $wmi object holds the COM object that we pull the WMI data from
-
 
280
     * @param string $strClass name of the class where the values are stored
-
 
281
     * @param array  $strValue filter out only needed values, if not set all values of the class are returned
-
 
282
     *
-
 
283
     * @return array content of the class stored in an array
-
 
284
     */
-
 
285
    public static function getWMI($wmi, $strClass, $strValue = array())
-
 
286
    {
-
 
287
        $arrData = array();
-
 
288
        if (gettype($wmi) === "object") {
-
 
289
            $value = "";
-
 
290
            try {
-
 
291
                $objWEBM = $wmi->Get($strClass);
-
 
292
                $arrProp = $objWEBM->Properties_;
-
 
293
                $arrWEBMCol = $objWEBM->Instances_();
-
 
294
                foreach ($arrWEBMCol as $objItem) {
-
 
295
                    if (is_array($arrProp)) {
-
 
296
                        reset($arrProp);
-
 
297
                    }
-
 
298
                    $arrInstance = array();
-
 
299
                    foreach ($arrProp as $propItem) {
-
 
300
                        $value = $objItem->{$propItem->Name}; //instead exploitable eval("\$value = \$objItem->".$propItem->Name.";");
-
 
301
                        if (empty($strValue)) {
-
 
302
                            if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
-
 
303
                            else $arrInstance[$propItem->Name] = $value;
-
 
304
                        } else {
-
 
305
                            if (in_array($propItem->Name, $strValue)) {
-
 
306
                                if (is_string($value)) $arrInstance[$propItem->Name] = trim($value);
-
 
307
                                else $arrInstance[$propItem->Name] = $value;
-
 
308
                            }
-
 
309
                        }
-
 
310
                    }
-
 
311
                    $arrData[] = $arrInstance;
-
 
312
                }
-
 
313
            } catch (Exception $e) {
-
 
314
                if (PSI_DEBUG && (($message = trim($e->getMessage())) !== "<b>Source:</b> SWbemServicesEx<br/><b>Description:</b> Not found")) {
-
 
315
                    $error = PSI_Error::singleton();
-
 
316
                    $error->addError("getWMI()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $message)));
-
 
317
                }
-
 
318
            }
-
 
319
        } elseif ((gettype($wmi) === "string") && (PSI_OS == 'Linux')) {
-
 
320
            $delimeter = '@@@DELIM@@@';
-
 
321
            if (CommonFunctions::executeProgram('wmic', '--delimiter="'.$delimeter.'" '.$wmi.' '.$strClass.'" 2>/dev/null', $strBuf, true) && preg_match("/^CLASS:\s/", $strBuf)) {
-
 
322
                if (self::$_cp) {
-
 
323
                    if (self::$_cp == 932) {
-
 
324
                        $codename = ' (SJIS)';
-
 
325
                    } elseif (self::$_cp == 949) {
-
 
326
                        $codename = ' (EUC-KR)';
-
 
327
                    } elseif (self::$_cp == 950) {
-
 
328
                        $codename = ' (BIG-5)';
-
 
329
                    } else {
-
 
330
                        $codename = '';
-
 
331
                    }
-
 
332
                    self::convertCP($strBuf, 'windows-'.self::$_cp.$codename);
-
 
333
                }
-
 
334
                $lines = preg_split('/\n/', $strBuf, -1, PREG_SPLIT_NO_EMPTY);
-
 
335
                if (count($lines) >=3) {
-
 
336
                    unset($lines[0]);
-
 
337
                    $names = preg_split('/'.$delimeter.'/', $lines[1], -1, PREG_SPLIT_NO_EMPTY);
-
 
338
                    $namesc = count($names);
-
 
339
                    unset($lines[1]);
-
 
340
                    foreach ($lines as $line) {
-
 
341
                        $arrInstance = array();
-
 
342
                        $values = preg_split('/'.$delimeter.'/', $line, -1);
-
 
343
                        if (count($values) == $namesc) {
-
 
344
                            foreach ($values as $id=>$value) {
-
 
345
                                if (empty($strValue)) {
-
 
346
                                    if ($value !== "(null)") $arrInstance[$names[$id]] = trim($value);
-
 
347
                                    else $arrInstance[$names[$id]] = null;
-
 
348
                                } else {
-
 
349
                                    if (in_array($names[$id], $strValue)) {
-
 
350
                                        if ($value !== "(null)") $arrInstance[$names[$id]] = trim($value);
-
 
351
                                        else $arrInstance[$names[$id]] = null;
-
 
352
                                    }
-
 
353
                                }
-
 
354
                            }
-
 
355
                            $arrData[] = $arrInstance;
-
 
356
                        }
-
 
357
                    }
-
 
358
                }
-
 
359
            }
-
 
360
        }
-
 
361
 
-
 
362
        return $arrData;
-
 
363
    }
-
 
364
 
-
 
365
    /**
-
 
366
     * readReg function
-
 
367
     *
-
 
368
     * @return boolean command successfull or not
-
 
369
     */
-
 
370
    public static function readReg($reg, $strName, &$strBuffer, $booErrorRep = true, $dword = false, $bits64 = false)
-
 
371
    {
-
 
372
        $strBuffer = '';
-
 
373
 
-
 
374
        if ($reg === false) {
-
 
375
            if (defined('PSI_EMU_HOSTNAME')) {
-
 
376
                return false;
-
 
377
            }
-
 
378
            $last = strrpos($strName, "\\");
-
 
379
            $keyname = substr($strName, $last + 1);
-
 
380
            if ($bits64) {
-
 
381
                $param = ' /reg:64';
-
 
382
            } else {
-
 
383
                $param = '';
-
 
384
            }
-
 
385
            if ($dword) {
-
 
386
                $valtype = "DWORD";
-
 
387
            } else {
-
 
388
                $valtype = "SZ|EXPAND_SZ";
-
 
389
            }
-
 
390
            if (self::$_cp) {
-
 
391
                if (CommonFunctions::executeProgram('cmd', '/c chcp '.self::$_cp.' >nul & reg query "'.substr($strName, 0, $last).'" /v '.$keyname.$param.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_(".$valtype.")\s+(.+)\s*$/mi", $strBuf, $buffer2)) {
-
 
392
                    if ($dword) {
-
 
393
                        $strBuffer = strval(hexdec($buffer2[2]));
-
 
394
                    } else {
-
 
395
                        $strBuffer = $buffer2[2];
-
 
396
                    }
-
 
397
                } else {
-
 
398
                    return false;
-
 
399
                }
-
 
400
            } else {
-
 
401
                if (CommonFunctions::executeProgram('reg', 'query "'.substr($strName, 0, $last).'" /v '.$keyname.$param.' 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match("/^\s*".$keyname."\s+REG_(".$valtype.")\s+(.+)\s*$/mi", $strBuf, $buffer2)) {
-
 
402
                    if ($dword) {
-
 
403
                        $strBuffer = strval(hexdec($buffer2[2]));
-
 
404
                    } else {
-
 
405
                        $strBuffer = $buffer2[2];
-
 
406
                    }
-
 
407
                } else {
-
 
408
                    return false;
-
 
409
                }
-
 
410
            }
-
 
411
        } elseif (gettype($reg) === "object") {
-
 
412
            $_hkey = array('HKEY_CLASSES_ROOT'=>0x80000000, 'HKEY_CURRENT_USER'=>0x80000001, 'HKEY_LOCAL_MACHINE'=>0x80000002, 'HKEY_USERS'=>0x80000003, 'HKEY_PERFORMANCE_DATA'=>0x80000004, 'HKEY_PERFORMANCE_TEXT'=>0x80000050, 'HKEY_PERFORMANCE_NLSTEXT'=>0x80000060, 'HKEY_CURRENT_CONFIG'=>0x80000005, 'HKEY_DYN_DATA'=>0x80000006);
-
 
413
            $first = strpos($strName, "\\");
-
 
414
            $last = strrpos($strName, "\\");
-
 
415
            $hkey = substr($strName, 0, $first);
-
 
416
            if (isset($_hkey[$hkey])) {
-
 
417
                $sub_keys = new VARIANT();
-
 
418
                try {
-
 
419
                    if ($dword) {
-
 
420
                        $reg->Get("StdRegProv")->GetDWORDValue(strval($_hkey[$hkey]), substr($strName, $first+1, $last-$first-1), substr($strName, $last+1), $sub_keys);
-
 
421
                    } else {
-
 
422
                        $reg->Get("StdRegProv")->GetStringValue(strval($_hkey[$hkey]), substr($strName, $first+1, $last-$first-1), substr($strName, $last+1), $sub_keys);
-
 
423
                    }
-
 
424
                } catch (Exception $e) {
-
 
425
                    if ($booErrorRep) {
-
 
426
                        $error = PSI_Error::singleton();
-
 
427
                        $error->addError("GetStringValue()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage())));
-
 
428
                    }
-
 
429
 
-
 
430
                    return false;
-
 
431
                }
-
 
432
                if (variant_get_type($sub_keys) !== VT_NULL) {
-
 
433
                    $strBuffer = strval($sub_keys);
-
 
434
                } else {
-
 
435
                    return false;
-
 
436
                }
-
 
437
            } else {
-
 
438
                return false;
-
 
439
            }
-
 
440
        }
-
 
441
 
-
 
442
        return true;
-
 
443
    }
-
 
444
 
-
 
445
    /**
-
 
446
     * enumKey function
-
 
447
     *
-
 
448
     * @return boolean command successfull or not
-
 
449
     */
-
 
450
    public static function enumKey($reg, $strName, &$arrBuffer, $booErrorRep = true)
-
 
451
    {
-
 
452
        $arrBuffer = array();
-
 
453
 
-
 
454
        if ($reg === false) {
-
 
455
            if (defined('PSI_EMU_HOSTNAME')) {
-
 
456
                return false;
-
 
457
            }
-
 
458
            if (self::$_cp) {
-
 
459
                if (CommonFunctions::executeProgram('cmd', '/c chcp '.self::$_cp.' >nul & reg query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) {
-
 
460
                    foreach ($buffer2[1] as $sub_key) {
-
 
461
                        $arrBuffer[] = trim($sub_key);
-
 
462
                    }
-
 
463
                } else {
-
 
464
                    return false;
-
 
465
                }
-
 
466
            } else {
-
 
467
                if (CommonFunctions::executeProgram('reg', 'query "'.$strName.'" 2>&1', $strBuf, $booErrorRep) && (strlen($strBuf) > 0) && preg_match_all("/^".preg_replace("/\\\\/", "\\\\\\\\", $strName)."\\\\(.*)/mi", $strBuf, $buffer2)) {
-
 
468
                    foreach ($buffer2[1] as $sub_key) {
-
 
469
                        $arrBuffer[] = trim($sub_key);
-
 
470
                    }
-
 
471
                } else {
-
 
472
                    return false;
-
 
473
                }
-
 
474
            }
-
 
475
        } elseif (gettype($reg) === "object") {
-
 
476
            $_hkey = array('HKEY_CLASSES_ROOT'=>0x80000000, 'HKEY_CURRENT_USER'=>0x80000001, 'HKEY_LOCAL_MACHINE'=>0x80000002, 'HKEY_USERS'=>0x80000003, 'HKEY_PERFORMANCE_DATA'=>0x80000004, 'HKEY_PERFORMANCE_TEXT'=>0x80000050, 'HKEY_PERFORMANCE_NLSTEXT'=>0x80000060, 'HKEY_CURRENT_CONFIG'=>0x80000005, 'HKEY_DYN_DATA'=>0x80000006);
-
 
477
            $first = strpos($strName, "\\");
-
 
478
            $hkey = substr($strName, 0, $first);
-
 
479
            if (isset($_hkey[$hkey])) {
-
 
480
                $sub_keys = new VARIANT();
-
 
481
                try {
-
 
482
                   $reg->Get("StdRegProv")->EnumKey(strval($_hkey[$hkey]), substr($strName, $first+1), $sub_keys);
-
 
483
                } catch (Exception $e) {
-
 
484
                    if ($booErrorRep) {
-
 
485
                        $error = PSI_Error::singleton();
-
 
486
                        $error->addError("enumKey()", preg_replace('/<br\/>/', "\n", preg_replace('/<b>|<\/b>/', '', $e->getMessage())));;
-
 
487
                    }
-
 
488
 
-
 
489
                    return false;
-
 
490
                }
-
 
491
                if (variant_get_type($sub_keys) !== VT_NULL) {
-
 
492
                    foreach ($sub_keys as $sub_key) {
-
 
493
                        $arrBuffer[] = $sub_key;
-
 
494
                    }
-
 
495
                } else {
-
 
496
                    return false;
-
 
497
                }
-
 
498
            } else {
-
 
499
                return false;
-
 
500
            }
-
 
501
        }
-
 
502
 
-
 
503
        return true;
-
 
504
    }
-
 
505
 
-
 
506
    /**
-
 
507
     * initWMI function
-
 
508
     *
-
 
509
     * @return string, object or false
-
 
510
     */
-
 
511
    public static function initWMI($namespace, $booErrorRep = false)
-
 
512
    {
-
 
513
        $wmi = false;
-
 
514
        if (self::$_wmi !== false) { // WMI not disabled
-
 
515
            try {
-
 
516
                if (PSI_OS == 'Linux') {
-
 
517
                    if (defined('PSI_EMU_HOSTNAME'))
-
 
518
                        $wmi = '--namespace="'.$namespace.'" -U '.PSI_EMU_USER.'%'.PSI_EMU_PASSWORD.' //'.PSI_EMU_HOSTNAME.' "select * from';
-
 
519
                } elseif (PSI_OS == 'WINNT') {
-
 
520
                    $objLocator = new COM('WbemScripting.SWbemLocator');
-
 
521
                    if (defined('PSI_EMU_HOSTNAME'))
-
 
522
                        $wmi = $objLocator->ConnectServer(PSI_EMU_HOSTNAME, $namespace, PSI_EMU_USER, PSI_EMU_PASSWORD);
-
 
523
                    else
-
 
524
                        $wmi = $objLocator->ConnectServer('', $namespace);
-
 
525
                }
-
 
526
            } catch (Exception $e) {
-
 
527
                if ($booErrorRep) {
-
 
528
                    $error = PSI_Error::singleton();
-
 
529
                    $error->addError("WMI connect ".$namespace." error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed or credentials.");
-
 
530
                }
-
 
531
            }
-
 
532
        }
-
 
533
 
-
 
534
        return $wmi;
-
 
535
    }
-
 
536
 
-
 
537
    /**
-
 
538
     * convertCP function
-
 
539
     *
-
 
540
     * @return void
-
 
541
     */
-
 
542
    public static function convertCP(&$strBuf, $encoding)
-
 
543
    {
-
 
544
        if (defined('PSI_SYSTEM_CODEPAGE') && (PSI_SYSTEM_CODEPAGE != null) && ($encoding != null) && ($encoding != PSI_SYSTEM_CODEPAGE)) {
-
 
545
            $systemcp = PSI_SYSTEM_CODEPAGE;
-
 
546
            if (preg_match("/^windows-\d+ \((.+)\)$/", $systemcp, $buf)) {
-
 
547
                $systemcp = $buf[1];
-
 
548
            }
-
 
549
            if (preg_match("/^windows-\d+ \((.+)\)$/", $encoding, $buf)) {
-
 
550
                $encoding = $buf[1];
-
 
551
            }
-
 
552
            $enclist = mb_list_encodings();
-
 
553
            if (in_array($encoding, $enclist) && in_array($systemcp, $enclist)) {
-
 
554
                $strBuf = mb_convert_encoding($strBuf, $encoding, $systemcp);
-
 
555
            } elseif (function_exists("iconv")) {
-
 
556
                if (($iconvout=iconv($systemcp, $encoding.'//IGNORE', $strBuf))!==false) {
-
 
557
                    $strBuf = $iconvout;
-
 
558
                }
-
 
559
            } elseif (function_exists("libiconv") && (($iconvout=libiconv($systemcp, $encoding, $strBuf))!==false)) {
-
 
560
                $strBuf = $iconvout;
-
 
561
            }
-
 
562
        }
-
 
563
    }
-
 
564
 
-
 
565
    /**
186
     * build the global Error object and create the WMI connection
566
     * build the global Error object and create the WMI connection
187
     */
567
     */
188
    public function __construct($blockname = false)
568
    public function __construct($blockname = false)
189
    {
569
    {
190
        parent::__construct($blockname);
570
        parent::__construct($blockname);
191
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('cmd', '/c ver 2>nul', $ver_value, false) && (($ver_value = trim($ver_value)) !== "")) {
571
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('cmd', '/c ver 2>nul', $ver_value, false) && (($ver_value = trim($ver_value)) !== "")) {
192
            $this->_ver = $ver_value;
572
            $this->_ver = $ver_value;
193
        }
573
        }
194
        if (($this->_ver !== "") && preg_match("/ReactOS\r?\n\S+\s+.+/", $this->_ver)) {
574
        if (($this->_ver !== "") && preg_match("/ReactOS\r?\n\S+\s+.+/", $this->_ver)) {
195
            $this->_wmi = false; // No WMI info on ReactOS yet
575
            self::$_wmi = false; // No WMI info on ReactOS yet
196
            $this->_reg = false; // No EnumKey and ReadReg on ReactOS yet
576
            $this->_reg = false; // No EnumKey and ReadReg on ReactOS yet
197
        } else {
577
        } else {
198
            if (PSI_OS == 'WINNT') {
578
            if (PSI_OS == 'WINNT') {
199
                if (defined('PSI_EMU_HOSTNAME')) {
579
                if (defined('PSI_EMU_HOSTNAME')) {
200
                    try {
580
                    try {
201
                        $objLocator = new COM('WbemScripting.SWbemLocator');
581
                        $objLocator = new COM('WbemScripting.SWbemLocator');
202
                        $wmi = $objLocator->ConnectServer('', 'root\CIMv2');
582
                        $wmi = $objLocator->ConnectServer('', 'root\CIMv2');
203
                        $buffer = CommonFunctions::getWMI($wmi, 'Win32_OperatingSystem', array('CodeSet'));
583
                        $buffer = self::getWMI($wmi, 'Win32_OperatingSystem', array('CodeSet'));
204
                        if (!$buffer) {
584
                        if (!$buffer) {
205
                            $reg = $objLocator->ConnectServer('', 'root\default');
585
                            $reg = $objLocator->ConnectServer('', 'root\default');
206
                            if (CommonFunctions::readReg($reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
586
                            if (self::readReg($reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
207
                                $buffer[0]['CodeSet'] = $strBuf;
587
                                $buffer[0]['CodeSet'] = $strBuf;
208
                            }
588
                            }
209
                        }
589
                        }
210
                        if ($buffer && isset($buffer[0])) {
-
 
211
                            if (isset($buffer[0]['CodeSet'])) {
590
                        if ($buffer && isset($buffer[0]) && isset($buffer[0]['CodeSet'])) {
212
                                $codeset = $buffer[0]['CodeSet'];
591
                            $codeset = $buffer[0]['CodeSet'];
213
                                if ($codeset == 932) {
592
                            if ($codeset == 932) {
214
                                    $codename = ' (SJIS)';
593
                                 $codename = ' (SJIS)';
215
                                } elseif ($codeset == 949) {
594
                            } elseif ($codeset == 949) {
216
                                    $codename = ' (EUC-KR)';
595
                                 $codename = ' (EUC-KR)';
217
                                } elseif ($codeset == 950) {
596
                            } elseif ($codeset == 950) {
218
                                    $codename = ' (BIG-5)';
597
                                $codename = ' (BIG-5)';
219
                                } else {
598
                            } else {
220
                                    $codename = '';
599
                                $codename = '';
221
                                }
600
                            }
222
                                define('PSI_SYSTEM_CODEPAGE', 'windows-'.$codeset.$codename);
601
                            define('PSI_SYSTEM_CODEPAGE', 'windows-'.$codeset.$codename);
-
 
602
                        } else {
-
 
603
                            define('PSI_SYSTEM_CODEPAGE', null);
-
 
604
                            if (PSI_DEBUG) {
-
 
605
                                $this->error->addError("__construct()", "PhpSysInfo can not detect PSI_SYSTEM_CODEPAGE");
223
                            }
606
                            }
224
                        }
607
                        }
225
                    } catch (Exception $e) {
608
                    } catch (Exception $e) {
226
                        define('PSI_SYSTEM_CODEPAGE', null);
609
                        define('PSI_SYSTEM_CODEPAGE', null);
227
                        if (PSI_DEBUG) {
610
                        if (PSI_DEBUG) {
Line 230... Line 613...
230
                    }
613
                    }
231
                } else {
614
                } else {
232
                    define('PSI_SYSTEM_CODEPAGE', null);
615
                    define('PSI_SYSTEM_CODEPAGE', null);
233
                }
616
                }
234
            }
617
            }
235
            $this->_wmi = CommonFunctions::initWMI('root\CIMv2', true);
618
            self::$_wmi = self::initWMI('root\CIMv2', true);
236
            if (PSI_OS == 'WINNT') {
619
            if (PSI_OS == 'WINNT') {
237
                $this->_reg = CommonFunctions::initWMI('root\default', PSI_DEBUG);
620
                $this->_reg = self::initWMI('root\default', PSI_DEBUG);
238
                if (gettype($this->_reg) === "object") {
621
                if (gettype($this->_reg) === "object") {
239
                    $this->_reg->Security_->ImpersonationLevel = 3;
622
                    $this->_reg->Security_->ImpersonationLevel = 3;
240
                }
623
                }
241
            } else {
624
            } else {
242
                $this->_reg = false; // No EnumKey and ReadReg on Linux
625
                $this->_reg = false; // No EnumKey and ReadReg on Linux
Line 253... Line 636...
253
     */
636
     */
254
    private function _getCodeSet()
637
    private function _getCodeSet()
255
    {
638
    {
256
        $buffer = $this->_get_Win32_OperatingSystem();
639
        $buffer = $this->_get_Win32_OperatingSystem();
257
        if (!$buffer) {
640
        if (!$buffer) {
258
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
641
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
259
                $buffer[0]['CodeSet'] = $strBuf;
642
                $buffer[0]['CodeSet'] = $strBuf;
260
            }
643
            }
261
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language\\Default", $strBuf, false)) {
644
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language\\Default", $strBuf, false)) {
262
                $buffer[0]['Locale'] = $strBuf;
645
                $buffer[0]['Locale'] = $strBuf;
263
            }
646
            }
264
        }
647
        }
265
        if ($buffer && isset($buffer[0])) {
648
        if ($buffer && isset($buffer[0])) {
266
            if (isset($buffer[0]['CodeSet'])) {
649
            if (isset($buffer[0]['CodeSet'])) {
Line 272... Line 655...
272
                } elseif ($codeset == 950) {
655
                } elseif ($codeset == 950) {
273
                    $codename = ' (BIG-5)';
656
                    $codename = ' (BIG-5)';
274
                } else {
657
                } else {
275
                    $codename = '';
658
                    $codename = '';
276
                }
659
                }
277
                CommonFunctions::setcp($codeset);
660
                self::$_cp = $codeset;
278
                $this->_codepage = 'windows-'.$codeset.$codename;
661
                $this->_codepage = 'windows-'.$codeset.$codename;
279
            }
662
            }
280
            if (isset($buffer[0]['Locale']) && (($locale = hexdec($buffer[0]['Locale']))>0)) {
663
            if (isset($buffer[0]['Locale']) && (($locale = hexdec($buffer[0]['Locale']))>0)) {
281
                $lang = "";
664
                $lang = "";
282
                if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
665
                if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
Line 299... Line 682...
299
     *
682
     *
300
     * @return array list of devices of the specified type
683
     * @return array list of devices of the specified type
301
     */
684
     */
302
    private function _devicelist($strType)
685
    private function _devicelist($strType)
303
    {
686
    {
304
        if (empty($this->_wmidevices)) {
687
        if ($this->_wmidevices === null) {
-
 
688
            $this->_wmidevices = array();
305
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
689
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
306
                $this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID', 'Manufacturer', 'PNPClass'));
690
                $this->_wmidevices = self::getWMI(self::$_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID', 'Manufacturer', 'PNPClass'));
307
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
691
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
308
                    $this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size', 'SerialNumber'));
692
                    $this->_wmidisks = self::getWMI(self::$_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size', 'SerialNumber'));
309
                } else {
693
                } else {
310
                    $this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size'));
694
                    $this->_wmidisks = self::getWMI(self::$_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size'));
311
                }
695
                }
312
            } else {
696
            } else {
313
                $this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID'));
697
                $this->_wmidevices = self::getWMI(self::$_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID'));
314
            }
698
            }
315
 
699
 
316
            if (empty($this->_wmidevices)) {
700
            if (empty($this->_wmidevices)) {
-
 
701
                $lstdevs = array();
-
 
702
                $services = array();
-
 
703
                foreach (array('PCI', 'USB') as $type) {
-
 
704
                    $hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\".$type;
-
 
705
                    if (self::enumKey($this->_reg, $hkey, $vendevs, false)) {
-
 
706
                        foreach ($vendevs as $vendev) if (self::enumKey($this->_reg, $hkey."\\".$vendev, $ids, false)) {
-
 
707
                            foreach ($ids as $id) {
-
 
708
                                if ($type === 'PCI') { // enumerate all PCI devices
-
 
709
                                    $lstdevs[$type."\\".$vendev."\\".$id] = true;
-
 
710
                                } elseif (self::readReg($this->_reg, $hkey."\\".$vendev."\\".$id."\\Service", $service, false)) {
-
 
711
                                    $services[$service] = true; // ever used USB services
-
 
712
                                    break;
-
 
713
                                }
-
 
714
                            }
-
 
715
                        }
-
 
716
                    }
-
 
717
                }
-
 
718
 
-
 
719
                $hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services";
-
 
720
                foreach ($services as $service=>$tmp) if (self::readReg($this->_reg, $hkey."\\".$service."\\Enum\\Count", $count, false, true) && ($count > 0)) {
-
 
721
                    for ($i = 0; $i < $count; $i++) if (self::readReg($this->_reg, $hkey."\\".$service."\\Enum\\".$i, $id, false) && preg_match("/^USB/", $id)) {
-
 
722
                        $lstdevs[$id] = true; // used USB devices
-
 
723
                    }
-
 
724
                }
-
 
725
 
-
 
726
                $hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\";
-
 
727
                foreach ($lstdevs as $lstdev=>$tmp) {
-
 
728
                    if (self::readReg($this->_reg, $hkey.$lstdev."\\DeviceDesc", $nameBuf, false)) {
-
 
729
                        $namesplit = preg_split('/;/', $nameBuf, -1, PREG_SPLIT_NO_EMPTY);
-
 
730
                        if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && self::readReg($this->_reg, $hkey.$lstdev."\\Mfg", $mfgBuf, false)) {
-
 
731
                            $mfgsplit = preg_split('/;/', $mfgBuf, -1, PREG_SPLIT_NO_EMPTY);
-
 
732
                            $this->_wmidevices[] = array('Name'=>$namesplit[count($namesplit)-1], 'PNPDeviceID'=>$lstdev, 'Manufacturer'=>$mfgsplit[count($mfgsplit)-1]);
-
 
733
                        } else {
-
 
734
                            $this->_wmidevices[] = array('Name'=>$namesplit[count($namesplit)-1], 'PNPDeviceID'=>$lstdev);
-
 
735
                        }
-
 
736
                    }
-
 
737
                }
-
 
738
 
317
                $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\Scsi";
739
                $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\Scsi";
318
                $id = 0;
740
                $id = 0;
319
                if (CommonFunctions::enumKey($this->_reg, $hkey, $portBuf, false)) {
741
                if (self::enumKey($this->_reg, $hkey, $portBuf, false)) {
320
                    foreach ($portBuf as $scsiport) {
742
                    foreach ($portBuf as $scsiport) {
321
                        if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport, $busBuf, false)) {
743
                        if (self::enumKey($this->_reg, $hkey."\\".$scsiport, $busBuf, false)) {
322
                            foreach ($busBuf as $scsibus) {
744
                            foreach ($busBuf as $scsibus) {
323
                                if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus, $tarBuf, false)) {
745
                                if (self::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus, $tarBuf, false)) {
324
                                    foreach ($tarBuf as $scsitar) if (!strncasecmp($scsitar, "Target Id ", strlen("Target Id "))) {
746
                                    foreach ($tarBuf as $scsitar) if (!strncasecmp($scsitar, "Target Id ", strlen("Target Id "))) {
325
                                        if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar, $logBuf, false)) {
747
                                        if (self::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar, $logBuf, false)) {
326
                                            foreach ($logBuf as $scsilog) if (!strncasecmp($scsilog, "Logical Unit Id ", strlen("Logical Unit Id "))) {
748
                                            foreach ($logBuf as $scsilog) if (!strncasecmp($scsilog, "Logical Unit Id ", strlen("Logical Unit Id "))) {
327
                                               $hkey2 = $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar."\\".$scsilog."\\";
749
                                               $hkey2 = $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar."\\".$scsilog."\\";
328
                                               if ((CommonFunctions::readReg($this->_reg, $hkey2."DeviceType", $typeBuf, false) || CommonFunctions::readReg($this->_reg, $hkey2."Type", $typeBuf, false))
750
                                               if ((self::readReg($this->_reg, $hkey2."DeviceType", $typeBuf, false) || self::readReg($this->_reg, $hkey2."Type", $typeBuf, false))
329
                                                  && (($typeBuf=strtolower(trim($typeBuf))) !== "")) {
751
                                                  && (($typeBuf=strtolower(trim($typeBuf))) !== "")) {
330
                                                  if ((($typeBuf == 'diskperipheral') || ($typeBuf == 'cdromperipheral'))
752
                                                  if ((($typeBuf == 'diskperipheral') || ($typeBuf == 'cdromperipheral'))
331
                                                     && CommonFunctions::readReg($this->_reg, $hkey2."Identifier", $ideBuf, false)) {
753
                                                     && self::readReg($this->_reg, $hkey2."Identifier", $ideBuf, false)) {
332
                                                      $this->_wmidevices[] = array('Name'=>$ideBuf, 'PNPDeviceID'=>'SCSI\\'.$id);
754
                                                      $this->_wmidevices[] = array('Name'=>$ideBuf, 'PNPDeviceID'=>'SCSI\\'.$id);
333
                                                      if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL
755
                                                      if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL
334
                                                         && (CommonFunctions::readReg($this->_reg, $hkey2."SerialNumber", $serBuf, false))
756
                                                         && self::readReg($this->_reg, $hkey2."SerialNumber", $serBuf, false)
335
                                                         && (($serBuf=trim($serBuf)) !== "")) {
757
                                                         && (($serBuf=trim($serBuf)) !== "")) {
336
                                                          $this->_wmidisks[] = array('PNPDeviceID'=>'SCSI\\'.$id, 'SerialNumber'=>$serBuf);
758
                                                          $this->_wmidisks[] = array('PNPDeviceID'=>'SCSI\\'.$id, 'SerialNumber'=>$serBuf);
337
                                                      }
759
                                                      }
338
                                                      $id++;
760
                                                      $id++;
339
                                                  }
761
                                                  }
Line 369... Line 791...
369
                        }
791
                        }
370
                    }
792
                    }
371
                    $device['Serial'] = null;
793
                    $device['Serial'] = null;
372
                    if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
794
                    if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
373
                        if ($strType==='USB') {
795
                        if ($strType==='USB') {
-
 
796
//                            if (preg_match('/\\\\([^\\\\][^&\\\\][^\\\\]+)$/', $device['PNPDeviceID'], $buf)) { // second character !== &
374
                            if (preg_match('/\\\\(\w+)$/', $device['PNPDeviceID'], $buf)) {
797
                            if (preg_match('/\\\\(\w+)$/', $device['PNPDeviceID'], $buf)) {
375
                                $device['Serial'] = $buf[1];
798
                                $device['Serial'] = $buf[1];
376
                            }
799
                            }
377
                        } elseif (($strType==='IDE')||($strType==='SCSI')) {
800
                        } elseif (($strType==='IDE')||($strType==='SCSI')) {
378
                            foreach ($this->_wmidisks as $disk) {
801
                            foreach ($this->_wmidisks as $disk) {
Line 398... Line 821...
398
     *
821
     *
399
     * @return void
822
     * @return void
400
     */
823
     */
401
    private function _hostname()
824
    private function _hostname()
402
    {
825
    {
403
        if ((PSI_USE_VHOST === true) && !defined('PSI_EMU_HOSTNAME')) {
826
        if (PSI_USE_VHOST && !defined('PSI_EMU_HOSTNAME')) {
404
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
827
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
405
        } else {
828
        } else {
406
            $buffer = $this->_get_Win32_ComputerSystem();
829
            $buffer = $this->_get_Win32_ComputerSystem();
407
            if (!$buffer && CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName\\ComputerName", $strBuf, false) && (strlen($strBuf) > 0)) {
830
            if (!$buffer && self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName\\ComputerName", $strBuf, false) && (strlen($strBuf) > 0)) {
408
                    $buffer[0]['Name'] = $strBuf;
831
                    $buffer[0]['Name'] = $strBuf;
409
            }
832
            }
410
            if ($buffer) {
833
            if ($buffer) {
411
                $result = $buffer[0]['Name'];
834
                $result = $buffer[0]['Name'];
412
                $ip = gethostbyname($result);
835
                $ip = gethostbyname($result);
Line 435... Line 858...
435
            }
858
            }
436
        }
859
        }
437
    }
860
    }
438
 
861
 
439
    /**
862
    /**
-
 
863
     * Virtualizer info
-
 
864
     *
-
 
865
     * @return void
-
 
866
     */
-
 
867
    protected function _virtualizer()
-
 
868
    {
-
 
869
        if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO) {
-
 
870
            $cpuvirt = $this->sys->getVirtualizer(); // previous info from _cpuinfo()
-
 
871
 
-
 
872
            $vendor_array = array();
-
 
873
            if ($this->_Model != "") {
-
 
874
                $vendor_array[] = $this->_Model;
-
 
875
            }
-
 
876
            if ($this->_Manufacturer != "") {
-
 
877
                if ($this->_Model != "") {
-
 
878
                    $vendor_array[] = $this->_Manufacturer." ".$this->_Model;
-
 
879
                } else {
-
 
880
                    $vendor_array[] = $this->_Manufacturer;
-
 
881
                }
-
 
882
            }
-
 
883
            $novm = true;
-
 
884
            if (count($vendor_array)>0) {
-
 
885
                $virt = CommonFunctions::decodevirtualizer($vendor_array);
-
 
886
                if ($virt !== null) {
-
 
887
                    $this->sys->setVirtualizer($virt);
-
 
888
                    $novm = false;
-
 
889
                }
-
 
890
            }
-
 
891
            if ($novm) {
-
 
892
                // Detect QEMU cpu
-
 
893
                if (isset($cpuvirt["cpuid:QEMU"])) {
-
 
894
                    $this->sys->setVirtualizer('qemu'); // QEMU
-
 
895
                }
-
 
896
            }
-
 
897
        }
-
 
898
    }
-
 
899
 
-
 
900
    /**
440
     * UpTime
901
     * UpTime
441
     * time the system is running
902
     * time the system is running
442
     *
903
     *
443
     * @return void
904
     * @return void
444
     */
905
     */
Line 475... Line 936...
475
            $boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear) - $boffset*60;
936
            $boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear) - $boffset*60;
476
 
937
 
477
            $result = $localtime - $boottime;
938
            $result = $localtime - $boottime;
478
 
939
 
479
            $this->sys->setUptime($result);
940
            $this->sys->setUptime($result);
480
        } elseif (($this->sys->getDistribution()=="ReactOS") && CommonFunctions::executeProgram('uptime', '', $strBuf, false) && (strlen($strBuf) > 0) && preg_match("/^System Up Time:\s+(\d+) days, (\d+) Hours, (\d+) Minutes, (\d+) Seconds/", $strBuf, $ar_buf)) {
941
        } elseif (!defined('PSI_EMU_HOSTNAME') && (substr($this->sys->getDistribution(), 0, 7)=="ReactOS") && CommonFunctions::executeProgram('uptime', '', $strBuf, false) && (strlen($strBuf) > 0) && preg_match("/^System Up Time:\s+(\d+) days, (\d+) Hours, (\d+) Minutes, (\d+) Seconds/", $strBuf, $ar_buf)) {
481
            $sec = $ar_buf[4];
942
            $sec = $ar_buf[4];
482
            $min = $ar_buf[3];
943
            $min = $ar_buf[3];
483
            $hours = $ar_buf[2];
944
            $hours = $ar_buf[2];
484
            $days = $ar_buf[1];
945
            $days = $ar_buf[1];
485
            $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60 + $sec);
946
            $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60 + $sec);
Line 496... Line 957...
496
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) {
957
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) {
497
                $lines = preg_split('/\n/', $strBuf);
958
                $lines = preg_split('/\n/', $strBuf);
498
                $users = count($lines)-1;
959
                $users = count($lines)-1;
499
        } else {
960
        } else {
500
            $users = 0;
961
            $users = 0;
501
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
962
            $buffer = self::getWMI(self::$_wmi, 'Win32_Process', array('Caption'));
502
            foreach ($buffer as $process) {
963
            foreach ($buffer as $process) {
503
                if (strtoupper($process['Caption']) == strtoupper('explorer.exe')) {
964
                if (strtoupper($process['Caption']) == strtoupper('explorer.exe')) {
504
                    $users++;
965
                    $users++;
505
                }
966
                }
506
            }
967
            }
Line 516... Line 977...
516
    private function _distro()
977
    private function _distro()
517
    {
978
    {
518
        $buffer = $this->_get_Win32_OperatingSystem();
979
        $buffer = $this->_get_Win32_OperatingSystem();
519
        if ($buffer) {
980
        if ($buffer) {
520
            $ver = $buffer[0]['Version'];
981
            $ver = $buffer[0]['Version'];
-
 
982
            if (($this->_ver !== "") && preg_match("/^Microsoft [^\[]*\s*\[\D*\s*(".$ver."\.\d+).*\]/", $this->_ver, $ar_temp)) {
-
 
983
                $kernel = $ar_temp[1];
-
 
984
            } else {
521
            $kernel = $ver;
985
                $kernel = $ver;
-
 
986
            }
522
            if ($buffer[0]['ServicePackMajorVersion'] > 0) {
987
            if ($buffer[0]['ServicePackMajorVersion'] > 0) {
523
                $kernel .= ' SP'.$buffer[0]['ServicePackMajorVersion'];
988
                $kernel .= ' SP'.$buffer[0]['ServicePackMajorVersion'];
524
            }
989
            }
-
 
990
            if ($allCpus = $this->_get_Win32_Processor()) {
-
 
991
                $addresswidth = 0;
525
            if (isset($buffer[0]['OSArchitecture']) && preg_match("/^(\d+)/", $buffer[0]['OSArchitecture'], $bits)) {
992
                if (isset($allCpus[0]['AddressWidth']) && (($addresswidth = $allCpus[0]['AddressWidth']) > 0)) {
526
                $this->sys->setKernel($kernel.' ('.$bits[1].'-bit)');
993
                    $kernel .= ' ('.$addresswidth.'-bit)';
-
 
994
                }
527
            } elseif (($allCpus = $this->_get_Win32_Processor()) && isset($allCpus[0]['AddressWidth'])) {
995
                if (isset($allCpus[0]['Architecture'])) {
528
                $this->sys->setKernel($kernel.' ('.$allCpus[0]['AddressWidth'].'-bit)');
996
                    switch ($allCpus[0]['Architecture']) {
-
 
997
                    case 0: $kernel .= ' x86'; break;
-
 
998
                    case 1: $kernel .= ' MIPS'; break;
-
 
999
                    case 2: $kernel .= ' Alpha'; break;
-
 
1000
                    case 3: $kernel .= ' PowerPC'; break;
-
 
1001
                    case 5: $kernel .= ' ARM'; break;
-
 
1002
                    case 6: $kernel .= ' ia64'; break;
-
 
1003
                    case 9: if ($addresswidth == 32) {
-
 
1004
                                $kernel .= ' x86';
529
            } else {
1005
                            } else {
530
                $this->sys->setKernel($kernel);
1006
                                $kernel .= ' x64';
-
 
1007
                            }
-
 
1008
                            break;
-
 
1009
                    case 12: if ($addresswidth == 32) {
-
 
1010
                                 $kernel .= ' ARM';
-
 
1011
                             } else {
-
 
1012
                                 $kernel .= ' ARM64';
-
 
1013
                             }
-
 
1014
                    }
-
 
1015
                }
531
            }
1016
            }
-
 
1017
            $this->sys->setKernel($kernel);
-
 
1018
            $distribution = $buffer[0]['Caption'];
-
 
1019
            if (version_compare($ver, "10.0", ">=") && !preg_match('/server/i', $buffer[0]['Caption']) && ($list = @parse_ini_file(PSI_APP_ROOT."/data/osnames.ini", true))) {
-
 
1020
                $karray = preg_split('/\./', $ver);
-
 
1021
                if (isset($karray[2]) && isset($list['win10'][$karray[2]])) {
-
 
1022
                    $distribution .= ' ('.$list['win10'][$karray[2]].')';
-
 
1023
                }
-
 
1024
            }
532
            $this->sys->setDistribution($buffer[0]['Caption']);
1025
            $this->sys->setDistribution($distribution);
533
 
-
 
534
            if (version_compare($ver, "5.1", "<"))
1026
            if (version_compare($ver, "5.1", "<"))
535
                $icon = 'Win2000.png';
1027
                $icon = 'Win2000.png';
536
            elseif (version_compare($ver, "5.1", ">=") && version_compare($ver, "6.0", "<"))
1028
            elseif (version_compare($ver, "5.1", ">=") && version_compare($ver, "6.0", "<"))
537
                $icon = 'WinXP.png';
1029
                $icon = 'WinXP.png';
538
            elseif (version_compare($ver, "6.0", ">=") && version_compare($ver, "6.2", "<"))
1030
            elseif (version_compare($ver, "6.0", ">=") && version_compare($ver, "6.2", "<"))
539
                $icon = 'WinVista.png';
1031
                $icon = 'WinVista.png';
540
            else
1032
            elseif (version_compare($ver, "6.2", ">=") && version_compare($ver, "10.0.21996", "<"))
541
                $icon = 'Win8.png';
1033
                $icon = 'Win8.png';
-
 
1034
            else
-
 
1035
                $icon = 'Win11.png';
542
            $this->sys->setDistributionIcon($icon);
1036
            $this->sys->setDistributionIcon($icon);
543
        } elseif ($this->_ver !== "") {
1037
        } elseif ($this->_ver !== "") {
544
                if (preg_match("/ReactOS\r?\n\S+\s+(.+)/", $this->_ver, $ar_temp)) {
1038
                if (preg_match("/ReactOS\r?\n\S+\s+(.+)/", $this->_ver, $ar_temp)) {
545
                    if (preg_match("/^(\d+\.\d+\.\d+[\S]*)(.+)$/", trim($ar_temp[1]), $ver_temp)) {
1039
                    if (preg_match("/^(\d+\.\d+\.\d+[\S]*)(.+)$/", trim($ar_temp[1]), $ver_temp)) {
546
                        $this->sys->setDistribution("ReactOS ".trim($ver_temp[1]));
1040
                        $this->sys->setDistribution("ReactOS ".trim($ver_temp[1]));
Line 548... Line 1042...
548
                    } else {
1042
                    } else {
549
                        $this->sys->setDistribution("ReactOS");
1043
                        $this->sys->setDistribution("ReactOS");
550
                        $this->sys->setKernel($ar_temp[1]);
1044
                        $this->sys->setKernel($ar_temp[1]);
551
                    }
1045
                    }
552
                    $this->sys->setDistributionIcon('ReactOS.png');
1046
                    $this->sys->setDistributionIcon('ReactOS.png');
553
                } elseif (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*(.+)\]/", $this->_ver, $ar_temp)) {
1047
                } elseif (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*([\.\d]+)\]/", $this->_ver, $ar_temp)) {
-
 
1048
                    $ver = $ar_temp[2];
-
 
1049
                    $kernel = $ver;
-
 
1050
                    if (($this->_reg === false) && self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $strBuf, false, false, true) && (strlen($strBuf) > 0)) { // only if reg query via cmd
-
 
1051
                        if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $tmpBuf, false)) {
-
 
1052
                            $kernel .= ' (64-bit)';
-
 
1053
                        }
-
 
1054
                        if (preg_match("/^Microsoft /", $strBuf)) {
-
 
1055
                            $distribution = $strBuf;
-
 
1056
                        } else {
-
 
1057
                            $distribution = "Microsoft ".$strBuf;
-
 
1058
                        }
554
                    if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $strBuf, false) && (strlen($strBuf) > 0)) {
1059
                    } elseif (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $strBuf, false) && (strlen($strBuf) > 0)) {
555
                        if (preg_match("/^Microsoft /", $strBuf)) {
1060
                        if (preg_match("/^Microsoft /", $strBuf)) {
556
                            $this->sys->setDistribution($strBuf);
1061
                            $distribution = $strBuf;
557
                        } else {
1062
                        } else {
558
                            $this->sys->setDistribution("Microsoft ".$strBuf);
1063
                            $distribution = "Microsoft ".$strBuf;
559
                        }
1064
                        }
560
                    } else {
1065
                    } else {
561
                        $this->sys->setDistribution($ar_temp[1]);
1066
                        $distribution = $ar_temp[1];
562
                    }
1067
                    }
563
                    $kernel = $ar_temp[2];
-
 
564
                    $this->sys->setKernel($kernel);
1068
                    $this->sys->setKernel($kernel);
-
 
1069
                    if (version_compare($ver, "10.0", ">=") && !preg_match('/server/i', $this->sys->getDistribution()) && ($list = @parse_ini_file(PSI_APP_ROOT."/data/osnames.ini", true))) {
-
 
1070
                        if (version_compare($ver, "10.0.21996", ">=") && version_compare($ver, "11.0", "<")) {
-
 
1071
                            $distribution = preg_replace("/Windows 10/", "Windows 11", $distribution); // fix Windows 11 detection
-
 
1072
                        }
-
 
1073
                        $karray = preg_split('/\./', $ver);
565
                    if ((($kernel[1] == '.') && ($kernel[0] <5)) || (substr($kernel, 0, 4) == '5.0.'))
1074
                        if (isset($karray[2]) && isset($list['win10'][$karray[2]])) {
-
 
1075
                            $distribution .= ' ('.$list['win10'][$karray[2]].')';
-
 
1076
                        }
-
 
1077
                    }
-
 
1078
                    $this->sys->setDistribution($distribution);
-
 
1079
                    if (version_compare($ver, "5.1", "<"))
566
                        $icon = 'Win2000.png';
1080
                        $icon = 'Win2000.png';
-
 
1081
                    elseif (version_compare($ver, "5.1", ">=") && version_compare($ver, "6.0", "<"))
-
 
1082
                        $icon = 'WinXP.png';
567
                    elseif ((substr($kernel, 0, 4) == '6.0.') || (substr($kernel, 0, 4) == '6.1.'))
1083
                    elseif (version_compare($ver, "6.0", ">=") && version_compare($ver, "6.2", "<"))
568
                        $icon = 'WinVista.png';
1084
                        $icon = 'WinVista.png';
569
                    elseif ((substr($kernel, 0, 4) == '6.2.') || (substr($kernel, 0, 4) == '6.3.') || (substr($kernel, 0, 4) == '6.4.') || (substr($kernel, 0, 5) == '10.0.'))
1085
                    elseif (version_compare($ver, "6.2", ">=") && version_compare($ver, "10.0.21996", "<"))
570
                        $icon = 'Win8.png';
1086
                        $icon = 'Win8.png';
571
                    else
1087
                    else
572
                        $icon = 'WinXP.png';
1088
                        $icon = 'Win11.png';
573
                    $this->sys->setDistributionIcon($icon);
1089
                    $this->sys->setDistributionIcon($icon);
574
                } else {
1090
                } else {
575
                    $this->sys->setDistribution("WINNT");
1091
                    $this->sys->setDistribution("WINNT");
576
                    $this->sys->setDistributionIcon('WINNT.png');
1092
                    $this->sys->setDistributionIcon('WINNT.png');
577
                }
1093
                }
Line 622... Line 1138...
622
     * @return void
1138
     * @return void
623
     */
1139
     */
624
    private function _cpuinfo()
1140
    private function _cpuinfo()
625
    {
1141
    {
626
        $allCpus = $this->_get_Win32_Processor();
1142
        $allCpus = $this->_get_Win32_Processor();
627
        if (!$allCpus) {
1143
        if (empty($allCpus)) {
628
            $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
1144
            $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
629
            if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) {
1145
            if (self::enumKey($this->_reg, $hkey, $arrBuf, false)) {
630
                foreach ($arrBuf as $coreCount) {
1146
                foreach ($arrBuf as $coreCount) {
631
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\ProcessorNameString", $strBuf, false)) {
1147
                    if (self::readReg($this->_reg, $hkey."\\".$coreCount."\\ProcessorNameString", $strBuf, false)) {
632
                        $allCpus[$coreCount]['Name'] = $strBuf;
1148
                        $allCpus[$coreCount]['Name'] = $strBuf;
633
                    }
1149
                    }
634
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\~MHz", $strBuf, false)) {
1150
                    if (self::readReg($this->_reg, $hkey."\\".$coreCount."\\~MHz", $strBuf, false)) {
635
                        if (preg_match("/^0x([0-9a-f]+)$/i", $strBuf, $hexvalue)) {
1151
                        if (preg_match("/^0x([0-9a-f]+)$/i", $strBuf, $hexvalue)) {
636
                            $allCpus[$coreCount]['CurrentClockSpeed'] = hexdec($hexvalue[1]);
1152
                            $allCpus[$coreCount]['CurrentClockSpeed'] = hexdec($hexvalue[1]);
637
                        }
1153
                        }
638
                    }
1154
                    }
639
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\VendorIdentifier", $strBuf, false)) {
1155
                    if (self::readReg($this->_reg, $hkey."\\".$coreCount."\\VendorIdentifier", $strBuf, false)) {
640
                        $allCpus[$coreCount]['Manufacturer'] = $strBuf;
1156
                        $allCpus[$coreCount]['Manufacturer'] = $strBuf;
641
                    }
1157
                    }
-
 
1158
                    if (self::readReg($this->_reg, $hkey."\\".$coreCount."\\Identifier", $strBuf, false)) {
-
 
1159
                        $allCpus[$coreCount]['Caption'] = $strBuf;
-
 
1160
                    }
642
                }
1161
                }
643
            }
1162
            }
644
        }
1163
        }
645
 
1164
 
646
        $globalcpus = 0;
1165
        $globalcpus = 0;
Line 652... Line 1171...
652
                $cpuCount = $oneCpu['NumberOfCores'];
1171
                $cpuCount = $oneCpu['NumberOfCores'];
653
            }
1172
            }
654
            $globalcpus+=$cpuCount;
1173
            $globalcpus+=$cpuCount;
655
        }
1174
        }
656
 
1175
 
-
 
1176
        $cpulist = null;
657
        foreach ($allCpus as $oneCpu) {
1177
        foreach ($allCpus as $oneCpu) {
658
            $cpuCount = 1;
1178
            $cpuCount = 1;
659
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
1179
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
660
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
1180
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
661
            } elseif (isset($oneCpu['NumberOfCores'])) {
1181
            } elseif (isset($oneCpu['NumberOfCores'])) {
Line 664... Line 1184...
664
            for ($i = 0; $i < $cpuCount; $i++) {
1184
            for ($i = 0; $i < $cpuCount; $i++) {
665
                $cpu = new CpuDevice();
1185
                $cpu = new CpuDevice();
666
                if (isset($oneCpu['Name'])) $cpu->setModel($oneCpu['Name']);
1186
                if (isset($oneCpu['Name'])) $cpu->setModel($oneCpu['Name']);
667
                if (isset($oneCpu['L3CacheSize']) && ($oneCpu['L3CacheSize'] > 0)) {
1187
                if (isset($oneCpu['L3CacheSize']) && ($oneCpu['L3CacheSize'] > 0)) {
668
                    $cpu->setCache($oneCpu['L3CacheSize'] * 1024);
1188
                    $cpu->setCache($oneCpu['L3CacheSize'] * 1024);
669
                } elseif (isset($oneCpu['L2CacheSize'])) {
1189
                } elseif (isset($oneCpu['L2CacheSize']) && ($oneCpu['L2CacheSize'] > 0)) {
670
                    $cpu->setCache($oneCpu['L2CacheSize'] * 1024);
1190
                    $cpu->setCache($oneCpu['L2CacheSize'] * 1024);
671
                }
1191
                }
-
 
1192
                if (isset($oneCpu['CurrentVoltage']) && ($oneCpu['CurrentVoltage'] > 0)) {
672
                if (isset($oneCpu['CurrentClockSpeed'])) {
1193
                    $cpu->setVoltage($oneCpu['CurrentVoltage']/10);
-
 
1194
                }
-
 
1195
                if (isset($oneCpu['CurrentClockSpeed']) && ($oneCpu['CurrentClockSpeed'] > 0)) {
673
                    $cpu->setCpuSpeed($oneCpu['CurrentClockSpeed']);
1196
                    $cpu->setCpuSpeed($oneCpu['CurrentClockSpeed']);
674
                    if (isset($oneCpu['MaxClockSpeed']) && ($oneCpu['CurrentClockSpeed'] < $oneCpu['MaxClockSpeed'])) $cpu->setCpuSpeedMax($oneCpu['MaxClockSpeed']);
1197
                    if (isset($oneCpu['MaxClockSpeed']) && ($oneCpu['CurrentClockSpeed'] <= $oneCpu['MaxClockSpeed'])) $cpu->setCpuSpeedMax($oneCpu['MaxClockSpeed']);
-
 
1198
                }
-
 
1199
                if (isset($oneCpu['ExtClock']) && ($oneCpu['ExtClock'] > 0)) {
-
 
1200
                    $cpu->setBusSpeed($oneCpu['ExtClock']);
-
 
1201
                }
-
 
1202
                if (isset($oneCpu['Manufacturer'])) {
-
 
1203
                    $cpumanufacturer = $oneCpu['Manufacturer'];
-
 
1204
                    $cpu->setVendorId($cpumanufacturer);
-
 
1205
                    if ($cpumanufacturer === "QEMU") {
-
 
1206
                        if (isset($oneCpu['Caption'])) {
-
 
1207
                            $impl = '';
-
 
1208
                            if (preg_match('/^ARMv8 \(64-bit\) Family 8 Model ([0-9a-fA-F]+) Revision[ ]+([0-9a-fA-F]+)$/', $oneCpu['Caption'], $partvar)) {
-
 
1209
                                switch (strtolower($partvar[1])) {
-
 
1210
                                case '51':
-
 
1211
                                    $impl = '0x0'; break; // Qemu
-
 
1212
                                case 'd03':
-
 
1213
                                case 'd07':
-
 
1214
                                case 'd08':
-
 
1215
                                    $impl = '0x41'; break; // ARM Limited
-
 
1216
                                case '1':
-
 
1217
                                    $impl = '0x46'; // Fujitsu Ltd.
-
 
1218
                                }
-
 
1219
                            } elseif (preg_match('/^ARM Family 7 Model ([0-9a-fA-F]+) Revision[ ]+([0-9a-fA-F]+)$/', $oneCpu['Caption'], $partvar)) {
-
 
1220
                                switch (strtolower($partvar[1])) {
-
 
1221
                                case 'c07':
-
 
1222
                                case 'c0f':
-
 
1223
                                        $impl = '0x41'; // ARM Limited
-
 
1224
                                }
-
 
1225
                            }
-
 
1226
                            if ($impl !== '') {
-
 
1227
                                if ($cpulist === null) $cpulist = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true);
-
 
1228
                                if ($cpulist) {
-
 
1229
                                    if ((isset($cpulist['cpu'][$cpufromlist = strtolower($impl.',0x'.$partvar[1].',0x'.$partvar[2])]))
-
 
1230
                                       || isset($cpulist['cpu'][$cpufromlist = strtolower($impl.',0x'.$partvar[1])])) {
-
 
1231
                                        if (($cpumodel = $cpu->getModel()) !== '') {
-
 
1232
                                            $cpu->setModel($cpumodel.' - '.$cpulist['cpu'][$cpufromlist]);
-
 
1233
                                        } else {
-
 
1234
                                            $cpu->setModel($cpulist['cpu'][$cpufromlist]);
-
 
1235
                                        }
-
 
1236
                                    }
-
 
1237
                                }
-
 
1238
                            }
-
 
1239
                        }
-
 
1240
                        if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO) {
-
 
1241
                            $this->sys->setVirtualizer("cpuid:QEMU", false);
-
 
1242
                        }
-
 
1243
                    }
675
                }
1244
                }
676
                if (isset($oneCpu['ExtClock'])) $cpu->setBusSpeed($oneCpu['ExtClock']);
-
 
677
                if (isset($oneCpu['Manufacturer'])) $cpu->setVendorId($oneCpu['Manufacturer']);
-
 
678
                if (PSI_LOAD_BAR) {
1245
                if (PSI_LOAD_BAR) {
679
                    if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && (count($cpubuffer) == ($globalcpus+1)) && isset($cpubuffer['cpu'.$i])) {
1246
                    if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && (count($cpubuffer) == ($globalcpus+1)) && isset($cpubuffer['cpu'.$i])) {
680
                           $cpu->setLoad($cpubuffer['cpu'.$i]);
1247
                           $cpu->setLoad($cpubuffer['cpu'.$i]);
681
                    } elseif ((count($allCpus) == $globalcpus) && isset($oneCpu['LoadPercentage'])) {
1248
                    } elseif ((count($allCpus) == $globalcpus) && isset($oneCpu['LoadPercentage'])) {
682
                        $cpu->setLoad($oneCpu['LoadPercentage']);
1249
                        $cpu->setLoad($oneCpu['LoadPercentage']);
Line 693... Line 1260...
693
     * @return void
1260
     * @return void
694
     */
1261
     */
695
    private function _machine()
1262
    private function _machine()
696
    {
1263
    {
697
        $buffer = $this->_get_Win32_ComputerSystem();
1264
        $buffer = $this->_get_Win32_ComputerSystem();
698
        $bufferp = CommonFunctions::getWMI($this->_wmi, 'Win32_BaseBoard', array('Product'));
1265
        $bufferp = self::getWMI(self::$_wmi, 'Win32_BaseBoard', array('Product'));
699
        $bufferb = CommonFunctions::getWMI($this->_wmi, 'Win32_BIOS', array('SMBIOSBIOSVersion', 'ReleaseDate'));
1266
        $bufferb = self::getWMI(self::$_wmi, 'Win32_BIOS', array('SMBIOSBIOSVersion', 'ReleaseDate'));
700
 
1267
 
701
        if (!$buffer) {
1268
        if (!$buffer) {
702
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\systemManufacturer", $strBuf, false)) {
1269
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\systemManufacturer", $strBuf, false)) {
703
                $buffer[0]['Manufacturer'] = $strBuf;
1270
                $buffer[0]['Manufacturer'] = $strBuf;
704
            }
1271
            }
705
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemProductName", $strBuf, false)) {
1272
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemProductName", $strBuf, false)) {
706
                $buffer[0]['Model'] = $strBuf;
1273
                $buffer[0]['Model'] = $strBuf;
707
            }
1274
            }
708
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemFamily", $strBuf, false)) {
1275
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemFamily", $strBuf, false)) {
709
                $buffer[0]['SystemFamily'] = $strBuf;
1276
                $buffer[0]['SystemFamily'] = $strBuf;
710
            }
1277
            }
711
        }
1278
        }
712
        if (!$bufferp) {
1279
        if (!$bufferp) {
713
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BaseBoardProduct", $strBuf, false)) {
1280
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BaseBoardProduct", $strBuf, false)) {
714
                $bufferp[0]['Product'] = $strBuf;
1281
                $bufferp[0]['Product'] = $strBuf;
715
            }
1282
            }
716
        }
1283
        }
717
        if (!$bufferb) {
1284
        if (!$bufferb) {
718
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSVersion", $strBuf, false)) {
1285
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSVersion", $strBuf, false)) {
719
                $bufferb[0]['SMBIOSBIOSVersion'] = $strBuf;
1286
                $bufferb[0]['SMBIOSBIOSVersion'] = $strBuf;
720
            }
1287
            }
721
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSReleaseDate", $strBuf, false)) {
1288
            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSReleaseDate", $strBuf, false)) {
722
                $bufferb[0]['ReleaseDate'] = $strBuf;
1289
                $bufferb[0]['ReleaseDate'] = $strBuf;
723
            }
1290
            }
724
        }
1291
        }
-
 
1292
 
-
 
1293
        if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO) {
-
 
1294
            if (isset($buffer[0]['Manufacturer'])) {
-
 
1295
                $this->_Manufacturer = $buffer[0]['Manufacturer'];
-
 
1296
            }
-
 
1297
            if (isset($buffer[0]['Model'])) {
-
 
1298
                $this->_Model = $buffer[0]['Model'];
-
 
1299
            }
-
 
1300
        }
-
 
1301
 
725
        $buf = "";
1302
        $buf = "";
726
        $model = "";
1303
        $model = "";
727
        if ($buffer && isset($buffer[0])) {
1304
        if ($buffer && isset($buffer[0])) {
728
            if (isset($buffer[0]['Manufacturer']) && !preg_match("/^To be filled by O\.E\.M\.$|^System manufacturer$|^Not Specified$/i", $buf2=trim($buffer[0]['Manufacturer'])) && ($buf2 !== "")) {
1305
            if (isset($buffer[0]['Manufacturer']) && !preg_match("/^To be filled by O\.E\.M\.$|^System manufacturer$|^Not Specified$/i", $buf2=trim($buffer[0]['Manufacturer'])) && ($buf2 !== "")) {
729
                $buf .= ' '.$buf2;
1306
                $buf .= ' '.$buf2;
Line 830... Line 1407...
830
     *
1407
     *
831
     * @return void
1408
     * @return void
832
     */
1409
     */
833
    private function _network()
1410
    private function _network()
834
    {
1411
    {
835
        if ($this->_wmi) {
1412
        if (self::$_wmi) {
836
            $buffer = $this->_get_Win32_OperatingSystem();
1413
            $buffer = $this->_get_Win32_OperatingSystem();
837
            if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "6.2", ">=")) { // minimal windows 2012 or windows 8
1414
            if ($buffer && isset($buffer[0]) && isset($buffer[0]['Version']) && version_compare($buffer[0]['Version'], "6.2", ">=")) { // minimal windows 2012 or windows 8
838
                $allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkAdapter', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
1415
                $allDevices = self::getWMI(self::$_wmi, 'Win32_PerfRawData_Tcpip_NetworkAdapter', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
839
            } else {
1416
            } else {
840
                $allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkInterface', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
1417
                $allDevices = self::getWMI(self::$_wmi, 'Win32_PerfRawData_Tcpip_NetworkInterface', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
841
            }
1418
            }
842
            if ($allDevices) {
1419
            if ($allDevices) {
843
                $aliases = array();
1420
                $aliases = array();
844
                $hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}";
1421
                $hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}";
845
                if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) {
1422
                if (self::enumKey($this->_reg, $hkey, $arrBuf, false)) {
846
                    foreach ($arrBuf as $netID) {
1423
                    foreach ($arrBuf as $netID) {
847
                        if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\PnPInstanceId", $strInstanceID, false)) {
1424
                        if (self::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\PnPInstanceId", $strInstanceID, false)) {
848
                            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\".$strInstanceID."\\FriendlyName", $strName, false)) {
1425
                            if (self::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\".$strInstanceID."\\FriendlyName", $strName, false)) {
849
                                $cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical
1426
                                $cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical
850
                                if (!isset($aliases[$cname])) { // duplicate checking
1427
                                if (!isset($aliases[$cname])) { // duplicate checking
851
                                    $aliases[$cname]['id'] = $netID;
1428
                                    $aliases[$cname]['id'] = $netID;
852
                                    $aliases[$cname]['name'] = $strName;
1429
                                    $aliases[$cname]['name'] = $strName;
853
                                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\Name", $strCName, false)
1430
                                    if (self::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\Name", $strCName, false)
854
                                       && (str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strCName) !== $cname)) {
1431
                                       && (str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strCName) !== $cname)) {
855
                                        $aliases[$cname]['netname'] = $strCName;
1432
                                        $aliases[$cname]['netname'] = $strCName;
856
                                    }
1433
                                    }
857
                                } else {
1434
                                } else {
858
                                    $aliases[$cname]['id'] = '';
1435
                                    $aliases[$cname]['id'] = '';
Line 862... Line 1439...
862
                    }
1439
                    }
863
                }
1440
                }
864
 
1441
 
865
                $aliases2 = array();
1442
                $aliases2 = array();
866
                $hkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards";
1443
                $hkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards";
867
                if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) {
1444
                if (self::enumKey($this->_reg, $hkey, $arrBuf, false)) {
868
                    foreach ($arrBuf as $netCount) {
1445
                    foreach ($arrBuf as $netCount) {
869
                        if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\Description", $strName, false)
1446
                        if (self::readReg($this->_reg, $hkey."\\".$netCount."\\Description", $strName, false)
870
                            && CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\ServiceName", $strGUID, false)) {
1447
                            && self::readReg($this->_reg, $hkey."\\".$netCount."\\ServiceName", $strGUID, false)) {
871
                            $cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical
1448
                            $cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical
872
                            if (!isset($aliases2[$cname])) { // duplicate checking
1449
                            if (!isset($aliases2[$cname])) { // duplicate checking
873
                                $aliases2[$cname]['id'] = $strGUID;
1450
                                $aliases2[$cname]['id'] = $strGUID;
874
                                $aliases2[$cname]['name'] = $strName;
1451
                                $aliases2[$cname]['name'] = $strName;
875
                            } else {
1452
                            } else {
Line 877... Line 1454...
877
                            }
1454
                            }
878
                        }
1455
                        }
879
                    }
1456
                    }
880
                }
1457
                }
881
 
1458
 
882
                $allNetworkAdapterConfigurations = CommonFunctions::getWMI($this->_wmi, 'Win32_NetworkAdapterConfiguration', array('SettingID', /*'Description',*/ 'MACAddress', 'IPAddress'));
1459
                $allNetworkAdapterConfigurations = self::getWMI(self::$_wmi, 'Win32_NetworkAdapterConfiguration', array('SettingID', /*'Description',*/ 'MACAddress', 'IPAddress'));
883
                foreach ($allDevices as $device) if (!preg_match('/^WAN Miniport \[/', $device['Name'])) {
1460
                foreach ($allDevices as $device) if (!preg_match('/^WAN Miniport \[/', $device['Name'])) {
884
                    $dev = new NetDevice();
1461
                    $dev = new NetDevice();
885
                    $name = $device['Name'];
1462
                    $name = $device['Name'];
886
 
1463
 
887
                    if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $name)) {
1464
                    if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $name)) {
Line 901... Line 1478...
901
                                if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $mininame))
1478
                                if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $mininame))
902
                                    $mininame="Microsoft ISATAP Adapter";
1479
                                    $mininame="Microsoft ISATAP Adapter";
903
                                elseif (preg_match('/\s-\s([^-]*)$/', $mininame, $ar_name))
1480
                                elseif (preg_match('/\s-\s([^-]*)$/', $mininame, $ar_name))
904
                                    $name=substr($mininame, 0, strlen($mininame)-strlen($ar_name[0]));
1481
                                    $name=substr($mininame, 0, strlen($mininame)-strlen($ar_name[0]));
905
                                $dev->setName($mininame);
1482
                                $dev->setName($mininame);
906
                                if (trim($NetworkAdapterConfiguration['MACAddress']) !== "") $macexist = true;
1483
                                if (isset($NetworkAdapterConfiguration['MACAddress']) && trim($NetworkAdapterConfiguration['MACAddress']) !== "") $macexist = true;
907
                                if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
1484
                                if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
908
                                    if (isset($ali[$name]['netname'])) $dev->setInfo(str_replace(';', ':', $ali[$name]['netname']));
1485
                                    if (isset($ali[$name]['netname'])) $dev->setInfo(str_replace(';', ':', $ali[$name]['netname']));
909
                                    if ((!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR)
1486
                                    if ((!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR)
910
                                       && (trim($NetworkAdapterConfiguration['MACAddress']) !== "")) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').str_replace(':', '-', strtoupper($NetworkAdapterConfiguration['MACAddress'])));
1487
                                       && $macexist) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').str_replace(':', '-', strtoupper(trim($NetworkAdapterConfiguration['MACAddress']))));
911
                                    if (isset($NetworkAdapterConfiguration['IPAddress']))
1488
                                    if (isset($NetworkAdapterConfiguration['IPAddress']))
912
                                        foreach ($NetworkAdapterConfiguration['IPAddress'] as $ipaddres)
1489
                                        foreach ($NetworkAdapterConfiguration['IPAddress'] as $ipaddres)
913
                                            if (($ipaddres != "0.0.0.0") && ($ipaddres != "::") && !preg_match('/^fe80::/i', $ipaddres))
1490
                                            if (($ipaddres != "0.0.0.0") && ($ipaddres != "::") && !preg_match('/^fe80::/i', $ipaddres))
914
                                                $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
1491
                                                $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
915
                                }
1492
                                }
Line 1003... Line 1580...
1003
     * @link http://msdn2.microsoft.com/en-us/library/aa394246.aspx
1580
     * @link http://msdn2.microsoft.com/en-us/library/aa394246.aspx
1004
     * @return void
1581
     * @return void
1005
     */
1582
     */
1006
    private function _memory()
1583
    private function _memory()
1007
    {
1584
    {
1008
        if ($this->_wmi) {
1585
        if (self::$_wmi) {
1009
            $buffer = $this->_get_Win32_OperatingSystem();
1586
            $buffer = $this->_get_Win32_OperatingSystem();
1010
            if ($buffer) {
1587
            if ($buffer) {
1011
                $this->sys->setMemTotal($buffer[0]['TotalVisibleMemorySize'] * 1024);
1588
                $this->sys->setMemTotal($buffer[0]['TotalVisibleMemorySize'] * 1024);
1012
                $this->sys->setMemFree($buffer[0]['FreePhysicalMemory'] * 1024);
1589
                $this->sys->setMemFree($buffer[0]['FreePhysicalMemory'] * 1024);
1013
                $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
1590
                $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
1014
            }
1591
            }
1015
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PageFileUsage');
1592
            $buffer = self::getWMI(self::$_wmi, 'Win32_PageFileUsage');
1016
            foreach ($buffer as $swapdevice) {
1593
            foreach ($buffer as $swapdevice) {
1017
                $dev = new DiskDevice();
1594
                $dev = new DiskDevice();
1018
                $dev->setName("SWAP");
1595
                $dev->setName("SWAP");
1019
                $dev->setMountPoint($swapdevice['Name']);
1596
                $dev->setMountPoint($swapdevice['Name']);
1020
                $dev->setTotal($swapdevice['AllocatedBaseSize'] * 1024 * 1024);
1597
                $dev->setTotal($swapdevice['AllocatedBaseSize'] * 1024 * 1024);
Line 1038... Line 1615...
1038
     */
1615
     */
1039
    private function _filesystems()
1616
    private function _filesystems()
1040
    {
1617
    {
1041
        $typearray = array('Unknown', 'No Root Directory', 'Removable Disk', 'Local Disk', 'Network Drive', 'Compact Disc', 'RAM Disk');
1618
        $typearray = array('Unknown', 'No Root Directory', 'Removable Disk', 'Local Disk', 'Network Drive', 'Compact Disc', 'RAM Disk');
1042
        $floppyarray = array('Unknown', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', 'Other', 'HD', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '8 in.');
1619
        $floppyarray = array('Unknown', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', '5 1/4 in.', 'Other', 'HD', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '5 1/4 in.', '3 1/2 in.', '3 1/2 in.', '8 in.');
1043
        $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_LogicalDisk', array('Name', 'Size', 'FreeSpace', 'FileSystem', 'DriveType', 'MediaType'));
1620
        $buffer = self::getWMI(self::$_wmi, 'Win32_LogicalDisk', array('Name', 'Size', 'FreeSpace', 'FileSystem', 'DriveType', 'MediaType'));
1044
        foreach ($buffer as $filesystem) {
1621
        foreach ($buffer as $filesystem) {
1045
            $dev = new DiskDevice();
1622
            $dev = new DiskDevice();
1046
            $dev->setMountPoint($filesystem['Name']);
1623
            $dev->setMountPoint($filesystem['Name']);
-
 
1624
            if (isset($filesystem['FileSystem'])) {
1047
            $dev->setFsType($filesystem['FileSystem']);
1625
                $dev->setFsType($filesystem['FileSystem']);
-
 
1626
            }
1048
            if ($filesystem['Size'] > 0) {
1627
            if ($filesystem['Size'] > 0) {
1049
                $dev->setTotal($filesystem['Size']);
1628
                $dev->setTotal($filesystem['Size']);
1050
                $dev->setFree($filesystem['FreeSpace']);
1629
                $dev->setFree($filesystem['FreeSpace']);
1051
                $dev->setUsed($filesystem['Size'] - $filesystem['FreeSpace']);
1630
                $dev->setUsed($filesystem['Size'] - $filesystem['FreeSpace']);
1052
            }
1631
            }
Line 1055... Line 1634...
1055
            } else {
1634
            } else {
1056
                $dev->setName($typearray[$filesystem['DriveType']]);
1635
                $dev->setName($typearray[$filesystem['DriveType']]);
1057
            }
1636
            }
1058
            $this->sys->setDiskDevices($dev);
1637
            $this->sys->setDiskDevices($dev);
1059
        }
1638
        }
1060
        if (!$buffer && ($this->sys->getDistribution()=="ReactOS")) {
1639
        if (!$buffer && !defined('PSI_EMU_HOSTNAME')) {
-
 
1640
            $letters = array();
-
 
1641
            if (CommonFunctions::executeProgram('fsutil', 'fsinfo drives 2>nul', $out_value, false) && ($out_value !== '') && preg_match('/^Drives:\s*(.+)$/i', $out_value, $disks)) {
-
 
1642
                $diskarr = preg_split('/ /', $disks[1], -1, PREG_SPLIT_NO_EMPTY);
-
 
1643
                foreach ($diskarr as $disk) if (preg_match('/^(\w):\\\\$/', $disk, $diskletter)) {
1061
            // test for command 'free' on current disk
1644
                    $letters[] = $diskletter[1];
-
 
1645
                }
-
 
1646
            }
-
 
1647
            if (count($letters) == 0) for ($letter='A'; $letter!='AA'; $letter++) {
-
 
1648
                $letters[] = $letter;
-
 
1649
            }
1062
            if (CommonFunctions::executeProgram('cmd', '/c free 2>nul', $out_value, true)) {
1650
            if ((substr($this->sys->getDistribution(), 0, 7)=="ReactOS") && CommonFunctions::executeProgram('cmd', '/c free 2>nul', $out_value, false)) {
1063
                for ($letter='A'; $letter!='AA'; $letter++) if (CommonFunctions::executeProgram('cmd', '/c free '.$letter.': 2>nul', $out_value, false)) {
1651
                foreach ($letters as $letter) if (CommonFunctions::executeProgram('cmd', '/c free '.$letter.': 2>nul', $out_value, false)) {
1064
                    $values = preg_replace('/[^\d\n]/', '', $out_value);
1652
                    $values = preg_replace('/[^\d\n]/', '', $out_value);
1065
                    if (preg_match('/\n(\d+)\n(\d+)\n(\d+)$/', $values, $out_dig)) {
1653
                    if (preg_match('/\n(\d+)\n(\d+)\n(\d+)$/', $values, $out_dig)) {
1066
                        $size = $out_dig[1];
1654
                        $size = $out_dig[1];
1067
                        $used = $out_dig[2];
1655
                        $used = $out_dig[2];
1068
                        $free = $out_dig[3];
1656
                        $free = $out_dig[3];
1069
                        if ($used + $free == $size) {
1657
                        if ($used + $free == $size) {
1070
                            $dev = new DiskDevice();
1658
                            $dev = new DiskDevice();
1071
                            $dev->setMountPoint($letter.":");
1659
                            $dev->setMountPoint($letter.":");
-
 
1660
                            if (CommonFunctions::executeProgram('fsutil', 'fsinfo volumeinfo '.$letter.':\ 2>nul', $out_value, false) && ($out_value !== '') && preg_match('/\nFile System Name\s*:\s*(\S+)/im', $out_value, $fsname)) {
-
 
1661
                                $dev->setFsType($fsname[1]);
-
 
1662
                            } else {
1072
                            $dev->setFsType('Unknown');
1663
                                $dev->setFsType('Unknown');
-
 
1664
                            }
1073
                            $dev->setName('Unknown');
1665
                            $dev->setName('Unknown');
1074
                            $dev->setTotal($size);
1666
                            $dev->setTotal($size);
1075
                            $dev->setUsed($used);
1667
                            $dev->setUsed($used);
1076
                            $dev->setFree($free);
1668
                            $dev->setFree($free);
1077
                            $this->sys->setDiskDevices($dev);
1669
                            $this->sys->setDiskDevices($dev);
1078
                        }
1670
                        }
1079
                    }
1671
                    }
1080
                }
1672
                }
-
 
1673
            } else {
-
 
1674
                if (substr($this->sys->getDistribution(), 0, 7)=="ReactOS") {
-
 
1675
                    $disksep = ':\\';
-
 
1676
                } else {
-
 
1677
                    $disksep = ':';
-
 
1678
                }
-
 
1679
                foreach ($letters as $letter) {
-
 
1680
                    $size = disk_total_space($letter.':\\');
-
 
1681
                    $free = disk_free_space($letter.':\\');
-
 
1682
                    if (($size !== false) && ($free !== false) && ($size >= 0) && ($free >= 0) && ($size >= $free)) {
-
 
1683
                        $dev = new DiskDevice();
-
 
1684
                        $dev->setMountPoint($letter.":");
-
 
1685
                        if (CommonFunctions::executeProgram('fsutil', 'fsinfo volumeinfo '.$letter.$disksep.' 2>nul', $out_value, false) && ($out_value !== '') && preg_match('/\nFile System Name\s*:\s*(\S+)/im', $out_value, $fsname)) {
-
 
1686
                            $dev->setFsType($fsname[1]);
-
 
1687
                        } else {
-
 
1688
                            $dev->setFsType('Unknown');
-
 
1689
                        }
-
 
1690
                        $dev->setName('Unknown');
-
 
1691
                        $dev->setTotal($size);
-
 
1692
                        $dev->setUsed($size - $free);
-
 
1693
                        $dev->setFree($free);
-
 
1694
                       $this->sys->setDiskDevices($dev);
-
 
1695
                    }
-
 
1696
                }
1081
            }
1697
            }
1082
        }
1698
        }
1083
    }
1699
    }
1084
 
1700
 
1085
    /**
1701
    /**
Line 1112... Line 1728...
1112
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) {
1728
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) {
1113
            $lines = preg_split('/\n/', $strBuf);
1729
            $lines = preg_split('/\n/', $strBuf);
1114
            $processes['*'] = (count($lines)-1) - 3 ; //correction for process "qprocess *"
1730
            $processes['*'] = (count($lines)-1) - 3 ; //correction for process "qprocess *"
1115
        }
1731
        }
1116
        if ($processes['*'] <= 0) {
1732
        if ($processes['*'] <= 0) {
1117
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
1733
            $buffer = self::getWMI(self::$_wmi, 'Win32_Process', array('Caption'));
1118
            $processes['*'] = count($buffer);
1734
            $processes['*'] = count($buffer);
1119
        }
1735
        }
1120
        $processes[' '] = $processes['*'];
1736
        $processes[' '] = $processes['*'];
1121
        $this->sys->setProcesses($processes);
1737
        $this->sys->setProcesses($processes);
1122
    }
1738
    }
Line 1126... Line 1742...
1126
     *
1742
     *
1127
     * @return void
1743
     * @return void
1128
     */
1744
     */
1129
    private function _meminfo()
1745
    private function _meminfo()
1130
    {
1746
    {
1131
        $allMems = CommonFunctions::getWMI($this->_wmi, 'Win32_PhysicalMemory', array('PartNumber', 'DeviceLocator', 'Capacity', 'Manufacturer', 'SerialNumber', 'Speed', 'ConfiguredClockSpeed', 'ConfiguredVoltage', 'MemoryType', 'SMBIOSMemoryType', 'FormFactor', 'DataWidth', 'TotalWidth', 'BankLabel', 'MinVoltage', 'MaxVoltage'));
1747
        $allMems = self::_get_Win32_PhysicalMemory();
1132
        if ($allMems) {
1748
        if ($allMems) {
1133
            $reg = false;
1749
            $reg = false;
1134
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
1750
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
1135
                $arrMems = CommonFunctions::getWMI($this->_wmi, 'Win32_PhysicalMemoryArray', array('MemoryErrorCorrection'));
1751
                $arrMems = self::getWMI(self::$_wmi, 'Win32_PhysicalMemoryArray', array('MemoryErrorCorrection'));
1136
                $reg = (count($arrMems) == 1) && isset($arrMems[0]['MemoryErrorCorrection']) && ($arrMems[0]['MemoryErrorCorrection'] == 6);
1752
                $reg = (count($arrMems) == 1) && isset($arrMems[0]['MemoryErrorCorrection']) && ($arrMems[0]['MemoryErrorCorrection'] == 6);
1137
            }
1753
            }
1138
            foreach ($allMems as $mem) {
1754
            foreach ($allMems as $mem) {
1139
                $dev = new HWDevice();
1755
                $dev = new HWDevice();
1140
                $name = '';
1756
                $name = '';
Line 1168... Line 1784...
1168
                        $dev->setCapacity($mem['Capacity']);
1784
                        $dev->setCapacity($mem['Capacity']);
1169
                    }
1785
                    }
1170
                    $memtype = '';
1786
                    $memtype = '';
1171
                    if (isset($mem['MemoryType']) && (($memval = $mem['MemoryType']) != 0)) {
1787
                    if (isset($mem['MemoryType']) && (($memval = $mem['MemoryType']) != 0)) {
1172
                        switch ($memval) {
1788
                        switch ($memval) {
1173
//                            case 0: $memtype = 'Unknown'; break;
1789
//                        case 0: $memtype = 'Unknown'; break;
1174
//                            case 1: $memtype = 'Other'; break;
1790
//                        case 1: $memtype = 'Other'; break;
1175
                            case 2: $memtype = 'DRAM'; break;
1791
                        case 2: $memtype = 'DRAM'; break;
1176
                            case 3: $memtype = 'Synchronous DRAM'; break;
1792
                        case 3: $memtype = 'Synchronous DRAM'; break;
1177
                            case 4: $memtype = 'Cache DRAM'; break;
1793
                        case 4: $memtype = 'Cache DRAM'; break;
1178
                            case 5: $memtype = 'EDO'; break;
1794
                        case 5: $memtype = 'EDO'; break;
1179
                            case 6: $memtype = 'EDRAM'; break;
1795
                        case 6: $memtype = 'EDRAM'; break;
1180
                            case 7: $memtype = 'VRAM'; break;
1796
                        case 7: $memtype = 'VRAM'; break;
1181
                            case 8: $memtype = 'SRAM'; break;
1797
                        case 8: $memtype = 'SRAM'; break;
1182
                            case 9: $memtype = 'RAM'; break;
1798
                        case 9: $memtype = 'RAM'; break;
1183
                            case 10: $memtype = 'ROM'; break;
1799
                        case 10: $memtype = 'ROM'; break;
1184
                            case 11: $memtype = 'Flash'; break;
1800
                        case 11: $memtype = 'Flash'; break;
1185
                            case 12: $memtype = 'EEPROM'; break;
1801
                        case 12: $memtype = 'EEPROM'; break;
1186
                            case 13: $memtype = 'FEPROM'; break;
1802
                        case 13: $memtype = 'FEPROM'; break;
1187
                            case 14: $memtype = 'EPROM'; break;
1803
                        case 14: $memtype = 'EPROM'; break;
1188
                            case 15: $memtype = 'CDRAM'; break;
1804
                        case 15: $memtype = 'CDRAM'; break;
1189
                            case 16: $memtype = '3DRAM'; break;
1805
                        case 16: $memtype = '3DRAM'; break;
1190
                            case 17: $memtype = 'SDRAM'; break;
1806
                        case 17: $memtype = 'SDRAM'; break;
1191
                            case 18: $memtype = 'SGRAM'; break;
1807
                        case 18: $memtype = 'SGRAM'; break;
1192
                            case 19: $memtype = 'RDRAM'; break;
1808
                        case 19: $memtype = 'RDRAM'; break;
1193
                            case 20: $memtype = 'DDR'; break;
1809
                        case 20: $memtype = 'DDR'; break;
1194
                            case 21: $memtype = 'DDR2'; break;
1810
                        case 21: $memtype = 'DDR2'; break;
1195
                            case 22: $memtype = 'DDR2 FB-DIMM'; break;
1811
                        case 22: $memtype = 'DDR2 FB-DIMM'; break;
1196
                            case 24: $memtype = 'DDR3'; break;
1812
                        case 24: $memtype = 'DDR3'; break;
1197
                            case 25: $memtype = 'FBD2'; break;
1813
                        case 25: $memtype = 'FBD2'; break;
1198
                            case 26: $memtype = 'DDR4'; break;
1814
                        case 26: $memtype = 'DDR4';
1199
                        }
1815
                        }
1200
                    } elseif (isset($mem['SMBIOSMemoryType'])) {
1816
                    } elseif (isset($mem['SMBIOSMemoryType'])) {
1201
                        switch ($mem['SMBIOSMemoryType']) {
1817
                        switch ($mem['SMBIOSMemoryType']) {
1202
//                            case 0: $memtype = 'Invalid'; break;
1818
//                        case 0: $memtype = 'Invalid'; break;
1203
//                            case 1: $memtype = 'Other'; break;
1819
//                        case 1: $memtype = 'Other'; break;
1204
//                            case 2: $memtype = 'Unknown'; break;
1820
//                        case 2: $memtype = 'Unknown'; break;
1205
                            case 3: $memtype = 'DRAM'; break;
1821
                        case 3: $memtype = 'DRAM'; break;
1206
                            case 4: $memtype = 'EDRAM'; break;
1822
                        case 4: $memtype = 'EDRAM'; break;
1207
                            case 5: $memtype = 'VRAM'; break;
1823
                        case 5: $memtype = 'VRAM'; break;
1208
                            case 6: $memtype = 'SRAM'; break;
1824
                        case 6: $memtype = 'SRAM'; break;
1209
                            case 7: $memtype = 'RAM'; break;
1825
                        case 7: $memtype = 'RAM'; break;
1210
                            case 8: $memtype = 'ROM'; break;
1826
                        case 8: $memtype = 'ROM'; break;
1211
                            case 9: $memtype = 'FLASH'; break;
1827
                        case 9: $memtype = 'FLASH'; break;
1212
                            case 10: $memtype = 'EEPROM'; break;
1828
                        case 10: $memtype = 'EEPROM'; break;
1213
                            case 11: $memtype = 'FEPROM'; break;
1829
                        case 11: $memtype = 'FEPROM'; break;
1214
                            case 12: $memtype = 'EPROM'; break;
1830
                        case 12: $memtype = 'EPROM'; break;
1215
                            case 13: $memtype = 'CDRAM'; break;
1831
                        case 13: $memtype = 'CDRAM'; break;
1216
                            case 14: $memtype = '3DRAM'; break;
1832
                        case 14: $memtype = '3DRAM'; break;
1217
                            case 15: $memtype = 'SDRAM'; break;
1833
                        case 15: $memtype = 'SDRAM'; break;
1218
                            case 16: $memtype = 'SGRAM'; break;
1834
                        case 16: $memtype = 'SGRAM'; break;
1219
                            case 17: $memtype = 'RDRAM'; break;
1835
                        case 17: $memtype = 'RDRAM'; break;
1220
                            case 18: $memtype = 'DDR'; break;
1836
                        case 18: $memtype = 'DDR'; break;
1221
                            case 19: $memtype = 'DDR2'; break;
1837
                        case 19: $memtype = 'DDR2'; break;
1222
                            case 20: $memtype = 'DDR2 FB-DIMM'; break;
1838
                        case 20: $memtype = 'DDR2 FB-DIMM'; break;
1223
                            case 24: $memtype = 'DDR3'; break;
1839
                        case 24: $memtype = 'DDR3'; break;
1224
                            case 25: $memtype = 'FBD2'; break;
1840
                        case 25: $memtype = 'FBD2'; break;
1225
                            case 26: $memtype = 'DDR4'; break;
1841
                        case 26: $memtype = 'DDR4'; break;
1226
                            case 27: $memtype = 'LPDDR'; break;
1842
                        case 27: $memtype = 'LPDDR'; break;
1227
                            case 28: $memtype = 'LPDDR2'; break;
1843
                        case 28: $memtype = 'LPDDR2'; break;
1228
                            case 29: $memtype = 'LPDDR3'; break;
1844
                        case 29: $memtype = 'LPDDR3'; break;
1229
                            case 30: $memtype = 'DDR3'; break;
1845
                        case 30: $memtype = 'DDR3'; break;
1230
                            case 31: $memtype = 'FBD2'; break;
1846
                        case 31: $memtype = 'FBD2'; break;
1231
                            case 32: $memtype = 'Logical non-volatile device'; break;
1847
                        case 32: $memtype = 'Logical non-volatile device'; break;
1232
                            case 33: $memtype = 'HBM2'; break;
1848
                        case 33: $memtype = 'HBM2'; break;
1233
                            case 34: $memtype = 'DDR5'; break;
1849
                        case 34: $memtype = 'DDR5'; break;
1234
                            case 35: $memtype = 'LPDDR5'; break;
1850
                        case 35: $memtype = 'LPDDR5';
1235
                        }
1851
                        }
1236
                    }
1852
                    }
1237
                    if (isset($mem['Speed']) && (($speed = $mem['Speed']) > 0) && (preg_match('/^(DDR\d*)(.*)/', $memtype, $dr) || preg_match('/^(SDR)AM(.*)/', $memtype, $dr))) {
1853
                    if (isset($mem['Speed']) && (($speed = $mem['Speed']) > 0) && (preg_match('/^(DDR\d*)(.*)/', $memtype, $dr) || preg_match('/^(SDR)AM(.*)/', $memtype, $dr))) {
1238
                        if (isset($mem['MinVoltage']) && isset($mem['MaxVoltage']) && (($minv = $mem['MinVoltage']) > 0) && (($maxv = $mem['MaxVoltage']) > 0) && ($minv < $maxv)) {
1854
                        if (isset($mem['MinVoltage']) && isset($mem['MaxVoltage']) && (($minv = $mem['MinVoltage']) > 0) && (($maxv = $mem['MaxVoltage']) > 0) && ($minv < $maxv)) {
1239
                            $lv = 'L';
1855
                            $lv = 'L';
Line 1246... Line 1862...
1246
                            $memtype = $dr[1].$lv.'-'.$speed;
1862
                            $memtype = $dr[1].$lv.'-'.$speed;
1247
                        }
1863
                        }
1248
                    }
1864
                    }
1249
                    if (isset($mem['FormFactor'])) {
1865
                    if (isset($mem['FormFactor'])) {
1250
                        switch ($mem['FormFactor']) {
1866
                        switch ($mem['FormFactor']) {
1251
//                                case 0: $memtype .= ' Unknown'; break;
1867
//                        case 0: $memtype .= ' Unknown'; break;
1252
//                                case 1: $memtype .= ' Other'; break;
1868
//                        case 1: $memtype .= ' Other'; break;
1253
                            case 2: $memtype .= ' SIP'; break;
1869
                        case 2: $memtype .= ' SIP'; break;
1254
                            case 3: $memtype .= ' DIP'; break;
1870
                        case 3: $memtype .= ' DIP'; break;
1255
                            case 4: $memtype .= ' ZIP'; break;
1871
                        case 4: $memtype .= ' ZIP'; break;
1256
                            case 5: $memtype .= ' SOJ'; break;
1872
                        case 5: $memtype .= ' SOJ'; break;
1257
                            case 6: $memtype .= ' Proprietary'; break;
1873
                        case 6: $memtype .= ' Proprietary'; break;
1258
                            case 7: $memtype .= ' SIMM'; break;
1874
                        case 7: $memtype .= ' SIMM'; break;
1259
                            case 8: $memtype .= ' DIMM'; break;
1875
                        case 8: $memtype .= ' DIMM'; break;
1260
                            case 9: $memtype .= ' TSOPO'; break;
1876
                        case 9: $memtype .= ' TSOPO'; break;
1261
                            case 10: $memtype .= ' PGA'; break;
1877
                        case 10: $memtype .= ' PGA'; break;
1262
                            case 11: $memtype .= ' RIM'; break;
1878
                        case 11: $memtype .= ' RIM'; break;
1263
                            case 12: $memtype .= ' SODIMM'; break;
1879
                        case 12: $memtype .= ' SODIMM'; break;
1264
                            case 13: $memtype .= ' SRIMM'; break;
1880
                        case 13: $memtype .= ' SRIMM'; break;
1265
                            case 14: $memtype .= ' SMD'; break;
1881
                        case 14: $memtype .= ' SMD'; break;
1266
                            case 15: $memtype .= ' SSMP'; break;
1882
                        case 15: $memtype .= ' SSMP'; break;
1267
                            case 16: $memtype .= ' QFP'; break;
1883
                        case 16: $memtype .= ' QFP'; break;
1268
                            case 17: $memtype .= ' TQFP'; break;
1884
                        case 17: $memtype .= ' TQFP'; break;
1269
                            case 18: $memtype .= ' SOIC'; break;
1885
                        case 18: $memtype .= ' SOIC'; break;
1270
                            case 19: $memtype .= ' LCC'; break;
1886
                        case 19: $memtype .= ' LCC'; break;
1271
                            case 20: $memtype .= ' PLCC'; break;
1887
                        case 20: $memtype .= ' PLCC'; break;
1272
                            case 21: $memtype .= ' BGA'; break;
1888
                        case 21: $memtype .= ' BGA'; break;
1273
                            case 22: $memtype .= ' FPBGA'; break;
1889
                        case 22: $memtype .= ' FPBGA'; break;
1274
                            case 23: $memtype .= ' LGA'; break;
1890
                        case 23: $memtype .= ' LGA';
1275
                        }
1891
                        }
1276
                    }
1892
                    }
1277
                    if (isset($mem['DataWidth']) && isset($mem['TotalWidth']) && (($dataw = $mem['DataWidth']) > 0) && (($totalw = $mem['TotalWidth']) > 0) && ($dataw < $totalw)) {
1893
                    if (isset($mem['DataWidth']) && isset($mem['TotalWidth']) && (($dataw = $mem['DataWidth']) > 0) && (($totalw = $mem['TotalWidth']) > 0) && ($dataw < $totalw)) {
1278
                        $memtype .= ' ECC';
1894
                        $memtype .= ' ECC';
1279
                    }
1895
                    }
Line 1302... Line 1918...
1302
    /**
1918
    /**
1303
     * get the information
1919
     * get the information
1304
     *
1920
     *
1305
     * @see PSI_Interface_OS::build()
1921
     * @see PSI_Interface_OS::build()
1306
     *
1922
     *
1307
     * @return Void
1923
     * @return void
1308
     */
1924
     */
1309
    public function build()
1925
    public function build()
1310
    {
1926
    {
1311
        $this->_distro(); //share getDistribution()
1927
        $this->_distro(); // share getDistribution()
1312
        if ($this->sys->getDistribution()=="ReactOS") {
1928
        if (substr($this->sys->getDistribution(), 0, 7)=="ReactOS") {
1313
            $this->error->addError("WARN", "The ReactOS version of phpSysInfo is a work in progress, some things currently don't work");
1929
            $this->error->addWarning("The ReactOS version of phpSysInfo is a work in progress, some things currently don't work");
1314
        }
1930
        }
1315
        if (!$this->blockname || $this->blockname==='vitals') {
1931
        if (!$this->blockname || $this->blockname==='vitals') {
1316
            $this->_hostname();
1932
            $this->_hostname();
1317
            $this->_users();
1933
            $this->_users();
1318
            $this->_uptime();
1934
            $this->_uptime();
1319
            $this->_loadavg();
1935
            $this->_loadavg();
1320
            $this->_processes();
1936
            $this->_processes();
1321
        }
1937
        }
1322
        if (!$this->blockname || $this->blockname==='network') {
-
 
1323
            $this->_network();
-
 
1324
        }
-
 
1325
        if (!$this->blockname || $this->blockname==='hardware') {
1938
        if (!$this->blockname || $this->blockname==='hardware') {
1326
            $this->_machine();
1939
            $this->_machine();
1327
            $this->_cpuinfo();
1940
            $this->_cpuinfo();
-
 
1941
            $this->_virtualizer();
1328
            $this->_meminfo();
1942
            $this->_meminfo();
1329
            $this->_hardware();
1943
            $this->_hardware();
1330
        }
1944
        }
-
 
1945
        if (!$this->blockname || $this->blockname==='memory') {
-
 
1946
            $this->_memory();
-
 
1947
        }
1331
        if (!$this->blockname || $this->blockname==='filesystem') {
1948
        if (!$this->blockname || $this->blockname==='filesystem') {
1332
            $this->_filesystems();
1949
            $this->_filesystems();
1333
        }
1950
        }
1334
        if (!$this->blockname || $this->blockname==='memory') {
1951
        if (!$this->blockname || $this->blockname==='network') {
1335
            $this->_memory();
1952
            $this->_network();
1336
        }
1953
        }
1337
    }
1954
    }
1338
}
1955
}