Subversion Repositories ALCASAR

Rev

Rev 2770 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2770 rexy 1
<?php
2
/**
3
 * WINNT System Class
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI WINNT OS class
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   SVN: $Id: class.WINNT.inc.php 699 2012-09-15 11:57:13Z namiltd $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 /**
16
 * WINNT sysinfo class
17
 * get all the required information from WINNT systems
18
 * information are retrieved through the WMI interface
19
 *
20
 * @category  PHP
21
 * @package   PSI WINNT OS class
22
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
23
 * @copyright 2009 phpSysInfo
24
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
25
 * @version   Release: 3.0
26
 * @link      http://phpsysinfo.sourceforge.net
27
 */
28
class WINNT extends OS
29
{
30
    /**
31
     * holds the data from WMI Win32_OperatingSystem
32
     *
33
     * @var array
34
     */
35
    private $_Win32_OperatingSystem = null;
325 richard 36
 
2770 rexy 37
    /**
38
     * holds the data from WMI Win32_ComputerSystem
39
     *
40
     * @var array
41
     */
42
    private $_Win32_ComputerSystem = null;
325 richard 43
 
2770 rexy 44
    /**
45
     * holds the data from WMI Win32_Processor
46
     *
47
     * @var array
48
     */
49
    private $_Win32_Processor = null;
325 richard 50
 
2770 rexy 51
     /**
52
     * holds the data from WMI Win32_PerfFormattedData_PerfOS_Processor
53
     *
54
     * @var array
55
     */
56
    private $_Win32_PerfFormattedData_PerfOS_Processor = null;
325 richard 57
 
2770 rexy 58
    /**
59
     * holds the data from systeminfo command
60
     *
61
     * @var string
62
     */
63
    private $_systeminfo = null;
325 richard 64
 
2770 rexy 65
    /**
2976 rexy 66
     * holds the COM object that we pull WMI root\CIMv2 data from
2770 rexy 67
     *
68
     * @var Object
69
     */
70
    private $_wmi = null;
325 richard 71
 
2770 rexy 72
    /**
2976 rexy 73
     * holds the COM object that we pull all the EnumKey and RegRead data from
2770 rexy 74
     *
75
     * @var Object
76
     */
77
    private $_reg = null;
78
 
79
    /**
2976 rexy 80
     * holds result of 'cmd /c ver'
2770 rexy 81
     *
2976 rexy 82
     * @var string
2770 rexy 83
     */
2976 rexy 84
    private $_ver = "";
2770 rexy 85
 
86
    /**
87
     * holds all devices, which are in the system
88
     *
89
     * @var array
90
     */
2976 rexy 91
    private $_wmidevices = array();
2770 rexy 92
 
93
    /**
94
     * holds all disks, which are in the system
95
     *
96
     * @var array
97
     */
2976 rexy 98
    private $_wmidisks = array();
2770 rexy 99
 
100
    /**
101
     * store language encoding of the system to convert some output to utf-8
102
     *
103
     * @var string
104
     */
105
    private $_codepage = null;
106
 
107
    /**
108
     * store language of the system
109
     *
110
     * @var string
111
     */
112
    private $_syslang = null;
113
 
114
    /**
115
     * reads the data from WMI Win32_OperatingSystem
116
     *
117
     * @return array
118
     */
119
    private function _get_Win32_OperatingSystem()
120
    {
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'));
122
        return $this->_Win32_OperatingSystem;
325 richard 123
    }
124
 
2770 rexy 125
    /**
126
     * reads the data from WMI Win32_ComputerSystem
127
     *
128
     * @return array
129
     */
130
    private function _get_Win32_ComputerSystem()
325 richard 131
    {
2976 rexy 132
        if ($this->_Win32_ComputerSystem === null) $this->_Win32_ComputerSystem = CommonFunctions::getWMI($this->_wmi, 'Win32_ComputerSystem', array('Name', 'Manufacturer', 'Model', 'SystemFamily'));
2770 rexy 133
        return $this->_Win32_ComputerSystem;
134
    }
135
 
136
    /**
137
     * reads the data from WMI Win32_Processor
138
     *
139
     * @return array
140
     */
141
    private function _get_Win32_Processor()
142
    {
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'));
144
        return $this->_Win32_Processor;
145
    }
146
 
147
    /**
148
     * reads the data from WMI Win32_PerfFormattedData_PerfOS_Processor
149
     *
150
     * @return array
151
     */
152
    private function _get_Win32_PerfFormattedData_PerfOS_Processor()
153
    {
154
        if ($this->_Win32_PerfFormattedData_PerfOS_Processor === null) {
155
            $this->_Win32_PerfFormattedData_PerfOS_Processor = array();
156
            $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
158
                $cpubuffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfFormattedData_PerfOS_Processor', array('Name', 'PercentProcessorTime'));
159
                if ($cpubuffer) foreach ($cpubuffer as $cpu) {
160
                    if (isset($cpu['Name']) && isset($cpu['PercentProcessorTime'])) {
161
                        $this->_Win32_PerfFormattedData_PerfOS_Processor['cpu'.$cpu['Name']] = $cpu['PercentProcessorTime'];
162
                    }
163
                }
325 richard 164
            }
165
        }
166
 
2770 rexy 167
        return $this->_Win32_PerfFormattedData_PerfOS_Processor;
325 richard 168
    }
169
 
2770 rexy 170
    /**
171
     * reads the data from systeminfo
172
     *
173
     * @return string
174
     */
175
    private function _get_systeminfo()
176
    {
2976 rexy 177
        if (!defined('PSI_EMU_HOSTNAME')) {
178
            if ($this->_systeminfo === null) CommonFunctions::executeProgram('systeminfo', '', $this->_systeminfo, false);
179
            return $this->_systeminfo;
180
        } else {
181
            return '';
182
        }
325 richard 183
    }
184
 
2770 rexy 185
    /**
186
     * build the global Error object and create the WMI connection
187
     */
188
    public function __construct($blockname = false)
189
    {
190
        parent::__construct($blockname);
2976 rexy 191
        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;
2770 rexy 193
        }
2976 rexy 194
        if (($this->_ver !== "") && preg_match("/ReactOS\r?\n\S+\s+.+/", $this->_ver)) {
195
            $this->_wmi = false; // No WMI info on ReactOS yet
196
            $this->_reg = false; // No EnumKey and ReadReg on ReactOS yet
197
        } else {
198
            if (PSI_OS == 'WINNT') {
199
                if (defined('PSI_EMU_HOSTNAME')) {
200
                    try {
201
                        $objLocator = new COM('WbemScripting.SWbemLocator');
202
                        $wmi = $objLocator->ConnectServer('', 'root\CIMv2');
203
                        $buffer = CommonFunctions::getWMI($wmi, 'Win32_OperatingSystem', array('CodeSet'));
204
                        if (!$buffer) {
205
                            $reg = $objLocator->ConnectServer('', 'root\default');
206
                            if (CommonFunctions::readReg($reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
207
                                $buffer[0]['CodeSet'] = $strBuf;
208
                            }
209
                        }
210
                        if ($buffer && isset($buffer[0])) {
211
                            if (isset($buffer[0]['CodeSet'])) {
212
                                $codeset = $buffer[0]['CodeSet'];
213
                                if ($codeset == 932) {
214
                                    $codename = ' (SJIS)';
215
                                } elseif ($codeset == 949) {
216
                                    $codename = ' (EUC-KR)';
217
                                } elseif ($codeset == 950) {
218
                                    $codename = ' (BIG-5)';
219
                                } else {
220
                                    $codename = '';
221
                                }
222
                                define('PSI_SYSTEM_CODEPAGE', 'windows-'.$codeset.$codename);
223
                            }
224
                        }
225
                    } catch (Exception $e) {
226
                        define('PSI_SYSTEM_CODEPAGE', null);
227
                        if (PSI_DEBUG) {
228
                            $this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed");
229
                        }
230
                    }
231
                } else {
232
                    define('PSI_SYSTEM_CODEPAGE', null);
233
                }
234
            }
235
            $this->_wmi = CommonFunctions::initWMI('root\CIMv2', true);
236
            if (PSI_OS == 'WINNT') {
237
                $this->_reg = CommonFunctions::initWMI('root\default', PSI_DEBUG);
238
                if (gettype($this->_reg) === "object") {
239
                    $this->_reg->Security_->ImpersonationLevel = 3;
240
                }
241
            } else {
242
                $this->_reg = false; // No EnumKey and ReadReg on Linux
243
            }
2770 rexy 244
        }
325 richard 245
 
2770 rexy 246
        $this->_getCodeSet();
247
    }
