2012-06-15 15:47:28 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Hans Leidekker for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
2012-06-19 10:21:47 +02:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2012-06-15 15:47:28 +02:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2012-09-06 14:03:24 +02:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2012-06-15 15:47:28 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2012-09-28 13:38:05 +02:00
|
|
|
#include "initguid.h"
|
2012-06-15 15:47:28 +02:00
|
|
|
#include "wbemcli.h"
|
2012-09-28 13:38:05 +02:00
|
|
|
#include "wbemprov.h"
|
2012-06-25 11:20:09 +02:00
|
|
|
#include "winsock2.h"
|
|
|
|
#include "iphlpapi.h"
|
2012-06-18 09:32:02 +02:00
|
|
|
#include "tlhelp32.h"
|
2012-06-22 09:23:36 +02:00
|
|
|
#include "d3d10.h"
|
2012-06-26 16:03:10 +02:00
|
|
|
#include "winternl.h"
|
2012-06-29 13:41:07 +02:00
|
|
|
#include "winioctl.h"
|
2012-07-27 14:04:03 +02:00
|
|
|
#include "winsvc.h"
|
2013-06-04 13:29:03 +02:00
|
|
|
#include "winver.h"
|
2012-06-15 15:47:28 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "wbemprox_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
|
|
|
|
|
2012-07-04 10:32:00 +02:00
|
|
|
static const WCHAR class_baseboardW[] =
|
|
|
|
{'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const WCHAR class_biosW[] =
|
|
|
|
{'W','i','n','3','2','_','B','I','O','S',0};
|
2012-10-04 15:36:54 +02:00
|
|
|
static const WCHAR class_cdromdriveW[] =
|
|
|
|
{'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0};
|
2012-06-19 10:20:22 +02:00
|
|
|
static const WCHAR class_compsysW[] =
|
|
|
|
{'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
|
2013-06-04 13:29:03 +02:00
|
|
|
static const WCHAR class_datafileW[] =
|
|
|
|
{'C','I','M','_','D','a','t','a','F','i','l','e',0};
|
2013-05-29 12:16:44 +02:00
|
|
|
static const WCHAR class_directoryW[] =
|
|
|
|
{'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0};
|
2012-10-04 15:37:13 +02:00
|
|
|
static const WCHAR class_diskdriveW[] =
|
|
|
|
{'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const WCHAR class_diskpartitionW[] =
|
|
|
|
{'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
|
2012-06-29 13:41:07 +02:00
|
|
|
static const WCHAR class_logicaldiskW[] =
|
|
|
|
{'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
|
2013-05-22 10:06:35 +02:00
|
|
|
static const WCHAR class_logicaldisk2W[] =
|
|
|
|
{'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0};
|
2012-06-26 16:03:10 +02:00
|
|
|
static const WCHAR class_networkadapterW[] =
|
|
|
|
{'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
|
2013-11-04 11:54:51 +01:00
|
|
|
static const WCHAR class_networkadapterconfigW[] =
|
|
|
|
{'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',
|
|
|
|
'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
|
2012-06-19 10:21:47 +02:00
|
|
|
static const WCHAR class_osW[] =
|
|
|
|
{'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR class_paramsW[] =
|
|
|
|
{'_','_','P','A','R','A','M','E','T','E','R','S',0};
|
2013-12-11 14:36:34 +01:00
|
|
|
static const WCHAR class_physicalmediaW[] =
|
|
|
|
{'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const WCHAR class_qualifiersW[] =
|
|
|
|
{'_','_','Q','U','A','L','I','F','I','E','R','S',0};
|
|
|
|
static const WCHAR class_process_getowner_outW[] =
|
|
|
|
{'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W',
|
|
|
|
'N','E','R','_','O','U','T',0};
|
2012-06-19 10:20:42 +02:00
|
|
|
static const WCHAR class_processorW[] =
|
|
|
|
{'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
|
2012-10-04 15:37:32 +02:00
|
|
|
static const WCHAR class_sounddeviceW[] =
|
|
|
|
{'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0};
|
2012-06-22 09:23:36 +02:00
|
|
|
static const WCHAR class_videocontrollerW[] =
|
|
|
|
{'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
|
2012-07-30 15:04:15 +02:00
|
|
|
static const WCHAR prop_acceptpauseW[] =
|
|
|
|
{'A','c','c','e','p','t','P','a','u','s','e',0};
|
|
|
|
static const WCHAR prop_acceptstopW[] =
|
|
|
|
{'A','c','c','e','p','t','S','t','o','p',0};
|
2013-05-29 12:16:44 +02:00
|
|
|
static const WCHAR prop_accessmaskW[] =
|
|
|
|
{'A','c','c','e','s','s','M','a','s','k',0};
|
2013-06-14 10:06:46 +02:00
|
|
|
static const WCHAR prop_adapterdactypeW[] =
|
|
|
|
{'A','d','a','p','t','e','r','D','A','C','T','y','p','e',0};
|
2012-06-22 09:23:36 +02:00
|
|
|
static const WCHAR prop_adapterramW[] =
|
|
|
|
{'A','d','a','p','t','e','r','R','A','M',0};
|
2013-05-29 12:16:44 +02:00
|
|
|
static const WCHAR prop_adaptertypeW[] =
|
|
|
|
{'A','d','a','p','t','e','r','T','y','p','e',0};
|
2013-06-14 10:02:29 +02:00
|
|
|
static const WCHAR prop_addresswidthW[] =
|
|
|
|
{'A','d','d','r','e','s','s','W','i','d','t','h',0};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const WCHAR prop_bootableW[] =
|
|
|
|
{'B','o','o','t','a','b','l','e',0};
|
2013-04-08 10:21:29 +02:00
|
|
|
static const WCHAR prop_bootpartitionW[] =
|
|
|
|
{'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const WCHAR prop_captionW[] =
|
|
|
|
{'C','a','p','t','i','o','n',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR prop_classW[] =
|
|
|
|
{'C','l','a','s','s',0};
|
2013-06-14 10:04:11 +02:00
|
|
|
static const WCHAR prop_codesetW[] =
|
|
|
|
{'C','o','d','e','S','e','t',0};
|
2012-06-20 12:07:02 +02:00
|
|
|
static const WCHAR prop_commandlineW[] =
|
|
|
|
{'C','o','m','m','a','n','d','L','i','n','e',0};
|
2013-06-14 10:04:43 +02:00
|
|
|
static const WCHAR prop_countrycodeW[] =
|
|
|
|
{'C','o','u','n','t','r','y','C','o','d','e',0};
|
2012-06-26 16:03:32 +02:00
|
|
|
static const WCHAR prop_cpustatusW[] =
|
|
|
|
{'C','p','u','S','t','a','t','u','s',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR prop_csdversionW[] =
|
|
|
|
{'C','S','D','V','e','r','s','i','o','n',0};
|
2012-06-28 09:24:05 +02:00
|
|
|
static const WCHAR prop_currentbitsperpixelW[] =
|
|
|
|
{'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
|
|
|
|
static const WCHAR prop_currenthorizontalresW[] =
|
|
|
|
{'C','u','r','r','e','n','t','H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
|
|
|
|
static const WCHAR prop_currentverticalresW[] =
|
|
|
|
{'C','u','r','r','e','n','t','V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR prop_defaultvalueW[] =
|
|
|
|
{'D','e','f','a','u','l','t','V','a','l','u','e',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const WCHAR prop_descriptionW[] =
|
|
|
|
{'D','e','s','c','r','i','p','t','i','o','n',0};
|
2012-06-22 09:23:36 +02:00
|
|
|
static const WCHAR prop_deviceidW[] =
|
|
|
|
{'D','e','v','i','c','e','I','d',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR prop_directionW[] =
|
|
|
|
{'D','i','r','e','c','t','i','o','n',0};
|
2012-07-27 14:04:03 +02:00
|
|
|
static const WCHAR prop_displaynameW[] =
|
|
|
|
{'D','i','s','p','l','a','y','N','a','m','e',0};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const WCHAR prop_diskindexW[] =
|
|
|
|
{'D','i','s','k','I','n','d','e','x',0};
|
2012-09-28 13:39:04 +02:00
|
|
|
static const WCHAR prop_domainW[] =
|
|
|
|
{'D','o','m','a','i','n',0};
|
2012-09-04 13:49:57 +02:00
|
|
|
static const WCHAR prop_domainroleW[] =
|
|
|
|
{'D','o','m','a','i','n','R','o','l','e',0};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const WCHAR prop_driveW[] =
|
|
|
|
{'D','r','i','v','e',0};
|
2012-06-29 13:41:07 +02:00
|
|
|
static const WCHAR prop_drivetypeW[] =
|
|
|
|
{'D','r','i','v','e','T','y','p','e',0};
|
2013-05-02 12:02:34 +02:00
|
|
|
static const WCHAR prop_familyW[] =
|
|
|
|
{'F','a','m','i','l','y',0};
|
2012-06-29 13:41:07 +02:00
|
|
|
static const WCHAR prop_filesystemW[] =
|
|
|
|
{'F','i','l','e','S','y','s','t','e','m',0};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const WCHAR prop_flavorW[] =
|
|
|
|
{'F','l','a','v','o','r',0};
|
2012-06-29 13:41:07 +02:00
|
|
|
static const WCHAR prop_freespaceW[] =
|
|
|
|
{'F','r','e','e','S','p','a','c','e',0};
|
2012-06-20 12:06:17 +02:00
|
|
|
static const WCHAR prop_handleW[] =
|
|
|
|
{'H','a','n','d','l','e',0};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const WCHAR prop_idW[] =
|
|
|
|
{'I','D',0};
|
2013-11-04 11:54:10 +01:00
|
|
|
static const WCHAR prop_identificationcodeW[] =
|
|
|
|
{'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const WCHAR prop_indexW[] =
|
|
|
|
{'I','n','d','e','x',0};
|
2012-06-25 11:20:09 +02:00
|
|
|
static const WCHAR prop_interfaceindexW[] =
|
|
|
|
{'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const WCHAR prop_intvalueW[] =
|
|
|
|
{'I','n','t','e','g','e','r','V','a','l','u','e',0};
|
2014-01-28 13:26:57 +01:00
|
|
|
static const WCHAR prop_ipconnectionmetricW[] =
|
|
|
|
{'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
|
2013-11-04 11:54:51 +01:00
|
|
|
static const WCHAR prop_ipenabledW[] =
|
|
|
|
{'I','P','E','n','a','b','l','e','d',0};
|
2012-09-18 13:12:20 +02:00
|
|
|
static const WCHAR prop_lastbootuptimeW[] =
|
|
|
|
{'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
|
2013-09-08 16:47:16 +02:00
|
|
|
static const WCHAR prop_localdatetimeW[] =
|
|
|
|
{'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
|
2013-06-14 10:05:26 +02:00
|
|
|
static const WCHAR prop_localeW[] =
|
|
|
|
{'L','o','c','a','l','e',0};
|
2012-07-13 11:34:17 +02:00
|
|
|
static const WCHAR prop_macaddressW[] =
|
|
|
|
{'M','A','C','A','d','d','r','e','s','s',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const WCHAR prop_manufacturerW[] =
|
|
|
|
{'M','a','n','u','f','a','c','t','u','r','e','r',0};
|
2012-09-04 13:48:54 +02:00
|
|
|
static const WCHAR prop_maxclockspeedW[] =
|
|
|
|
{'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
|
2014-02-28 11:21:11 +01:00
|
|
|
static const WCHAR prop_mediatypeW[] =
|
|
|
|
{'M','e','d','i','a','T','y','p','e',0};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const WCHAR prop_memberW[] =
|
|
|
|
{'M','e','m','b','e','r',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR prop_methodW[] =
|
|
|
|
{'M','e','t','h','o','d',0};
|
2012-06-19 10:20:22 +02:00
|
|
|
static const WCHAR prop_modelW[] =
|
|
|
|
{'M','o','d','e','l',0};
|
2012-06-25 11:20:09 +02:00
|
|
|
static const WCHAR prop_netconnectionstatusW[] =
|
|
|
|
{'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
|
2013-06-14 10:03:25 +02:00
|
|
|
static const WCHAR prop_numcoresW[] =
|
|
|
|
{'N','u','m','b','e','r','O','f','C','o','r','e','s',0};
|
2012-06-26 16:03:10 +02:00
|
|
|
static const WCHAR prop_numlogicalprocessorsW[] =
|
|
|
|
{'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0};
|
|
|
|
static const WCHAR prop_numprocessorsW[] =
|
|
|
|
{'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
|
2012-06-19 10:21:47 +02:00
|
|
|
static const WCHAR prop_osarchitectureW[] =
|
|
|
|
{'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
|
2012-06-26 16:02:41 +02:00
|
|
|
static const WCHAR prop_oslanguageW[] =
|
|
|
|
{'O','S','L','a','n','g','u','a','g','e',0};
|
2013-05-02 12:02:06 +02:00
|
|
|
static const WCHAR prop_osproductsuiteW[] =
|
|
|
|
{'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
|
|
|
|
static const WCHAR prop_ostypeW[] =
|
|
|
|
{'O','S','T','y','p','e',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR prop_parameterW[] =
|
|
|
|
{'P','a','r','a','m','e','t','e','r',0};
|
2013-06-14 10:07:43 +02:00
|
|
|
static const WCHAR prop_physicaladapterW[] =
|
|
|
|
{'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
|
2012-07-13 11:34:17 +02:00
|
|
|
static const WCHAR prop_pnpdeviceidW[] =
|
|
|
|
{'P','N','P','D','e','v','i','c','e','I','D',0};
|
2012-06-18 09:32:02 +02:00
|
|
|
static const WCHAR prop_pprocessidW[] =
|
|
|
|
{'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
|
|
|
|
static const WCHAR prop_processidW[] =
|
|
|
|
{'P','r','o','c','e','s','s','I','D',0};
|
2012-06-29 13:39:19 +02:00
|
|
|
static const WCHAR prop_processoridW[] =
|
|
|
|
{'P','r','o','c','e','s','s','o','r','I','d',0};
|
2012-10-04 15:37:32 +02:00
|
|
|
static const WCHAR prop_productnameW[] =
|
|
|
|
{'P','r','o','d','u','c','t','N','a','m','e',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const WCHAR prop_releasedateW[] =
|
|
|
|
{'R','e','l','e','a','s','e','D','a','t','e',0};
|
|
|
|
static const WCHAR prop_serialnumberW[] =
|
|
|
|
{'S','e','r','i','a','l','N','u','m','b','e','r',0};
|
2013-05-02 12:02:06 +02:00
|
|
|
static const WCHAR prop_servicepackmajorW[] =
|
|
|
|
{'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
|
2013-06-14 10:06:01 +02:00
|
|
|
static const WCHAR prop_servicepackminorW[] =
|
|
|
|
{'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
|
2012-07-27 14:04:03 +02:00
|
|
|
static const WCHAR prop_servicetypeW[] =
|
|
|
|
{'S','e','r','v','i','c','e','T','y','p','e',0};
|
2013-11-04 11:54:10 +01:00
|
|
|
static const WCHAR prop_smbiosbiosversionW[] =
|
|
|
|
{'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
|
2012-08-26 19:29:29 +02:00
|
|
|
static const WCHAR prop_startmodeW[] =
|
|
|
|
{'S','t','a','r','t','M','o','d','e',0};
|
2012-06-29 13:41:07 +02:00
|
|
|
static const WCHAR prop_sizeW[] =
|
|
|
|
{'S','i','z','e',0};
|
2012-06-27 11:34:41 +02:00
|
|
|
static const WCHAR prop_speedW[] =
|
|
|
|
{'S','p','e','e','d',0};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const WCHAR prop_startingoffsetW[] =
|
|
|
|
{'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0};
|
2012-07-27 14:04:03 +02:00
|
|
|
static const WCHAR prop_stateW[] =
|
|
|
|
{'S','t','a','t','e',0};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const WCHAR prop_strvalueW[] =
|
|
|
|
{'S','t','r','i','n','g','V','a','l','u','e',0};
|
2013-05-02 12:02:06 +02:00
|
|
|
static const WCHAR prop_suitemaskW[] =
|
|
|
|
{'S','u','i','t','e','M','a','s','k',0};
|
2012-06-26 16:02:41 +02:00
|
|
|
static const WCHAR prop_systemdirectoryW[] =
|
|
|
|
{'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
|
2012-08-27 06:29:21 +02:00
|
|
|
static const WCHAR prop_systemnameW[] =
|
|
|
|
{'S','y','s','t','e','m','N','a','m','e',0};
|
2012-07-04 10:32:00 +02:00
|
|
|
static const WCHAR prop_tagW[] =
|
|
|
|
{'T','a','g',0};
|
2012-06-18 09:32:02 +02:00
|
|
|
static const WCHAR prop_threadcountW[] =
|
|
|
|
{'T','h','r','e','a','d','C','o','u','n','t',0};
|
2012-06-27 11:35:45 +02:00
|
|
|
static const WCHAR prop_totalphysicalmemoryW[] =
|
|
|
|
{'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const WCHAR prop_typeW[] =
|
|
|
|
{'T','y','p','e',0};
|
2012-10-04 15:37:57 +02:00
|
|
|
static const WCHAR prop_uniqueidW[] =
|
|
|
|
{'U','n','i','q','u','e','I','d',0};
|
2012-10-12 14:25:39 +02:00
|
|
|
static const WCHAR prop_varianttypeW[] =
|
|
|
|
{'V','a','r','i','a','n','t','T','y','p','e',0};
|
2012-09-28 13:38:34 +02:00
|
|
|
static const WCHAR prop_versionW[] =
|
|
|
|
{'V','e','r','s','i','o','n',0};
|
2014-03-17 09:36:55 +01:00
|
|
|
static const WCHAR prop_volumeserialnumberW[] =
|
|
|
|
{'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
|
2012-07-13 11:35:09 +02:00
|
|
|
|
2012-06-27 11:35:45 +02:00
|
|
|
/* column definitions must be kept in sync with record structures below */
|
2012-07-04 10:32:00 +02:00
|
|
|
static const struct column col_baseboard[] =
|
|
|
|
{
|
|
|
|
{ prop_manufacturerW, CIM_STRING },
|
2013-11-04 11:53:46 +01:00
|
|
|
{ prop_modelW, CIM_STRING },
|
|
|
|
{ prop_nameW, CIM_STRING },
|
2012-07-04 10:32:00 +02:00
|
|
|
{ prop_serialnumberW, CIM_STRING },
|
|
|
|
{ prop_tagW, CIM_STRING|COL_FLAG_KEY }
|
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const struct column col_bios[] =
|
|
|
|
{
|
2013-11-04 11:54:10 +01:00
|
|
|
{ prop_descriptionW, CIM_STRING },
|
|
|
|
{ prop_identificationcodeW, CIM_STRING },
|
|
|
|
{ prop_manufacturerW, CIM_STRING },
|
|
|
|
{ prop_releasedateW, CIM_DATETIME },
|
|
|
|
{ prop_serialnumberW, CIM_STRING },
|
|
|
|
{ prop_smbiosbiosversionW, CIM_STRING },
|
|
|
|
{ prop_versionW, CIM_STRING|COL_FLAG_KEY }
|
2012-06-15 15:47:28 +02:00
|
|
|
};
|
2012-10-04 15:36:54 +02:00
|
|
|
static const struct column col_cdromdrive[] =
|
|
|
|
{
|
2013-02-25 11:03:56 +01:00
|
|
|
{ prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
|
|
|
|
{ prop_driveW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ prop_nameW, CIM_STRING },
|
|
|
|
{ prop_pnpdeviceidW, CIM_STRING }
|
2012-10-04 15:36:54 +02:00
|
|
|
};
|
2012-06-19 10:20:22 +02:00
|
|
|
static const struct column col_compsys[] =
|
|
|
|
{
|
2012-06-26 16:03:10 +02:00
|
|
|
{ prop_descriptionW, CIM_STRING },
|
2012-09-28 13:39:04 +02:00
|
|
|
{ prop_domainW, CIM_STRING },
|
2012-09-04 13:49:57 +02:00
|
|
|
{ prop_domainroleW, CIM_UINT16 },
|
2012-06-26 16:03:10 +02:00
|
|
|
{ prop_manufacturerW, CIM_STRING },
|
|
|
|
{ prop_modelW, CIM_STRING },
|
2013-04-08 10:21:29 +02:00
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-07-02 16:01:17 +02:00
|
|
|
{ prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_numprocessorsW, CIM_UINT32, VT_I4 },
|
2012-06-27 11:35:45 +02:00
|
|
|
{ prop_totalphysicalmemoryW, CIM_UINT64 }
|
2012-06-19 10:20:22 +02:00
|
|
|
};
|
2013-06-04 13:29:03 +02:00
|
|
|
static const struct column col_datafile[] =
|
|
|
|
{
|
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
|
|
|
|
};
|
2013-05-29 12:16:44 +02:00
|
|
|
static const struct column col_directory[] =
|
|
|
|
{
|
|
|
|
{ prop_accessmaskW, CIM_UINT32 },
|
2013-06-04 13:29:03 +02:00
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }
|
2013-05-29 12:16:44 +02:00
|
|
|
};
|
2012-10-04 15:37:13 +02:00
|
|
|
static const struct column col_diskdrive[] =
|
|
|
|
{
|
2013-01-21 16:29:00 +01:00
|
|
|
{ prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
|
2013-04-08 10:21:29 +02:00
|
|
|
{ prop_indexW, CIM_UINT32, VT_I4 },
|
2012-10-04 15:37:13 +02:00
|
|
|
{ prop_manufacturerW, CIM_STRING },
|
2014-02-28 11:21:11 +01:00
|
|
|
{ prop_mediatypeW, CIM_STRING },
|
2012-10-04 15:37:13 +02:00
|
|
|
{ prop_modelW, CIM_STRING },
|
|
|
|
{ prop_serialnumberW, CIM_STRING }
|
|
|
|
};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const struct column col_diskpartition[] =
|
|
|
|
{
|
|
|
|
{ prop_bootableW, CIM_BOOLEAN },
|
2013-04-08 10:21:29 +02:00
|
|
|
{ prop_bootpartitionW, CIM_BOOLEAN },
|
2013-02-25 11:04:29 +01:00
|
|
|
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ prop_diskindexW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_indexW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ prop_sizeW, CIM_UINT64 },
|
|
|
|
{ prop_startingoffsetW, CIM_UINT64 },
|
|
|
|
{ prop_typeW, CIM_STRING|COL_FLAG_DYNAMIC }
|
|
|
|
};
|
2012-06-29 13:41:07 +02:00
|
|
|
static const struct column col_logicaldisk[] =
|
|
|
|
{
|
2014-03-17 09:36:55 +01:00
|
|
|
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ prop_drivetypeW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ prop_freespaceW, CIM_UINT64 },
|
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ prop_sizeW, CIM_UINT64 },
|
|
|
|
{ prop_volumeserialnumberW, CIM_STRING|COL_FLAG_DYNAMIC }
|
2012-06-29 13:41:07 +02:00
|
|
|
};
|
2012-06-25 11:20:09 +02:00
|
|
|
static const struct column col_networkadapter[] =
|
|
|
|
{
|
2012-10-10 12:01:22 +02:00
|
|
|
{ prop_adaptertypeW, CIM_STRING },
|
2012-06-25 11:20:09 +02:00
|
|
|
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2014-01-28 13:26:57 +01:00
|
|
|
{ prop_indexW, CIM_UINT32, VT_I4 },
|
2012-07-02 16:01:17 +02:00
|
|
|
{ prop_interfaceindexW, CIM_UINT32, VT_I4 },
|
2012-07-13 11:34:17 +02:00
|
|
|
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-10-04 15:38:18 +02:00
|
|
|
{ prop_manufacturerW, CIM_STRING },
|
2014-01-28 13:26:57 +01:00
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-07-02 16:01:17 +02:00
|
|
|
{ prop_netconnectionstatusW, CIM_UINT16, VT_I4 },
|
2013-06-14 10:07:43 +02:00
|
|
|
{ prop_physicaladapterW, CIM_BOOLEAN },
|
2012-07-13 11:34:17 +02:00
|
|
|
{ prop_pnpdeviceidW, CIM_STRING },
|
2012-06-27 11:34:41 +02:00
|
|
|
{ prop_speedW, CIM_UINT64 }
|
2012-06-25 11:20:09 +02:00
|
|
|
};
|
2013-11-04 11:54:51 +01:00
|
|
|
static const struct column col_networkadapterconfig[] =
|
|
|
|
{
|
2014-01-28 13:26:57 +01:00
|
|
|
{ prop_indexW, CIM_UINT32|COL_FLAG_KEY },
|
|
|
|
{ prop_ipconnectionmetricW, CIM_UINT32 },
|
|
|
|
{ prop_ipenabledW, CIM_BOOLEAN },
|
|
|
|
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }
|
2013-11-04 11:54:51 +01:00
|
|
|
};
|
2012-06-19 10:21:47 +02:00
|
|
|
static const struct column col_os[] =
|
|
|
|
{
|
2013-05-02 12:02:06 +02:00
|
|
|
{ prop_captionW, CIM_STRING },
|
2013-06-14 10:04:11 +02:00
|
|
|
{ prop_codesetW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2013-06-14 10:04:43 +02:00
|
|
|
{ prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2013-05-02 12:02:06 +02:00
|
|
|
{ prop_csdversionW, CIM_STRING },
|
|
|
|
{ prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
|
2013-09-08 16:47:16 +02:00
|
|
|
{ prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
|
2013-06-14 10:05:26 +02:00
|
|
|
{ prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2014-01-10 09:38:19 +01:00
|
|
|
{ prop_nameW, CIM_STRING },
|
2013-05-02 12:02:06 +02:00
|
|
|
{ prop_osarchitectureW, CIM_STRING },
|
|
|
|
{ prop_oslanguageW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_osproductsuiteW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_ostypeW, CIM_UINT16, VT_I4 },
|
|
|
|
{ prop_servicepackmajorW, CIM_UINT16, VT_I4 },
|
2013-06-14 10:06:01 +02:00
|
|
|
{ prop_servicepackminorW, CIM_UINT16, VT_I4 },
|
2013-05-02 12:02:06 +02:00
|
|
|
{ prop_suitemaskW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ prop_versionW, CIM_STRING }
|
2012-06-19 10:21:47 +02:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const struct column col_param[] =
|
2012-07-13 11:35:09 +02:00
|
|
|
{
|
|
|
|
{ prop_classW, CIM_STRING },
|
|
|
|
{ prop_methodW, CIM_STRING },
|
|
|
|
{ prop_directionW, CIM_SINT32 },
|
|
|
|
{ prop_parameterW, CIM_STRING },
|
|
|
|
{ prop_typeW, CIM_UINT32 },
|
2012-10-12 14:25:39 +02:00
|
|
|
{ prop_varianttypeW, CIM_UINT32 },
|
2012-07-13 11:35:09 +02:00
|
|
|
{ prop_defaultvalueW, CIM_UINT32 }
|
|
|
|
};
|
2013-12-11 14:36:34 +01:00
|
|
|
static const struct column col_physicalmedia[] =
|
|
|
|
{
|
2014-02-28 11:22:01 +01:00
|
|
|
{ prop_serialnumberW, CIM_STRING },
|
|
|
|
{ prop_tagW, CIM_STRING }
|
2013-12-11 14:36:34 +01:00
|
|
|
};
|
2012-06-18 09:32:02 +02:00
|
|
|
static const struct column col_process[] =
|
|
|
|
{
|
2012-06-19 10:21:12 +02:00
|
|
|
{ prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-20 12:07:02 +02:00
|
|
|
{ prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-19 10:21:12 +02:00
|
|
|
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-20 12:06:17 +02:00
|
|
|
{ prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2013-05-22 10:06:35 +02:00
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-07-02 16:01:17 +02:00
|
|
|
{ prop_pprocessidW, CIM_UINT32, VT_I4 },
|
|
|
|
{ prop_processidW, CIM_UINT32, VT_I4 },
|
2013-01-11 17:22:14 +01:00
|
|
|
{ prop_threadcountW, CIM_UINT32, VT_I4 },
|
|
|
|
/* methods */
|
|
|
|
{ method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
|
2012-06-18 09:32:02 +02:00
|
|
|
};
|
2012-06-19 10:20:42 +02:00
|
|
|
static const struct column col_processor[] =
|
|
|
|
{
|
2013-06-14 10:02:29 +02:00
|
|
|
{ prop_addresswidthW, CIM_UINT16, VT_I4 },
|
2012-09-04 13:48:54 +02:00
|
|
|
{ prop_cpustatusW, CIM_UINT16 },
|
|
|
|
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2013-05-02 12:02:34 +02:00
|
|
|
{ prop_familyW, CIM_UINT16, VT_I4 },
|
2012-09-04 13:48:54 +02:00
|
|
|
{ prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-09-17 12:18:58 +02:00
|
|
|
{ prop_maxclockspeedW, CIM_UINT32, VT_I4 },
|
2012-09-04 13:48:54 +02:00
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2013-06-14 10:03:25 +02:00
|
|
|
{ prop_numcoresW, CIM_UINT32, VT_I4 },
|
2012-09-06 14:03:24 +02:00
|
|
|
{ prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
|
2012-10-04 15:37:57 +02:00
|
|
|
{ prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ prop_uniqueidW, CIM_STRING }
|
2012-06-19 10:20:42 +02:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const struct column col_qualifier[] =
|
|
|
|
{
|
|
|
|
{ prop_classW, CIM_STRING },
|
|
|
|
{ prop_memberW, CIM_STRING },
|
|
|
|
{ prop_typeW, CIM_UINT32 },
|
|
|
|
{ prop_flavorW, CIM_SINT32 },
|
|
|
|
{ prop_nameW, CIM_STRING },
|
|
|
|
{ prop_intvalueW, CIM_SINT32 },
|
|
|
|
{ prop_strvalueW, CIM_STRING }
|
|
|
|
};
|
2012-07-27 14:04:03 +02:00
|
|
|
static const struct column col_service[] =
|
|
|
|
{
|
2012-07-30 15:04:15 +02:00
|
|
|
{ prop_acceptpauseW, CIM_BOOLEAN },
|
|
|
|
{ prop_acceptstopW, CIM_BOOLEAN },
|
2012-07-27 14:04:03 +02:00
|
|
|
{ prop_displaynameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ prop_processidW, CIM_UINT32 },
|
|
|
|
{ prop_servicetypeW, CIM_STRING },
|
2012-08-26 19:29:29 +02:00
|
|
|
{ prop_startmodeW, CIM_STRING },
|
2012-08-27 06:29:21 +02:00
|
|
|
{ prop_stateW, CIM_STRING },
|
2012-10-17 11:07:17 +02:00
|
|
|
{ prop_systemnameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
/* methods */
|
2012-10-17 11:07:38 +02:00
|
|
|
{ method_pauseserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2012-10-17 11:07:57 +02:00
|
|
|
{ method_resumeserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2012-10-17 11:08:14 +02:00
|
|
|
{ method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ method_stopserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
|
2012-07-27 14:04:03 +02:00
|
|
|
};
|
2012-10-04 15:37:32 +02:00
|
|
|
static const struct column col_sounddevice[] =
|
|
|
|
{
|
2013-06-14 10:08:24 +02:00
|
|
|
{ prop_nameW, CIM_STRING },
|
2012-10-04 15:37:32 +02:00
|
|
|
{ prop_productnameW, CIM_STRING }
|
|
|
|
};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const struct column col_stdregprov[] =
|
|
|
|
{
|
2012-10-15 10:46:09 +02:00
|
|
|
{ method_enumkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2012-06-22 09:23:36 +02:00
|
|
|
static const struct column col_videocontroller[] =
|
|
|
|
{
|
2013-06-14 10:06:46 +02:00
|
|
|
{ prop_adapterdactypeW, CIM_STRING },
|
2013-06-14 10:02:02 +02:00
|
|
|
{ prop_adapterramW, CIM_UINT32, VT_I4 },
|
2012-06-28 09:24:05 +02:00
|
|
|
{ prop_currentbitsperpixelW, CIM_UINT32 },
|
|
|
|
{ prop_currenthorizontalresW, CIM_UINT32 },
|
|
|
|
{ prop_currentverticalresW, CIM_UINT32 },
|
2012-09-17 12:19:30 +02:00
|
|
|
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-28 09:24:05 +02:00
|
|
|
{ prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
|
2013-01-29 15:32:06 +01:00
|
|
|
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
|
2013-01-30 16:27:22 +01:00
|
|
|
{ prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC }
|
2012-06-22 09:23:36 +02:00
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
|
2012-07-04 10:32:00 +02:00
|
|
|
static const WCHAR baseboard_manufacturerW[] =
|
|
|
|
{'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
|
|
|
|
static const WCHAR baseboard_serialnumberW[] =
|
|
|
|
{'N','o','n','e',0};
|
|
|
|
static const WCHAR baseboard_tagW[] =
|
|
|
|
{'B','a','s','e',' ','B','o','a','r','d',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const WCHAR bios_descriptionW[] =
|
|
|
|
{'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
|
|
|
|
static const WCHAR bios_manufacturerW[] =
|
|
|
|
{'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
|
|
|
|
static const WCHAR bios_releasedateW[] =
|
|
|
|
{'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
|
|
|
|
static const WCHAR bios_serialnumberW[] =
|
|
|
|
{'0',0};
|
2013-11-04 11:54:10 +01:00
|
|
|
static const WCHAR bios_smbiosbiosversionW[] =
|
|
|
|
{'W','i','n','e',0};
|
2012-09-28 13:38:34 +02:00
|
|
|
static const WCHAR bios_versionW[] =
|
|
|
|
{'W','I','N','E',' ',' ',' ','-',' ','1',0};
|
2012-10-04 15:36:54 +02:00
|
|
|
static const WCHAR cdromdrive_nameW[] =
|
|
|
|
{'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
|
2013-02-25 11:03:56 +01:00
|
|
|
static const WCHAR cdromdrive_pnpdeviceidW[]=
|
|
|
|
{'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
|
|
|
|
'_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
|
|
|
|
'_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
|
|
|
|
'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
|
2012-06-19 10:20:22 +02:00
|
|
|
static const WCHAR compsys_descriptionW[] =
|
|
|
|
{'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
|
2012-09-28 13:39:04 +02:00
|
|
|
static const WCHAR compsys_domainW[] =
|
|
|
|
{'W','O','R','K','G','R','O','U','P',0};
|
2012-06-19 10:20:22 +02:00
|
|
|
static const WCHAR compsys_manufacturerW[] =
|
|
|
|
{'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
|
|
|
|
static const WCHAR compsys_modelW[] =
|
|
|
|
{'W','i','n','e',0};
|
2013-01-21 16:29:00 +01:00
|
|
|
static const WCHAR diskdrive_deviceidW[] =
|
|
|
|
{'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
|
2012-10-04 15:37:13 +02:00
|
|
|
static const WCHAR diskdrive_manufacturerW[] =
|
|
|
|
{'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
|
2014-02-28 11:21:11 +01:00
|
|
|
static const WCHAR diskdrive_mediatypeW[] =
|
|
|
|
{'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
|
|
|
|
static const WCHAR diskdrive_modelW[] =
|
|
|
|
{'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
|
2013-04-08 10:21:29 +02:00
|
|
|
static const WCHAR diskdrive_serialW[] =
|
|
|
|
{'W','I','N','E','H','D','I','S','K',0};
|
2012-07-13 11:34:17 +02:00
|
|
|
static const WCHAR networkadapter_pnpdeviceidW[]=
|
|
|
|
{'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
|
|
|
|
'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
|
|
|
|
'3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
|
2012-06-19 10:21:47 +02:00
|
|
|
static const WCHAR os_captionW[] =
|
2012-06-27 11:34:57 +02:00
|
|
|
{'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
|
|
|
|
'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
|
|
|
|
static const WCHAR os_csdversionW[] =
|
|
|
|
{'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
|
2012-06-19 10:21:47 +02:00
|
|
|
static const WCHAR os_32bitW[] =
|
|
|
|
{'3','2','-','b','i','t',0};
|
|
|
|
static const WCHAR os_64bitW[] =
|
|
|
|
{'6','4','-','b','i','t',0};
|
2014-01-10 09:38:19 +01:00
|
|
|
static const WCHAR os_nameW[] =
|
|
|
|
{'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
|
|
|
|
'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
|
|
|
|
'|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
|
|
|
|
'\\','P','a','r','t','i','t','i','o','n','1',0};
|
2013-05-02 12:02:06 +02:00
|
|
|
static const WCHAR os_versionW[] =
|
|
|
|
{'5','.','1','.','2','6','0','0',0};
|
2014-02-28 11:22:01 +01:00
|
|
|
static const WCHAR physicalmedia_tagW[] =
|
|
|
|
{'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
|
2012-10-04 15:37:32 +02:00
|
|
|
static const WCHAR sounddevice_productnameW[] =
|
|
|
|
{'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
|
2013-06-14 10:06:46 +02:00
|
|
|
static const WCHAR videocontroller_dactypeW[] =
|
|
|
|
{'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
|
2012-06-22 09:23:36 +02:00
|
|
|
static const WCHAR videocontroller_deviceidW[] =
|
|
|
|
{'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
|
2012-06-15 15:47:28 +02:00
|
|
|
|
|
|
|
#include "pshpack1.h"
|
2012-07-04 10:32:00 +02:00
|
|
|
struct record_baseboard
|
|
|
|
{
|
|
|
|
const WCHAR *manufacturer;
|
2013-11-04 11:53:46 +01:00
|
|
|
const WCHAR *model;
|
|
|
|
const WCHAR *name;
|
2012-07-04 10:32:00 +02:00
|
|
|
const WCHAR *serialnumber;
|
|
|
|
const WCHAR *tag;
|
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
struct record_bios
|
|
|
|
{
|
|
|
|
const WCHAR *description;
|
2013-11-04 11:54:10 +01:00
|
|
|
const WCHAR *identificationcode;
|
2012-06-15 15:47:28 +02:00
|
|
|
const WCHAR *manufacturer;
|
|
|
|
const WCHAR *releasedate;
|
|
|
|
const WCHAR *serialnumber;
|
2013-11-04 11:54:10 +01:00
|
|
|
const WCHAR *smbiosbiosversion;
|
2012-09-28 13:38:34 +02:00
|
|
|
const WCHAR *version;
|
2012-06-15 15:47:28 +02:00
|
|
|
};
|
2012-10-04 15:36:54 +02:00
|
|
|
struct record_cdromdrive
|
|
|
|
{
|
2013-02-25 11:03:56 +01:00
|
|
|
const WCHAR *device_id;
|
|
|
|
const WCHAR *drive;
|
2012-10-04 15:36:54 +02:00
|
|
|
const WCHAR *name;
|
2013-02-25 11:03:56 +01:00
|
|
|
const WCHAR *pnpdevice_id;
|
2012-10-04 15:36:54 +02:00
|
|
|
};
|
2012-06-19 10:20:22 +02:00
|
|
|
struct record_computersystem
|
|
|
|
{
|
|
|
|
const WCHAR *description;
|
2012-09-28 13:39:04 +02:00
|
|
|
const WCHAR *domain;
|
2012-09-04 13:49:57 +02:00
|
|
|
UINT16 domainrole;
|
2012-06-19 10:20:22 +02:00
|
|
|
const WCHAR *manufacturer;
|
|
|
|
const WCHAR *model;
|
2013-04-08 10:21:29 +02:00
|
|
|
const WCHAR *name;
|
2012-06-26 16:03:10 +02:00
|
|
|
UINT32 num_logical_processors;
|
|
|
|
UINT32 num_processors;
|
2012-06-27 11:35:45 +02:00
|
|
|
UINT64 total_physical_memory;
|
2012-06-19 10:20:22 +02:00
|
|
|
};
|
2013-06-04 13:29:03 +02:00
|
|
|
struct record_datafile
|
|
|
|
{
|
|
|
|
const WCHAR *name;
|
|
|
|
const WCHAR *version;
|
|
|
|
};
|
2013-05-29 12:16:44 +02:00
|
|
|
struct record_directory
|
|
|
|
{
|
|
|
|
UINT32 accessmask;
|
|
|
|
const WCHAR *name;
|
|
|
|
};
|
2012-10-04 15:37:13 +02:00
|
|
|
struct record_diskdrive
|
|
|
|
{
|
2013-01-21 16:29:00 +01:00
|
|
|
const WCHAR *device_id;
|
2013-04-08 10:21:29 +02:00
|
|
|
UINT32 index;
|
2012-10-04 15:37:13 +02:00
|
|
|
const WCHAR *manufacturer;
|
2014-02-28 11:21:11 +01:00
|
|
|
const WCHAR *mediatype;
|
2012-10-04 15:37:13 +02:00
|
|
|
const WCHAR *name;
|
|
|
|
const WCHAR *serialnumber;
|
|
|
|
};
|
2013-02-25 11:04:29 +01:00
|
|
|
struct record_diskpartition
|
|
|
|
{
|
|
|
|
int bootable;
|
2013-04-08 10:21:29 +02:00
|
|
|
int bootpartition;
|
2013-02-25 11:04:29 +01:00
|
|
|
const WCHAR *device_id;
|
|
|
|
UINT32 diskindex;
|
|
|
|
UINT32 index;
|
|
|
|
const WCHAR *pnpdevice_id;
|
|
|
|
UINT64 size;
|
|
|
|
UINT64 startingoffset;
|
|
|
|
const WCHAR *type;
|
|
|
|
};
|
2012-06-29 13:41:07 +02:00
|
|
|
struct record_logicaldisk
|
|
|
|
{
|
|
|
|
const WCHAR *device_id;
|
|
|
|
UINT32 drivetype;
|
|
|
|
const WCHAR *filesystem;
|
|
|
|
UINT64 freespace;
|
2012-10-12 14:24:54 +02:00
|
|
|
const WCHAR *name;
|
2012-06-29 13:41:07 +02:00
|
|
|
UINT64 size;
|
2014-03-17 09:36:55 +01:00
|
|
|
const WCHAR *volumeserialnumber;
|
2012-06-29 13:41:07 +02:00
|
|
|
};
|
2012-06-25 11:20:09 +02:00
|
|
|
struct record_networkadapter
|
|
|
|
{
|
2012-10-10 12:01:22 +02:00
|
|
|
const WCHAR *adaptertype;
|
2012-06-25 11:20:09 +02:00
|
|
|
const WCHAR *device_id;
|
2014-01-28 13:26:57 +01:00
|
|
|
UINT32 index;
|
|
|
|
UINT32 interface_index;
|
2012-07-13 11:34:17 +02:00
|
|
|
const WCHAR *mac_address;
|
2012-10-04 15:38:18 +02:00
|
|
|
const WCHAR *manufacturer;
|
2014-01-28 13:26:57 +01:00
|
|
|
const WCHAR *name;
|
2012-06-25 11:20:09 +02:00
|
|
|
UINT16 netconnection_status;
|
2013-06-14 10:07:43 +02:00
|
|
|
int physicaladapter;
|
2012-07-13 11:34:17 +02:00
|
|
|
const WCHAR *pnpdevice_id;
|
2012-06-27 11:34:41 +02:00
|
|
|
UINT64 speed;
|
2012-06-25 11:20:09 +02:00
|
|
|
};
|
2013-11-04 11:54:51 +01:00
|
|
|
struct record_networkadapterconfig
|
|
|
|
{
|
|
|
|
UINT32 index;
|
2014-01-28 13:26:57 +01:00
|
|
|
UINT32 ipconnectionmetric;
|
2013-11-04 11:54:51 +01:00
|
|
|
int ipenabled;
|
|
|
|
const WCHAR *mac_address;
|
|
|
|
};
|
2012-06-19 10:21:47 +02:00
|
|
|
struct record_operatingsystem
|
|
|
|
{
|
|
|
|
const WCHAR *caption;
|
2013-06-14 10:04:11 +02:00
|
|
|
const WCHAR *codeset;
|
2013-06-14 10:04:43 +02:00
|
|
|
const WCHAR *countrycode;
|
2012-06-27 11:34:57 +02:00
|
|
|
const WCHAR *csdversion;
|
2012-09-18 13:12:20 +02:00
|
|
|
const WCHAR *lastbootuptime;
|
2013-09-08 16:47:16 +02:00
|
|
|
const WCHAR *localdatetime;
|
2013-06-14 10:05:26 +02:00
|
|
|
const WCHAR *locale;
|
2014-01-10 09:38:19 +01:00
|
|
|
const WCHAR *name;
|
2012-06-19 10:21:47 +02:00
|
|
|
const WCHAR *osarchitecture;
|
2012-06-26 16:02:41 +02:00
|
|
|
UINT32 oslanguage;
|
2013-05-02 12:02:06 +02:00
|
|
|
UINT32 osproductsuite;
|
|
|
|
UINT16 ostype;
|
|
|
|
UINT16 servicepackmajor;
|
2013-06-14 10:06:01 +02:00
|
|
|
UINT16 servicepackminor;
|
2013-05-02 12:02:06 +02:00
|
|
|
UINT32 suitemask;
|
2012-06-26 16:02:41 +02:00
|
|
|
const WCHAR *systemdirectory;
|
2013-05-02 12:02:06 +02:00
|
|
|
const WCHAR *version;
|
2012-06-19 10:21:47 +02:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
struct record_param
|
2012-07-13 11:35:09 +02:00
|
|
|
{
|
|
|
|
const WCHAR *class;
|
|
|
|
const WCHAR *method;
|
|
|
|
INT32 direction;
|
|
|
|
const WCHAR *parameter;
|
|
|
|
UINT32 type;
|
2012-10-12 14:25:39 +02:00
|
|
|
UINT32 varianttype;
|
2012-07-13 11:35:09 +02:00
|
|
|
UINT32 defaultvalue;
|
|
|
|
};
|
2013-12-11 14:36:34 +01:00
|
|
|
struct record_physicalmedia
|
|
|
|
{
|
|
|
|
const WCHAR *serialnumber;
|
2014-02-28 11:22:01 +01:00
|
|
|
const WCHAR *tag;
|
2013-12-11 14:36:34 +01:00
|
|
|
};
|
2012-06-18 09:32:02 +02:00
|
|
|
struct record_process
|
|
|
|
{
|
|
|
|
const WCHAR *caption;
|
2012-06-20 12:07:02 +02:00
|
|
|
const WCHAR *commandline;
|
2012-06-18 09:32:02 +02:00
|
|
|
const WCHAR *description;
|
2012-06-20 12:06:17 +02:00
|
|
|
const WCHAR *handle;
|
2013-05-22 10:06:35 +02:00
|
|
|
const WCHAR *name;
|
2012-06-18 09:32:02 +02:00
|
|
|
UINT32 pprocess_id;
|
|
|
|
UINT32 process_id;
|
|
|
|
UINT32 thread_count;
|
2013-01-11 17:22:14 +01:00
|
|
|
/* methods */
|
|
|
|
class_method *get_owner;
|
2012-06-18 09:32:02 +02:00
|
|
|
};
|
2012-06-19 10:20:42 +02:00
|
|
|
struct record_processor
|
|
|
|
{
|
2013-06-14 10:02:29 +02:00
|
|
|
UINT16 addresswidth;
|
2012-06-26 16:03:32 +02:00
|
|
|
UINT16 cpu_status;
|
|
|
|
const WCHAR *device_id;
|
2013-05-02 12:02:34 +02:00
|
|
|
UINT16 family;
|
2012-06-19 10:20:42 +02:00
|
|
|
const WCHAR *manufacturer;
|
2012-08-31 15:58:47 +02:00
|
|
|
UINT32 maxclockspeed;
|
2012-07-04 10:32:55 +02:00
|
|
|
const WCHAR *name;
|
2013-06-14 10:03:25 +02:00
|
|
|
UINT32 num_cores;
|
2012-09-06 14:03:24 +02:00
|
|
|
UINT32 num_logical_processors;
|
2012-06-29 13:39:19 +02:00
|
|
|
const WCHAR *processor_id;
|
2012-10-04 15:37:57 +02:00
|
|
|
const WCHAR *unique_id;
|
2012-06-19 10:20:42 +02:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
struct record_qualifier
|
|
|
|
{
|
|
|
|
const WCHAR *class;
|
|
|
|
const WCHAR *member;
|
|
|
|
UINT32 type;
|
|
|
|
INT32 flavor;
|
|
|
|
const WCHAR *name;
|
|
|
|
INT32 intvalue;
|
|
|
|
const WCHAR *strvalue;
|
|
|
|
};
|
2012-07-27 14:04:03 +02:00
|
|
|
struct record_service
|
|
|
|
{
|
2012-07-30 15:04:15 +02:00
|
|
|
int accept_pause;
|
|
|
|
int accept_stop;
|
2012-07-27 14:04:03 +02:00
|
|
|
const WCHAR *displayname;
|
|
|
|
const WCHAR *name;
|
|
|
|
UINT32 process_id;
|
|
|
|
const WCHAR *servicetype;
|
2012-08-26 19:29:29 +02:00
|
|
|
const WCHAR *startmode;
|
2012-07-27 14:04:03 +02:00
|
|
|
const WCHAR *state;
|
2012-08-27 06:29:21 +02:00
|
|
|
const WCHAR *systemname;
|
2012-10-17 11:07:17 +02:00
|
|
|
/* methods */
|
|
|
|
class_method *pause_service;
|
2012-10-17 11:07:38 +02:00
|
|
|
class_method *resume_service;
|
2012-10-17 11:07:57 +02:00
|
|
|
class_method *start_service;
|
2012-10-17 11:08:14 +02:00
|
|
|
class_method *stop_service;
|
2012-07-27 14:04:03 +02:00
|
|
|
};
|
2012-10-04 15:37:32 +02:00
|
|
|
struct record_sounddevice
|
|
|
|
{
|
2013-06-14 10:08:24 +02:00
|
|
|
const WCHAR *name;
|
2012-10-04 15:37:32 +02:00
|
|
|
const WCHAR *productname;
|
|
|
|
};
|
2012-07-13 11:35:09 +02:00
|
|
|
struct record_stdregprov
|
|
|
|
{
|
|
|
|
class_method *enumkey;
|
|
|
|
class_method *enumvalues;
|
2012-10-15 10:46:09 +02:00
|
|
|
class_method *getstringvalue;
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2012-06-22 09:23:36 +02:00
|
|
|
struct record_videocontroller
|
|
|
|
{
|
2013-06-14 10:06:46 +02:00
|
|
|
const WCHAR *adapter_dactype;
|
2012-06-22 09:23:36 +02:00
|
|
|
UINT32 adapter_ram;
|
2012-06-28 09:24:05 +02:00
|
|
|
UINT32 current_bitsperpixel;
|
|
|
|
UINT32 current_horizontalres;
|
|
|
|
UINT32 current_verticalres;
|
2012-09-17 12:19:30 +02:00
|
|
|
const WCHAR *description;
|
2012-06-22 09:23:36 +02:00
|
|
|
const WCHAR *device_id;
|
2012-06-28 09:24:05 +02:00
|
|
|
const WCHAR *name;
|
2013-01-29 15:32:06 +01:00
|
|
|
const WCHAR *pnpdevice_id;
|
2012-06-22 09:23:36 +02:00
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
#include "poppack.h"
|
|
|
|
|
2012-07-04 10:32:00 +02:00
|
|
|
static const struct record_baseboard data_baseboard[] =
|
|
|
|
{
|
2013-11-04 11:53:46 +01:00
|
|
|
{ baseboard_manufacturerW, baseboard_tagW, baseboard_tagW, baseboard_serialnumberW, baseboard_tagW }
|
2012-07-04 10:32:00 +02:00
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const struct record_bios data_bios[] =
|
|
|
|
{
|
2013-11-04 11:54:10 +01:00
|
|
|
{ bios_descriptionW, bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW,
|
|
|
|
bios_smbiosbiosversionW, bios_versionW }
|
2012-06-15 15:47:28 +02:00
|
|
|
};
|
2012-10-04 15:37:13 +02:00
|
|
|
static const struct record_diskdrive data_diskdrive[] =
|
|
|
|
{
|
2014-02-28 11:21:11 +01:00
|
|
|
{ diskdrive_deviceidW, 0, diskdrive_manufacturerW, diskdrive_mediatypeW, diskdrive_modelW,
|
|
|
|
diskdrive_serialW }
|
2012-10-04 15:37:13 +02:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const struct record_param data_param[] =
|
2012-07-13 11:35:09 +02:00
|
|
|
{
|
2013-01-11 17:22:14 +01:00
|
|
|
{ class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
|
|
|
{ class_processW, method_getownerW, -1, param_userW, CIM_STRING },
|
|
|
|
{ class_processW, method_getownerW, -1, param_domainW, CIM_STRING },
|
2012-10-17 11:07:17 +02:00
|
|
|
{ class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
2012-10-17 11:07:38 +02:00
|
|
|
{ class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
2012-10-17 11:07:57 +02:00
|
|
|
{ class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
2012-10-17 11:08:14 +02:00
|
|
|
{ class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
2012-10-12 14:25:39 +02:00
|
|
|
{ class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
|
2012-07-13 11:35:09 +02:00
|
|
|
{ class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING },
|
2012-10-12 14:25:39 +02:00
|
|
|
{ class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
2012-07-13 11:35:09 +02:00
|
|
|
{ class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
|
2012-10-12 14:25:39 +02:00
|
|
|
{ class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
|
2012-07-13 11:35:09 +02:00
|
|
|
{ class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING },
|
2012-10-12 14:25:39 +02:00
|
|
|
{ class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
2012-07-13 11:35:09 +02:00
|
|
|
{ class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
|
2012-10-15 10:46:09 +02:00
|
|
|
{ class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY },
|
|
|
|
{ class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
|
|
|
|
{ class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING },
|
|
|
|
{ class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING },
|
|
|
|
{ class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
|
|
|
|
{ class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING }
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
|
|
|
|
#define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
|
|
|
|
WBEM_FLAVOR_ORIGIN_PROPAGATED)
|
|
|
|
|
2013-12-11 14:36:34 +01:00
|
|
|
static const struct record_physicalmedia data_physicalmedia[] =
|
|
|
|
{
|
2014-02-28 11:22:01 +01:00
|
|
|
{ diskdrive_serialW, physicalmedia_tagW }
|
2013-12-11 14:36:34 +01:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const struct record_qualifier data_qualifier[] =
|
|
|
|
{
|
|
|
|
{ class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 },
|
|
|
|
{ class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 }
|
|
|
|
};
|
2012-10-04 15:37:32 +02:00
|
|
|
static const struct record_sounddevice data_sounddevice[] =
|
|
|
|
{
|
2013-06-14 10:08:24 +02:00
|
|
|
{ sounddevice_productnameW, sounddevice_productnameW }
|
2012-10-04 15:37:32 +02:00
|
|
|
};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const struct record_stdregprov data_stdregprov[] =
|
|
|
|
{
|
2012-10-15 10:46:09 +02:00
|
|
|
{ reg_enum_key, reg_enum_values, reg_get_stringvalue }
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
|
2013-05-22 10:10:16 +02:00
|
|
|
/* check if row matches condition and update status */
|
|
|
|
static BOOL match_row( const struct table *table, UINT row, const struct expr *cond, enum fill_status *status )
|
|
|
|
{
|
|
|
|
LONGLONG val;
|
2014-01-28 13:26:16 +01:00
|
|
|
UINT type;
|
|
|
|
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!cond)
|
|
|
|
{
|
|
|
|
*status = FILL_STATUS_UNFILTERED;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2014-01-28 13:26:16 +01:00
|
|
|
if (eval_cond( table, row, cond, &val, &type ) != S_OK)
|
2013-05-22 10:10:16 +02:00
|
|
|
{
|
|
|
|
*status = FILL_STATUS_FAILED;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
*status = FILL_STATUS_FILTERED;
|
|
|
|
return val != 0;
|
|
|
|
}
|
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
|
|
|
|
{
|
|
|
|
if (!table->num_rows_allocated)
|
|
|
|
{
|
|
|
|
if (!(table->data = heap_alloc( row_count * row_size ))) return FALSE;
|
|
|
|
table->num_rows_allocated = row_count;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (row_count >= table->num_rows_allocated)
|
|
|
|
{
|
|
|
|
BYTE *data;
|
|
|
|
UINT count = table->num_rows_allocated * 2;
|
|
|
|
if (!(data = heap_realloc( table->data, count * row_size ))) return FALSE;
|
|
|
|
table->data = data;
|
|
|
|
table->num_rows_allocated = count;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_cdromdrive( struct table *table, const struct expr *cond )
|
2013-02-25 11:03:56 +01:00
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'%','c',':',0};
|
|
|
|
WCHAR drive[3], root[] = {'A',':','\\',0};
|
|
|
|
struct record_cdromdrive *rec;
|
2013-06-04 13:28:21 +02:00
|
|
|
UINT i, row = 0, offset = 0;
|
2013-02-25 11:03:56 +01:00
|
|
|
DWORD drives = GetLogicalDrives();
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2013-02-25 11:03:56 +01:00
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2013-02-25 11:03:56 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sizeof(drives); i++)
|
|
|
|
{
|
|
|
|
if (drives & (1 << i))
|
|
|
|
{
|
|
|
|
root[0] = 'A' + i;
|
|
|
|
if (GetDriveTypeW( root ) != DRIVE_CDROM)
|
|
|
|
continue;
|
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
2013-02-25 11:03:56 +01:00
|
|
|
rec = (struct record_cdromdrive *)(table->data + offset);
|
|
|
|
rec->device_id = cdromdrive_pnpdeviceidW;
|
|
|
|
sprintfW( drive, fmtW, 'A' + i );
|
|
|
|
rec->drive = heap_strdupW( drive );
|
|
|
|
rec->name = cdromdrive_nameW;
|
|
|
|
rec->pnpdevice_id = cdromdrive_pnpdeviceidW;
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
2013-02-25 11:03:56 +01:00
|
|
|
offset += sizeof(*rec);
|
2013-05-22 10:10:16 +02:00
|
|
|
row++;
|
2013-02-25 11:03:56 +01:00
|
|
|
}
|
|
|
|
}
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
2013-02-25 11:03:56 +01:00
|
|
|
}
|
|
|
|
|
2012-06-26 16:03:10 +02:00
|
|
|
static UINT get_processor_count(void)
|
|
|
|
{
|
|
|
|
SYSTEM_BASIC_INFORMATION info;
|
|
|
|
|
|
|
|
if (NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )) return 1;
|
|
|
|
return info.NumberOfProcessors;
|
|
|
|
}
|
|
|
|
|
2013-06-14 10:03:25 +02:00
|
|
|
static UINT get_logical_processor_count( UINT *num_cores )
|
2012-09-06 14:03:24 +02:00
|
|
|
{
|
|
|
|
SYSTEM_LOGICAL_PROCESSOR_INFORMATION *info;
|
|
|
|
UINT i, j, count = 0;
|
|
|
|
NTSTATUS status;
|
|
|
|
ULONG len;
|
|
|
|
|
2013-06-14 10:03:25 +02:00
|
|
|
if (num_cores) *num_cores = get_processor_count();
|
2012-09-06 14:03:24 +02:00
|
|
|
status = NtQuerySystemInformation( SystemLogicalProcessorInformation, NULL, 0, &len );
|
|
|
|
if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count();
|
|
|
|
|
|
|
|
if (!(info = heap_alloc( len ))) return get_processor_count();
|
|
|
|
status = NtQuerySystemInformation( SystemLogicalProcessorInformation, info, len, &len );
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
heap_free( info );
|
|
|
|
return get_processor_count();
|
|
|
|
}
|
2013-06-14 10:03:25 +02:00
|
|
|
if (num_cores) *num_cores = 0;
|
2012-09-06 14:03:24 +02:00
|
|
|
for (i = 0; i < len / sizeof(*info); i++)
|
|
|
|
{
|
2013-06-14 10:03:25 +02:00
|
|
|
if (info[i].Relationship == RelationProcessorCore)
|
|
|
|
{
|
|
|
|
for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) count++;
|
|
|
|
}
|
|
|
|
else if (info[i].Relationship == RelationProcessorPackage && num_cores)
|
|
|
|
{
|
|
|
|
for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) (*num_cores)++;
|
|
|
|
}
|
2012-09-06 14:03:24 +02:00
|
|
|
}
|
|
|
|
heap_free( info );
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2012-06-27 11:35:45 +02:00
|
|
|
static UINT64 get_total_physical_memory(void)
|
|
|
|
{
|
|
|
|
MEMORYSTATUSEX status;
|
|
|
|
|
|
|
|
status.dwLength = sizeof(status);
|
|
|
|
if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
|
|
|
|
return status.ullTotalPhys;
|
|
|
|
}
|
|
|
|
|
2013-04-08 10:21:29 +02:00
|
|
|
static WCHAR *get_computername(void)
|
|
|
|
{
|
|
|
|
WCHAR *ret;
|
2013-05-22 10:10:16 +02:00
|
|
|
DWORD size = MAX_COMPUTERNAME_LENGTH;
|
2013-04-08 10:21:29 +02:00
|
|
|
|
|
|
|
if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
|
|
|
|
GetComputerNameW( ret, &size );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_compsys( struct table *table, const struct expr *cond )
|
2012-06-26 16:03:10 +02:00
|
|
|
{
|
|
|
|
struct record_computersystem *rec;
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0;
|
2012-06-26 16:03:10 +02:00
|
|
|
|
2013-06-14 10:01:33 +02:00
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2012-06-26 16:03:10 +02:00
|
|
|
|
|
|
|
rec = (struct record_computersystem *)table->data;
|
|
|
|
rec->description = compsys_descriptionW;
|
2012-09-28 13:39:04 +02:00
|
|
|
rec->domain = compsys_domainW;
|
2012-09-04 13:49:57 +02:00
|
|
|
rec->domainrole = 0; /* standalone workstation */
|
2012-06-26 16:03:10 +02:00
|
|
|
rec->manufacturer = compsys_manufacturerW;
|
|
|
|
rec->model = compsys_modelW;
|
2013-04-08 10:21:29 +02:00
|
|
|
rec->name = get_computername();
|
2013-06-14 10:03:25 +02:00
|
|
|
rec->num_logical_processors = get_logical_processor_count( NULL );
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->num_processors = get_processor_count();
|
2012-06-27 11:35:45 +02:00
|
|
|
rec->total_physical_memory = get_total_physical_memory();
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
2012-06-26 16:03:10 +02:00
|
|
|
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
2012-06-26 16:03:10 +02:00
|
|
|
}
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
struct dirstack
|
|
|
|
{
|
|
|
|
WCHAR **dirs;
|
|
|
|
UINT *len_dirs;
|
|
|
|
UINT num_dirs;
|
|
|
|
UINT num_allocated;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct dirstack *alloc_dirstack( UINT size )
|
|
|
|
{
|
|
|
|
struct dirstack *dirstack;
|
|
|
|
|
|
|
|
if (!(dirstack = heap_alloc( sizeof(*dirstack) ))) return NULL;
|
|
|
|
if (!(dirstack->dirs = heap_alloc( sizeof(WCHAR *) * size )))
|
|
|
|
{
|
|
|
|
heap_free( dirstack );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!(dirstack->len_dirs = heap_alloc( sizeof(UINT) * size )))
|
|
|
|
{
|
|
|
|
heap_free( dirstack->dirs );
|
|
|
|
heap_free( dirstack );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
dirstack->num_dirs = 0;
|
|
|
|
dirstack->num_allocated = size;
|
|
|
|
return dirstack;
|
|
|
|
}
|
|
|
|
|
2013-06-04 13:26:32 +02:00
|
|
|
static void clear_dirstack( struct dirstack *dirstack )
|
2013-05-29 12:16:44 +02:00
|
|
|
{
|
|
|
|
UINT i;
|
|
|
|
for (i = 0; i < dirstack->num_dirs; i++) heap_free( dirstack->dirs[i] );
|
2013-06-04 13:26:32 +02:00
|
|
|
dirstack->num_dirs = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void free_dirstack( struct dirstack *dirstack )
|
|
|
|
{
|
|
|
|
clear_dirstack( dirstack );
|
2013-05-29 12:16:44 +02:00
|
|
|
heap_free( dirstack->dirs );
|
|
|
|
heap_free( dirstack->len_dirs );
|
|
|
|
heap_free( dirstack );
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL push_dir( struct dirstack *dirstack, WCHAR *dir, UINT len )
|
|
|
|
{
|
|
|
|
UINT size, i = dirstack->num_dirs;
|
|
|
|
|
2013-06-04 13:26:32 +02:00
|
|
|
if (!dir) return FALSE;
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
if (i == dirstack->num_allocated)
|
|
|
|
{
|
|
|
|
WCHAR **tmp;
|
|
|
|
UINT *len_tmp;
|
|
|
|
|
|
|
|
size = dirstack->num_allocated * 2;
|
|
|
|
if (!(tmp = heap_realloc( dirstack->dirs, size * sizeof(WCHAR *) ))) return FALSE;
|
|
|
|
dirstack->dirs = tmp;
|
|
|
|
if (!(len_tmp = heap_realloc( dirstack->len_dirs, size * sizeof(UINT) ))) return FALSE;
|
|
|
|
dirstack->len_dirs = len_tmp;
|
|
|
|
dirstack->num_allocated = size;
|
|
|
|
}
|
|
|
|
dirstack->dirs[i] = dir;
|
|
|
|
dirstack->len_dirs[i] = len;
|
|
|
|
dirstack->num_dirs++;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *pop_dir( struct dirstack *dirstack, UINT *len )
|
|
|
|
{
|
|
|
|
if (!dirstack->num_dirs)
|
|
|
|
{
|
|
|
|
*len = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
dirstack->num_dirs--;
|
|
|
|
*len = dirstack->len_dirs[dirstack->num_dirs];
|
|
|
|
return dirstack->dirs[dirstack->num_dirs];
|
|
|
|
}
|
|
|
|
|
|
|
|
static const WCHAR *peek_dir( struct dirstack *dirstack )
|
|
|
|
{
|
|
|
|
if (!dirstack->num_dirs) return NULL;
|
|
|
|
return dirstack->dirs[dirstack->num_dirs - 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len )
|
|
|
|
{
|
|
|
|
UINT i = 0;
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
|
|
|
|
ret[i++] = drive;
|
|
|
|
ret[i++] = ':';
|
|
|
|
ret[i++] = '\\';
|
2013-06-04 13:26:32 +02:00
|
|
|
if (path && len)
|
2013-05-29 12:16:44 +02:00
|
|
|
{
|
|
|
|
memcpy( ret + i, path, len * sizeof(WCHAR) );
|
|
|
|
i += len;
|
|
|
|
ret[i++] = '\\';
|
|
|
|
}
|
|
|
|
ret[i++] = '*';
|
|
|
|
ret[i] = 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-06-04 13:26:32 +02:00
|
|
|
static WCHAR *build_name( WCHAR drive, const WCHAR *path )
|
2013-05-29 12:16:44 +02:00
|
|
|
{
|
|
|
|
UINT i = 0, len = 0;
|
|
|
|
const WCHAR *p;
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
for (p = path; *p; p++)
|
|
|
|
{
|
|
|
|
if (*p == '\\') len += 2;
|
|
|
|
else len++;
|
|
|
|
};
|
|
|
|
if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
|
|
|
|
ret[i++] = drive;
|
|
|
|
ret[i++] = ':';
|
|
|
|
ret[i++] = '\\';
|
|
|
|
ret[i++] = '\\';
|
|
|
|
for (p = path; *p; p++)
|
|
|
|
{
|
|
|
|
if (*p != '\\') ret[i++] = *p;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret[i++] = '\\';
|
|
|
|
ret[i++] = '\\';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret[i] = 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-06-04 13:26:32 +02:00
|
|
|
static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
|
|
|
|
{
|
|
|
|
const WCHAR *p = path, *start;
|
|
|
|
UINT len, i;
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
|
|
|
|
start = path + 4;
|
|
|
|
len = strlenW( start );
|
|
|
|
p = start + len - 1;
|
|
|
|
if (*p == '\\') return NULL;
|
|
|
|
|
|
|
|
while (p >= start && *p != '\\') { len--; p--; };
|
|
|
|
while (p >= start && *p == '\\') { len--; p--; };
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
|
|
|
|
for (i = 0, p = start; p < start + len; p++)
|
|
|
|
{
|
|
|
|
if (p[0] == '\\' && p[1] == '\\')
|
|
|
|
{
|
|
|
|
ret[i++] = '\\';
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
else ret[i++] = *p;
|
|
|
|
}
|
|
|
|
ret[i] = 0;
|
|
|
|
*ret_len = i;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL seen_dir( struct dirstack *dirstack, const WCHAR *path )
|
|
|
|
{
|
|
|
|
UINT i;
|
|
|
|
for (i = 0; i < dirstack->num_dirs; i++) if (!strcmpW( dirstack->dirs[i], path )) return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* optimize queries of the form WHERE Name='...' [OR Name='...']* */
|
|
|
|
static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR root, UINT *count )
|
|
|
|
{
|
2013-08-28 09:49:05 +02:00
|
|
|
const struct expr *left, *right;
|
2013-06-04 13:26:32 +02:00
|
|
|
|
2013-08-28 09:49:05 +02:00
|
|
|
if (!cond || cond->type != EXPR_COMPLEX) return *count = 0;
|
|
|
|
|
|
|
|
left = cond->u.expr.left;
|
|
|
|
right = cond->u.expr.right;
|
2013-06-04 13:26:32 +02:00
|
|
|
if (cond->u.expr.op == OP_EQ)
|
|
|
|
{
|
|
|
|
UINT len;
|
|
|
|
WCHAR *path;
|
|
|
|
const WCHAR *str = NULL;
|
|
|
|
|
|
|
|
if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL &&
|
|
|
|
!strcmpW( left->u.propval->name, prop_nameW ) &&
|
|
|
|
toupperW( right->u.sval[0] ) == toupperW( root ))
|
|
|
|
{
|
|
|
|
str = right->u.sval;
|
|
|
|
}
|
|
|
|
else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL &&
|
|
|
|
!strcmpW( right->u.propval->name, prop_nameW ) &&
|
|
|
|
toupperW( left->u.sval[0] ) == toupperW( root ))
|
|
|
|
{
|
|
|
|
str = left->u.sval;
|
|
|
|
}
|
|
|
|
if (str && (path = build_dirname( str, &len )))
|
|
|
|
{
|
|
|
|
if (seen_dir( dirstack, path ))
|
|
|
|
{
|
|
|
|
heap_free( path );
|
|
|
|
return ++*count;
|
|
|
|
}
|
|
|
|
else if (push_dir( dirstack, path, len )) return ++*count;
|
|
|
|
heap_free( path );
|
|
|
|
return *count = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (cond->u.expr.op == OP_OR)
|
|
|
|
{
|
|
|
|
UINT left_count = 0, right_count = 0;
|
|
|
|
|
|
|
|
if (!(seed_dirs( dirstack, left, root, &left_count ))) return *count = 0;
|
|
|
|
if (!(seed_dirs( dirstack, right, root, &right_count ))) return *count = 0;
|
|
|
|
return *count += left_count + right_count;
|
|
|
|
}
|
|
|
|
return *count = 0;
|
|
|
|
}
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len )
|
|
|
|
{
|
|
|
|
UINT len_path = 0, len_segment = strlenW( segment );
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
*len = 0;
|
|
|
|
if (path) len_path = strlenW( path );
|
|
|
|
if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
|
2013-06-04 13:26:32 +02:00
|
|
|
if (path && len_path)
|
2013-05-29 12:16:44 +02:00
|
|
|
{
|
|
|
|
memcpy( ret, path, len_path * sizeof(WCHAR) );
|
|
|
|
ret[len_path] = '\\';
|
|
|
|
*len += len_path + 1;
|
|
|
|
}
|
|
|
|
memcpy( ret + *len, segment, len_segment * sizeof(WCHAR) );
|
|
|
|
*len += len_segment;
|
|
|
|
ret[*len] = 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-06-04 13:29:03 +02:00
|
|
|
static WCHAR *get_file_version( const WCHAR *filename )
|
|
|
|
{
|
|
|
|
static const WCHAR slashW[] = {'\\',0}, fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
|
|
|
|
VS_FIXEDFILEINFO *info;
|
|
|
|
DWORD size;
|
|
|
|
void *block;
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( (4 * 5 + sizeof(fmtW) / sizeof(fmtW[0])) * sizeof(WCHAR) ))) return NULL;
|
|
|
|
if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size )))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!GetFileVersionInfoW( filename, 0, size, block ) ||
|
|
|
|
!VerQueryValueW( block, slashW, (void **)&info, &size ))
|
|
|
|
{
|
|
|
|
heap_free( block );
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
sprintfW( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff,
|
|
|
|
info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff );
|
|
|
|
heap_free( block );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_datafile( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
|
|
|
|
struct record_datafile *rec;
|
|
|
|
UINT i, len, row = 0, offset = 0, num_expected_rows;
|
|
|
|
WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
|
|
|
|
DWORD drives = GetLogicalDrives();
|
|
|
|
WIN32_FIND_DATAW data;
|
|
|
|
HANDLE handle;
|
2014-03-24 08:51:04 +01:00
|
|
|
struct dirstack *dirstack;
|
2013-06-04 13:29:03 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
|
|
|
|
if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
2014-03-24 08:51:04 +01:00
|
|
|
dirstack = alloc_dirstack(2);
|
|
|
|
|
2013-06-04 13:29:03 +02:00
|
|
|
for (i = 0; i < sizeof(drives); i++)
|
|
|
|
{
|
|
|
|
if (!(drives & (1 << i))) continue;
|
|
|
|
|
|
|
|
root[0] = 'A' + i;
|
|
|
|
if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
|
|
|
|
|
|
|
|
num_expected_rows = 0;
|
|
|
|
if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
path = pop_dir( dirstack, &len );
|
|
|
|
if (!(glob = build_glob( root[0], path, len )))
|
|
|
|
{
|
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) ))
|
|
|
|
{
|
|
|
|
status = FILL_STATUS_FAILED;
|
2014-03-24 08:51:04 +01:00
|
|
|
FindClose( handle );
|
2013-06-04 13:29:03 +02:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue;
|
|
|
|
new_path = append_path( path, data.cFileName, &len );
|
|
|
|
|
|
|
|
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
|
|
|
{
|
|
|
|
if (push_dir( dirstack, new_path, len )) continue;
|
|
|
|
heap_free( new_path );
|
2014-03-24 08:51:04 +01:00
|
|
|
FindClose( handle );
|
2013-06-04 13:29:03 +02:00
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
rec = (struct record_datafile *)(table->data + offset);
|
|
|
|
rec->name = build_name( root[0], new_path );
|
|
|
|
rec->version = get_file_version( rec->name );
|
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (num_expected_rows && row == num_expected_rows - 1)
|
|
|
|
{
|
|
|
|
row++;
|
|
|
|
FindClose( handle );
|
|
|
|
status = FILL_STATUS_FILTERED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
offset += sizeof(*rec);
|
|
|
|
row++;
|
|
|
|
}
|
|
|
|
while (FindNextFileW( handle, &data ));
|
|
|
|
FindClose( handle );
|
|
|
|
}
|
|
|
|
if (!peek_dir( dirstack )) break;
|
|
|
|
heap_free( glob );
|
|
|
|
heap_free( path );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
free_dirstack( dirstack );
|
|
|
|
heap_free( glob );
|
|
|
|
heap_free( path );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
static enum fill_status fill_directory( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
|
|
|
|
struct record_directory *rec;
|
2013-06-04 13:28:21 +02:00
|
|
|
UINT i, len, row = 0, offset = 0, num_expected_rows;
|
2013-05-29 12:16:44 +02:00
|
|
|
WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
|
|
|
|
DWORD drives = GetLogicalDrives();
|
|
|
|
WIN32_FIND_DATAW data;
|
|
|
|
HANDLE handle;
|
2013-06-20 22:44:00 +02:00
|
|
|
struct dirstack *dirstack;
|
2013-05-29 12:16:44 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2013-05-29 12:16:44 +02:00
|
|
|
|
2013-06-20 22:44:00 +02:00
|
|
|
dirstack = alloc_dirstack(2);
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
for (i = 0; i < sizeof(drives); i++)
|
|
|
|
{
|
|
|
|
if (!(drives & (1 << i))) continue;
|
|
|
|
|
|
|
|
root[0] = 'A' + i;
|
|
|
|
if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
|
|
|
|
|
2013-06-04 13:26:32 +02:00
|
|
|
num_expected_rows = 0;
|
|
|
|
if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
path = pop_dir( dirstack, &len );
|
|
|
|
if (!(glob = build_glob( root[0], path, len )))
|
|
|
|
{
|
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) ))
|
2013-05-29 12:16:44 +02:00
|
|
|
{
|
2013-06-20 10:34:57 +02:00
|
|
|
FindClose( handle );
|
2013-06-04 13:28:21 +02:00
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
goto done;
|
2013-05-29 12:16:44 +02:00
|
|
|
}
|
|
|
|
if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
|
|
|
|
!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW ))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
new_path = append_path( path, data.cFileName, &len );
|
|
|
|
if (!(push_dir( dirstack, new_path, len )))
|
|
|
|
{
|
|
|
|
heap_free( new_path );
|
2013-06-20 10:34:57 +02:00
|
|
|
FindClose( handle );
|
2013-05-29 12:16:44 +02:00
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
rec = (struct record_directory *)(table->data + offset);
|
|
|
|
rec->accessmask = FILE_ALL_ACCESS;
|
2013-06-04 13:26:32 +02:00
|
|
|
rec->name = build_name( root[0], new_path );
|
2013-05-29 12:16:44 +02:00
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
2013-06-04 13:26:32 +02:00
|
|
|
else if (num_expected_rows && row == num_expected_rows - 1)
|
|
|
|
{
|
|
|
|
row++;
|
|
|
|
FindClose( handle );
|
|
|
|
status = FILL_STATUS_FILTERED;
|
|
|
|
goto done;
|
|
|
|
}
|
2013-05-29 12:16:44 +02:00
|
|
|
offset += sizeof(*rec);
|
|
|
|
row++;
|
|
|
|
}
|
|
|
|
while (FindNextFileW( handle, &data ));
|
|
|
|
FindClose( handle );
|
|
|
|
}
|
|
|
|
if (!peek_dir( dirstack )) break;
|
|
|
|
heap_free( glob );
|
|
|
|
heap_free( path );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
free_dirstack( dirstack );
|
|
|
|
heap_free( glob );
|
|
|
|
heap_free( path );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-06-04 13:26:32 +02:00
|
|
|
static WCHAR *get_filesystem( const WCHAR *root )
|
|
|
|
{
|
|
|
|
static const WCHAR ntfsW[] = {'N','T','F','S',0};
|
|
|
|
WCHAR buffer[MAX_PATH + 1];
|
|
|
|
|
|
|
|
if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
|
|
|
|
return heap_strdupW( buffer );
|
|
|
|
return heap_strdupW( ntfsW );
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
|
|
|
|
{
|
|
|
|
WCHAR root[] = {'\\','\\','.','\\','A',':',0};
|
|
|
|
ULARGE_INTEGER free;
|
|
|
|
DISK_GEOMETRY_EX info;
|
|
|
|
HANDLE handle;
|
|
|
|
|
|
|
|
free.QuadPart = 512 * 1024 * 1024;
|
|
|
|
GetDiskFreeSpaceExW( dir, NULL, NULL, &free );
|
|
|
|
|
|
|
|
root[4] = dir[0];
|
|
|
|
handle = CreateFileW( root, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
|
|
|
|
if (handle != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &info, sizeof(info), NULL, NULL ))
|
|
|
|
*disksize = info.DiskSize.QuadPart;
|
|
|
|
CloseHandle( handle );
|
|
|
|
}
|
|
|
|
return free.QuadPart;
|
|
|
|
}
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_diskpartition( struct table *table, const struct expr *cond )
|
2013-02-25 11:04:29 +01:00
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] =
|
|
|
|
{'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
|
|
|
|
WCHAR device_id[32], root[] = {'A',':','\\',0};
|
|
|
|
struct record_diskpartition *rec;
|
2013-06-04 13:28:21 +02:00
|
|
|
UINT i, row = 0, offset = 0, type, index = 0;
|
2013-02-25 11:04:29 +01:00
|
|
|
UINT64 size = 1024 * 1024 * 1024;
|
|
|
|
DWORD drives = GetLogicalDrives();
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2013-02-25 11:04:29 +01:00
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2013-02-25 11:04:29 +01:00
|
|
|
|
|
|
|
for (i = 0; i < sizeof(drives); i++)
|
|
|
|
{
|
|
|
|
if (drives & (1 << i))
|
|
|
|
{
|
|
|
|
root[0] = 'A' + i;
|
|
|
|
type = GetDriveTypeW( root );
|
|
|
|
if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
|
|
|
|
continue;
|
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
2013-02-25 11:04:29 +01:00
|
|
|
rec = (struct record_diskpartition *)(table->data + offset);
|
|
|
|
rec->bootable = (i == 2) ? -1 : 0;
|
2013-04-08 10:21:29 +02:00
|
|
|
rec->bootpartition = (i == 2) ? -1 : 0;
|
2013-02-25 11:04:29 +01:00
|
|
|
sprintfW( device_id, fmtW, index );
|
|
|
|
rec->device_id = heap_strdupW( device_id );
|
|
|
|
rec->diskindex = index;
|
|
|
|
rec->index = 0;
|
|
|
|
rec->pnpdevice_id = heap_strdupW( device_id );
|
|
|
|
get_freespace( root, &size );
|
|
|
|
rec->size = size;
|
|
|
|
rec->startingoffset = 0;
|
|
|
|
rec->type = get_filesystem( root );
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
2013-02-25 11:04:29 +01:00
|
|
|
offset += sizeof(*rec);
|
2013-05-22 10:10:16 +02:00
|
|
|
row++;
|
2013-02-25 11:04:29 +01:00
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
2013-02-25 11:04:29 +01:00
|
|
|
}
|
|
|
|
|
2014-03-17 09:36:55 +01:00
|
|
|
static WCHAR *get_volumeserialnumber( const WCHAR *root )
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'%','0','8','X',0};
|
|
|
|
DWORD serial = 0;
|
|
|
|
WCHAR buffer[9];
|
|
|
|
|
|
|
|
GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 );
|
|
|
|
sprintfW( buffer, fmtW, serial );
|
|
|
|
return heap_strdupW( buffer );
|
|
|
|
}
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_logicaldisk( struct table *table, const struct expr *cond )
|
2012-06-29 13:41:07 +02:00
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'%','c',':',0};
|
|
|
|
WCHAR device_id[3], root[] = {'A',':','\\',0};
|
|
|
|
struct record_logicaldisk *rec;
|
2013-06-04 13:28:21 +02:00
|
|
|
UINT i, row = 0, offset = 0, type;
|
2012-06-29 13:41:07 +02:00
|
|
|
UINT64 size = 1024 * 1024 * 1024;
|
|
|
|
DWORD drives = GetLogicalDrives();
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2012-06-29 13:41:07 +02:00
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2012-06-29 13:41:07 +02:00
|
|
|
|
|
|
|
for (i = 0; i < sizeof(drives); i++)
|
|
|
|
{
|
|
|
|
if (drives & (1 << i))
|
|
|
|
{
|
|
|
|
root[0] = 'A' + i;
|
|
|
|
type = GetDriveTypeW( root );
|
|
|
|
if (type != DRIVE_FIXED && type != DRIVE_CDROM && type != DRIVE_REMOVABLE)
|
|
|
|
continue;
|
|
|
|
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
2012-06-29 13:41:07 +02:00
|
|
|
rec = (struct record_logicaldisk *)(table->data + offset);
|
|
|
|
sprintfW( device_id, fmtW, 'A' + i );
|
2014-03-17 09:36:55 +01:00
|
|
|
rec->device_id = heap_strdupW( device_id );
|
|
|
|
rec->drivetype = type;
|
|
|
|
rec->filesystem = get_filesystem( root );
|
|
|
|
rec->freespace = get_freespace( root, &size );
|
|
|
|
rec->name = heap_strdupW( device_id );
|
|
|
|
rec->size = size;
|
|
|
|
rec->volumeserialnumber = get_volumeserialnumber( root );
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
2012-06-29 13:41:07 +02:00
|
|
|
offset += sizeof(*rec);
|
2013-05-22 10:10:16 +02:00
|
|
|
row++;
|
2012-06-29 13:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
2012-06-29 13:41:07 +02:00
|
|
|
}
|
|
|
|
|
2012-06-25 11:20:09 +02:00
|
|
|
static UINT16 get_connection_status( IF_OPER_STATUS status )
|
|
|
|
{
|
|
|
|
switch (status)
|
|
|
|
{
|
|
|
|
case IfOperStatusDown:
|
|
|
|
return 0; /* Disconnected */
|
|
|
|
case IfOperStatusUp:
|
|
|
|
return 2; /* Connected */
|
|
|
|
default:
|
|
|
|
ERR("unhandled status %u\n", status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2012-07-13 11:34:17 +02:00
|
|
|
static WCHAR *get_mac_address( const BYTE *addr, DWORD len )
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] =
|
|
|
|
{'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
|
|
|
|
'%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
|
|
|
|
sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
|
|
|
|
return ret;
|
|
|
|
}
|
2013-06-14 10:07:43 +02:00
|
|
|
static const WCHAR *get_adaptertype( DWORD type, int *physical )
|
2012-10-10 12:01:22 +02:00
|
|
|
{
|
|
|
|
static const WCHAR ethernetW[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
|
|
|
|
static const WCHAR wirelessW[] = {'W','i','r','e','l','e','s','s',0};
|
|
|
|
static const WCHAR firewireW[] = {'1','3','9','4',0};
|
|
|
|
static const WCHAR tunnelW[] = {'T','u','n','n','e','l',0};
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
2013-06-14 10:07:43 +02:00
|
|
|
case IF_TYPE_ETHERNET_CSMACD: *physical = -1; return ethernetW;
|
|
|
|
case IF_TYPE_IEEE80211: *physical = -1; return wirelessW;
|
|
|
|
case IF_TYPE_IEEE1394: *physical = -1; return firewireW;
|
|
|
|
case IF_TYPE_TUNNEL: *physical = 0; return tunnelW;
|
|
|
|
default: *physical = 0; return NULL;
|
2012-10-10 12:01:22 +02:00
|
|
|
}
|
|
|
|
}
|
2012-06-25 11:20:09 +02:00
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_networkadapter( struct table *table, const struct expr *cond )
|
2012-06-25 11:20:09 +02:00
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'%','u',0};
|
|
|
|
WCHAR device_id[11];
|
|
|
|
struct record_networkadapter *rec;
|
|
|
|
IP_ADAPTER_ADDRESSES *aa, *buffer;
|
2013-05-22 10:10:16 +02:00
|
|
|
UINT row = 0, offset = 0, count = 0;
|
2012-06-25 11:20:09 +02:00
|
|
|
DWORD size = 0, ret;
|
2013-06-14 10:07:43 +02:00
|
|
|
int physical;
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2012-06-25 11:20:09 +02:00
|
|
|
|
|
|
|
ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
|
2013-05-22 10:09:26 +02:00
|
|
|
if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
|
2012-06-25 11:20:09 +02:00
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
|
2012-06-25 11:20:09 +02:00
|
|
|
if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
|
|
|
|
{
|
|
|
|
heap_free( buffer );
|
2013-05-22 10:09:26 +02:00
|
|
|
return FILL_STATUS_FAILED;
|
2012-06-25 11:20:09 +02:00
|
|
|
}
|
2014-02-11 09:55:48 +01:00
|
|
|
for (aa = buffer; aa; aa = aa->Next)
|
|
|
|
{
|
|
|
|
if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
|
|
|
|
}
|
2013-06-14 10:01:33 +02:00
|
|
|
if (!resize_table( table, count, sizeof(*rec) ))
|
2012-06-25 11:20:09 +02:00
|
|
|
{
|
|
|
|
heap_free( buffer );
|
2013-05-22 10:09:26 +02:00
|
|
|
return FILL_STATUS_FAILED;
|
2012-06-25 11:20:09 +02:00
|
|
|
}
|
|
|
|
for (aa = buffer; aa; aa = aa->Next)
|
|
|
|
{
|
2014-02-11 09:55:48 +01:00
|
|
|
if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
|
|
|
|
|
2012-06-25 11:20:09 +02:00
|
|
|
rec = (struct record_networkadapter *)(table->data + offset);
|
|
|
|
sprintfW( device_id, fmtW, aa->u.s.IfIndex );
|
2013-06-14 10:07:43 +02:00
|
|
|
rec->adaptertype = get_adaptertype( aa->IfType, &physical );
|
2012-06-25 11:20:09 +02:00
|
|
|
rec->device_id = heap_strdupW( device_id );
|
2014-01-28 13:26:57 +01:00
|
|
|
rec->index = aa->u.s.IfIndex;
|
2012-06-25 11:20:09 +02:00
|
|
|
rec->interface_index = aa->u.s.IfIndex;
|
2012-07-13 11:34:17 +02:00
|
|
|
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
|
2012-10-04 15:38:18 +02:00
|
|
|
rec->manufacturer = compsys_manufacturerW;
|
2014-01-28 13:26:57 +01:00
|
|
|
rec->name = heap_strdupW( aa->FriendlyName );
|
2012-06-25 11:20:09 +02:00
|
|
|
rec->netconnection_status = get_connection_status( aa->OperStatus );
|
2013-06-14 10:07:43 +02:00
|
|
|
rec->physicaladapter = physical;
|
2012-07-13 11:34:17 +02:00
|
|
|
rec->pnpdevice_id = networkadapter_pnpdeviceidW;
|
2012-06-27 11:34:41 +02:00
|
|
|
rec->speed = 1000000;
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
2012-06-25 11:20:09 +02:00
|
|
|
offset += sizeof(*rec);
|
2013-05-22 10:10:16 +02:00
|
|
|
row++;
|
2012-06-25 11:20:09 +02:00
|
|
|
}
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
2012-06-25 11:20:09 +02:00
|
|
|
|
|
|
|
heap_free( buffer );
|
2013-05-22 10:10:16 +02:00
|
|
|
return status;
|
2012-06-25 11:20:09 +02:00
|
|
|
}
|
|
|
|
|
2013-11-04 11:54:51 +01:00
|
|
|
static enum fill_status fill_networkadapterconfig( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_networkadapterconfig *rec;
|
|
|
|
IP_ADAPTER_ADDRESSES *aa, *buffer;
|
|
|
|
UINT row = 0, offset = 0, count = 0;
|
|
|
|
DWORD size = 0, ret;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
|
|
|
|
ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
|
|
|
|
if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
|
|
|
|
if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
|
|
|
|
{
|
|
|
|
heap_free( buffer );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
2014-02-11 09:55:48 +01:00
|
|
|
for (aa = buffer; aa; aa = aa->Next)
|
|
|
|
{
|
|
|
|
if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
|
|
|
|
}
|
2013-11-04 11:54:51 +01:00
|
|
|
if (!resize_table( table, count, sizeof(*rec) ))
|
|
|
|
{
|
|
|
|
heap_free( buffer );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
for (aa = buffer; aa; aa = aa->Next)
|
|
|
|
{
|
2014-02-11 09:55:48 +01:00
|
|
|
if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
|
|
|
|
|
2013-11-04 11:54:51 +01:00
|
|
|
rec = (struct record_networkadapterconfig *)(table->data + offset);
|
2014-01-28 13:26:57 +01:00
|
|
|
rec->index = aa->u.s.IfIndex;
|
|
|
|
rec->ipconnectionmetric = 20;
|
|
|
|
rec->ipenabled = -1;
|
|
|
|
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
|
2013-11-04 11:54:51 +01:00
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
offset += sizeof(*rec);
|
|
|
|
row++;
|
|
|
|
}
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
|
|
|
|
heap_free( buffer );
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2012-06-20 12:07:02 +02:00
|
|
|
static WCHAR *get_cmdline( DWORD process_id )
|
|
|
|
{
|
|
|
|
if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
|
|
|
|
return NULL; /* FIXME handle different process case */
|
|
|
|
}
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_process( struct table *table, const struct expr *cond )
|
2012-06-18 09:32:02 +02:00
|
|
|
{
|
2012-06-20 12:06:17 +02:00
|
|
|
static const WCHAR fmtW[] = {'%','u',0};
|
|
|
|
WCHAR handle[11];
|
2012-06-18 09:32:02 +02:00
|
|
|
struct record_process *rec;
|
|
|
|
PROCESSENTRY32W entry;
|
|
|
|
HANDLE snap;
|
2013-05-22 10:09:26 +02:00
|
|
|
enum fill_status status = FILL_STATUS_FAILED;
|
2013-06-04 13:28:21 +02:00
|
|
|
UINT row = 0, offset = 0;
|
2012-06-18 09:32:02 +02:00
|
|
|
|
|
|
|
snap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
2013-05-22 10:09:26 +02:00
|
|
|
if (snap == INVALID_HANDLE_VALUE) return FILL_STATUS_FAILED;
|
2012-06-18 09:32:02 +02:00
|
|
|
|
|
|
|
entry.dwSize = sizeof(entry);
|
|
|
|
if (!Process32FirstW( snap, &entry )) goto done;
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, 8, sizeof(*rec) )) goto done;
|
2012-06-18 09:32:02 +02:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) )) goto done;
|
|
|
|
|
2012-06-18 09:32:02 +02:00
|
|
|
rec = (struct record_process *)(table->data + offset);
|
|
|
|
rec->caption = heap_strdupW( entry.szExeFile );
|
2012-06-20 12:07:02 +02:00
|
|
|
rec->commandline = get_cmdline( entry.th32ProcessID );
|
2012-06-18 09:32:02 +02:00
|
|
|
rec->description = heap_strdupW( entry.szExeFile );
|
2012-06-20 12:06:17 +02:00
|
|
|
sprintfW( handle, fmtW, entry.th32ProcessID );
|
|
|
|
rec->handle = heap_strdupW( handle );
|
2013-05-22 10:06:35 +02:00
|
|
|
rec->name = heap_strdupW( entry.szExeFile );
|
2012-06-18 09:32:02 +02:00
|
|
|
rec->process_id = entry.th32ProcessID;
|
|
|
|
rec->pprocess_id = entry.th32ParentProcessID;
|
|
|
|
rec->thread_count = entry.cntThreads;
|
2013-01-11 17:22:14 +01:00
|
|
|
rec->get_owner = process_get_owner;
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
2012-06-18 09:32:02 +02:00
|
|
|
offset += sizeof(*rec);
|
2013-05-22 10:10:16 +02:00
|
|
|
row++;
|
2012-06-18 09:32:02 +02:00
|
|
|
} while (Process32NextW( snap, &entry ));
|
|
|
|
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
2013-05-22 10:09:26 +02:00
|
|
|
status = FILL_STATUS_UNFILTERED;
|
2012-06-18 09:32:02 +02:00
|
|
|
|
|
|
|
done:
|
|
|
|
CloseHandle( snap );
|
2013-05-22 10:09:26 +02:00
|
|
|
return status;
|
2012-06-18 09:32:02 +02:00
|
|
|
}
|
|
|
|
|
2012-06-29 13:39:19 +02:00
|
|
|
static inline void do_cpuid( unsigned int ax, unsigned int *p )
|
|
|
|
{
|
|
|
|
#ifdef __i386__
|
|
|
|
__asm__("pushl %%ebx\n\t"
|
|
|
|
"cpuid\n\t"
|
|
|
|
"movl %%ebx, %%esi\n\t"
|
|
|
|
"popl %%ebx"
|
|
|
|
: "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3])
|
|
|
|
: "0" (ax));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2012-07-04 10:32:55 +02:00
|
|
|
static void get_processor_id( WCHAR *processor_id )
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0};
|
|
|
|
unsigned int regs[4] = {0, 0, 0, 0};
|
|
|
|
|
|
|
|
do_cpuid( 1, regs );
|
|
|
|
sprintfW( processor_id, fmtW, regs[3], regs[0] );
|
|
|
|
}
|
|
|
|
static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer )
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
unsigned char *p = (unsigned char *)regs;
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
for (i = 0; i < len; i++) { buffer[i] = *p++; }
|
2012-07-04 10:32:55 +02:00
|
|
|
buffer[i] = 0;
|
|
|
|
}
|
|
|
|
static void get_processor_manufacturer( WCHAR *manufacturer )
|
|
|
|
{
|
|
|
|
unsigned int tmp, regs[4] = {0, 0, 0, 0};
|
|
|
|
|
|
|
|
do_cpuid( 0, regs );
|
|
|
|
tmp = regs[2]; /* swap edx and ecx */
|
|
|
|
regs[2] = regs[3];
|
|
|
|
regs[3] = tmp;
|
|
|
|
|
|
|
|
regs_to_str( regs + 1, 12, manufacturer );
|
|
|
|
}
|
|
|
|
static void get_processor_name( WCHAR *name )
|
|
|
|
{
|
|
|
|
unsigned int regs[4] = {0, 0, 0, 0};
|
|
|
|
|
|
|
|
do_cpuid( 0x80000000, regs );
|
|
|
|
if (regs[0] >= 0x80000004)
|
|
|
|
{
|
|
|
|
do_cpuid( 0x80000002, regs );
|
|
|
|
regs_to_str( regs, 16, name );
|
|
|
|
do_cpuid( 0x80000003, regs );
|
|
|
|
regs_to_str( regs, 16, name + 16 );
|
|
|
|
do_cpuid( 0x80000004, regs );
|
|
|
|
regs_to_str( regs, 16, name + 32 );
|
|
|
|
}
|
|
|
|
}
|
2012-09-06 14:03:38 +02:00
|
|
|
static UINT get_processor_maxclockspeed( void )
|
|
|
|
{
|
2012-09-17 12:18:46 +02:00
|
|
|
PROCESSOR_POWER_INFORMATION *info;
|
2012-09-17 12:19:13 +02:00
|
|
|
UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
|
2012-09-17 12:18:46 +02:00
|
|
|
NTSTATUS status;
|
|
|
|
|
|
|
|
if ((info = heap_alloc( size )))
|
|
|
|
{
|
|
|
|
status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
|
|
|
|
if (!status) ret = info[0].MaxMhz;
|
|
|
|
heap_free( info );
|
|
|
|
}
|
|
|
|
return ret;
|
2012-09-06 14:03:38 +02:00
|
|
|
}
|
2013-06-14 10:02:29 +02:00
|
|
|
static const WCHAR *get_osarchitecture(void)
|
|
|
|
{
|
|
|
|
SYSTEM_INFO info;
|
|
|
|
GetNativeSystemInfo( &info );
|
|
|
|
if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW;
|
|
|
|
return os_32bitW;
|
|
|
|
}
|
2012-07-04 10:32:55 +02:00
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_processor( struct table *table, const struct expr *cond )
|
2012-06-26 16:03:32 +02:00
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'C','P','U','%','u',0};
|
2012-07-04 10:32:55 +02:00
|
|
|
WCHAR device_id[14], processor_id[17], manufacturer[13], name[49] = {0};
|
2012-06-26 16:03:32 +02:00
|
|
|
struct record_processor *rec;
|
2013-06-14 10:03:25 +02:00
|
|
|
UINT i, offset = 0, maxclockspeed, num_cores, num_logical_processors, count = get_processor_count();
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2012-06-26 16:03:32 +02:00
|
|
|
|
2013-06-14 10:01:33 +02:00
|
|
|
if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2012-06-26 16:03:32 +02:00
|
|
|
|
2012-07-04 10:32:55 +02:00
|
|
|
get_processor_id( processor_id );
|
|
|
|
get_processor_manufacturer( manufacturer );
|
|
|
|
get_processor_name( name );
|
|
|
|
|
2012-09-06 14:03:38 +02:00
|
|
|
maxclockspeed = get_processor_maxclockspeed();
|
2013-06-14 10:03:25 +02:00
|
|
|
num_logical_processors = get_logical_processor_count( &num_cores ) / count;
|
|
|
|
num_cores /= count;
|
2012-09-06 14:03:24 +02:00
|
|
|
|
2012-06-26 16:03:32 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
rec = (struct record_processor *)(table->data + offset);
|
2013-06-14 10:02:29 +02:00
|
|
|
rec->addresswidth = get_osarchitecture() == os_32bitW ? 32 : 64;
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->cpu_status = 1; /* CPU Enabled */
|
2012-06-26 16:03:32 +02:00
|
|
|
sprintfW( device_id, fmtW, i );
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->device_id = heap_strdupW( device_id );
|
2013-05-02 12:02:34 +02:00
|
|
|
rec->family = 2; /* Unknown */
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->manufacturer = heap_strdupW( manufacturer );
|
2012-09-06 14:03:38 +02:00
|
|
|
rec->maxclockspeed = maxclockspeed;
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->name = heap_strdupW( name );
|
2013-06-14 10:03:25 +02:00
|
|
|
rec->num_cores = num_cores;
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->num_logical_processors = num_logical_processors;
|
|
|
|
rec->processor_id = heap_strdupW( processor_id );
|
2012-10-04 15:37:57 +02:00
|
|
|
rec->unique_id = NULL;
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, i, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, i );
|
|
|
|
continue;
|
|
|
|
}
|
2012-06-26 16:03:32 +02:00
|
|
|
offset += sizeof(*rec);
|
|
|
|
}
|
2012-06-27 11:33:31 +02:00
|
|
|
|
|
|
|
TRACE("created %u rows\n", count);
|
|
|
|
table->num_rows = count;
|
2013-05-22 10:10:16 +02:00
|
|
|
return status;
|
2012-06-26 16:03:32 +02:00
|
|
|
}
|
|
|
|
|
2012-09-18 13:12:20 +02:00
|
|
|
static WCHAR *get_lastbootuptime(void)
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] =
|
|
|
|
{'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
|
|
|
|
'.','%','0','6','u','+','0','0','0',0};
|
2013-01-24 15:24:31 +01:00
|
|
|
SYSTEM_TIMEOFDAY_INFORMATION ti;
|
|
|
|
TIME_FIELDS tf;
|
2012-09-18 13:12:20 +02:00
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
|
2013-01-24 15:24:31 +01:00
|
|
|
|
|
|
|
NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
|
|
|
|
RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
|
|
|
|
sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
|
2012-09-18 13:12:20 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2013-09-08 16:47:16 +02:00
|
|
|
static WCHAR *get_localdatetime(void)
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] =
|
|
|
|
{'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
|
|
|
|
'.','%','0','6','u','%','+','0','3','d',0};
|
|
|
|
TIME_ZONE_INFORMATION tzi;
|
|
|
|
SYSTEMTIME st;
|
|
|
|
WCHAR *ret;
|
|
|
|
DWORD Status;
|
|
|
|
LONG Bias;
|
|
|
|
|
|
|
|
Status = GetTimeZoneInformation(&tzi);
|
|
|
|
|
|
|
|
if(Status == TIME_ZONE_ID_INVALID) return NULL;
|
|
|
|
Bias = tzi.Bias;
|
|
|
|
if(Status == TIME_ZONE_ID_DAYLIGHT)
|
|
|
|
Bias+= tzi.DaylightBias;
|
|
|
|
else
|
|
|
|
Bias+= tzi.StandardBias;
|
|
|
|
if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
|
|
|
|
|
|
|
|
GetLocalTime(&st);
|
|
|
|
sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias);
|
|
|
|
return ret;
|
|
|
|
}
|
2012-09-18 13:11:59 +02:00
|
|
|
static WCHAR *get_systemdirectory(void)
|
|
|
|
{
|
2012-06-26 16:02:41 +02:00
|
|
|
void *redir;
|
2012-09-18 13:11:59 +02:00
|
|
|
WCHAR *ret;
|
2012-06-19 10:21:47 +02:00
|
|
|
|
2012-09-18 13:11:59 +02:00
|
|
|
if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
|
|
|
|
Wow64DisableWow64FsRedirection( &redir );
|
|
|
|
GetSystemDirectoryW( ret, MAX_PATH );
|
|
|
|
Wow64RevertWow64FsRedirection( redir );
|
|
|
|
return ret;
|
|
|
|
}
|
2013-06-14 10:04:11 +02:00
|
|
|
static WCHAR *get_codeset(void)
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = {'%','u',0};
|
|
|
|
WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
|
|
|
|
if (ret) sprintfW( ret, fmtW, GetACP() );
|
|
|
|
return ret;
|
|
|
|
}
|
2013-06-14 10:04:43 +02:00
|
|
|
static WCHAR *get_countrycode(void)
|
|
|
|
{
|
|
|
|
WCHAR *ret = heap_alloc( 6 * sizeof(WCHAR) );
|
|
|
|
if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, ret, 6 );
|
|
|
|
return ret;
|
|
|
|
}
|
2013-06-14 10:05:26 +02:00
|
|
|
static WCHAR *get_locale(void)
|
|
|
|
{
|
|
|
|
WCHAR *ret = heap_alloc( 5 * sizeof(WCHAR) );
|
|
|
|
if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, ret, 5 );
|
|
|
|
return ret;
|
|
|
|
}
|
2012-06-19 10:21:47 +02:00
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_os( struct table *table, const struct expr *cond )
|
2012-09-18 13:11:59 +02:00
|
|
|
{
|
|
|
|
struct record_operatingsystem *rec;
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0;
|
2012-06-19 10:21:47 +02:00
|
|
|
|
2013-06-14 10:01:33 +02:00
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2012-06-26 16:02:41 +02:00
|
|
|
|
2012-09-18 13:11:59 +02:00
|
|
|
rec = (struct record_operatingsystem *)table->data;
|
2013-05-02 12:02:06 +02:00
|
|
|
rec->caption = os_captionW;
|
2013-06-14 10:04:11 +02:00
|
|
|
rec->codeset = get_codeset();
|
2013-06-14 10:04:43 +02:00
|
|
|
rec->countrycode = get_countrycode();
|
2013-05-02 12:02:06 +02:00
|
|
|
rec->csdversion = os_csdversionW;
|
|
|
|
rec->lastbootuptime = get_lastbootuptime();
|
2013-09-08 16:47:16 +02:00
|
|
|
rec->localdatetime = get_localdatetime();
|
2013-06-14 10:05:26 +02:00
|
|
|
rec->locale = get_locale();
|
2014-01-10 09:38:19 +01:00
|
|
|
rec->name = os_nameW;
|
2013-05-02 12:02:06 +02:00
|
|
|
rec->osarchitecture = get_osarchitecture();
|
2013-06-14 10:05:26 +02:00
|
|
|
rec->oslanguage = GetSystemDefaultLangID();
|
2013-05-02 12:02:06 +02:00
|
|
|
rec->osproductsuite = 2461140; /* Windows XP Professional */
|
|
|
|
rec->ostype = 18; /* WINNT */
|
|
|
|
rec->servicepackmajor = 3;
|
2013-06-14 10:06:01 +02:00
|
|
|
rec->servicepackminor = 0;
|
2013-05-02 12:02:06 +02:00
|
|
|
rec->suitemask = 272; /* Single User + Terminal */
|
|
|
|
rec->systemdirectory = get_systemdirectory();
|
|
|
|
rec->version = os_versionW;
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
2012-06-26 16:02:41 +02:00
|
|
|
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
2012-06-19 10:21:47 +02:00
|
|
|
}
|
|
|
|
|
2012-07-27 14:04:03 +02:00
|
|
|
static const WCHAR *get_service_type( DWORD type )
|
|
|
|
{
|
|
|
|
static const WCHAR filesystem_driverW[] =
|
|
|
|
{'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
|
|
|
|
static const WCHAR kernel_driverW[] =
|
|
|
|
{'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
|
|
|
|
static const WCHAR own_processW[] =
|
|
|
|
{'O','w','n',' ','P','r','o','c','e','s','s',0};
|
|
|
|
static const WCHAR share_processW[] =
|
|
|
|
{'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
|
|
|
|
|
|
|
|
if (type & SERVICE_KERNEL_DRIVER) return kernel_driverW;
|
|
|
|
else if (type & SERVICE_FILE_SYSTEM_DRIVER) return filesystem_driverW;
|
|
|
|
else if (type & SERVICE_WIN32_OWN_PROCESS) return own_processW;
|
|
|
|
else if (type & SERVICE_WIN32_SHARE_PROCESS) return share_processW;
|
|
|
|
else ERR("unhandled type 0x%08x\n", type);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
static const WCHAR *get_service_state( DWORD state )
|
|
|
|
{
|
|
|
|
static const WCHAR runningW[] =
|
|
|
|
{'R','u','n','n','i','n','g',0};
|
|
|
|
static const WCHAR start_pendingW[] =
|
|
|
|
{'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
|
|
|
|
static const WCHAR stop_pendingW[] =
|
|
|
|
{'S','t','o','p',' ','P','e','n','d','i','n','g',0};
|
|
|
|
static const WCHAR stoppedW[] =
|
|
|
|
{'S','t','o','p','p','e','d',0};
|
|
|
|
static const WCHAR unknownW[] =
|
|
|
|
{'U','n','k','n','o','w','n',0};
|
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case SERVICE_STOPPED: return stoppedW;
|
|
|
|
case SERVICE_START_PENDING: return start_pendingW;
|
|
|
|
case SERVICE_STOP_PENDING: return stop_pendingW;
|
|
|
|
case SERVICE_RUNNING: return runningW;
|
|
|
|
default:
|
|
|
|
ERR("unknown state %u\n", state);
|
|
|
|
return unknownW;
|
|
|
|
}
|
|
|
|
}
|
2012-08-26 19:29:29 +02:00
|
|
|
static const WCHAR *get_service_startmode( DWORD mode )
|
|
|
|
{
|
|
|
|
static const WCHAR bootW[] = {'B','o','o','t',0};
|
|
|
|
static const WCHAR systemW[] = {'S','y','s','t','e','m',0};
|
|
|
|
static const WCHAR autoW[] = {'A','u','t','o',0};
|
|
|
|
static const WCHAR manualW[] = {'M','a','n','u','a','l',0};
|
|
|
|
static const WCHAR disabledW[] = {'D','i','s','a','b','l','e','d',0};
|
|
|
|
static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',0};
|
|
|
|
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case SERVICE_BOOT_START: return bootW;
|
|
|
|
case SERVICE_SYSTEM_START: return systemW;
|
|
|
|
case SERVICE_AUTO_START: return autoW;
|
|
|
|
case SERVICE_DEMAND_START: return manualW;
|
|
|
|
case SERVICE_DISABLED: return disabledW;
|
|
|
|
default:
|
|
|
|
ERR("unknown mode 0x%x\n", mode);
|
|
|
|
return unknownW;
|
|
|
|
}
|
|
|
|
}
|
2012-09-04 13:49:11 +02:00
|
|
|
static QUERY_SERVICE_CONFIGW *query_service_config( SC_HANDLE manager, const WCHAR *name )
|
|
|
|
{
|
|
|
|
QUERY_SERVICE_CONFIGW *config = NULL;
|
|
|
|
SC_HANDLE service;
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
if (!(service = OpenServiceW( manager, name, SERVICE_QUERY_CONFIG ))) return NULL;
|
|
|
|
QueryServiceConfigW( service, NULL, 0, &size );
|
|
|
|
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
|
|
|
|
if (!(config = heap_alloc( size ))) goto done;
|
|
|
|
if (QueryServiceConfigW( service, config, size, &size )) goto done;
|
|
|
|
heap_free( config );
|
|
|
|
config = NULL;
|
|
|
|
|
|
|
|
done:
|
|
|
|
CloseServiceHandle( service );
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_service( struct table *table, const struct expr *cond )
|
2012-07-27 14:04:03 +02:00
|
|
|
{
|
|
|
|
struct record_service *rec;
|
|
|
|
SC_HANDLE manager;
|
|
|
|
ENUM_SERVICE_STATUS_PROCESSW *tmp, *services = NULL;
|
|
|
|
SERVICE_STATUS_PROCESS *status;
|
2012-08-27 06:29:21 +02:00
|
|
|
WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1];
|
|
|
|
DWORD len = sizeof(sysnameW) / sizeof(sysnameW[0]);
|
2013-05-22 10:10:16 +02:00
|
|
|
UINT i, row = 0, offset = 0, size = 256, needed, count;
|
2013-05-22 10:09:26 +02:00
|
|
|
enum fill_status fill_status = FILL_STATUS_FAILED;
|
2012-07-27 14:04:03 +02:00
|
|
|
BOOL ret;
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) return FILL_STATUS_FAILED;
|
2012-07-27 14:04:03 +02:00
|
|
|
if (!(services = heap_alloc( size ))) goto done;
|
|
|
|
|
|
|
|
ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
|
|
|
|
SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
|
|
|
|
&count, NULL, NULL );
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
if (GetLastError() != ERROR_MORE_DATA) goto done;
|
|
|
|
size = needed;
|
|
|
|
if (!(tmp = heap_realloc( services, size ))) goto done;
|
|
|
|
services = tmp;
|
|
|
|
ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
|
|
|
|
SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
|
|
|
|
&count, NULL, NULL );
|
|
|
|
if (!ret) goto done;
|
|
|
|
}
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!resize_table( table, count, sizeof(*rec) )) goto done;
|
2012-07-27 14:04:03 +02:00
|
|
|
|
2012-08-27 06:29:21 +02:00
|
|
|
GetComputerNameW( sysnameW, &len );
|
2013-05-22 10:10:16 +02:00
|
|
|
fill_status = FILL_STATUS_UNFILTERED;
|
2012-08-27 06:29:21 +02:00
|
|
|
|
2012-07-27 14:04:03 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
2012-08-26 19:29:29 +02:00
|
|
|
QUERY_SERVICE_CONFIGW *config;
|
2012-09-04 13:49:11 +02:00
|
|
|
|
|
|
|
if (!(config = query_service_config( manager, services[i].lpServiceName ))) continue;
|
2012-08-26 19:29:29 +02:00
|
|
|
|
2012-07-27 14:04:03 +02:00
|
|
|
status = &services[i].ServiceStatusProcess;
|
|
|
|
rec = (struct record_service *)(table->data + offset);
|
2012-10-17 11:07:17 +02:00
|
|
|
rec->accept_pause = (status->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) ? -1 : 0;
|
|
|
|
rec->accept_stop = (status->dwControlsAccepted & SERVICE_ACCEPT_STOP) ? -1 : 0;
|
|
|
|
rec->displayname = heap_strdupW( services[i].lpDisplayName );
|
|
|
|
rec->name = heap_strdupW( services[i].lpServiceName );
|
|
|
|
rec->process_id = status->dwProcessId;
|
|
|
|
rec->servicetype = get_service_type( status->dwServiceType );
|
|
|
|
rec->startmode = get_service_startmode( config->dwStartType );
|
|
|
|
rec->state = get_service_state( status->dwCurrentState );
|
|
|
|
rec->systemname = heap_strdupW( sysnameW );
|
|
|
|
rec->pause_service = service_pause_service;
|
2012-10-17 11:07:38 +02:00
|
|
|
rec->resume_service = service_resume_service;
|
2012-10-17 11:07:57 +02:00
|
|
|
rec->start_service = service_start_service;
|
2012-10-17 11:08:14 +02:00
|
|
|
rec->stop_service = service_stop_service;
|
2012-09-04 13:49:11 +02:00
|
|
|
heap_free( config );
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &fill_status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
2012-07-27 14:04:03 +02:00
|
|
|
offset += sizeof(*rec);
|
2013-05-22 10:10:16 +02:00
|
|
|
row++;
|
2012-07-27 14:04:03 +02:00
|
|
|
}
|
|
|
|
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
2012-07-27 14:04:03 +02:00
|
|
|
|
|
|
|
done:
|
|
|
|
CloseServiceHandle( manager );
|
|
|
|
heap_free( services );
|
2013-05-22 10:09:26 +02:00
|
|
|
return fill_status;
|
2012-07-27 14:04:03 +02:00
|
|
|
}
|
|
|
|
|
2012-06-28 09:24:05 +02:00
|
|
|
static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres )
|
|
|
|
{
|
|
|
|
HDC hdc = GetDC( NULL );
|
|
|
|
UINT32 ret;
|
|
|
|
|
|
|
|
if (!hdc) return 32;
|
|
|
|
ret = GetDeviceCaps( hdc, BITSPIXEL );
|
|
|
|
*hres = GetDeviceCaps( hdc, HORZRES );
|
|
|
|
*vres = GetDeviceCaps( hdc, VERTRES );
|
|
|
|
ReleaseDC( NULL, hdc );
|
|
|
|
return ret;
|
|
|
|
}
|
2013-01-30 16:27:22 +01:00
|
|
|
static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] =
|
|
|
|
{'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
|
|
|
|
'&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
|
|
|
|
'0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL;
|
|
|
|
sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-05-22 10:09:26 +02:00
|
|
|
static enum fill_status fill_videocontroller( struct table *table, const struct expr *cond )
|
2012-06-22 09:23:36 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
struct record_videocontroller *rec;
|
|
|
|
HRESULT hr;
|
|
|
|
IDXGIFactory *factory = NULL;
|
|
|
|
IDXGIAdapter *adapter = NULL;
|
|
|
|
DXGI_ADAPTER_DESC desc;
|
2012-06-28 09:24:05 +02:00
|
|
|
UINT hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
|
|
|
|
const WCHAR *name = videocontroller_deviceidW;
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0;
|
2012-06-22 09:23:36 +02:00
|
|
|
|
2013-06-14 10:01:33 +02:00
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
2013-05-09 10:50:28 +02:00
|
|
|
memset (&desc, 0, sizeof(desc));
|
2012-06-22 09:23:36 +02:00
|
|
|
hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
|
|
|
|
if (FAILED(hr)) goto done;
|
|
|
|
|
|
|
|
hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
|
|
|
|
if (FAILED(hr)) goto done;
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_GetDesc( adapter, &desc );
|
2012-06-28 09:24:05 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
vidmem = desc.DedicatedVideoMemory;
|
|
|
|
name = desc.Description;
|
|
|
|
}
|
2012-06-22 09:23:36 +02:00
|
|
|
|
|
|
|
done:
|
|
|
|
rec = (struct record_videocontroller *)table->data;
|
2013-06-14 10:06:46 +02:00
|
|
|
rec->adapter_dactype = videocontroller_dactypeW;
|
2012-06-28 09:24:05 +02:00
|
|
|
rec->adapter_ram = vidmem;
|
|
|
|
rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres );
|
|
|
|
rec->current_horizontalres = hres;
|
|
|
|
rec->current_verticalres = vres;
|
2012-09-17 12:19:30 +02:00
|
|
|
rec->description = heap_strdupW( name );
|
2012-06-28 09:24:05 +02:00
|
|
|
rec->device_id = videocontroller_deviceidW;
|
|
|
|
rec->name = heap_strdupW( name );
|
2013-01-30 16:27:22 +01:00
|
|
|
rec->pnpdevice_id = get_pnpdeviceid( &desc );
|
2013-05-22 10:10:16 +02:00
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
2012-06-22 09:23:36 +02:00
|
|
|
|
2013-05-22 10:10:16 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
2012-06-22 09:23:36 +02:00
|
|
|
|
|
|
|
if (adapter) IDXGIAdapter_Release( adapter );
|
|
|
|
if (factory) IDXGIFactory_Release( factory );
|
2013-05-22 10:10:16 +02:00
|
|
|
return status;
|
2012-06-22 09:23:36 +02:00
|
|
|
}
|
|
|
|
|
2012-07-13 11:35:39 +02:00
|
|
|
static struct table builtin_classes[] =
|
2012-06-15 15:47:28 +02:00
|
|
|
{
|
2013-06-04 13:28:21 +02:00
|
|
|
{ class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), 0, (BYTE *)data_baseboard },
|
|
|
|
{ class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), 0, (BYTE *)data_bios },
|
|
|
|
{ class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive },
|
|
|
|
{ class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
|
2013-06-04 13:29:03 +02:00
|
|
|
{ class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
|
2013-06-04 13:28:21 +02:00
|
|
|
{ class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory },
|
|
|
|
{ class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, SIZEOF(data_diskdrive), 0, (BYTE *)data_diskdrive },
|
|
|
|
{ class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },
|
|
|
|
{ class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
|
|
|
|
{ class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
|
|
|
|
{ class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter },
|
2013-11-04 11:54:51 +01:00
|
|
|
{ class_networkadapterconfigW, SIZEOF(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL,
|
|
|
|
fill_networkadapterconfig },
|
2013-06-04 13:28:21 +02:00
|
|
|
{ class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os },
|
|
|
|
{ class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param },
|
2013-12-11 14:36:34 +01:00
|
|
|
{ class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia },
|
2013-06-04 13:28:21 +02:00
|
|
|
{ class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process },
|
|
|
|
{ class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
|
|
|
|
{ class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier },
|
|
|
|
{ class_serviceW, SIZEOF(col_service), col_service, 0, 0, NULL, fill_service },
|
|
|
|
{ class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), 0, (BYTE *)data_sounddevice },
|
|
|
|
{ class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), 0, (BYTE *)data_stdregprov },
|
|
|
|
{ class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller }
|
2012-06-15 15:47:28 +02:00
|
|
|
};
|
|
|
|
|
2012-07-13 11:35:39 +02:00
|
|
|
void init_table_list( void )
|
2012-06-15 15:47:28 +02:00
|
|
|
{
|
2012-07-13 11:35:39 +02:00
|
|
|
static struct list tables = LIST_INIT( tables );
|
2012-06-15 15:47:28 +02:00
|
|
|
UINT i;
|
|
|
|
|
2013-02-25 11:03:56 +01:00
|
|
|
for (i = 0; i < SIZEOF(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry );
|
2012-07-13 11:35:39 +02:00
|
|
|
table_list = &tables;
|
2012-06-15 15:47:28 +02:00
|
|
|
}
|