Subversion Repositories ALCASAR

Rev

Rev 2770 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

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