325 richard 248
 
2770 rexy 249
    /**
250
     * store the codepage of the os for converting some strings to utf-8
251
     *
252
     * @return void
253
     */
254
    private function _getCodeSet()
255
    {
256
        $buffer = $this->_get_Win32_OperatingSystem();
257
        if (!$buffer) {
258
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP", $strBuf, false)) {
259
                $buffer[0]['CodeSet'] = $strBuf;
260
            }
261
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Language\\Default", $strBuf, false)) {
262
                $buffer[0]['Locale'] = $strBuf;
263
            }
264
        }
265
        if ($buffer && isset($buffer[0])) {
266
            if (isset($buffer[0]['CodeSet'])) {
267
                $codeset = $buffer[0]['CodeSet'];
268
                if ($codeset == 932) {
269
                    $codename = ' (SJIS)';
270
                } elseif ($codeset == 949) {
271
                    $codename = ' (EUC-KR)';
272
                } elseif ($codeset == 950) {
273
                    $codename = ' (BIG-5)';
274
                } else {
275
                    $codename = '';
276
                }
277
                CommonFunctions::setcp($codeset);
278
                $this->_codepage = 'windows-'.$codeset.$codename;
279
            }
280
            if (isset($buffer[0]['Locale']) && (($locale = hexdec($buffer[0]['Locale']))>0)) {
281
                $lang = "";
282
                if (is_readable(PSI_APP_ROOT.'/data/languages.ini') && ($langdata = @parse_ini_file(PSI_APP_ROOT.'/data/languages.ini', true))) {
283
                    if (isset($langdata['WINNT'][$locale])) {
284
                        $lang = $langdata['WINNT'][$locale];
285
                    }
286
                }
287
                if ($lang == "") {
288
                    $lang = 'Unknown';
289
                }
290
                $this->_syslang = $lang.' ('.$locale.')';
291
            }
292
        }
293
    }
325 richard 294
 
2770 rexy 295
    /**
296
     * retrieve different device types from the system based on selector
297
     *
298
     * @param string $strType type of the devices that should be returned
299
     *
300
     * @return array list of devices of the specified type
301
     */
302
    private function _devicelist($strType)
303
    {
304
        if (empty($this->_wmidevices)) {
305
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
306
                $this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID', 'Manufacturer', 'PNPClass'));
307
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
308
                    $this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size', 'SerialNumber'));
309
                } else {
310
                    $this->_wmidisks = CommonFunctions::getWMI($this->_wmi, 'Win32_DiskDrive', array('PNPDeviceID', 'Size'));
311
                }
312
            } else {
313
                $this->_wmidevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PnPEntity', array('Name', 'PNPDeviceID'));
314
            }
2976 rexy 315
 
316
            if (empty($this->_wmidevices)) {
317
                $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\Scsi";
318
                $id = 0;
319
                if (CommonFunctions::enumKey($this->_reg, $hkey, $portBuf, false)) {
320
                    foreach ($portBuf as $scsiport) {
321
                        if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport, $busBuf, false)) {
322
                            foreach ($busBuf as $scsibus) {
323
                                if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus, $tarBuf, false)) {
324
                                    foreach ($tarBuf as $scsitar) if (!strncasecmp($scsitar, "Target Id ", strlen("Target Id "))) {
325
                                        if (CommonFunctions::enumKey($this->_reg, $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar, $logBuf, false)) {
326
                                            foreach ($logBuf as $scsilog) if (!strncasecmp($scsilog, "Logical Unit Id ", strlen("Logical Unit Id "))) {
327
                                               $hkey2 = $hkey."\\".$scsiport."\\".$scsibus."\\".$scsitar."\\".$scsilog."\\";
328
                                               if ((CommonFunctions::readReg($this->_reg, $hkey2."DeviceType", $typeBuf, false) || CommonFunctions::readReg($this->_reg, $hkey2."Type", $typeBuf, false))
329
                                                  && (($typeBuf=strtolower(trim($typeBuf))) !== "")) {
330
                                                  if ((($typeBuf == 'diskperipheral') || ($typeBuf == 'cdromperipheral'))
331
                                                     && CommonFunctions::readReg($this->_reg, $hkey2."Identifier", $ideBuf, false)) {
332
                                                      $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
334
                                                         && (CommonFunctions::readReg($this->_reg, $hkey2."SerialNumber", $serBuf, false))
335
                                                         && (($serBuf=trim($serBuf)) !== "")) {
336
                                                          $this->_wmidisks[] = array('PNPDeviceID'=>'SCSI\\'.$id, 'SerialNumber'=>$serBuf);
337
                                                      }
338
                                                      $id++;
339
                                                  }
340
                                               }
341
                                            }
342
                                        }
343
                                    }
344
                                }
345
                            }
346
                        }
347
                    }
348
                }
349
            }
2770 rexy 350
        }
2976 rexy 351
 
2770 rexy 352
        $list = array();
353
        foreach ($this->_wmidevices as $device) {
354
            if (substr($device['PNPDeviceID'], 0, strpos($device['PNPDeviceID'], "\\") + 1) == ($strType."\\")) {
355
                if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
356
                    if (!isset($device['PNPClass']) || ($device['PNPClass']===$strType) || ($device['PNPClass']==='System')) {
357
                        $device['PNPClass'] = null;
358
                    }
2976 rexy 359
                    if (!isset($device['Manufacturer']) || preg_match('/^\(.*\)$/', $device['Manufacturer']) || (($device['PNPClass']==='USB') && preg_match('/\sUSB\s/', $device['Manufacturer']))) {
2770 rexy 360
                        $device['Manufacturer'] = null;
361
                    }
362
                    $device['Capacity'] = null;
363
                    if (($strType==='IDE')||($strType==='SCSI')) {
364
                        foreach ($this->_wmidisks as $disk) {
365
                            if (($disk['PNPDeviceID'] === $device['PNPDeviceID']) && isset($disk['Size'])) {
366
                                $device['Capacity'] = $disk['Size'];
367
                                break;
368
                            }
369
                        }
370
                    }
371
                    $device['Serial'] = null;
372
                    if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
373
                        if ($strType==='USB') {
374
                            if (preg_match('/\\\\(\w+)$/', $device['PNPDeviceID'], $buf)) {
375
                                $device['Serial'] = $buf[1];
376
                            }
377
                        } elseif (($strType==='IDE')||($strType==='SCSI')) {
378
                            foreach ($this->_wmidisks as $disk) {
379
                                if (($disk['PNPDeviceID'] === $device['PNPDeviceID']) && isset($disk['SerialNumber'])) {
380
                                    $device['Serial'] = $disk['SerialNumber'];
381
                                    break;
382
                                }
383
                            }
384
                        }
385
                    }
386
                    $list[] = array('Name'=>$device['Name'], 'Manufacturer'=>$device['Manufacturer'], 'Product'=>$device['PNPClass'], 'Capacity'=>$device['Capacity'], 'Serial'=>$device['Serial']);
387
                } else {
388
                    $list[] = array('Name'=>$device['Name']);
389
                }
390
            }
391
        }
325 richard 392
 
2770 rexy 393
        return $list;
325 richard 394
    }
395
 
2770 rexy 396
    /**
397
     * Host Name
398
     *
399
     * @return void
400
     */
401
    private function _hostname()
402
    {
2976 rexy 403
        if ((PSI_USE_VHOST === true) && !defined('PSI_EMU_HOSTNAME')) {
2770 rexy 404
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
405
        } else {
406
            $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)) {
408
                    $buffer[0]['Name'] = $strBuf;
409
            }
410
            if ($buffer) {
411
                $result = $buffer[0]['Name'];
412
                $ip = gethostbyname($result);
413
                if ($ip != $result) {
414
                    if ((version_compare("10.0.0.0", $ip, "<=") && version_compare($ip, "10.255.255.255", "<=")) ||
415
                        (version_compare("172.16.0.0", $ip, "<=") && version_compare($ip, "172.31.255.255", "<=")) ||
416
                        (version_compare("192.168.0.0", $ip, "<=") && version_compare($ip, "192.168.255.255", "<=")) ||
417
                        (version_compare("127.0.0.0", $ip, "<=") && version_compare($ip, "127.255.255.255", "<=")) ||
418
                        (version_compare("169.254.1.0", $ip, "<=") && version_compare($ip, "169.254.254.255", "<=")) ||
419
                        (version_compare("255.255.255.255", $ip, "=="))) {
420
                        $this->sys->setHostname($result); // internal ip
421
                    } else {
2976 rexy 422
                        $hostname = gethostbyaddr($ip);
423
                        if ($hostname !== false)
424
                            $this->sys->setHostname($hostname);
425
                        else
426
                            $this->sys->setHostname($result);
2770 rexy 427
                    }
2976 rexy 428
                } else {
429
                    $this->sys->setHostname($result);
2770 rexy 430
                }
2976 rexy 431
            } elseif (defined('PSI_EMU_HOSTNAME')) {
432
                $this->sys->setHostname(PSI_EMU_HOSTNAME);
433
            } elseif (CommonFunctions::readenv('COMPUTERNAME', $hnm)) {
434
                $this->sys->setHostname($hnm);
2770 rexy 435
            }
436
        }
437
    }
325 richard 438
 
2770 rexy 439
    /**
440
     * UpTime
441
     * time the system is running
442
     *
443
     * @return void
444
     */
445
    private function _uptime()
446
    {
447
        $result = 0;
448
        date_default_timezone_set('UTC');
449
        $buffer = $this->_get_Win32_OperatingSystem();
450
        if ($buffer && ($buffer[0]['LastBootUpTime'] !== null)) {
451
            $local = $buffer[0]['LocalDateTime'];
452
            $boot = $buffer[0]['LastBootUpTime'];
325 richard 453
 
2770 rexy 454
            $lyear = intval(substr($local, 0, 4));
455
            $lmonth = intval(substr($local, 4, 2));
456
            $lday = intval(substr($local, 6, 2));
457
            $lhour = intval(substr($local, 8, 2));
458
            $lminute = intval(substr($local, 10, 2));
459
            $lseconds = intval(substr($local, 12, 2));
460
            $loffset = intval(substr($boot, 21, 4));
325 richard 461
 
2770 rexy 462
            $byear = intval(substr($boot, 0, 4));
463
            $bmonth = intval(substr($boot, 4, 2));
464
            $bday = intval(substr($boot, 6, 2));
465
            $bhour = intval(substr($boot, 8, 2));
466
            $bminute = intval(substr($boot, 10, 2));
467
            $bseconds = intval(substr($boot, 12, 2));
468
            $boffset = intval(substr($boot, 21, 4));
325 richard 469
 
2770 rexy 470
            if (version_compare($buffer[0]['Version'], "5.1", "<")) { // fix LastBootUpTime on Windows 2000 and older
471
                $boffset += $boffset;
472
            }
325 richard 473
 
2770 rexy 474
            $localtime = mktime($lhour, $lminute, $lseconds, $lmonth, $lday, $lyear) - $loffset*60;
475
            $boottime = mktime($bhour, $bminute, $bseconds, $bmonth, $bday, $byear) - $boffset*60;
325 richard 476
 
2770 rexy 477
            $result = $localtime - $boottime;
325 richard 478
 
2770 rexy 479
            $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)) {
481
            $sec = $ar_buf[4];
482
            $min = $ar_buf[3];
483
            $hours = $ar_buf[2];
484
            $days = $ar_buf[1];
485
            $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60 + $sec);
486
        }
325 richard 487
    }
2770 rexy 488
 
489
    /**
490
     * Number of Users
491
     *
492
     * @return void
493
     */
494
    protected function _users()
495
    {
2976 rexy 496
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('quser', '', $strBuf, false) && (strlen($strBuf) > 0)) {
2770 rexy 497
                $lines = preg_split('/\n/', $strBuf);
498
                $users = count($lines)-1;
499
        } else {
500
            $users = 0;
501
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
502
            foreach ($buffer as $process) {
503
                if (strtoupper($process['Caption']) == strtoupper('explorer.exe')) {
504
                    $users++;
505
                }
506
            }
507
        }
508
        $this->sys->setUsers($users);
325 richard 509
    }
510
 
2770 rexy 511
    /**
512
     * Distribution
513
     *
514
     * @return void
515
     */
516
    private function _distro()
517
    {
518
        $buffer = $this->_get_Win32_OperatingSystem();
519
        if ($buffer) {
520
            $ver = $buffer[0]['Version'];
521
            $kernel = $ver;
522
            if ($buffer[0]['ServicePackMajorVersion'] > 0) {
523
                $kernel .= ' SP'.$buffer[0]['ServicePackMajorVersion'];
524
            }
525
            if (isset($buffer[0]['OSArchitecture']) && preg_match("/^(\d+)/", $buffer[0]['OSArchitecture'], $bits)) {
526
                $this->sys->setKernel($kernel.' ('.$bits[1].'-bit)');
527
            } elseif (($allCpus = $this->_get_Win32_Processor()) && isset($allCpus[0]['AddressWidth'])) {
528
                $this->sys->setKernel($kernel.' ('.$allCpus[0]['AddressWidth'].'-bit)');
529
            } else {
530
                $this->sys->setKernel($kernel);
531
            }
532
            $this->sys->setDistribution($buffer[0]['Caption']);
325 richard 533
 
2770 rexy 534
            if (version_compare($ver, "5.1", "<"))
535
                $icon = 'Win2000.png';
536
            elseif (version_compare($ver, "5.1", ">=") && version_compare($ver, "6.0", "<"))
537
                $icon = 'WinXP.png';
538
            elseif (version_compare($ver, "6.0", ">=") && version_compare($ver, "6.2", "<"))
539
                $icon = 'WinVista.png';
540
            else
541
                $icon = 'Win8.png';
542
            $this->sys->setDistributionIcon($icon);
2976 rexy 543
        } elseif ($this->_ver !== "") {
544
                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)) {
546
                        $this->sys->setDistribution("ReactOS ".trim($ver_temp[1]));
547
                        $this->sys->setKernel(trim($ver_temp[2]));
548
                    } else {
549
                        $this->sys->setDistribution("ReactOS");
550
                        $this->sys->setKernel($ar_temp[1]);
551
                    }
2770 rexy 552
                    $this->sys->setDistributionIcon('ReactOS.png');
2976 rexy 553
                } elseif (preg_match("/^(Microsoft [^\[]*)\s*\[\D*\s*(.+)\]/", $this->_ver, $ar_temp)) {
2770 rexy 554
                    if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName", $strBuf, false) && (strlen($strBuf) > 0)) {
555
                        if (preg_match("/^Microsoft /", $strBuf)) {
556
                            $this->sys->setDistribution($strBuf);
557
                        } else {
558
                            $this->sys->setDistribution("Microsoft ".$strBuf);
559
                        }
560
                    } else {
561
                        $this->sys->setDistribution($ar_temp[1]);
562
                    }
563
                    $kernel = $ar_temp[2];
564
                    $this->sys->setKernel($kernel);
565
                    if ((($kernel[1] == '.') && ($kernel[0] <5)) || (substr($kernel, 0, 4) == '5.0.'))
566
                        $icon = 'Win2000.png';
567
                    elseif ((substr($kernel, 0, 4) == '6.0.') || (substr($kernel, 0, 4) == '6.1.'))
568
                        $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.'))
570
                        $icon = 'Win8.png';
571
                    else
572
                        $icon = 'WinXP.png';
573
                    $this->sys->setDistributionIcon($icon);
574
                } else {
2976 rexy 575
                    $this->sys->setDistribution("WINNT");
576
                    $this->sys->setDistributionIcon('WINNT.png');
2770 rexy 577
                }
578
        } else {
2976 rexy 579
            $this->sys->setDistribution("WINNT");
580
            $this->sys->setDistributionIcon('WINNT.png');
2770 rexy 581
        }
582
    }
325 richard 583
 
2770 rexy 584
    /**
585
     * Processor Load
586
     * optionally create a loadbar
587
     *
588
     * @return void
589
     */
590
    private function _loadavg()
591
    {
592
        if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && isset($cpubuffer['cpu_Total'])) {
593
            $this->sys->setLoad($cpubuffer['cpu_Total']);
594
            if (PSI_LOAD_BAR) {
595
                $this->sys->setLoadPercent($cpubuffer['cpu_Total']);
596
            }
597
        } elseif ($buffer = $this->_get_Win32_Processor()) {
598
            $loadok = true;
599
            $sum = 0;
600
            foreach ($buffer as $load) {
601
                $value = $load['LoadPercentage'];
602
                if ($value !== null) {
603
                    $sum += $value;
604
                } else {
605
                    $loadok = false;
606
                    break;
607
                }
608
            }
609
            if ($loadok) {
610
                $percent = $sum / count($buffer);
611
                $this->sys->setLoad($percent);
612
                if (PSI_LOAD_BAR) {
613
                    $this->sys->setLoadPercent($percent);
614
                }
615
            }
616
        }
617
    }
325 richard 618
 
2770 rexy 619
    /**
620
     * CPU information
621
     *
622
     * @return void
623
     */
624
    private function _cpuinfo()
625
    {
626
        $allCpus = $this->_get_Win32_Processor();
627
        if (!$allCpus) {
628
            $hkey = "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
2976 rexy 629
            if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) {
2770 rexy 630
                foreach ($arrBuf as $coreCount) {
631
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\ProcessorNameString", $strBuf, false)) {
632
                        $allCpus[$coreCount]['Name'] = $strBuf;
633
                    }
634
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\~MHz", $strBuf, false)) {
635
                        if (preg_match("/^0x([0-9a-f]+)$/i", $strBuf, $hexvalue)) {
636
                            $allCpus[$coreCount]['CurrentClockSpeed'] = hexdec($hexvalue[1]);
637
                        }
638
                    }
639
                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$coreCount."\\VendorIdentifier", $strBuf, false)) {
640
                        $allCpus[$coreCount]['Manufacturer'] = $strBuf;
641
                    }
642
                }
643
            }
644
        }
325 richard 645
 
2770 rexy 646
        $globalcpus = 0;
647
        foreach ($allCpus as $oneCpu) {
648
            $cpuCount = 1;
649
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
650
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
651
            } elseif (isset($oneCpu['NumberOfCores'])) {
652
                $cpuCount = $oneCpu['NumberOfCores'];
653
            }
654
            $globalcpus+=$cpuCount;
655
        }
325 richard 656
 
2770 rexy 657
        foreach ($allCpus as $oneCpu) {
658
            $cpuCount = 1;
659
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
660
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
661
            } elseif (isset($oneCpu['NumberOfCores'])) {
662
                $cpuCount = $oneCpu['NumberOfCores'];
663
            }
664
            for ($i = 0; $i < $cpuCount; $i++) {
665
                $cpu = new CpuDevice();
666
                if (isset($oneCpu['Name'])) $cpu->setModel($oneCpu['Name']);
667
                if (isset($oneCpu['L3CacheSize']) && ($oneCpu['L3CacheSize'] > 0)) {
668
                    $cpu->setCache($oneCpu['L3CacheSize'] * 1024);
669
                } elseif (isset($oneCpu['L2CacheSize'])) {
670
                    $cpu->setCache($oneCpu['L2CacheSize'] * 1024);
671
                }
672
                if (isset($oneCpu['CurrentClockSpeed'])) {
673
                    $cpu->setCpuSpeed($oneCpu['CurrentClockSpeed']);
674
                    if (isset($oneCpu['MaxClockSpeed']) && ($oneCpu['CurrentClockSpeed'] < $oneCpu['MaxClockSpeed'])) $cpu->setCpuSpeedMax($oneCpu['MaxClockSpeed']);
675
                }
676
                if (isset($oneCpu['ExtClock'])) $cpu->setBusSpeed($oneCpu['ExtClock']);
677
                if (isset($oneCpu['Manufacturer'])) $cpu->setVendorId($oneCpu['Manufacturer']);
678
                if (PSI_LOAD_BAR) {
679
                    if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && (count($cpubuffer) == ($globalcpus+1)) && isset($cpubuffer['cpu'.$i])) {
680
                           $cpu->setLoad($cpubuffer['cpu'.$i]);
681
                    } elseif ((count($allCpus) == $globalcpus) && isset($oneCpu['LoadPercentage'])) {
682
                        $cpu->setLoad($oneCpu['LoadPercentage']);
683
                    }
684
                }
685
                $this->sys->setCpus($cpu);
686
            }
687
        }
688
    }
325 richard 689
 
2770 rexy 690
    /**
691
     * Machine information
692
     *
693
     * @return void
694
     */
695
    private function _machine()
696
    {
697
        $buffer = $this->_get_Win32_ComputerSystem();
2976 rexy 698
        $bufferp = CommonFunctions::getWMI($this->_wmi, 'Win32_BaseBoard', array('Product'));
699
        $bufferb = CommonFunctions::getWMI($this->_wmi, 'Win32_BIOS', array('SMBIOSBIOSVersion', 'ReleaseDate'));
700
 
701
        if (!$buffer) {
702
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\systemManufacturer", $strBuf, false)) {
703
                $buffer[0]['Manufacturer'] = $strBuf;
704
            }
705
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemProductName", $strBuf, false)) {
706
                $buffer[0]['Model'] = $strBuf;
707
            }
708
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\SystemFamily", $strBuf, false)) {
709
                $buffer[0]['SystemFamily'] = $strBuf;
710
            }
711
        }
712
        if (!$bufferp) {
713
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BaseBoardProduct", $strBuf, false)) {
714
                $bufferp[0]['Product'] = $strBuf;
715
            }
716
        }
717
        if (!$bufferb) {
718
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSVersion", $strBuf, false)) {
719
                $bufferb[0]['SMBIOSBIOSVersion'] = $strBuf;
720
            }
721
            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\BIOS\\BIOSReleaseDate", $strBuf, false)) {
722
                $bufferb[0]['ReleaseDate'] = $strBuf;
723
            }
724
        }
725
        $buf = "";
726
        $model = "";
727
        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 !== "")) {
2770 rexy 729
                $buf .= ' '.$buf2;
730
            }
325 richard 731
 
2976 rexy 732
            if (isset($buffer[0]['Model']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Product Name$|^Not Specified$/i", $buf2=trim($buffer[0]['Model'])) && ($buf2 !== "")) {
733
                $model = $buf2;
2770 rexy 734
                $buf .= ' '.$buf2;
735
            }
2976 rexy 736
        }
737
        if ($bufferp && isset($bufferp[0])) {
738
            if (isset($bufferp[0]['Product']) && !preg_match("/^To be filled by O\.E\.M\.$|^BaseBoard Product Name$|^Not Specified$|^Default string$/i", $buf2=trim($bufferp[0]['Product'])) && ($buf2 !== "")) {
739
                if ($buf2 !== $model) {
740
                    $buf .= '/'.$buf2;
741
                } elseif (isset($buffer[0]['SystemFamily']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Family$|^Not Specified$/i", $buf2=trim($buffer[0]['SystemFamily'])) && ($buf2 !== "")) {
742
                    $buf .= '/'.$buf2;
743
                }
2770 rexy 744
            }
745
        }
2976 rexy 746
        if ($bufferb && isset($bufferb[0])) {
747
            $bver = "";
748
            $brel = "";
749
            if (isset($bufferb[0]['SMBIOSBIOSVersion']) && (($buf2=trim($bufferb[0]['SMBIOSBIOSVersion'])) !== "")) {
750
                $bver .= ' '.$buf2;
751
            }
752
            if (isset($bufferb[0]['ReleaseDate'])) {
753
                if (preg_match("/^(\d{4})(\d{2})(\d{2})\d{6}\.\d{6}\+\d{3}$/", $bufferb[0]['ReleaseDate'], $dateout)) {
754
                    $brel .= ' '.$dateout[2].'/'.$dateout[3].'/'.$dateout[1];
755
                } elseif (preg_match("/^\d{2}\/\d{2}\/\d{4}$/", $bufferb[0]['ReleaseDate'])) {
756
                    $brel .= ' '.$bufferb[0]['ReleaseDate'];
757
                }
758
            }
759
            if ((trim($bver) !== "") || (trim($brel) !== "")) {
760
                $buf .= ', BIOS'.$bver.$brel;
761
            }
762
        }
763
 
764
        if (trim($buf) != "") {
765
            $this->sys->setMachine(trim($buf));
766
        }
2770 rexy 767
    }
325 richard 768
 
2770 rexy 769
    /**
770
     * Hardwaredevices
771
     *
772
     * @return void
773
     */
774
    private function _hardware()
775
    {
776
        foreach ($this->_devicelist('PCI') as $pciDev) {
777
            $dev = new HWDevice();
778
            $dev->setName($pciDev['Name']);
779
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
2976 rexy 780
                if (($pciDev['Manufacturer'] !== null) && preg_match("/^@[^\.]+\.inf,%([^%]+)%$/i", trim($pciDev['Manufacturer']), $mbuff)) {
781
                   $dev->setManufacturer($mbuff[1]);
782
                } else {
783
                    $dev->setManufacturer($pciDev['Manufacturer']);
784
                }
2770 rexy 785
                $dev->setProduct($pciDev['Product']);
786
            }
787
            $this->sys->setPciDevices($dev);
788
        }
325 richard 789
 
2770 rexy 790
        foreach ($this->_devicelist('IDE') as $ideDev) {
791
            $dev = new HWDevice();
792
            $dev->setName($ideDev['Name']);
793
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
794
                $dev->setCapacity($ideDev['Capacity']);
795
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
796
                    $dev->setSerial($ideDev['Serial']);
797
                }
798
            }
799
            $this->sys->setIdeDevices($dev);
800
        }
325 richard 801
 
2770 rexy 802
        foreach ($this->_devicelist('SCSI') as $scsiDev) {
803
            $dev = new HWDevice();
804
            $dev->setName($scsiDev['Name']);
805
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
806
                $dev->setCapacity($scsiDev['Capacity']);
807
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
808
                    $dev->setSerial($scsiDev['Serial']);
809
                }
810
            }
811
            $this->sys->setScsiDevices($dev);
812
        }
325 richard 813
 
2770 rexy 814
        foreach ($this->_devicelist('USB') as $usbDev) {
815
            $dev = new HWDevice();
816
            $dev->setName($usbDev['Name']);
817
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
818
                $dev->setManufacturer($usbDev['Manufacturer']);
819
                $dev->setProduct($usbDev['Product']);
820
                if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) {
821
                    $dev->setSerial($usbDev['Serial']);
822
                }
823
            }
824
            $this->sys->setUsbDevices($dev);
825
        }
826
    }
325 richard 827
 
2770 rexy 828
    /**
829
     * Network devices
830
     *
831
     * @return void
832
     */
833
    private function _network()
834
    {
835
        if ($this->_wmi) {
836
            $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
838
                $allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkAdapter', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
839
            } else {
840
                $allDevices = CommonFunctions::getWMI($this->_wmi, 'Win32_PerfRawData_Tcpip_NetworkInterface', array('Name', 'BytesSentPersec', 'BytesTotalPersec', 'BytesReceivedPersec', 'PacketsReceivedErrors', 'PacketsReceivedDiscarded', 'CurrentBandwidth'));
841
            }
842
            if ($allDevices) {
843
                $aliases = array();
844
                $hkey = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}";
2976 rexy 845
                if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) {
2770 rexy 846
                    foreach ($arrBuf as $netID) {
2976 rexy 847
                        if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\PnPInstanceId", $strInstanceID, false)) {
2770 rexy 848
                            if (CommonFunctions::readReg($this->_reg, "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\".$strInstanceID."\\FriendlyName", $strName, false)) {
2976 rexy 849
                                $cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical
2770 rexy 850
                                if (!isset($aliases[$cname])) { // duplicate checking
851
                                    $aliases[$cname]['id'] = $netID;
852
                                    $aliases[$cname]['name'] = $strName;
853
                                    if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netID."\\Connection\\Name", $strCName, false)
2976 rexy 854
                                       && (str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strCName) !== $cname)) {
2770 rexy 855
                                        $aliases[$cname]['netname'] = $strCName;
856
                                    }
857
                                } else {
858
                                    $aliases[$cname]['id'] = '';
859
                                }
860
                            }
861
                        }
862
                    }
863
                }
325 richard 864
 
2770 rexy 865
                $aliases2 = array();
866
                $hkey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards";
2976 rexy 867
                if (CommonFunctions::enumKey($this->_reg, $hkey, $arrBuf, false)) {
2770 rexy 868
                    foreach ($arrBuf as $netCount) {
869
                        if (CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\Description", $strName, false)
870
                            && CommonFunctions::readReg($this->_reg, $hkey."\\".$netCount."\\ServiceName", $strGUID, false)) {
2976 rexy 871
                            $cname = str_replace(array('(', ')', '#', '/'), array('[', ']', '_', '_'), $strName); //convert to canonical
2770 rexy 872
                            if (!isset($aliases2[$cname])) { // duplicate checking
873
                                $aliases2[$cname]['id'] = $strGUID;
874
                                $aliases2[$cname]['name'] = $strName;
875
                            } else {
876
                                $aliases2[$cname]['id'] = '';
877
                            }
878
                        }
879
                    }
880
                }
325 richard 881
 
2770 rexy 882
                $allNetworkAdapterConfigurations = CommonFunctions::getWMI($this->_wmi, 'Win32_NetworkAdapterConfiguration', array('SettingID', /*'Description',*/ 'MACAddress', 'IPAddress'));
883
                foreach ($allDevices as $device) if (!preg_match('/^WAN Miniport \[/', $device['Name'])) {
884
                    $dev = new NetDevice();
885
                    $name = $device['Name'];
325 richard 886
 
2770 rexy 887
                    if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $name)) {
888
                        $dev->setName("Microsoft ISATAP Adapter");
889
                    } else {
890
                        if (preg_match('/\s-\s([^-]*)$/', $name, $ar_name)) {
891
                            $name=substr($name, 0, strlen($name)-strlen($ar_name[0]));
892
                        }
893
                        $dev->setName($name);
894
                    }
325 richard 895
 
2770 rexy 896
                    $macexist = false;
897
                    if (((($ali=$aliases) && isset($ali[$name])) || (($ali=$aliases2) && isset($ali[$name]))) && isset($ali[$name]['id']) && ($ali[$name]['id'] !== "")) {
898
                        foreach ($allNetworkAdapterConfigurations as $NetworkAdapterConfiguration) {
899
                            if ($ali[$name]['id']==$NetworkAdapterConfiguration['SettingID']) {
900
                                $mininame = $ali[$name]['name'];
901
                                if (preg_match('/^isatap\.({[A-Fa-f0-9\-]*})/', $mininame))
902
                                    $mininame="Microsoft ISATAP Adapter";
903
                                elseif (preg_match('/\s-\s([^-]*)$/', $mininame, $ar_name))
904
                                    $name=substr($mininame, 0, strlen($mininame)-strlen($ar_name[0]));
905
                                $dev->setName($mininame);
906
                                if (trim($NetworkAdapterConfiguration['MACAddress']) !== "") $macexist = true;
907
                                if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
908
                                    if (isset($ali[$name]['netname'])) $dev->setInfo(str_replace(';', ':', $ali[$name]['netname']));
909
                                    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'])));
911
                                    if (isset($NetworkAdapterConfiguration['IPAddress']))
912
                                        foreach ($NetworkAdapterConfiguration['IPAddress'] as $ipaddres)
913
                                            if (($ipaddres != "0.0.0.0") && ($ipaddres != "::") && !preg_match('/^fe80::/i', $ipaddres))
914
                                                $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
915
                                }
325 richard 916
 
2770 rexy 917
                                break;
918
                            }
919
                        }
920
                    }
921
 
922
                    if ($macexist
923
//                        || ($device['CurrentBandwidth'] >= 1000000)
924
                        || ($device['BytesTotalPersec'] != 0)
925
                        || ($device['BytesSentPersec'] != 0)
926
                        || ($device['BytesReceivedPersec'] != 0)
927
                        || ($device['PacketsReceivedErrors'] != 0)
928
                        || ($device['PacketsReceivedDiscarded'] != 0)) { // hide unused
929
                        if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS) {
930
                            if (($speedinfo = $device['CurrentBandwidth']) >= 1000000) {
931
                                if ($speedinfo > 1000000000) {
932
                                    $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').round($speedinfo/1000000000, 2)."Gb/s");
933
                                } else {
934
                                    $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').round($speedinfo/1000000, 2)."Mb/s");
935
                                }
936
                            }
937
                        }
938
 
939
                        // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_perfrawdata_tcpip_networkinterface.asp
940
                        // there is a possible bug in the wmi interfaceabout uint32 and uint64: http://www.ureader.com/message/1244948.aspx, so that
941
                        // magative numbers would occour, try to calculate the nagative value from total - positive number
942
                        $txbytes = $device['BytesSentPersec'];
943
                        $rxbytes = $device['BytesReceivedPersec'];
944
                        if (($txbytes < 0) && ($rxbytes < 0)) {
945
                            $txbytes += 4294967296;
946
                            $rxbytes += 4294967296;
947
                        } elseif ($txbytes < 0) {
948
                            if ($device['BytesTotalPersec'] > $rxbytes)
949
                               $txbytes = $device['BytesTotalPersec'] - $rxbytes;
950
                            else
951
                               $txbytes += 4294967296;
952
                        } elseif ($rxbytes < 0) {
953
                            if ($device['BytesTotalPersec'] > $txbytes)
954
                               $rxbytes = $device['BytesTotalPersec'] - $txbytes;
955
                            else
956
                               $rxbytes += 4294967296;
957
                        }
958
                        $dev->setTxBytes($txbytes);
959
                        $dev->setRxBytes($rxbytes);
960
                        $dev->setErrors($device['PacketsReceivedErrors']);
961
                        $dev->setDrops($device['PacketsReceivedDiscarded']);
962
 
963
                        $this->sys->setNetDevices($dev);
964
                    }
965
                }
966
            }
967
        } elseif (($buffer = $this->_get_systeminfo()) && preg_match('/^(\s+)\[\d+\]:[^\r\n]+\r\n\s+[^\s\[]/m', $buffer, $matches, PREG_OFFSET_CAPTURE)) {
968
            $netbuf = substr($buffer, $matches[0][1]);
969
            if (preg_match('/^[^\s]/m', $netbuf, $matches2, PREG_OFFSET_CAPTURE)) {
970
                $netbuf = substr($netbuf, 0, $matches2[0][1]);
971
            }
972
            $netstrs = preg_split('/^'.$matches[1][0].'\[\d+\]:/m', $netbuf, -1, PREG_SPLIT_NO_EMPTY);
973
            $devnr = 0;
974
            foreach ($netstrs as $netstr) {
975
                $netstrls = preg_split('/\r\n/', $netstr, -1, PREG_SPLIT_NO_EMPTY);
976
                if (sizeof($netstrls)>1) {
977
                    $dev = new NetDevice();
978
                    foreach ($netstrls as $nr=>$netstrl) {
979
                        if ($nr === 0) {
980
                            $name = trim($netstrl);
981
                            if ($name !== "") {
982
                                $dev->setName($name);
983
                            } else {
984
                                $dev->setName('dev'.$devnr);
985
                                $devnr++;
986
                            }
987
                        } elseif (preg_match('/\[\d+\]:\s+(.+)/', $netstrl, $netinfo)) {
988
                            $ipaddres = trim($netinfo[1]);
989
                            if (($ipaddres!="0.0.0.0") && !preg_match('/^fe80::/i', $ipaddres))
990
                                $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ipaddres));
991
                        }
992
                    }
993
                    $this->sys->setNetDevices($dev);
994
                }
995
            }
996
        }
997
    }
998
 
999
    /**
1000
     * Physical memory information and Swap Space information
1001
     *
1002
     * @link http://msdn2.microsoft.com/En-US/library/aa394239.aspx
1003
     * @link http://msdn2.microsoft.com/en-us/library/aa394246.aspx
1004
     * @return void
1005
     */
1006
    private function _memory()
1007
    {
1008
        if ($this->_wmi) {
1009
            $buffer = $this->_get_Win32_OperatingSystem();
1010
            if ($buffer) {
1011
                $this->sys->setMemTotal($buffer[0]['TotalVisibleMemorySize'] * 1024);
1012
                $this->sys->setMemFree($buffer[0]['FreePhysicalMemory'] * 1024);
1013
                $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
1014
            }
1015
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_PageFileUsage');
1016
            foreach ($buffer as $swapdevice) {
1017
                $dev = new DiskDevice();
1018
                $dev->setName("SWAP");
1019
                $dev->setMountPoint($swapdevice['Name']);
1020
                $dev->setTotal($swapdevice['AllocatedBaseSize'] * 1024 * 1024);
1021
                $dev->setUsed($swapdevice['CurrentUsage'] * 1024 * 1024);
1022
                $dev->setFree($dev->getTotal() - $dev->getUsed());
1023
                $dev->setFsType('swap');
1024
                $this->sys->setSwapDevices($dev);
1025
            }
1026
        } elseif (($buffer = $this->_get_systeminfo()) && preg_match("/:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+\s([\d \xFF]+)\sMB\r\n/m", $buffer, $buffer2)) {
1027
//           && (preg_match("/:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+:\s([\d \xFF]+)\sMB\r\n.+\s([\d \xFF]+)\sMB\r\n.*:\s+(\S+)\r\n/m", $buffer, $buffer2)) {
1028
            $this->sys->setMemTotal(preg_replace('/(\s)|(\xFF)/', '', $buffer2[1]) * 1024 * 1024);
1029
            $this->sys->setMemFree(preg_replace('/(\s)|(\xFF)/', '', $buffer2[2]) * 1024 * 1024);
1030
            $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
1031
        }
1032
    }
1033
 
1034
    /**
1035
     * filesystem information
1036
     *
1037
     * @return void
1038
     */
1039
    private function _filesystems()
1040
    {
1041
        $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.');
1043
        $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_LogicalDisk', array('Name', 'Size', 'FreeSpace', 'FileSystem', 'DriveType', 'MediaType'));
1044
        foreach ($buffer as $filesystem) {
1045
            $dev = new DiskDevice();
1046
            $dev->setMountPoint($filesystem['Name']);
1047
            $dev->setFsType($filesystem['FileSystem']);
1048
            if ($filesystem['Size'] > 0) {
1049
                $dev->setTotal($filesystem['Size']);
1050
                $dev->setFree($filesystem['FreeSpace']);
1051
                $dev->setUsed($filesystem['Size'] - $filesystem['FreeSpace']);
1052
            }
1053
            if ($filesystem['MediaType'] != "" && $filesystem['DriveType'] == 2) {
1054
                $dev->setName($typearray[$filesystem['DriveType']]." (".$floppyarray[$filesystem['MediaType']].")");
1055
            } else {
1056
                $dev->setName($typearray[$filesystem['DriveType']]);
1057
            }
1058
            $this->sys->setDiskDevices($dev);
1059
        }
1060
        if (!$buffer && ($this->sys->getDistribution()=="ReactOS")) {
1061
            // test for command 'free' on current disk
1062
            if (CommonFunctions::executeProgram('cmd', '/c free 2>nul', $out_value, true)) {
1063
                for ($letter='A'; $letter!='AA'; $letter++) if (CommonFunctions::executeProgram('cmd', '/c free '.$letter.': 2>nul', $out_value, false)) {
1064
                    $values = preg_replace('/[^\d\n]/', '', $out_value);
1065
                    if (preg_match('/\n(\d+)\n(\d+)\n(\d+)$/', $values, $out_dig)) {
1066
                        $size = $out_dig[1];
1067
                        $used = $out_dig[2];
1068
                        $free = $out_dig[3];
1069
                        if ($used + $free == $size) {
1070
                            $dev = new DiskDevice();
1071
                            $dev->setMountPoint($letter.":");
1072
                            $dev->setFsType('Unknown');
1073
                            $dev->setName('Unknown');
1074
                            $dev->setTotal($size);
1075
                            $dev->setUsed($used);
1076
                            $dev->setFree($free);
1077
                            $this->sys->setDiskDevices($dev);
1078
                        }
1079
                    }
1080
                }
1081
            }
1082
        }
1083
    }
1084
 
1085
    /**
1086
     * get os specific encoding
1087
     *
1088
     * @see OS::getEncoding()
1089
     *
1090
     * @return string
1091
     */
1092
    public function getEncoding()
1093
    {
1094
        return $this->_codepage;
1095
    }
1096
 
1097
    /**
1098
     * get os specific language
1099
     *
1100
     * @see OS::getLanguage()
1101
     *
1102
     * @return string
1103
     */
1104
    public function getLanguage()
1105
    {
1106
        return $this->_syslang;
1107
    }
1108
 
1109
    public function _processes()
1110
    {
1111
        $processes['*'] = 0;
2976 rexy 1112
        if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::executeProgram('qprocess', '*', $strBuf, false) && (strlen($strBuf) > 0)) {
2770 rexy 1113
            $lines = preg_split('/\n/', $strBuf);
1114
            $processes['*'] = (count($lines)-1) - 3 ; //correction for process "qprocess *"
1115
        }
1116
        if ($processes['*'] <= 0) {
1117
            $buffer = CommonFunctions::getWMI($this->_wmi, 'Win32_Process', array('Caption'));
1118
            $processes['*'] = count($buffer);
1119
        }
1120
        $processes[' '] = $processes['*'];
1121
        $this->sys->setProcesses($processes);
1122
    }
1123
 
1124
    /**
2976 rexy 1125
     * MEM information
1126
     *
1127
     * @return void
1128
     */
1129
    private function _meminfo()
1130
    {
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'));
1132
        if ($allMems) {
1133
            $reg = false;
1134
            if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
1135
                $arrMems = CommonFunctions::getWMI($this->_wmi, 'Win32_PhysicalMemoryArray', array('MemoryErrorCorrection'));
1136
                $reg = (count($arrMems) == 1) && isset($arrMems[0]['MemoryErrorCorrection']) && ($arrMems[0]['MemoryErrorCorrection'] == 6);
1137
            }
1138
            foreach ($allMems as $mem) {
1139
                $dev = new HWDevice();
1140
                $name = '';
1141
                if (isset($mem['PartNumber']) && !preg_match("/^PartNum\d+$/", $part = $mem['PartNumber']) && ($part != '') && ($part != 'None') && ($part != 'N/A') && ($part != 'NOT AVAILABLE')) {
1142
                    $name = $part;
1143
                 }
1144
                if (isset($mem['DeviceLocator']) && (($dloc = $mem['DeviceLocator']) != '') && ($dloc != 'None') && ($dloc != 'N/A')) {
1145
                    if ($name != '') {
1146
                        $name .= ' - '.$dloc;
1147
                    } else {
1148
                        $name = $dloc;
1149
                    }
1150
                }
1151
                if (isset($mem['BankLabel']) && (($bank = $mem['BankLabel']) != '') && ($bank != 'None') && ($bank != 'N/A')) {
1152
                    if ($name != '') {
1153
                        $name .= ' in '.$bank;
1154
                    } else {
1155
                        $name = 'Physical Memory in '.$bank;
1156
                    }
1157
                }
1158
                if ($name != '') {
1159
                    $dev->setName(trim($name));
1160
                } else {
1161
                    $dev->setName('Physical Memory');
1162
                }
1163
                if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS) {
1164
                    if (isset($mem['Manufacturer']) && !preg_match("/^([A-F\d]{4}|[A-F\d]{12}|[A-F\d]{16})$/", $manufacturer = $mem['Manufacturer']) && !preg_match("/^Manufacturer\d+$/", $manufacturer) && !preg_match("/^Mfg \d+$/", $manufacturer) && ($manufacturer != '') && ($manufacturer != 'None') && ($manufacturer != 'N/A') && ($manufacturer != 'UNKNOWN')) {
1165
                        $dev->setManufacturer($manufacturer);
1166
                    }
1167
                    if (isset($mem['Capacity'])) {
1168
                        $dev->setCapacity($mem['Capacity']);
1169
                    }
1170
                    $memtype = '';
1171
                    if (isset($mem['MemoryType']) && (($memval = $mem['MemoryType']) != 0)) {
1172
                        switch ($memval) {
1173
//                            case 0: $memtype = 'Unknown'; break;
1174
//                            case 1: $memtype = 'Other'; break;
1175
                            case 2: $memtype = 'DRAM'; break;
1176
                            case 3: $memtype = 'Synchronous DRAM'; break;
1177
                            case 4: $memtype = 'Cache DRAM'; break;
1178
                            case 5: $memtype = 'EDO'; break;
1179
                            case 6: $memtype = 'EDRAM'; break;
1180
                            case 7: $memtype = 'VRAM'; break;
1181
                            case 8: $memtype = 'SRAM'; break;
1182
                            case 9: $memtype = 'RAM'; break;
1183
                            case 10: $memtype = 'ROM'; break;
1184
                            case 11: $memtype = 'Flash'; break;
1185
                            case 12: $memtype = 'EEPROM'; break;
1186
                            case 13: $memtype = 'FEPROM'; break;
1187
                            case 14: $memtype = 'EPROM'; break;
1188
                            case 15: $memtype = 'CDRAM'; break;
1189
                            case 16: $memtype = '3DRAM'; break;
1190
                            case 17: $memtype = 'SDRAM'; break;
1191
                            case 18: $memtype = 'SGRAM'; break;
1192
                            case 19: $memtype = 'RDRAM'; break;
1193
                            case 20: $memtype = 'DDR'; break;
1194
                            case 21: $memtype = 'DDR2'; break;
1195
                            case 22: $memtype = 'DDR2 FB-DIMM'; break;
1196
                            case 24: $memtype = 'DDR3'; break;
1197
                            case 25: $memtype = 'FBD2'; break;
1198
                            case 26: $memtype = 'DDR4'; break;
1199
                        }
1200
                    } elseif (isset($mem['SMBIOSMemoryType'])) {
1201
                        switch ($mem['SMBIOSMemoryType']) {
1202
//                            case 0: $memtype = 'Invalid'; break;
1203
//                            case 1: $memtype = 'Other'; break;
1204
//                            case 2: $memtype = 'Unknown'; break;
1205
                            case 3: $memtype = 'DRAM'; break;
1206
                            case 4: $memtype = 'EDRAM'; break;
1207
                            case 5: $memtype = 'VRAM'; break;
1208
                            case 6: $memtype = 'SRAM'; break;
1209
                            case 7: $memtype = 'RAM'; break;
1210
                            case 8: $memtype = 'ROM'; break;
1211
                            case 9: $memtype = 'FLASH'; break;
1212
                            case 10: $memtype = 'EEPROM'; break;
1213
                            case 11: $memtype = 'FEPROM'; break;
1214
                            case 12: $memtype = 'EPROM'; break;
1215
                            case 13: $memtype = 'CDRAM'; break;
1216
                            case 14: $memtype = '3DRAM'; break;
1217
                            case 15: $memtype = 'SDRAM'; break;
1218
                            case 16: $memtype = 'SGRAM'; break;
1219
                            case 17: $memtype = 'RDRAM'; break;
1220
                            case 18: $memtype = 'DDR'; break;
1221
                            case 19: $memtype = 'DDR2'; break;
1222
                            case 20: $memtype = 'DDR2 FB-DIMM'; break;
1223
                            case 24: $memtype = 'DDR3'; break;
1224
                            case 25: $memtype = 'FBD2'; break;
1225
                            case 26: $memtype = 'DDR4'; break;
1226
                            case 27: $memtype = 'LPDDR'; break;
1227
                            case 28: $memtype = 'LPDDR2'; break;
1228
                            case 29: $memtype = 'LPDDR3'; break;
1229
                            case 30: $memtype = 'DDR3'; break;
1230
                            case 31: $memtype = 'FBD2'; break;
1231
                            case 32: $memtype = 'Logical non-volatile device'; break;
1232
                            case 33: $memtype = 'HBM2'; break;
1233
                            case 34: $memtype = 'DDR5'; break;
1234
                            case 35: $memtype = 'LPDDR5'; break;
1235
                        }
1236
                    }
1237
                    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)) {
1239
                            $lv = 'L';
1240
                        } else {
1241
                            $lv = '';
1242
                        }
1243
                        if (isset($dr[2])) {
1244
                            $memtype = $dr[1].$lv.'-'.$speed.' '.$dr[2];
1245
                        } else {
1246
                            $memtype = $dr[1].$lv.'-'.$speed;
1247
                        }
1248
                    }
1249
                    if (isset($mem['FormFactor'])) {
1250
                        switch ($mem['FormFactor']) {
1251
//                                case 0: $memtype .= ' Unknown'; break;
1252
//                                case 1: $memtype .= ' Other'; break;
1253
                            case 2: $memtype .= ' SIP'; break;
1254
                            case 3: $memtype .= ' DIP'; break;
1255
                            case 4: $memtype .= ' ZIP'; break;
1256
                            case 5: $memtype .= ' SOJ'; break;
1257
                            case 6: $memtype .= ' Proprietary'; break;
1258
                            case 7: $memtype .= ' SIMM'; break;
1259
                            case 8: $memtype .= ' DIMM'; break;
1260
                            case 9: $memtype .= ' TSOPO'; break;
1261
                            case 10: $memtype .= ' PGA'; break;
1262
                            case 11: $memtype .= ' RIM'; break;
1263
                            case 12: $memtype .= ' SODIMM'; break;
1264
                            case 13: $memtype .= ' SRIMM'; break;
1265
                            case 14: $memtype .= ' SMD'; break;
1266
                            case 15: $memtype .= ' SSMP'; break;
1267
                            case 16: $memtype .= ' QFP'; break;
1268
                            case 17: $memtype .= ' TQFP'; break;
1269
                            case 18: $memtype .= ' SOIC'; break;
1270
                            case 19: $memtype .= ' LCC'; break;
1271
                            case 20: $memtype .= ' PLCC'; break;
1272
                            case 21: $memtype .= ' BGA'; break;
1273
                            case 22: $memtype .= ' FPBGA'; break;
1274
                            case 23: $memtype .= ' LGA'; break;
1275
                        }
1276
                    }
1277
                    if (isset($mem['DataWidth']) && isset($mem['TotalWidth']) && (($dataw = $mem['DataWidth']) > 0) && (($totalw = $mem['TotalWidth']) > 0) && ($dataw < $totalw)) {
1278
                        $memtype .= ' ECC';
1279
                    }
1280
                    if ($reg) {
1281
                        $memtype .= ' REG';
1282
                    }
1283
                    if (($memtype = trim($memtype)) != '') {
1284
                        $dev->setProduct($memtype);
1285
                    }
1286
                    if (isset($mem['ConfiguredClockSpeed']) && (($clock = $mem['ConfiguredClockSpeed']) > 0)) {
1287
                        $dev->setSpeed($clock);
1288
                    }
1289
                    if (isset($mem['ConfiguredVoltage']) && (($voltage = $mem['ConfiguredVoltage']) > 0)) {
1290
                        $dev->setVoltage($voltage/1000);
1291
                    }
1292
                    if (defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL &&
1293
                       isset($mem['SerialNumber']) && !preg_match("/^SerNum\d+$/", $serial = $mem['SerialNumber']) && ($serial != '') && ($serial != 'None')) {
1294
                        $dev->setSerial($serial);
1295
                    }
1296
                }
1297
                $this->sys->setMemDevices($dev);
1298
            }
1299
        }
1300
    }
1301
 
1302
    /**
2770 rexy 1303
     * get the information
1304
     *
1305
     * @see PSI_Interface_OS::build()
1306
     *
1307
     * @return Void
1308
     */
1309
    public function build()
1310
    {
1311
        $this->_distro(); //share getDistribution()
1312
        if ($this->sys->getDistribution()=="ReactOS") {
1313
            $this->error->addError("WARN", "The ReactOS version of phpSysInfo is a work in progress, some things currently don't work");
1314
        }
1315
        if (!$this->blockname || $this->blockname==='vitals') {
1316
            $this->_hostname();
1317
            $this->_users();
1318
            $this->_uptime();
1319
            $this->_loadavg();
1320
            $this->_processes();
1321
        }
1322
        if (!$this->blockname || $this->blockname==='network') {
1323
            $this->_network();
1324
        }
1325
        if (!$this->blockname || $this->blockname==='hardware') {
1326
            $this->_machine();
1327
            $this->_cpuinfo();
2976 rexy 1328
            $this->_meminfo();
2770 rexy 1329
            $this->_hardware();
1330
        }
1331
        if (!$this->blockname || $this->blockname==='filesystem') {
1332
            $this->_filesystems();
1333
        }
1334
        if (!$this->blockname || $this->blockname==='memory') {
1335
            $this->_memory();
1336
        }
1337
    }
1338
}