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 <stdarg.h>
|
2020-05-05 02:52:56 +02:00
|
|
|
#include <intrin.h>
|
2012-06-15 15:47:28 +02:00
|
|
|
|
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"
|
2019-07-04 09:27:39 +02:00
|
|
|
#include "winsock2.h"
|
|
|
|
#include "ws2tcpip.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 "iphlpapi.h"
|
2018-08-01 17:23:29 +02:00
|
|
|
#include "netioapi.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"
|
2015-02-13 13:40:36 +01:00
|
|
|
#include "sddl.h"
|
|
|
|
#include "ntsecapi.h"
|
2015-04-02 16:20:27 +02:00
|
|
|
#include "winspool.h"
|
2018-08-06 18:11:15 +02:00
|
|
|
#include "setupapi.h"
|
2020-05-26 10:18:43 +02:00
|
|
|
#include "ntddstor.h"
|
2012-06-15 15:47:28 +02:00
|
|
|
|
2019-05-14 12:30:46 +02:00
|
|
|
#include "wine/asm.h"
|
2012-06-15 15:47:28 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "wbemprox_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
|
|
|
|
|
2012-06-27 11:35:45 +02:00
|
|
|
/* column definitions must be kept in sync with record structures below */
|
2019-09-10 17:09:14 +02:00
|
|
|
static const struct column col_associator[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"AssocClass", CIM_STRING },
|
|
|
|
{ L"Class", CIM_STRING },
|
|
|
|
{ L"Associator", CIM_STRING }
|
2019-09-10 17:09:14 +02:00
|
|
|
};
|
2012-07-04 10:32:00 +02:00
|
|
|
static const struct column col_baseboard[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Manufacturer", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Model", CIM_STRING },
|
|
|
|
{ L"Name", CIM_STRING },
|
|
|
|
{ L"Product", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"SerialNumber", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Tag", CIM_STRING|COL_FLAG_KEY },
|
|
|
|
{ L"Version", CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-07-04 10:32:00 +02:00
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
static const struct column col_bios[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"CurrentLanguage", CIM_STRING },
|
|
|
|
{ L"Description", CIM_STRING },
|
|
|
|
{ L"EmbeddedControllerMajorVersion", CIM_UINT8 },
|
|
|
|
{ L"EmbeddedControllerMinorVersion", CIM_UINT8 },
|
|
|
|
{ L"IdentificationCode", CIM_STRING },
|
|
|
|
{ L"Manufacturer", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Name", CIM_STRING },
|
|
|
|
{ L"ReleaseDate", CIM_DATETIME|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"SerialNumber", CIM_STRING },
|
|
|
|
{ L"SMBIOSBIOSVersion", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"SMBIOSMajorVersion", CIM_UINT16 },
|
|
|
|
{ L"SMBIOSMinorVersion", CIM_UINT16 },
|
|
|
|
{ L"SystemBiosMajorVersion", CIM_UINT8 },
|
|
|
|
{ L"SystemBiosMinorVersion", CIM_UINT8 },
|
|
|
|
{ L"Version", 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[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_KEY },
|
|
|
|
{ L"Drive", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"MediaType", CIM_STRING },
|
|
|
|
{ L"Name", CIM_STRING },
|
|
|
|
{ L"PNPDeviceID", CIM_STRING },
|
2012-10-04 15:36:54 +02:00
|
|
|
};
|
2012-06-19 10:20:22 +02:00
|
|
|
static const struct column col_compsys[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Description", CIM_STRING },
|
|
|
|
{ L"Domain", CIM_STRING },
|
|
|
|
{ L"DomainRole", CIM_UINT16 },
|
|
|
|
{ L"Manufacturer", CIM_STRING },
|
|
|
|
{ L"Model", CIM_STRING },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"NumberOfLogicalProcessors", CIM_UINT32 },
|
|
|
|
{ L"NumberOfProcessors", CIM_UINT32 },
|
|
|
|
{ L"TotalPhysicalMemory", CIM_UINT64 },
|
|
|
|
{ L"UserName", CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-19 10:20:22 +02:00
|
|
|
};
|
2015-01-07 15:27:13 +01:00
|
|
|
static const struct column col_compsysproduct[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"IdentifyingNumber", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"SKUNumber", CIM_STRING },
|
|
|
|
{ L"UUID", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Vendor", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Version", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2015-01-07 15:27:13 +01:00
|
|
|
};
|
2013-06-04 13:29:03 +02:00
|
|
|
static const struct column col_datafile[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"Version", CIM_STRING|COL_FLAG_DYNAMIC },
|
2013-06-04 13:29:03 +02:00
|
|
|
};
|
2015-07-29 11:39:28 +02:00
|
|
|
static const struct column col_desktopmonitor[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Name", CIM_STRING },
|
|
|
|
{ L"PixelsPerXLogicalInch", CIM_UINT32 },
|
2015-07-29 11:39:28 +02:00
|
|
|
};
|
2013-05-29 12:16:44 +02:00
|
|
|
static const struct column col_directory[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"AccessMask", CIM_UINT32 },
|
|
|
|
{ L"Name", 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[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"Index", CIM_UINT32 },
|
|
|
|
{ L"InterfaceType", CIM_STRING },
|
|
|
|
{ L"Manufacturer", CIM_STRING },
|
|
|
|
{ L"MediaType", CIM_STRING },
|
|
|
|
{ L"Model", CIM_STRING },
|
|
|
|
{ L"PNPDeviceID", CIM_STRING },
|
2020-05-26 10:18:43 +02:00
|
|
|
{ L"SerialNumber", CIM_STRING|COL_FLAG_DYNAMIC },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Size", CIM_UINT64 },
|
2012-10-04 15:37:13 +02:00
|
|
|
};
|
2019-09-10 17:09:12 +02:00
|
|
|
static const struct column col_diskdrivetodiskpartition[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Antecedent", CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"Dependent", CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2019-09-10 17:09:12 +02:00
|
|
|
};
|
2013-02-25 11:04:29 +01:00
|
|
|
static const struct column col_diskpartition[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Bootable", CIM_BOOLEAN },
|
|
|
|
{ L"BootPartition", CIM_BOOLEAN },
|
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"DiskIndex", CIM_UINT32 },
|
|
|
|
{ L"Index", CIM_UINT32 },
|
|
|
|
{ L"PNPDeviceID", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Size", CIM_UINT64 },
|
|
|
|
{ L"StartingOffset", CIM_UINT64 },
|
|
|
|
{ L"Type", CIM_STRING|COL_FLAG_DYNAMIC },
|
2013-02-25 11:04:29 +01:00
|
|
|
};
|
2019-09-20 13:37:15 +02:00
|
|
|
static const struct column col_displaycontrollerconfig[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"BitsPerPixel", CIM_UINT32 },
|
|
|
|
{ L"Caption", CIM_STRING },
|
|
|
|
{ L"HorizontalResolution", CIM_UINT32 },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_KEY },
|
|
|
|
{ L"VerticalResolution", CIM_UINT32 },
|
2019-09-20 13:37:15 +02:00
|
|
|
};
|
2017-02-01 14:18:50 +01:00
|
|
|
static const struct column col_ip4routetable[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Destination", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"InterfaceIndex", CIM_SINT32|COL_FLAG_KEY },
|
|
|
|
{ L"NextHop", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2017-02-01 14:18:50 +01:00
|
|
|
};
|
2012-06-29 13:41:07 +02:00
|
|
|
static const struct column col_logicaldisk[] =
|
|
|
|
{
|
2021-02-09 10:12:54 +01:00
|
|
|
{ L"Caption", CIM_STRING|COL_FLAG_DYNAMIC },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"DriveType", CIM_UINT32 },
|
|
|
|
{ L"FileSystem", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"FreeSpace", CIM_UINT64 },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Size", CIM_UINT64 },
|
|
|
|
{ L"VolumeName", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"VolumeSerialNumber", CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-29 13:41:07 +02:00
|
|
|
};
|
2019-09-10 17:09:11 +02:00
|
|
|
static const struct column col_logicaldisktopartition[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Antecedent", CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"Dependent", CIM_REFERENCE|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2019-09-10 17:09:11 +02:00
|
|
|
};
|
2012-06-25 11:20:09 +02:00
|
|
|
static const struct column col_networkadapter[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"AdapterType", CIM_STRING },
|
|
|
|
{ L"AdapterTypeID", CIM_UINT16 },
|
|
|
|
{ L"Description", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
2021-01-21 12:36:39 +01:00
|
|
|
{ L"GUID", CIM_STRING|COL_FLAG_DYNAMIC },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Index", CIM_UINT32 },
|
|
|
|
{ L"InterfaceIndex", CIM_UINT32 },
|
|
|
|
{ L"MACAddress", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Manufacturer", CIM_STRING },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"NetConnectionStatus", CIM_UINT16 },
|
|
|
|
{ L"PhysicalAdapter", CIM_BOOLEAN },
|
|
|
|
{ L"PNPDeviceID", CIM_STRING },
|
2021-01-21 12:36:42 +01:00
|
|
|
{ L"ServiceName", CIM_STRING|COL_FLAG_DYNAMIC },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Speed", CIM_UINT64 },
|
2012-06-25 11:20:09 +02:00
|
|
|
};
|
2013-11-04 11:54:51 +01:00
|
|
|
static const struct column col_networkadapterconfig[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"DefaultIPGateway", CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Description", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"DHCPEnabled", CIM_BOOLEAN },
|
|
|
|
{ L"DNSHostName", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"DNSServerSearchOrder", CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Index", CIM_UINT32|COL_FLAG_KEY },
|
|
|
|
{ L"IPAddress", CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"IPConnectionMetric", CIM_UINT32 },
|
|
|
|
{ L"IPEnabled", CIM_BOOLEAN },
|
|
|
|
{ L"IPSubnet", CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"MACAddress", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"SettingID", CIM_STRING|COL_FLAG_DYNAMIC },
|
2013-11-04 11:54:51 +01:00
|
|
|
};
|
2019-09-17 13:41:43 +02:00
|
|
|
static const struct column col_operatingsystem[] =
|
2012-06-19 10:21:47 +02:00
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"BuildNumber", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Caption", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"CodeSet", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"CountryCode", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"CSDVersion", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"CSName", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"CurrentTimeZone", CIM_SINT16 },
|
|
|
|
{ L"FreePhysicalMemory", CIM_UINT64 },
|
|
|
|
{ L"InstallDate", CIM_DATETIME },
|
|
|
|
{ L"LastBootUpTime", CIM_DATETIME|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"LocalDateTime", CIM_DATETIME|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Locale", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Manufacturer", CIM_STRING },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"OperatingSystemSKU", CIM_UINT32 },
|
|
|
|
{ L"OSArchitecture", CIM_STRING },
|
|
|
|
{ L"OSLanguage", CIM_UINT32 },
|
|
|
|
{ L"OSProductSuite", CIM_UINT32 },
|
|
|
|
{ L"OSType", CIM_UINT16 },
|
|
|
|
{ L"Primary", CIM_BOOLEAN },
|
2021-03-14 21:22:51 +01:00
|
|
|
{ L"ProductType", CIM_UINT32 },
|
2020-05-18 09:49:40 +02:00
|
|
|
{ L"SerialNumber", CIM_STRING|COL_FLAG_DYNAMIC },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"ServicePackMajorVersion", CIM_UINT16 },
|
|
|
|
{ L"ServicePackMinorVersion", CIM_UINT16 },
|
|
|
|
{ L"SuiteMask", CIM_UINT32 },
|
|
|
|
{ L"SystemDirectory", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"SystemDrive", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"TotalVirtualMemorySize", CIM_UINT64 },
|
|
|
|
{ L"TotalVisibleMemorySize", CIM_UINT64 },
|
|
|
|
{ L"Version", CIM_STRING|COL_FLAG_DYNAMIC },
|
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
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Class", CIM_STRING },
|
|
|
|
{ L"Method", CIM_STRING },
|
|
|
|
{ L"Direction", CIM_SINT32 },
|
|
|
|
{ L"Parameter", CIM_STRING },
|
|
|
|
{ L"Type", CIM_UINT32 },
|
|
|
|
{ L"DefaultValue", CIM_UINT32 },
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2013-12-11 14:36:34 +01:00
|
|
|
static const struct column col_physicalmedia[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"SerialNumber", CIM_STRING },
|
|
|
|
{ L"Tag", CIM_STRING },
|
2013-12-11 14:36:34 +01:00
|
|
|
};
|
2014-04-03 12:34:18 +02:00
|
|
|
static const struct column col_physicalmemory[] =
|
|
|
|
{
|
2020-07-07 09:54:22 +02:00
|
|
|
{ L"BankLabel", CIM_STRING },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Capacity", CIM_UINT64 },
|
2020-07-07 09:54:22 +02:00
|
|
|
{ L"Caption", CIM_STRING },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"ConfiguredClockSpeed", CIM_UINT32 },
|
|
|
|
{ L"DeviceLocator", CIM_STRING },
|
|
|
|
{ L"FormFactor", CIM_UINT16 },
|
|
|
|
{ L"MemoryType", CIM_UINT16 },
|
|
|
|
{ L"PartNumber", CIM_STRING },
|
2020-07-07 09:54:22 +02:00
|
|
|
{ L"SerialNumber", CIM_STRING },
|
2014-04-03 12:34:18 +02:00
|
|
|
};
|
2018-08-06 18:11:15 +02:00
|
|
|
static const struct column col_pnpentity[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_DYNAMIC },
|
2018-08-06 18:11:15 +02:00
|
|
|
};
|
2015-04-02 16:20:27 +02:00
|
|
|
static const struct column col_printer[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Attributes", CIM_UINT32 },
|
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"DriverName", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"HorizontalResolution", CIM_UINT32 },
|
|
|
|
{ L"Local", CIM_BOOLEAN },
|
|
|
|
{ L"Location", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Network", CIM_BOOLEAN },
|
|
|
|
{ L"PortName", CIM_STRING|COL_FLAG_DYNAMIC },
|
2015-04-02 16:20:27 +02:00
|
|
|
};
|
2012-06-18 09:32:02 +02:00
|
|
|
static const struct column col_process[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Caption", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"CommandLine", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Description", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Handle", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"ParentProcessID", CIM_UINT32 },
|
|
|
|
{ L"ProcessID", CIM_UINT32 },
|
|
|
|
{ L"ThreadCount", CIM_UINT32 },
|
|
|
|
{ L"WorkingSetSize", CIM_UINT64 },
|
2013-01-11 17:22:14 +01:00
|
|
|
/* methods */
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"GetOwner", 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[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"AddressWidth", CIM_UINT16 },
|
|
|
|
{ L"Architecture", CIM_UINT16 },
|
|
|
|
{ L"Caption", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"CpuStatus", CIM_UINT16 },
|
|
|
|
{ L"CurrentClockSpeed", CIM_UINT32 },
|
|
|
|
{ L"DataWidth", CIM_UINT16 },
|
|
|
|
{ L"Description", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"Family", CIM_UINT16 },
|
|
|
|
{ L"Level", CIM_UINT16 },
|
|
|
|
{ L"Manufacturer", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"MaxClockSpeed", CIM_UINT32 },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"NumberOfCores", CIM_UINT32 },
|
|
|
|
{ L"NumberOfLogicalProcessors", CIM_UINT32 },
|
|
|
|
{ L"ProcessorId", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"ProcessorType", CIM_UINT16 },
|
|
|
|
{ L"Revision", CIM_UINT16 },
|
|
|
|
{ L"UniqueId", CIM_STRING },
|
|
|
|
{ L"Version", CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-19 10:20:42 +02:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const struct column col_qualifier[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Class", CIM_STRING },
|
|
|
|
{ L"Member", CIM_STRING },
|
|
|
|
{ L"Type", CIM_UINT32 },
|
|
|
|
{ L"Flavor", CIM_SINT32 },
|
|
|
|
{ L"Name", CIM_STRING },
|
|
|
|
{ L"IntegerValue", CIM_SINT32 },
|
|
|
|
{ L"StringValue", CIM_STRING },
|
|
|
|
{ L"BoolValue", CIM_BOOLEAN },
|
2013-01-25 17:34:00 +01:00
|
|
|
};
|
2019-09-30 17:12:58 +02:00
|
|
|
static const struct column col_quickfixengineering[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Caption", CIM_STRING },
|
|
|
|
{ L"HotFixID", CIM_STRING|COL_FLAG_KEY },
|
2019-09-30 17:12:58 +02:00
|
|
|
};
|
2012-07-27 14:04:03 +02:00
|
|
|
static const struct column col_service[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"AcceptPause", CIM_BOOLEAN },
|
|
|
|
{ L"AcceptStop", CIM_BOOLEAN },
|
|
|
|
{ L"DisplayName", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"ProcessID", CIM_UINT32 },
|
|
|
|
{ L"ServiceType", CIM_STRING },
|
|
|
|
{ L"StartMode", CIM_STRING },
|
|
|
|
{ L"State", CIM_STRING },
|
|
|
|
{ L"SystemName", CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-10-17 11:07:17 +02:00
|
|
|
/* methods */
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"PauseService", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"ResumeService", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"StartService", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"StopService", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2012-07-27 14:04:03 +02:00
|
|
|
};
|
2015-02-13 13:40:36 +01:00
|
|
|
static const struct column col_sid[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"AccountName", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"BinaryRepresentation", CIM_UINT8|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"ReferencedDomainName", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"SID", CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
|
|
|
|
{ L"SidLength", CIM_UINT32 },
|
2015-02-13 13:40:36 +01:00
|
|
|
};
|
2012-10-04 15:37:32 +02:00
|
|
|
static const struct column col_sounddevice[] =
|
|
|
|
{
|
2020-11-27 09:14:45 +01:00
|
|
|
{ L"DeviceID", CIM_STRING|COL_FLAG_DYNAMIC },
|
2020-07-08 12:26:01 +02:00
|
|
|
{ L"Manufacturer", CIM_STRING },
|
|
|
|
{ L"Name", CIM_STRING },
|
2020-11-27 09:14:45 +01:00
|
|
|
{ L"PNPDeviceID", CIM_STRING|COL_FLAG_DYNAMIC },
|
2020-07-08 12:26:01 +02:00
|
|
|
{ L"ProductName", CIM_STRING },
|
2020-10-22 11:25:36 +02:00
|
|
|
{ L"Status", CIM_STRING },
|
2020-07-08 12:26:01 +02:00
|
|
|
{ L"StatusInfo", CIM_UINT16 },
|
2012-10-04 15:37:32 +02:00
|
|
|
};
|
2012-07-13 11:35:09 +02:00
|
|
|
static const struct column col_stdregprov[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"CreateKey", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"EnumKey", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"EnumValues", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"GetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2021-03-01 08:14:44 +01:00
|
|
|
{ L"SetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2021-03-01 08:14:45 +01:00
|
|
|
{ L"SetDWORDValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2021-03-01 08:14:46 +01:00
|
|
|
{ L"DeleteKey", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2015-04-16 21:46:13 +02:00
|
|
|
static const struct column col_systemenclosure[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Caption", CIM_STRING },
|
|
|
|
{ L"ChassisTypes", CIM_UINT16|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Description", CIM_STRING },
|
|
|
|
{ L"LockPresent", CIM_BOOLEAN },
|
|
|
|
{ L"Manufacturer", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Name", CIM_STRING },
|
|
|
|
{ L"Tag", CIM_STRING },
|
2015-04-16 21:46:13 +02:00
|
|
|
};
|
2014-08-04 23:29:16 +02:00
|
|
|
static const struct column col_systemsecurity[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"GetSD", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"SetSD", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
2014-08-04 23:29:16 +02:00
|
|
|
};
|
2021-01-20 11:15:57 +01:00
|
|
|
static const struct column col_sysrestore[] =
|
|
|
|
{
|
|
|
|
{ L"CreationTime", CIM_STRING },
|
|
|
|
{ L"Description", CIM_STRING },
|
|
|
|
{ L"EventType", CIM_UINT32 },
|
|
|
|
{ L"RestorePointType", CIM_UINT32 },
|
|
|
|
{ L"SequenceNumber", CIM_UINT32 },
|
|
|
|
/* methods */
|
|
|
|
{ L"CreateRestorePoint", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"Disable", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"Enable", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"GetLastRestoreStatus", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
{ L"Restore", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
|
|
|
};
|
2012-06-22 09:23:36 +02:00
|
|
|
static const struct column col_videocontroller[] =
|
|
|
|
{
|
2020-04-20 10:38:11 +02:00
|
|
|
{ L"AdapterCompatibility", CIM_STRING },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"AdapterDACType", CIM_STRING },
|
|
|
|
{ L"AdapterRAM", CIM_UINT32 },
|
|
|
|
{ L"Availability", CIM_UINT16 },
|
|
|
|
{ L"Caption", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"ConfigManagerErrorCode", CIM_UINT32 },
|
|
|
|
{ L"CurrentBitsPerPixel", CIM_UINT32 },
|
|
|
|
{ L"CurrentHorizontalResolution", CIM_UINT32 },
|
|
|
|
{ L"CurrentRefreshRate", CIM_UINT32 },
|
|
|
|
{ L"CurrentScanMode", CIM_UINT16 },
|
|
|
|
{ L"CurrentVerticalResolution", CIM_UINT32 },
|
|
|
|
{ L"Description", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"DeviceId", CIM_STRING|COL_FLAG_KEY },
|
|
|
|
{ L"DriverDate", CIM_DATETIME },
|
|
|
|
{ L"DriverVersion", CIM_STRING },
|
|
|
|
{ L"InstalledDisplayDrivers", CIM_STRING },
|
|
|
|
{ L"Name", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"PNPDeviceID", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"Status", CIM_STRING },
|
|
|
|
{ L"VideoArchitecture", CIM_UINT16 },
|
|
|
|
{ L"VideoMemoryType", CIM_UINT16 },
|
|
|
|
{ L"VideoModeDescription", CIM_STRING|COL_FLAG_DYNAMIC },
|
|
|
|
{ L"VideoProcessor", CIM_STRING|COL_FLAG_DYNAMIC },
|
2012-06-22 09:23:36 +02:00
|
|
|
};
|
2019-09-17 13:41:45 +02:00
|
|
|
static const struct column col_winsat[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"CPUScore", CIM_REAL32 },
|
|
|
|
{ L"D3DScore", CIM_REAL32 },
|
|
|
|
{ L"DiskScore", CIM_REAL32 },
|
|
|
|
{ L"GraphicsScore", CIM_REAL32 },
|
|
|
|
{ L"MemoryScore", CIM_REAL32 },
|
|
|
|
{ L"TimeTaken", CIM_STRING|COL_FLAG_KEY },
|
|
|
|
{ L"WinSATAssessmentState", CIM_UINT32 },
|
|
|
|
{ L"WinSPRLevel", CIM_REAL32 },
|
2019-09-17 13:41:45 +02:00
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
|
|
|
|
#include "pshpack1.h"
|
2019-09-10 17:09:14 +02:00
|
|
|
struct record_associator
|
|
|
|
{
|
|
|
|
const WCHAR *assocclass;
|
|
|
|
const WCHAR *class;
|
|
|
|
const WCHAR *associator;
|
|
|
|
};
|
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;
|
2015-01-21 13:26:11 +01:00
|
|
|
const WCHAR *product;
|
2012-07-04 10:32:00 +02:00
|
|
|
const WCHAR *serialnumber;
|
|
|
|
const WCHAR *tag;
|
2015-01-22 08:51:40 +01:00
|
|
|
const WCHAR *version;
|
2012-07-04 10:32:00 +02:00
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
struct record_bios
|
|
|
|
{
|
2019-09-17 13:41:42 +02:00
|
|
|
const WCHAR *currentlanguage;
|
2012-06-15 15:47:28 +02:00
|
|
|
const WCHAR *description;
|
2020-02-25 00:42:51 +01:00
|
|
|
UINT8 ecmajorversion;
|
|
|
|
UINT8 ecminorversion;
|
2013-11-04 11:54:10 +01:00
|
|
|
const WCHAR *identificationcode;
|
2012-06-15 15:47:28 +02:00
|
|
|
const WCHAR *manufacturer;
|
2015-10-07 14:20:25 +02:00
|
|
|
const WCHAR *name;
|
2012-06-15 15:47:28 +02:00
|
|
|
const WCHAR *releasedate;
|
|
|
|
const WCHAR *serialnumber;
|
2013-11-04 11:54:10 +01:00
|
|
|
const WCHAR *smbiosbiosversion;
|
2018-02-05 16:08:16 +01:00
|
|
|
UINT16 smbiosmajorversion;
|
|
|
|
UINT16 smbiosminorversion;
|
2020-02-25 00:42:51 +01:00
|
|
|
UINT8 systembiosmajorversion;
|
|
|
|
UINT8 systembiosminorversion;
|
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;
|
2014-04-03 12:35:53 +02:00
|
|
|
const WCHAR *mediatype;
|
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;
|
2015-02-22 22:23:12 +01:00
|
|
|
const WCHAR *username;
|
2012-06-19 10:20:22 +02:00
|
|
|
};
|
2015-01-07 15:27:13 +01:00
|
|
|
struct record_computersystemproduct
|
|
|
|
{
|
2015-01-21 13:25:50 +01:00
|
|
|
const WCHAR *identifyingnumber;
|
2018-02-05 16:08:15 +01:00
|
|
|
const WCHAR *name;
|
|
|
|
const WCHAR *skunumber;
|
2015-01-07 15:27:13 +01:00
|
|
|
const WCHAR *uuid;
|
2018-02-05 16:08:15 +01:00
|
|
|
const WCHAR *vendor;
|
|
|
|
const WCHAR *version;
|
2015-01-07 15:27:13 +01:00
|
|
|
};
|
2013-06-04 13:29:03 +02:00
|
|
|
struct record_datafile
|
|
|
|
{
|
|
|
|
const WCHAR *name;
|
|
|
|
const WCHAR *version;
|
|
|
|
};
|
2015-07-29 11:39:28 +02:00
|
|
|
struct record_desktopmonitor
|
|
|
|
{
|
2020-02-25 11:39:52 +01:00
|
|
|
const WCHAR *name;
|
2015-07-29 11:39:28 +02:00
|
|
|
UINT32 pixelsperxlogicalinch;
|
|
|
|
};
|
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;
|
2014-04-03 12:35:25 +02:00
|
|
|
const WCHAR *interfacetype;
|
2012-10-04 15:37:13 +02:00
|
|
|
const WCHAR *manufacturer;
|
2014-02-28 11:21:11 +01:00
|
|
|
const WCHAR *mediatype;
|
2014-04-03 12:35:25 +02:00
|
|
|
const WCHAR *model;
|
2015-01-22 08:08:38 +01:00
|
|
|
const WCHAR *pnpdevice_id;
|
2012-10-04 15:37:13 +02:00
|
|
|
const WCHAR *serialnumber;
|
2014-04-03 12:35:25 +02:00
|
|
|
UINT64 size;
|
2012-10-04 15:37:13 +02:00
|
|
|
};
|
2019-09-10 17:09:12 +02:00
|
|
|
struct record_diskdrivetodiskpartition
|
|
|
|
{
|
|
|
|
const WCHAR *antecedent;
|
|
|
|
const WCHAR *dependent;
|
|
|
|
};
|
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;
|
|
|
|
};
|
2019-09-20 13:37:15 +02:00
|
|
|
struct record_displaycontrollerconfig
|
|
|
|
{
|
|
|
|
UINT32 bitsperpixel;
|
|
|
|
const WCHAR *caption;
|
|
|
|
UINT32 horizontalresolution;
|
|
|
|
const WCHAR *name;
|
|
|
|
UINT32 verticalresolution;
|
|
|
|
};
|
2017-02-01 14:18:50 +01:00
|
|
|
struct record_ip4routetable
|
|
|
|
{
|
|
|
|
const WCHAR *destination;
|
|
|
|
INT32 interfaceindex;
|
|
|
|
const WCHAR *nexthop;
|
|
|
|
};
|
2012-06-29 13:41:07 +02:00
|
|
|
struct record_logicaldisk
|
|
|
|
{
|
2021-02-09 10:12:54 +01:00
|
|
|
const WCHAR *caption;
|
2012-06-29 13:41:07 +02:00
|
|
|
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;
|
2015-01-05 13:19:28 +01:00
|
|
|
const WCHAR *volumename;
|
2014-03-17 09:36:55 +01:00
|
|
|
const WCHAR *volumeserialnumber;
|
2012-06-29 13:41:07 +02:00
|
|
|
};
|
2019-09-10 17:09:11 +02:00
|
|
|
struct record_logicaldisktopartition
|
|
|
|
{
|
|
|
|
const WCHAR *antecedent;
|
|
|
|
const WCHAR *dependent;
|
|
|
|
};
|
2012-06-25 11:20:09 +02:00
|
|
|
struct record_networkadapter
|
|
|
|
{
|
2012-10-10 12:01:22 +02:00
|
|
|
const WCHAR *adaptertype;
|
2019-01-24 14:49:46 +01:00
|
|
|
UINT16 adaptertypeid;
|
2019-01-24 14:49:54 +01:00
|
|
|
const WCHAR *description;
|
2012-06-25 11:20:09 +02:00
|
|
|
const WCHAR *device_id;
|
2021-01-21 12:36:39 +01:00
|
|
|
const WCHAR *guid;
|
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;
|
2021-01-21 12:36:42 +01:00
|
|
|
const WCHAR *servicename;
|
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
|
|
|
|
{
|
2015-12-23 11:07:38 +01:00
|
|
|
const struct array *defaultipgateway;
|
|
|
|
const WCHAR *description;
|
2015-12-23 11:07:40 +01:00
|
|
|
int dhcpenabled;
|
2015-12-23 11:07:38 +01:00
|
|
|
const WCHAR *dnshostname;
|
2015-12-23 11:07:41 +01:00
|
|
|
const struct array *dnsserversearchorder;
|
2015-12-23 11:07:38 +01:00
|
|
|
UINT32 index;
|
2018-08-01 17:23:23 +02:00
|
|
|
const struct array *ipaddress;
|
2015-12-23 11:07:38 +01:00
|
|
|
UINT32 ipconnectionmetric;
|
|
|
|
int ipenabled;
|
2018-08-01 17:23:29 +02:00
|
|
|
const struct array *ipsubnet;
|
2015-12-23 11:07:38 +01:00
|
|
|
const WCHAR *mac_address;
|
2015-12-23 11:07:42 +01:00
|
|
|
const WCHAR *settingid;
|
2013-11-04 11:54:51 +01:00
|
|
|
};
|
2012-06-19 10:21:47 +02:00
|
|
|
struct record_operatingsystem
|
|
|
|
{
|
2014-04-03 12:34:47 +02:00
|
|
|
const WCHAR *buildnumber;
|
2012-06-19 10:21:47 +02:00
|
|
|
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;
|
2019-09-17 13:41:43 +02:00
|
|
|
const WCHAR *csname;
|
|
|
|
INT16 currenttimezone;
|
2018-03-02 11:54:57 +01:00
|
|
|
UINT64 freephysicalmemory;
|
2014-04-03 12:34:47 +02:00
|
|
|
const WCHAR *installdate;
|
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;
|
2019-09-17 13:41:43 +02:00
|
|
|
const WCHAR *manufacturer;
|
2014-01-10 09:38:19 +01:00
|
|
|
const WCHAR *name;
|
2019-03-25 10:06:05 +01:00
|
|
|
UINT32 operatingsystemsku;
|
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;
|
2015-06-22 12:13:56 +02:00
|
|
|
int primary;
|
2021-03-14 21:22:51 +01:00
|
|
|
UINT32 producttype;
|
2014-04-03 12:34:47 +02:00
|
|
|
const WCHAR *serialnumber;
|
2013-05-02 12:02:06 +02:00
|
|
|
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;
|
2019-04-24 12:58:11 +02:00
|
|
|
const WCHAR *systemdrive;
|
2016-11-16 17:01:53 +01:00
|
|
|
UINT64 totalvirtualmemorysize;
|
2014-12-04 22:32:35 +01:00
|
|
|
UINT64 totalvisiblememorysize;
|
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;
|
|
|
|
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
|
|
|
};
|
2014-04-03 12:34:18 +02:00
|
|
|
struct record_physicalmemory
|
|
|
|
{
|
2020-07-07 09:54:22 +02:00
|
|
|
const WCHAR *banklabel;
|
2019-03-25 10:06:04 +01:00
|
|
|
UINT64 capacity;
|
2020-07-07 09:54:22 +02:00
|
|
|
const WCHAR *caption;
|
2019-09-17 13:41:44 +02:00
|
|
|
UINT32 configuredclockspeed;
|
2019-03-25 10:06:04 +01:00
|
|
|
const WCHAR *devicelocator;
|
2020-02-25 11:39:51 +01:00
|
|
|
UINT16 formfactor;
|
2019-03-25 10:06:04 +01:00
|
|
|
UINT16 memorytype;
|
2019-09-17 13:41:44 +02:00
|
|
|
const WCHAR *partnumber;
|
2020-07-07 09:54:22 +02:00
|
|
|
const WCHAR *serial;
|
2014-04-03 12:34:18 +02:00
|
|
|
};
|
2018-08-06 18:11:15 +02:00
|
|
|
struct record_pnpentity
|
|
|
|
{
|
|
|
|
const WCHAR *device_id;
|
|
|
|
};
|
2015-04-02 16:20:27 +02:00
|
|
|
struct record_printer
|
|
|
|
{
|
|
|
|
UINT32 attributes;
|
2018-03-02 11:54:59 +01:00
|
|
|
const WCHAR *device_id;
|
2015-04-02 16:20:27 +02:00
|
|
|
const WCHAR *drivername;
|
|
|
|
UINT32 horizontalresolution;
|
|
|
|
int local;
|
2018-03-02 11:54:59 +01:00
|
|
|
const WCHAR *location;
|
2015-04-02 16:20:27 +02:00
|
|
|
const WCHAR *name;
|
|
|
|
int network;
|
2018-03-02 11:54:59 +01:00
|
|
|
const WCHAR *portname;
|
2015-04-02 16:20:27 +02: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;
|
2015-06-22 12:14:21 +02:00
|
|
|
UINT64 workingsetsize;
|
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;
|
2018-02-05 16:08:17 +01:00
|
|
|
UINT16 architecture;
|
2015-04-02 16:19:32 +02:00
|
|
|
const WCHAR *caption;
|
2012-06-26 16:03:32 +02:00
|
|
|
UINT16 cpu_status;
|
2014-04-30 10:20:05 +02:00
|
|
|
UINT32 currentclockspeed;
|
2015-04-02 16:19:32 +02:00
|
|
|
UINT16 datawidth;
|
|
|
|
const WCHAR *description;
|
2012-06-26 16:03:32 +02:00
|
|
|
const WCHAR *device_id;
|
2013-05-02 12:02:34 +02:00
|
|
|
UINT16 family;
|
2018-02-05 16:08:17 +01:00
|
|
|
UINT16 level;
|
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;
|
2015-01-22 05:07:48 +01:00
|
|
|
UINT16 processortype;
|
2018-02-05 16:08:17 +01:00
|
|
|
UINT16 revision;
|
2012-10-04 15:37:57 +02:00
|
|
|
const WCHAR *unique_id;
|
2015-04-02 16:19:32 +02:00
|
|
|
const WCHAR *version;
|
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;
|
2019-08-28 14:14:27 +02:00
|
|
|
int boolvalue;
|
2013-01-25 17:34:00 +01:00
|
|
|
};
|
2019-09-30 17:12:58 +02:00
|
|
|
struct record_quickfixengineering
|
|
|
|
{
|
|
|
|
const WCHAR *caption;
|
|
|
|
const WCHAR *hotfixid;
|
|
|
|
};
|
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
|
|
|
};
|
2015-02-13 13:40:36 +01:00
|
|
|
struct record_sid
|
|
|
|
{
|
|
|
|
const WCHAR *accountname;
|
2015-04-17 09:38:15 +02:00
|
|
|
const struct array *binaryrepresentation;
|
2015-02-13 13:40:36 +01:00
|
|
|
const WCHAR *referenceddomainname;
|
|
|
|
const WCHAR *sid;
|
|
|
|
UINT32 sidlength;
|
|
|
|
};
|
2012-10-04 15:37:32 +02:00
|
|
|
struct record_sounddevice
|
|
|
|
{
|
2020-10-29 13:15:48 +01:00
|
|
|
const WCHAR *deviceid;
|
2020-07-08 12:26:01 +02:00
|
|
|
const WCHAR *manufacturer;
|
2013-06-14 10:08:24 +02:00
|
|
|
const WCHAR *name;
|
2020-10-29 13:15:48 +01:00
|
|
|
const WCHAR *pnpdeviceid;
|
2012-10-04 15:37:32 +02:00
|
|
|
const WCHAR *productname;
|
2020-10-22 11:25:36 +02:00
|
|
|
const WCHAR *status;
|
2015-01-07 15:26:16 +01:00
|
|
|
UINT16 statusinfo;
|
2012-10-04 15:37:32 +02:00
|
|
|
};
|
2012-07-13 11:35:09 +02:00
|
|
|
struct record_stdregprov
|
|
|
|
{
|
2018-09-28 10:58:40 +02:00
|
|
|
class_method *createkey;
|
2012-07-13 11:35:09 +02:00
|
|
|
class_method *enumkey;
|
|
|
|
class_method *enumvalues;
|
2012-10-15 10:46:09 +02:00
|
|
|
class_method *getstringvalue;
|
2021-03-01 08:14:44 +01:00
|
|
|
class_method *setstringvalue;
|
2021-03-01 08:14:45 +01:00
|
|
|
class_method *setdwordvalue;
|
2021-03-01 08:14:46 +01:00
|
|
|
class_method *deletekey;
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2021-01-20 11:15:57 +01:00
|
|
|
struct record_sysrestore
|
|
|
|
{
|
|
|
|
const WCHAR *creation_time;
|
|
|
|
const WCHAR *description;
|
|
|
|
UINT32 event_type;
|
|
|
|
UINT32 restore_point_type;
|
|
|
|
UINT32 sequence_number;
|
|
|
|
class_method *create_restore_point;
|
|
|
|
class_method *disable_restore;
|
|
|
|
class_method *enable_restore;
|
|
|
|
class_method *get_last_restore_status;
|
|
|
|
class_method *restore;
|
|
|
|
};
|
2014-08-04 23:29:16 +02:00
|
|
|
struct record_systemsecurity
|
|
|
|
{
|
|
|
|
class_method *getsd;
|
2014-08-07 21:40:03 +02:00
|
|
|
class_method *setsd;
|
2014-08-04 23:29:16 +02:00
|
|
|
};
|
2015-04-16 21:46:13 +02:00
|
|
|
struct record_systemenclosure
|
|
|
|
{
|
2019-08-27 16:35:56 +02:00
|
|
|
const WCHAR *caption;
|
2015-04-16 21:46:13 +02:00
|
|
|
const struct array *chassistypes;
|
2019-08-27 16:35:56 +02:00
|
|
|
const WCHAR *description;
|
|
|
|
int lockpresent;
|
|
|
|
const WCHAR *manufacturer;
|
|
|
|
const WCHAR *name;
|
|
|
|
const WCHAR *tag;
|
2015-04-16 21:46:13 +02:00
|
|
|
};
|
2012-06-22 09:23:36 +02:00
|
|
|
struct record_videocontroller
|
|
|
|
{
|
2020-04-20 10:38:11 +02:00
|
|
|
const WCHAR *adapter_compatibility;
|
2013-06-14 10:06:46 +02:00
|
|
|
const WCHAR *adapter_dactype;
|
2012-06-22 09:23:36 +02:00
|
|
|
UINT32 adapter_ram;
|
2014-04-03 12:36:33 +02:00
|
|
|
UINT16 availability;
|
2015-04-02 16:19:58 +02:00
|
|
|
const WCHAR *caption;
|
2018-03-01 17:20:36 +01:00
|
|
|
UINT32 config_errorcode;
|
2012-06-28 09:24:05 +02:00
|
|
|
UINT32 current_bitsperpixel;
|
|
|
|
UINT32 current_horizontalres;
|
2015-04-02 16:19:58 +02:00
|
|
|
UINT32 current_refreshrate;
|
|
|
|
UINT16 current_scanmode;
|
2012-06-28 09:24:05 +02:00
|
|
|
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;
|
2018-03-01 17:20:39 +01:00
|
|
|
const WCHAR *driverdate;
|
2015-02-13 13:40:09 +01:00
|
|
|
const WCHAR *driverversion;
|
2018-03-01 17:20:38 +01:00
|
|
|
const WCHAR *installeddriver;
|
2012-06-28 09:24:05 +02:00
|
|
|
const WCHAR *name;
|
2013-01-29 15:32:06 +01:00
|
|
|
const WCHAR *pnpdevice_id;
|
2018-03-01 17:20:37 +01:00
|
|
|
const WCHAR *status;
|
2015-04-02 16:19:58 +02:00
|
|
|
UINT16 videoarchitecture;
|
|
|
|
UINT16 videomemorytype;
|
2016-01-06 14:44:34 +01:00
|
|
|
const WCHAR *videomodedescription;
|
2015-01-07 15:26:34 +01:00
|
|
|
const WCHAR *videoprocessor;
|
2012-06-22 09:23:36 +02:00
|
|
|
};
|
2019-09-17 13:41:45 +02:00
|
|
|
struct record_winsat
|
|
|
|
{
|
|
|
|
FLOAT cpuscore;
|
|
|
|
FLOAT d3dscore;
|
|
|
|
FLOAT diskscrore;
|
|
|
|
FLOAT graphicsscore;
|
|
|
|
FLOAT memoryscore;
|
|
|
|
const WCHAR *timetaken;
|
|
|
|
UINT32 winsatassessmentstate;
|
|
|
|
FLOAT winsprlevel;
|
|
|
|
};
|
2012-06-15 15:47:28 +02:00
|
|
|
#include "poppack.h"
|
|
|
|
|
2019-09-10 17:09:14 +02:00
|
|
|
static const struct record_associator data_associator[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Win32_DiskDriveToDiskPartition", L"Win32_DiskPartition", L"Win32_DiskDrive" },
|
|
|
|
{ L"Win32_LogicalDiskToPartition", L"Win32_LogicalDisk", L"Win32_DiskPartition" },
|
2019-09-10 17:09:14 +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
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"__SystemSecurity", L"GetSD", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"__SystemSecurity", L"GetSD", -1, L"SD", CIM_UINT8|CIM_FLAG_ARRAY },
|
|
|
|
{ L"__SystemSecurity", L"SetSD", 1, L"SD", CIM_UINT8|CIM_FLAG_ARRAY },
|
|
|
|
{ L"__SystemSecurity", L"SetSD", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"StdRegProv", L"CreateKey", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
|
|
|
{ L"StdRegProv", L"CreateKey", 1, L"sSubKeyName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"CreateKey", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"StdRegProv", L"EnumKey", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
|
|
|
{ L"StdRegProv", L"EnumKey", 1, L"sSubKeyName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"EnumKey", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"StdRegProv", L"EnumKey", -1, L"sNames", CIM_STRING|CIM_FLAG_ARRAY },
|
|
|
|
{ L"StdRegProv", L"EnumValues", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
|
|
|
{ L"StdRegProv", L"EnumValues", 1, L"sSubKeyName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"EnumValues", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"StdRegProv", L"EnumValues", -1, L"sNames", CIM_STRING|CIM_FLAG_ARRAY },
|
|
|
|
{ L"StdRegProv", L"EnumValues", -1, L"Types", CIM_SINT32|CIM_FLAG_ARRAY },
|
|
|
|
{ L"StdRegProv", L"GetStringValue", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
|
|
|
{ L"StdRegProv", L"GetStringValue", 1, L"sSubKeyName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"GetStringValue", 1, L"sValueName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"GetStringValue", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"StdRegProv", L"GetStringValue", -1, L"sValue", CIM_STRING },
|
2021-03-01 08:14:44 +01:00
|
|
|
{ L"StdRegProv", L"SetStringValue", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
|
|
|
{ L"StdRegProv", L"SetStringValue", 1, L"sSubKeyName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"SetStringValue", 1, L"sValueName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"SetStringValue", 1, L"sValue", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"SetStringValue", -1, L"ReturnValue", CIM_UINT32 },
|
2021-03-01 08:14:45 +01:00
|
|
|
{ L"StdRegProv", L"SetDWORDValue", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
|
|
|
{ L"StdRegProv", L"SetDWORDValue", 1, L"sSubKeyName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"SetDWORDValue", 1, L"sValueName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"SetDWORDValue", 1, L"uValue", CIM_UINT32 },
|
|
|
|
{ L"StdRegProv", L"SetDWORDValue", -1, L"ReturnValue", CIM_UINT32 },
|
2021-03-01 08:14:46 +01:00
|
|
|
{ L"StdRegProv", L"DeleteKey", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
|
|
|
{ L"StdRegProv", L"DeleteKey", 1, L"sSubKeyName", CIM_STRING },
|
|
|
|
{ L"StdRegProv", L"DeleteKey", -1, L"ReturnValue", CIM_UINT32 },
|
2021-01-20 11:15:57 +01:00
|
|
|
{ L"SystemRestore", L"Disable", 1, L"Drive", CIM_STRING },
|
|
|
|
{ L"SystemRestore", L"Disable", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"SystemRestore", L"Enable", 1, L"Drive", CIM_STRING },
|
|
|
|
{ L"SystemRestore", L"Enable", -1, L"ReturnValue", CIM_UINT32 },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Win32_Process", L"GetOwner", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"Win32_Process", L"GetOwner", -1, L"User", CIM_STRING },
|
|
|
|
{ L"Win32_Process", L"GetOwner", -1, L"Domain", CIM_STRING },
|
|
|
|
{ L"Win32_Service", L"PauseService", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"Win32_Service", L"ResumeService", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"Win32_Service", L"StartService", -1, L"ReturnValue", CIM_UINT32 },
|
|
|
|
{ L"Win32_Service", L"StopService", -1, L"ReturnValue", CIM_UINT32 },
|
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[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"WINEHDISK", L"\\\\.\\PHYSICALDRIVE0" }
|
2013-12-11 14:36:34 +01:00
|
|
|
};
|
2013-01-25 17:34:00 +01:00
|
|
|
static const struct record_qualifier data_qualifier[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"__WIN32_PROCESS_GETOWNER_OUT", L"User", CIM_SINT32, FLAVOR_ID, L"ID", 0 },
|
|
|
|
{ L"__WIN32_PROCESS_GETOWNER_OUT", L"Domain", CIM_SINT32, FLAVOR_ID, L"ID", 1 }
|
2013-01-25 17:34:00 +01:00
|
|
|
};
|
2019-09-30 17:12:58 +02:00
|
|
|
static const struct record_quickfixengineering data_quickfixengineering[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"http://winehq.org", L"KB1234567" },
|
2019-09-30 17:12:58 +02:00
|
|
|
};
|
2020-10-29 13:15:48 +01:00
|
|
|
|
2012-07-13 11:35:09 +02:00
|
|
|
static const struct record_stdregprov data_stdregprov[] =
|
|
|
|
{
|
2021-03-01 08:14:44 +01:00
|
|
|
{
|
|
|
|
reg_create_key,
|
|
|
|
reg_enum_key,
|
|
|
|
reg_enum_values,
|
|
|
|
reg_get_stringvalue,
|
|
|
|
reg_set_stringvalue,
|
2021-03-01 08:14:45 +01:00
|
|
|
reg_set_dwordvalue,
|
2021-03-01 08:14:46 +01:00
|
|
|
reg_delete_key,
|
2021-03-01 08:14:44 +01:00
|
|
|
}
|
2012-07-13 11:35:09 +02:00
|
|
|
};
|
2021-01-20 11:15:57 +01:00
|
|
|
|
|
|
|
static const struct record_sysrestore data_sysrestore[] =
|
|
|
|
{
|
2021-03-05 11:22:59 +01:00
|
|
|
{ NULL, NULL, 0, 0, 0, sysrestore_create, sysrestore_disable, sysrestore_enable, sysrestore_get_last_status,
|
|
|
|
sysrestore_restore }
|
2021-01-20 11:15:57 +01:00
|
|
|
};
|
|
|
|
|
2015-04-16 21:46:13 +02:00
|
|
|
static UINT16 systemenclosure_chassistypes[] =
|
|
|
|
{
|
|
|
|
1,
|
|
|
|
};
|
|
|
|
static const struct array systemenclosure_chassistypes_array =
|
|
|
|
{
|
2019-08-27 16:35:55 +02:00
|
|
|
sizeof(*systemenclosure_chassistypes),
|
2018-11-15 20:59:48 +01:00
|
|
|
ARRAY_SIZE(systemenclosure_chassistypes),
|
2015-04-16 21:46:13 +02:00
|
|
|
&systemenclosure_chassistypes
|
|
|
|
};
|
2014-08-04 23:29:16 +02:00
|
|
|
static const struct record_systemsecurity data_systemsecurity[] =
|
|
|
|
{
|
2014-08-07 21:40:03 +02:00
|
|
|
{ security_get_sd, security_set_sd }
|
2014-08-04 23:29:16 +02:00
|
|
|
};
|
2019-09-17 13:41:45 +02:00
|
|
|
static const struct record_winsat data_winsat[] =
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, L"MostRecentAssessment", 1 /* Valid */, 8.0f },
|
2019-09-17 13:41:45 +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;
|
|
|
|
}
|
2015-04-02 16:16:04 +02:00
|
|
|
if (row_count > table->num_rows_allocated)
|
2013-06-04 13:28:21 +02:00
|
|
|
{
|
|
|
|
BYTE *data;
|
2015-04-02 16:16:04 +02:00
|
|
|
UINT count = max( row_count, table->num_rows_allocated * 2 );
|
2013-06-04 13:28:21 +02:00
|
|
|
if (!(data = heap_realloc( table->data, count * row_size ))) return FALSE;
|
|
|
|
table->data = data;
|
|
|
|
table->num_rows_allocated = count;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
#include "pshpack1.h"
|
|
|
|
struct smbios_prologue
|
|
|
|
{
|
|
|
|
BYTE calling_method;
|
|
|
|
BYTE major_version;
|
|
|
|
BYTE minor_version;
|
|
|
|
BYTE revision;
|
|
|
|
DWORD length;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum smbios_type
|
|
|
|
{
|
|
|
|
SMBIOS_TYPE_BIOS,
|
|
|
|
SMBIOS_TYPE_SYSTEM,
|
|
|
|
SMBIOS_TYPE_BASEBOARD,
|
|
|
|
SMBIOS_TYPE_CHASSIS,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smbios_header
|
|
|
|
{
|
|
|
|
BYTE type;
|
|
|
|
BYTE length;
|
|
|
|
WORD handle;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smbios_baseboard
|
|
|
|
{
|
|
|
|
struct smbios_header hdr;
|
|
|
|
BYTE vendor;
|
|
|
|
BYTE product;
|
|
|
|
BYTE version;
|
|
|
|
BYTE serial;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smbios_bios
|
|
|
|
{
|
|
|
|
struct smbios_header hdr;
|
|
|
|
BYTE vendor;
|
|
|
|
BYTE version;
|
|
|
|
WORD start;
|
|
|
|
BYTE date;
|
|
|
|
BYTE size;
|
|
|
|
UINT64 characteristics;
|
2020-02-25 00:42:51 +01:00
|
|
|
BYTE characteristics_ext[2];
|
|
|
|
BYTE system_bios_major_release;
|
|
|
|
BYTE system_bios_minor_release;
|
|
|
|
BYTE ec_firmware_major_release;
|
|
|
|
BYTE ec_firmware_minor_release;
|
2019-08-27 16:35:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct smbios_chassis
|
|
|
|
{
|
|
|
|
struct smbios_header hdr;
|
|
|
|
BYTE vendor;
|
|
|
|
BYTE type;
|
|
|
|
BYTE version;
|
|
|
|
BYTE serial;
|
|
|
|
BYTE asset_tag;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct smbios_system
|
|
|
|
{
|
|
|
|
struct smbios_header hdr;
|
|
|
|
BYTE vendor;
|
|
|
|
BYTE product;
|
|
|
|
BYTE version;
|
|
|
|
BYTE serial;
|
|
|
|
BYTE uuid[16];
|
|
|
|
};
|
|
|
|
#include "poppack.h"
|
|
|
|
|
|
|
|
#define RSMB (('R' << 24) | ('S' << 16) | ('M' << 8) | 'B')
|
|
|
|
|
|
|
|
static const struct smbios_header *find_smbios_entry( enum smbios_type type, const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const char *ptr, *start;
|
|
|
|
const struct smbios_prologue *prologue;
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
|
|
|
|
if (len < sizeof(struct smbios_prologue)) return NULL;
|
|
|
|
prologue = (const struct smbios_prologue *)buf;
|
|
|
|
if (prologue->length > len - sizeof(*prologue) || prologue->length < sizeof(*hdr)) return NULL;
|
|
|
|
|
|
|
|
start = (const char *)(prologue + 1);
|
|
|
|
hdr = (const struct smbios_header *)start;
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if ((const char *)hdr - start >= prologue->length - sizeof(*hdr)) return NULL;
|
|
|
|
|
|
|
|
if (!hdr->length)
|
|
|
|
{
|
|
|
|
WARN( "invalid entry\n" );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hdr->type == type)
|
|
|
|
{
|
|
|
|
if ((const char *)hdr - start + hdr->length > prologue->length) return NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else /* skip other entries and their strings */
|
|
|
|
{
|
|
|
|
for (ptr = (const char *)hdr + hdr->length; ptr - buf < len && *ptr; ptr++)
|
|
|
|
{
|
|
|
|
for (; ptr - buf < len; ptr++) if (!*ptr) break;
|
|
|
|
}
|
|
|
|
if (ptr == (const char *)hdr + hdr->length) ptr++;
|
|
|
|
hdr = (const struct smbios_header *)(ptr + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hdr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_smbios_string( BYTE id, const char *buf, UINT offset, UINT buflen )
|
|
|
|
{
|
|
|
|
const char *ptr = buf + offset;
|
|
|
|
UINT i = 0;
|
|
|
|
|
|
|
|
if (!id || offset >= buflen) return NULL;
|
|
|
|
for (ptr = buf + offset; ptr - buf < buflen && *ptr; ptr++)
|
|
|
|
{
|
|
|
|
if (++i == id) return heap_strdupAW( ptr );
|
|
|
|
for (; ptr - buf < buflen; ptr++) if (!*ptr) break;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_baseboard_string( BYTE id, const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_baseboard *baseboard;
|
|
|
|
UINT offset;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BASEBOARD, buf, len ))) return NULL;
|
|
|
|
|
|
|
|
baseboard = (const struct smbios_baseboard *)hdr;
|
|
|
|
offset = (const char *)baseboard - buf + baseboard->hdr.length;
|
|
|
|
return get_smbios_string( id, buf, offset, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_baseboard_manufacturer( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_baseboard_string( 1, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"Intel Corporation" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_baseboard_product( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_baseboard_string( 2, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"Base Board" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_baseboard_serialnumber( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_baseboard_string( 4, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"None" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_baseboard_version( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_baseboard_string( 3, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"1.0" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_baseboard( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_baseboard *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0, len;
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
|
|
|
|
if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
|
|
|
|
GetSystemFirmwareTable( RSMB, 0, buf, len );
|
|
|
|
|
|
|
|
rec = (struct record_baseboard *)table->data;
|
|
|
|
rec->manufacturer = get_baseboard_manufacturer( buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->model = L"Base Board";
|
|
|
|
rec->name = L"Base Board";
|
2019-08-27 16:35:56 +02:00
|
|
|
rec->product = get_baseboard_product( buf, len );
|
|
|
|
rec->serialnumber = get_baseboard_serialnumber( buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->tag = L"Base Board";
|
2019-08-27 16:35:56 +02:00
|
|
|
rec->version = get_baseboard_version( buf, len );
|
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
|
|
|
|
|
|
|
heap_free( buf );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT16 get_bios_smbiosmajorversion( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_prologue *prologue = (const struct smbios_prologue *)buf;
|
|
|
|
if (len < sizeof(*prologue)) return 2;
|
|
|
|
return prologue->major_version;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT16 get_bios_smbiosminorversion( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_prologue *prologue = (const struct smbios_prologue *)buf;
|
|
|
|
if (len < sizeof(*prologue)) return 0;
|
|
|
|
return prologue->minor_version;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_bios_string( BYTE id, const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_bios *bios;
|
|
|
|
UINT offset;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return NULL;
|
|
|
|
|
|
|
|
bios = (const struct smbios_bios *)hdr;
|
|
|
|
offset = (const char *)bios - buf + bios->hdr.length;
|
|
|
|
return get_smbios_string( id, buf, offset, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_bios_manufacturer( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_bios_string( 1, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"The Wine Project" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *convert_bios_date( const WCHAR *str )
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
static const WCHAR fmtW[] = L"%04u%02u%02u000000.000000+000";
|
2019-08-27 16:35:56 +02:00
|
|
|
UINT year, month, day, len = lstrlenW( str );
|
|
|
|
const WCHAR *p = str, *q;
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
while (len && iswspace( *p )) { p++; len--; }
|
|
|
|
while (len && iswspace( p[len - 1] )) { len--; }
|
|
|
|
|
|
|
|
q = p;
|
2020-02-07 15:06:58 +01:00
|
|
|
while (len && is_digit( *q )) { q++; len--; };
|
2019-08-27 16:35:56 +02:00
|
|
|
if (q - p != 2 || !len || *q != '/') return NULL;
|
|
|
|
month = (p[0] - '0') * 10 + p[1] - '0';
|
|
|
|
|
|
|
|
p = ++q; len--;
|
2020-02-07 15:06:58 +01:00
|
|
|
while (len && is_digit( *q )) { q++; len--; };
|
2019-08-27 16:35:56 +02:00
|
|
|
if (q - p != 2 || !len || *q != '/') return NULL;
|
|
|
|
day = (p[0] - '0') * 10 + p[1] - '0';
|
|
|
|
|
|
|
|
p = ++q; len--;
|
2020-02-07 15:06:58 +01:00
|
|
|
while (len && is_digit( *q )) { q++; len--; };
|
2019-08-27 16:35:56 +02:00
|
|
|
if (q - p == 4) year = (p[0] - '0') * 1000 + (p[1] - '0') * 100 + (p[2] - '0') * 10 + p[3] - '0';
|
|
|
|
else if (q - p == 2) year = 1900 + (p[0] - '0') * 10 + p[1] - '0';
|
|
|
|
else return NULL;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(fmtW) ))) return NULL;
|
|
|
|
swprintf( ret, ARRAY_SIZE(fmtW), fmtW, year, month, day );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_bios_releasedate( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret, *date = get_bios_string( 3, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!date || !(ret = convert_bios_date( date ))) ret = heap_strdupW( L"20120608000000.000000+000" );
|
2019-08-27 16:35:56 +02:00
|
|
|
heap_free( date );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_bios_smbiosbiosversion( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_bios_string( 2, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"Wine" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-02-25 00:42:51 +01:00
|
|
|
static BYTE get_bios_ec_firmware_major_release( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_bios *bios;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF;
|
|
|
|
|
|
|
|
bios = (const struct smbios_bios *)hdr;
|
|
|
|
if (bios->hdr.length >= 0x18) return bios->ec_firmware_major_release;
|
|
|
|
else return 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BYTE get_bios_ec_firmware_minor_release( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_bios *bios;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF;
|
|
|
|
|
|
|
|
bios = (const struct smbios_bios *)hdr;
|
|
|
|
if (bios->hdr.length >= 0x18) return bios->ec_firmware_minor_release;
|
|
|
|
else return 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BYTE get_bios_system_bios_major_release( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_bios *bios;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF;
|
|
|
|
|
|
|
|
bios = (const struct smbios_bios *)hdr;
|
|
|
|
if (bios->hdr.length >= 0x18) return bios->system_bios_major_release;
|
|
|
|
else return 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BYTE get_bios_system_bios_minor_release( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_bios *bios;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_BIOS, buf, len ))) return 0xFF;
|
|
|
|
|
|
|
|
bios = (const struct smbios_bios *)hdr;
|
|
|
|
if (bios->hdr.length >= 0x18) return bios->system_bios_minor_release;
|
|
|
|
else return 0xFF;
|
|
|
|
}
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
static enum fill_status fill_bios( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_bios *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0, len;
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
|
|
|
|
if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
|
|
|
|
GetSystemFirmwareTable( RSMB, 0, buf, len );
|
|
|
|
|
|
|
|
rec = (struct record_bios *)table->data;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->currentlanguage = NULL;
|
|
|
|
rec->description = L"Default System BIOS";
|
|
|
|
rec->ecmajorversion = get_bios_ec_firmware_major_release( buf, len );
|
|
|
|
rec->ecminorversion = get_bios_ec_firmware_minor_release( buf, len );
|
|
|
|
rec->identificationcode = NULL;
|
|
|
|
rec->manufacturer = get_bios_manufacturer( buf, len );
|
|
|
|
rec->name = L"Default System BIOS";
|
|
|
|
rec->releasedate = get_bios_releasedate( buf, len );
|
|
|
|
rec->serialnumber = L"0";
|
|
|
|
rec->smbiosbiosversion = get_bios_smbiosbiosversion( buf, len );
|
|
|
|
rec->smbiosmajorversion = get_bios_smbiosmajorversion( buf, len );
|
|
|
|
rec->smbiosminorversion = get_bios_smbiosminorversion( buf, len );
|
2020-02-25 00:42:51 +01:00
|
|
|
rec->systembiosmajorversion = get_bios_system_bios_major_release( buf, len );
|
|
|
|
rec->systembiosminorversion = get_bios_system_bios_minor_release( buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->version = L"WINE - 1";
|
2019-08-27 16:35:56 +02:00
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
|
|
|
|
|
|
|
heap_free( buf );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2020-10-14 23:22:01 +02:00
|
|
|
WCHAR drive[3], root[] = L"A:\\";
|
2013-02-25 11:03:56 +01:00
|
|
|
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
|
|
|
|
2015-12-21 13:00:32 +01:00
|
|
|
for (i = 0; i < 26; i++)
|
2013-02-25 11:03:56 +01:00
|
|
|
{
|
|
|
|
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);
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->device_id = L"IDE\\CDROMWINE_CD-ROM_____________________________1.0_____\\5&3A2A5854&0&1.0.0";
|
|
|
|
swprintf( drive, ARRAY_SIZE( drive ), L"%c:", 'A' + i );
|
2013-02-25 11:03:56 +01:00
|
|
|
rec->drive = heap_strdupW( drive );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->mediatype = L"CR-ROM";
|
|
|
|
rec->name = L"Wine CD_ROM ATA Device";
|
|
|
|
rec->pnpdevice_id = L"IDE\\CDROMWINE_CD-ROM_____________________________1.0_____\\5&3A2A5854&0&1.0.0";
|
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;
|
|
|
|
}
|
|
|
|
|
2019-01-25 10:44:14 +01:00
|
|
|
static UINT get_logical_processor_count( UINT *num_physical, UINT *num_packages )
|
2012-09-06 14:03:24 +02:00
|
|
|
{
|
2019-01-25 10:44:14 +01:00
|
|
|
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *buf, *entry;
|
|
|
|
UINT core_relation_count = 0, package_relation_count = 0;
|
2012-09-06 14:03:24 +02:00
|
|
|
NTSTATUS status;
|
2019-01-25 10:44:14 +01:00
|
|
|
ULONG len, offset = 0;
|
|
|
|
BOOL smt_enabled = FALSE;
|
2019-02-16 23:38:55 +01:00
|
|
|
DWORD all = RelationAll;
|
2012-09-06 14:03:24 +02:00
|
|
|
|
2019-01-25 10:44:14 +01:00
|
|
|
if (num_packages) *num_packages = 1;
|
|
|
|
status = NtQuerySystemInformationEx( SystemLogicalProcessorInformationEx, &all, sizeof(all), NULL, 0, &len );
|
2012-09-06 14:03:24 +02:00
|
|
|
if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count();
|
|
|
|
|
2019-01-25 10:44:14 +01:00
|
|
|
if (!(buf = heap_alloc( len ))) return get_processor_count();
|
|
|
|
status = NtQuerySystemInformationEx( SystemLogicalProcessorInformationEx, &all, sizeof(all), buf, len, NULL );
|
2012-09-06 14:03:24 +02:00
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
{
|
2019-01-25 10:44:14 +01:00
|
|
|
heap_free( buf );
|
2012-09-06 14:03:24 +02:00
|
|
|
return get_processor_count();
|
|
|
|
}
|
2019-01-25 10:44:14 +01:00
|
|
|
|
|
|
|
while (offset < len)
|
2012-09-06 14:03:24 +02:00
|
|
|
{
|
2019-01-25 10:44:14 +01:00
|
|
|
entry = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)((char *)buf + offset);
|
|
|
|
|
|
|
|
if (entry->Relationship == RelationProcessorCore)
|
2013-06-14 10:03:25 +02:00
|
|
|
{
|
2019-01-25 10:44:14 +01:00
|
|
|
core_relation_count++;
|
|
|
|
if (entry->u.Processor.Flags & LTP_PC_SMT) smt_enabled = TRUE;
|
2013-06-14 10:03:25 +02:00
|
|
|
}
|
2019-01-25 10:44:14 +01:00
|
|
|
else if (entry->Relationship == RelationProcessorPackage)
|
2013-06-14 10:03:25 +02:00
|
|
|
{
|
2019-01-25 10:44:14 +01:00
|
|
|
package_relation_count++;
|
2013-06-14 10:03:25 +02:00
|
|
|
}
|
2019-01-25 10:44:14 +01:00
|
|
|
offset += entry->Size;
|
2012-09-06 14:03:24 +02:00
|
|
|
}
|
2019-01-25 10:44:14 +01:00
|
|
|
|
|
|
|
heap_free( buf );
|
|
|
|
if (num_physical) *num_physical = core_relation_count;
|
|
|
|
if (num_packages) *num_packages = package_relation_count;
|
|
|
|
return smt_enabled ? core_relation_count * 2 : core_relation_count;
|
2012-09-06 14:03:24 +02:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-03-02 11:54:57 +01:00
|
|
|
static UINT64 get_available_physical_memory(void)
|
|
|
|
{
|
|
|
|
MEMORYSTATUSEX status;
|
|
|
|
|
|
|
|
status.dwLength = sizeof(status);
|
|
|
|
if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
|
|
|
|
return status.ullAvailPhys;
|
|
|
|
}
|
|
|
|
|
2013-04-08 10:21:29 +02:00
|
|
|
static WCHAR *get_computername(void)
|
|
|
|
{
|
|
|
|
WCHAR *ret;
|
2015-02-22 21:17:46 +01:00
|
|
|
DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
|
2013-04-08 10:21:29 +02:00
|
|
|
|
|
|
|
if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
|
|
|
|
GetComputerNameW( ret, &size );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-02-22 22:23:12 +01:00
|
|
|
static WCHAR *get_username(void)
|
|
|
|
{
|
|
|
|
WCHAR *ret;
|
|
|
|
DWORD compsize, usersize;
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
compsize = 0;
|
|
|
|
GetComputerNameW( NULL, &compsize );
|
|
|
|
usersize = 0;
|
|
|
|
GetUserNameW( NULL, &usersize );
|
|
|
|
size = compsize + usersize; /* two null terminators account for the \ */
|
|
|
|
if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
|
|
|
|
GetComputerNameW( ret, &compsize );
|
|
|
|
ret[compsize] = '\\';
|
|
|
|
GetUserNameW( ret + compsize + 1, &usersize );
|
|
|
|
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;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->description = L"AT/AT COMPATIBLE";
|
|
|
|
rec->domain = L"WORKGROUP";
|
2012-09-04 13:49:57 +02:00
|
|
|
rec->domainrole = 0; /* standalone workstation */
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->manufacturer = L"The Wine Project";
|
|
|
|
rec->model = L"Wine";
|
2013-04-08 10:21:29 +02:00
|
|
|
rec->name = get_computername();
|
2019-01-25 10:44:14 +01:00
|
|
|
rec->num_logical_processors = get_logical_processor_count( NULL, &rec->num_processors );
|
2012-06-27 11:35:45 +02:00
|
|
|
rec->total_physical_memory = get_total_physical_memory();
|
2015-02-22 22:23:12 +01:00
|
|
|
rec->username = get_username();
|
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
|
|
|
}
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
static WCHAR *get_compsysproduct_string( BYTE id, const char *buf, UINT len )
|
2019-07-03 12:38:30 +02:00
|
|
|
{
|
2019-08-27 16:35:56 +02:00
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_system *system;
|
|
|
|
UINT offset;
|
2019-07-03 12:38:30 +02:00
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_SYSTEM, buf, len ))) return NULL;
|
2019-07-03 12:38:30 +02:00
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
system = (const struct smbios_system *)hdr;
|
|
|
|
offset = (const char *)system - buf + system->hdr.length;
|
|
|
|
return get_smbios_string( id, buf, offset, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_compsysproduct_identifyingnumber( const char *buf, UINT len )
|
2019-07-03 12:38:30 +02:00
|
|
|
{
|
2019-08-27 16:35:56 +02:00
|
|
|
WCHAR *ret = get_compsysproduct_string( 4, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"0" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2019-07-03 12:38:30 +02:00
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
static WCHAR *get_compsysproduct_name( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_compsysproduct_string( 2, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"Wine" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2019-07-03 12:38:30 +02:00
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
static WCHAR *get_compsysproduct_uuid( const char *buf, UINT len )
|
2016-10-24 10:04:21 +02:00
|
|
|
{
|
2019-07-03 12:38:30 +02:00
|
|
|
static const BYTE none[] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_system *system;
|
2019-08-27 16:35:56 +02:00
|
|
|
const BYTE *ptr;
|
2019-07-03 12:38:30 +02:00
|
|
|
WCHAR *ret = NULL;
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_SYSTEM, buf, len )) || hdr->length < sizeof(*system)) goto done;
|
|
|
|
system = (const struct smbios_system *)hdr;
|
|
|
|
if (!memcmp( system->uuid, none, sizeof(none) ) || !(ret = heap_alloc( 37 * sizeof(WCHAR) ))) goto done;
|
2019-07-03 12:38:30 +02:00
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
ptr = system->uuid;
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( ret, 37, L"%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", ptr[0], ptr[1],
|
|
|
|
ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13],
|
|
|
|
ptr[14], ptr[15] );
|
2019-07-03 12:38:30 +02:00
|
|
|
done:
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) ret = heap_strdupW( L"deaddead-dead-dead-dead-deaddeaddead" );
|
2019-07-03 12:38:30 +02:00
|
|
|
return ret;
|
2016-10-24 10:04:21 +02:00
|
|
|
}
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
static WCHAR *get_compsysproduct_vendor( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_compsysproduct_string( 1, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"The Wine Project" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_compsysproduct_version( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_compsysproduct_string( 3, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"1.0" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-10-24 10:04:21 +02:00
|
|
|
static enum fill_status fill_compsysproduct( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_computersystemproduct *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2019-08-27 16:35:56 +02:00
|
|
|
UINT row = 0, len;
|
|
|
|
char *buf;
|
2016-10-24 10:04:21 +02:00
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
|
|
|
|
if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
|
|
|
|
GetSystemFirmwareTable( RSMB, 0, buf, len );
|
|
|
|
|
2016-10-24 10:04:21 +02:00
|
|
|
rec = (struct record_computersystemproduct *)table->data;
|
2019-08-27 16:35:56 +02:00
|
|
|
rec->identifyingnumber = get_compsysproduct_identifyingnumber( buf, len );
|
|
|
|
rec->name = get_compsysproduct_name( buf, len );
|
2018-02-05 16:08:15 +01:00
|
|
|
rec->skunumber = NULL;
|
2019-08-27 16:35:56 +02:00
|
|
|
rec->uuid = get_compsysproduct_uuid( buf, len );
|
|
|
|
rec->vendor = get_compsysproduct_vendor( buf, len );
|
|
|
|
rec->version = get_compsysproduct_version( buf, len );
|
2016-10-24 10:04:21 +02:00
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
heap_free( buf );
|
|
|
|
|
2016-10-24 10:04:21 +02:00
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
if (!iswalpha( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
|
2013-06-04 13:26:32 +02:00
|
|
|
start = path + 4;
|
2019-07-04 09:27:39 +02:00
|
|
|
len = lstrlenW( start );
|
2013-06-04 13:26:32 +02:00
|
|
|
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;
|
2019-07-04 09:27:39 +02:00
|
|
|
for (i = 0; i < dirstack->num_dirs; i++) if (!wcscmp( dirstack->dirs[i], path )) return TRUE;
|
2013-06-04 13:26:32 +02:00
|
|
|
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 &&
|
2020-04-20 10:38:10 +02:00
|
|
|
!wcscmp( left->u.propval->name, L"Name" ) &&
|
2019-07-04 09:27:39 +02:00
|
|
|
towupper( right->u.sval[0] ) == towupper( root ))
|
2013-06-04 13:26:32 +02:00
|
|
|
{
|
|
|
|
str = right->u.sval;
|
|
|
|
}
|
|
|
|
else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL &&
|
2020-04-20 10:38:10 +02:00
|
|
|
!wcscmp( right->u.propval->name, L"Name" ) &&
|
2019-07-04 09:27:39 +02:00
|
|
|
towupper( left->u.sval[0] ) == towupper( root ))
|
2013-06-04 13:26:32 +02:00
|
|
|
{
|
|
|
|
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 )
|
|
|
|
{
|
2019-07-04 09:27:39 +02:00
|
|
|
UINT len_path = 0, len_segment = lstrlenW( segment );
|
2013-05-29 12:16:44 +02:00
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
*len = 0;
|
2019-07-04 09:27:39 +02:00
|
|
|
if (path) len_path = lstrlenW( path );
|
2013-05-29 12:16:44 +02:00
|
|
|
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 )
|
|
|
|
{
|
|
|
|
VS_FIXEDFILEINFO *info;
|
2020-04-20 10:38:10 +02:00
|
|
|
DWORD size, len = 4 * 5 + ARRAY_SIZE( L"%u.%u.%u.%u" );
|
2013-06-04 13:29:03 +02:00
|
|
|
void *block;
|
|
|
|
WCHAR *ret;
|
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
2013-06-04 13:29:03 +02:00
|
|
|
if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size )))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!GetFileVersionInfoW( filename, 0, size, block ) ||
|
2020-04-20 10:38:10 +02:00
|
|
|
!VerQueryValueW( block, L"\\", (void **)&info, &size ))
|
2013-06-04 13:29:03 +02:00
|
|
|
{
|
|
|
|
heap_free( block );
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( ret, len, L"%u.%u.%u.%u", info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff,
|
|
|
|
info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff );
|
2013-06-04 13:29:03 +02:00
|
|
|
heap_free( block );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_datafile( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_datafile *rec;
|
|
|
|
UINT i, len, row = 0, offset = 0, num_expected_rows;
|
2020-10-14 23:22:01 +02:00
|
|
|
WCHAR *glob = NULL, *path = NULL, *new_path, root[] = L"A:\\";
|
2013-06-04 13:29:03 +02:00
|
|
|
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);
|
|
|
|
|
2015-12-21 13:00:32 +01:00
|
|
|
for (i = 0; i < 26; i++)
|
2013-06-04 13:29:03 +02:00
|
|
|
{
|
|
|
|
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 (;;)
|
|
|
|
{
|
2015-06-22 12:13:30 +02:00
|
|
|
heap_free( glob );
|
|
|
|
heap_free( path );
|
2013-06-04 13:29:03 +02:00
|
|
|
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;
|
|
|
|
}
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!wcscmp( data.cFileName, L"." ) || !wcscmp( data.cFileName, L".." )) continue;
|
2019-11-18 11:16:48 +01:00
|
|
|
|
|
|
|
if (!(new_path = append_path( path, data.cFileName, &len )))
|
|
|
|
{
|
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
FindClose( handle );
|
|
|
|
goto done;
|
|
|
|
}
|
2013-06-04 13:29:03 +02:00
|
|
|
|
|
|
|
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 );
|
2019-11-18 11:16:48 +01:00
|
|
|
heap_free( new_path );
|
2013-06-04 13:29:03 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
free_dirstack( dirstack );
|
|
|
|
heap_free( glob );
|
|
|
|
heap_free( path );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2015-07-29 11:39:28 +02:00
|
|
|
static UINT32 get_pixelsperxlogicalinch(void)
|
|
|
|
{
|
|
|
|
HDC hdc = GetDC( NULL );
|
|
|
|
UINT32 ret;
|
|
|
|
|
|
|
|
if (!hdc) return 96;
|
|
|
|
ret = GetDeviceCaps( hdc, LOGPIXELSX );
|
|
|
|
ReleaseDC( NULL, hdc );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_desktopmonitor( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_desktopmonitor *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0;
|
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
rec = (struct record_desktopmonitor *)table->data;
|
2020-02-25 11:39:52 +01:00
|
|
|
rec->name = L"Generic Non-PnP Monitor";
|
2015-07-29 11:39:28 +02:00
|
|
|
rec->pixelsperxlogicalinch = get_pixelsperxlogicalinch();
|
|
|
|
|
|
|
|
if (match_row( table, row, cond, &status )) row++;
|
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
struct record_directory *rec;
|
2013-06-04 13:28:21 +02:00
|
|
|
UINT i, len, row = 0, offset = 0, num_expected_rows;
|
2020-10-14 23:22:01 +02:00
|
|
|
WCHAR *glob = NULL, *path = NULL, *new_path, root[] = L"A:\\";
|
2013-05-29 12:16:44 +02:00
|
|
|
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);
|
|
|
|
|
2015-12-21 13:00:32 +01:00
|
|
|
for (i = 0; i < 26; i++)
|
2013-05-29 12:16:44 +02:00
|
|
|
{
|
|
|
|
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 (;;)
|
|
|
|
{
|
2015-06-22 12:13:30 +02:00
|
|
|
heap_free( glob );
|
|
|
|
heap_free( path );
|
2013-05-29 12:16:44 +02:00
|
|
|
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) ||
|
2020-04-20 10:38:10 +02:00
|
|
|
!wcscmp( data.cFileName, L"." ) || !wcscmp( data.cFileName, L".." ))
|
2013-05-29 12:16:44 +02:00
|
|
|
continue;
|
|
|
|
|
2019-11-18 11:16:48 +01:00
|
|
|
if (!(new_path = append_path( path, data.cFileName, &len )))
|
|
|
|
{
|
|
|
|
FindClose( handle );
|
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2013-05-29 12:16:44 +02:00
|
|
|
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 );
|
2019-11-18 11:16:48 +01:00
|
|
|
heap_free( 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
|
|
|
|
{
|
2020-10-14 23:22:01 +02:00
|
|
|
WCHAR root[] = L"\\\\.\\A:";
|
2013-06-04 13:26:32 +02:00
|
|
|
ULARGE_INTEGER free;
|
|
|
|
DISK_GEOMETRY_EX info;
|
|
|
|
HANDLE handle;
|
2014-07-19 20:52:03 +02:00
|
|
|
DWORD bytes_returned;
|
2013-06-04 13:26:32 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2014-07-19 20:52:03 +02:00
|
|
|
if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &info, sizeof(info), &bytes_returned, NULL ))
|
2013-06-04 13:26:32 +02:00
|
|
|
*disksize = info.DiskSize.QuadPart;
|
|
|
|
CloseHandle( handle );
|
|
|
|
}
|
|
|
|
return free.QuadPart;
|
|
|
|
}
|
2020-05-26 10:18:43 +02:00
|
|
|
static WCHAR *get_diskdrive_serialnumber( WCHAR letter )
|
|
|
|
{
|
|
|
|
WCHAR *ret = NULL;
|
|
|
|
STORAGE_DEVICE_DESCRIPTOR *desc;
|
|
|
|
HANDLE handle = INVALID_HANDLE_VALUE;
|
|
|
|
STORAGE_PROPERTY_QUERY query = {0};
|
|
|
|
WCHAR drive[7];
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
swprintf( drive, ARRAY_SIZE(drive), L"\\\\.\\%c:", letter );
|
|
|
|
handle = CreateFileW( drive, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
|
|
|
|
if (handle == INVALID_HANDLE_VALUE) goto done;
|
|
|
|
|
|
|
|
query.PropertyId = StorageDeviceProperty;
|
|
|
|
query.QueryType = PropertyStandardQuery;
|
|
|
|
|
|
|
|
size = sizeof(*desc) + 256;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (!(desc = heap_alloc( size ))) break;
|
|
|
|
if (DeviceIoControl( handle, IOCTL_STORAGE_QUERY_PROPERTY, &query, sizeof(query), desc, size, NULL, NULL ))
|
|
|
|
{
|
|
|
|
if (desc->SerialNumberOffset) ret = heap_strdupAW( (const char *)desc + desc->SerialNumberOffset );
|
|
|
|
heap_free( desc );
|
|
|
|
break;
|
|
|
|
}
|
2020-08-02 19:20:23 +02:00
|
|
|
size = desc->Size;
|
2020-05-26 10:18:43 +02:00
|
|
|
heap_free( desc );
|
2020-08-02 19:20:23 +02:00
|
|
|
if (GetLastError() != ERROR_MORE_DATA) break;
|
2020-05-26 10:18:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (handle != INVALID_HANDLE_VALUE) CloseHandle( handle );
|
|
|
|
if (!ret) ret = heap_strdupW( L"WINEHDISK" );
|
|
|
|
return ret;
|
|
|
|
}
|
2013-06-04 13:26:32 +02:00
|
|
|
|
2014-04-03 12:35:25 +02:00
|
|
|
static enum fill_status fill_diskdrive( struct table *table, const struct expr *cond )
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
static const WCHAR fmtW[] = L"\\\\\\\\.\\\\PHYSICALDRIVE%u";
|
2020-10-14 23:22:01 +02:00
|
|
|
WCHAR device_id[ARRAY_SIZE( fmtW ) + 10], root[] = L"A:\\";
|
2014-04-03 12:35:25 +02:00
|
|
|
struct record_diskdrive *rec;
|
|
|
|
UINT i, row = 0, offset = 0, index = 0, type;
|
|
|
|
UINT64 size = 1024 * 1024 * 1024;
|
|
|
|
DWORD drives = GetLogicalDrives();
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
|
|
|
|
if (!resize_table( table, 2, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
2015-12-21 13:00:32 +01:00
|
|
|
for (i = 0; i < 26; i++)
|
2014-04-03 12:35:25 +02:00
|
|
|
{
|
|
|
|
if (drives & (1 << i))
|
|
|
|
{
|
|
|
|
root[0] = 'A' + i;
|
|
|
|
type = GetDriveTypeW( root );
|
|
|
|
if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
rec = (struct record_diskdrive *)(table->data + offset);
|
2019-07-04 09:27:39 +02:00
|
|
|
swprintf( device_id, ARRAY_SIZE( device_id ), fmtW, index );
|
2014-04-03 12:35:25 +02:00
|
|
|
rec->device_id = heap_strdupW( device_id );
|
2019-09-10 17:09:13 +02:00
|
|
|
rec->index = index++;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->interfacetype = L"IDE";
|
|
|
|
rec->manufacturer = L"(Standard disk drives)";
|
|
|
|
rec->mediatype = (type == DRIVE_FIXED) ? L"Fixed hard disk" : L"Removable media";
|
|
|
|
rec->model = L"Wine Disk Drive";
|
|
|
|
rec->pnpdevice_id = L"IDE\\Disk\\VEN_WINE";
|
2020-05-26 10:18:43 +02:00
|
|
|
rec->serialnumber = get_diskdrive_serialnumber( root[0] );
|
2014-04-03 12:35:25 +02:00
|
|
|
get_freespace( root, &size );
|
|
|
|
rec->size = size;
|
|
|
|
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;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2019-09-10 17:09:12 +02:00
|
|
|
struct association
|
|
|
|
{
|
|
|
|
WCHAR *ref;
|
|
|
|
WCHAR *ref2;
|
|
|
|
};
|
|
|
|
|
2019-11-28 13:21:09 +01:00
|
|
|
static void free_associations( struct association *assoc, UINT count )
|
2019-09-10 17:09:12 +02:00
|
|
|
{
|
|
|
|
UINT i;
|
|
|
|
if (!assoc) return;
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
heap_free( assoc[i].ref );
|
|
|
|
heap_free( assoc[i].ref2 );
|
|
|
|
}
|
|
|
|
heap_free( assoc );
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct association *get_diskdrivetodiskpartition_pairs( UINT *count )
|
|
|
|
{
|
|
|
|
struct association *ret = NULL;
|
|
|
|
struct query *query, *query2 = NULL;
|
|
|
|
VARIANT val;
|
|
|
|
HRESULT hr;
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
if (!(query = create_query())) return NULL;
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = parse_query( L"SELECT * FROM Win32_DiskDrive", &query->view, &query->mem )) != S_OK) goto done;
|
2019-09-10 17:09:12 +02:00
|
|
|
if ((hr = execute_view( query->view )) != S_OK) goto done;
|
|
|
|
|
|
|
|
if (!(query2 = create_query())) return FALSE;
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = parse_query( L"SELECT * FROM Win32_DiskPartition", &query2->view, &query2->mem )) != S_OK) goto done;
|
2019-09-10 17:09:12 +02:00
|
|
|
if ((hr = execute_view( query2->view )) != S_OK) goto done;
|
|
|
|
|
2019-09-10 17:09:14 +02:00
|
|
|
if (!(ret = heap_alloc_zero( query->view->result_count * sizeof(*ret) ))) goto done;
|
2019-09-10 17:09:12 +02:00
|
|
|
|
2019-09-10 17:09:14 +02:00
|
|
|
for (i = 0; i < query->view->result_count; i++)
|
2019-09-10 17:09:12 +02:00
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = get_propval( query->view, i, L"__PATH", &val, NULL, NULL )) != S_OK) goto done;
|
2019-09-10 17:09:12 +02:00
|
|
|
if (!(ret[i].ref = heap_strdupW( V_BSTR(&val) ))) goto done;
|
|
|
|
VariantClear( &val );
|
|
|
|
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = get_propval( query2->view, i, L"__PATH", &val, NULL, NULL )) != S_OK) goto done;
|
2019-09-10 17:09:12 +02:00
|
|
|
if (!(ret[i].ref2 = heap_strdupW( V_BSTR(&val) ))) goto done;
|
|
|
|
VariantClear( &val );
|
|
|
|
}
|
|
|
|
|
2019-09-10 17:09:14 +02:00
|
|
|
*count = query->view->result_count;
|
2019-09-10 17:09:12 +02:00
|
|
|
|
|
|
|
done:
|
2019-11-28 13:21:09 +01:00
|
|
|
if (!ret) free_associations( ret, query->view->result_count );
|
2019-09-10 17:09:12 +02:00
|
|
|
free_query( query );
|
|
|
|
free_query( query2 );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_diskdrivetodiskpartition( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_diskdrivetodiskpartition *rec;
|
|
|
|
UINT i, row = 0, offset = 0, count = 0;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
struct association *assoc;
|
|
|
|
|
|
|
|
if (!(assoc = get_diskdrivetodiskpartition_pairs( &count ))) return FILL_STATUS_FAILED;
|
|
|
|
if (!count)
|
|
|
|
{
|
2019-11-28 13:21:09 +01:00
|
|
|
free_associations( assoc, count );
|
2019-09-10 17:09:12 +02:00
|
|
|
return FILL_STATUS_UNFILTERED;
|
|
|
|
}
|
|
|
|
if (!resize_table( table, count, sizeof(*rec) ))
|
|
|
|
{
|
2019-11-28 13:21:09 +01:00
|
|
|
free_associations( assoc, count );
|
2019-09-10 17:09:12 +02:00
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
rec = (struct record_diskdrivetodiskpartition *)(table->data + offset);
|
|
|
|
rec->antecedent = assoc[i].ref;
|
|
|
|
rec->dependent = assoc[i].ref2;
|
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
offset += sizeof(*rec);
|
|
|
|
row++;
|
|
|
|
}
|
|
|
|
|
|
|
|
heap_free( assoc );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2014-04-03 12:35:25 +02:00
|
|
|
static WCHAR *get_filesystem( const WCHAR *root )
|
|
|
|
{
|
|
|
|
WCHAR buffer[MAX_PATH + 1];
|
|
|
|
|
|
|
|
if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
|
|
|
|
return heap_strdupW( buffer );
|
2020-04-20 10:38:10 +02:00
|
|
|
return heap_strdupW( L"NTFS" );
|
2014-04-03 12:35:25 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2020-10-14 23:22:01 +02:00
|
|
|
WCHAR device_id[32], root[] = L"A:\\";
|
2013-02-25 11:04:29 +01:00
|
|
|
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
|
|
|
|
2015-12-21 13:00:32 +01:00
|
|
|
for (i = 0; i < 26; i++)
|
2013-02-25 11:04:29 +01:00
|
|
|
{
|
|
|
|
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;
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( device_id, ARRAY_SIZE( device_id ), L"Disk #%u, Partition #0", index );
|
2013-02-25 11:04:29 +01:00
|
|
|
rec->device_id = heap_strdupW( device_id );
|
2019-09-10 17:09:13 +02:00
|
|
|
rec->diskindex = index++;
|
2013-02-25 11:04:29 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2019-09-20 13:37:15 +02:00
|
|
|
static UINT32 get_bitsperpixel( 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_displaycontrollerconfig( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_displaycontrollerconfig *rec;
|
|
|
|
UINT row = 0, hres = 1024, vres = 768;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
rec = (struct record_displaycontrollerconfig *)table->data;
|
|
|
|
rec->bitsperpixel = get_bitsperpixel( &hres, &vres );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->caption = L"VideoController1";
|
2019-09-20 13:37:15 +02:00
|
|
|
rec->horizontalresolution = hres;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->name = L"VideoController1";
|
2019-09-20 13:37:15 +02:00
|
|
|
rec->verticalresolution = vres;
|
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2017-02-01 14:18:50 +01:00
|
|
|
static WCHAR *get_ip4_string( DWORD addr )
|
|
|
|
{
|
2019-07-04 09:27:39 +02:00
|
|
|
DWORD len = sizeof("ddd.ddd.ddd.ddd");
|
2017-02-01 14:18:50 +01:00
|
|
|
WCHAR *ret;
|
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( ret, len, L"%u.%u.%u.%u", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff );
|
2017-02-01 14:18:50 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_ip4routetable( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_ip4routetable *rec;
|
|
|
|
UINT i, row = 0, offset = 0, size = 0;
|
|
|
|
MIB_IPFORWARDTABLE *forwards;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
|
|
|
|
if (GetIpForwardTable( NULL, &size, TRUE ) != ERROR_INSUFFICIENT_BUFFER) return FILL_STATUS_FAILED;
|
|
|
|
if (!(forwards = heap_alloc( size ))) return FILL_STATUS_FAILED;
|
|
|
|
if (GetIpForwardTable( forwards, &size, TRUE ))
|
|
|
|
{
|
|
|
|
heap_free( forwards );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
2017-10-05 11:04:37 +02:00
|
|
|
if (!resize_table( table, max(forwards->dwNumEntries, 1), sizeof(*rec) ))
|
2017-02-01 14:18:50 +01:00
|
|
|
{
|
|
|
|
heap_free( forwards );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < forwards->dwNumEntries; i++)
|
|
|
|
{
|
|
|
|
rec = (struct record_ip4routetable *)(table->data + offset);
|
|
|
|
|
|
|
|
rec->destination = get_ip4_string( ntohl(forwards->table[i].dwForwardDest) );
|
|
|
|
rec->interfaceindex = forwards->table[i].dwForwardIfIndex;
|
|
|
|
rec->nexthop = get_ip4_string( ntohl(forwards->table[i].dwForwardNextHop) );
|
|
|
|
|
|
|
|
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( forwards );
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2015-01-05 13:19:28 +01:00
|
|
|
static WCHAR *get_volumename( const WCHAR *root )
|
|
|
|
{
|
|
|
|
WCHAR buf[MAX_PATH + 1] = {0};
|
2018-09-11 22:08:07 +02:00
|
|
|
GetVolumeInformationW( root, buf, ARRAY_SIZE( buf ), NULL, NULL, NULL, NULL, 0 );
|
2015-01-05 13:19:28 +01:00
|
|
|
return heap_strdupW( buf );
|
|
|
|
}
|
2014-03-17 09:36:55 +01:00
|
|
|
static WCHAR *get_volumeserialnumber( const WCHAR *root )
|
|
|
|
{
|
|
|
|
DWORD serial = 0;
|
|
|
|
WCHAR buffer[9];
|
|
|
|
|
|
|
|
GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 );
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( buffer, ARRAY_SIZE( buffer ), L"%08X", serial );
|
2014-03-17 09:36:55 +01:00
|
|
|
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
|
|
|
{
|
2020-10-14 23:22:01 +02:00
|
|
|
WCHAR device_id[3], root[] = L"A:\\";
|
2012-06-29 13:41:07 +02:00
|
|
|
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
|
|
|
|
2015-12-21 13:00:32 +01:00
|
|
|
for (i = 0; i < 26; i++)
|
2012-06-29 13:41:07 +02:00
|
|
|
{
|
|
|
|
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);
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( device_id, ARRAY_SIZE( device_id ), L"%c:", 'A' + i );
|
2021-02-09 10:12:54 +01:00
|
|
|
rec->caption = heap_strdupW( device_id );
|
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;
|
2015-01-05 13:19:28 +01:00
|
|
|
rec->volumename = get_volumename( root );
|
2014-03-17 09:36:55 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-09-10 17:09:11 +02:00
|
|
|
static struct association *get_logicaldisktopartition_pairs( UINT *count )
|
|
|
|
{
|
|
|
|
struct association *ret = NULL;
|
|
|
|
struct query *query, *query2 = NULL;
|
|
|
|
VARIANT val;
|
|
|
|
HRESULT hr;
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
if (!(query = create_query())) return NULL;
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = parse_query( L"SELECT * FROM Win32_DiskPartition", &query->view, &query->mem )) != S_OK) goto done;
|
2019-09-10 17:09:11 +02:00
|
|
|
if ((hr = execute_view( query->view )) != S_OK) goto done;
|
|
|
|
|
|
|
|
if (!(query2 = create_query())) return FALSE;
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = parse_query( L"SELECT * FROM Win32_LogicalDisk WHERE DriveType=2 OR DriveType=3", &query2->view,
|
|
|
|
&query2->mem )) != S_OK) goto done;
|
2019-09-10 17:09:11 +02:00
|
|
|
if ((hr = execute_view( query2->view )) != S_OK) goto done;
|
|
|
|
|
2019-09-10 17:09:14 +02:00
|
|
|
if (!(ret = heap_alloc_zero( query->view->result_count * sizeof(*ret) ))) goto done;
|
2019-09-10 17:09:11 +02:00
|
|
|
|
|
|
|
/* assume fixed and removable disks are enumerated in the same order as partitions */
|
2019-09-10 17:09:14 +02:00
|
|
|
for (i = 0; i < query->view->result_count; i++)
|
2019-09-10 17:09:11 +02:00
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = get_propval( query->view, i, L"__PATH", &val, NULL, NULL )) != S_OK) goto done;
|
2019-09-10 17:09:11 +02:00
|
|
|
if (!(ret[i].ref = heap_strdupW( V_BSTR(&val) ))) goto done;
|
|
|
|
VariantClear( &val );
|
|
|
|
|
2020-04-20 10:38:10 +02:00
|
|
|
if ((hr = get_propval( query2->view, i, L"__PATH", &val, NULL, NULL )) != S_OK) goto done;
|
2019-09-10 17:09:11 +02:00
|
|
|
if (!(ret[i].ref2 = heap_strdupW( V_BSTR(&val) ))) goto done;
|
|
|
|
VariantClear( &val );
|
|
|
|
}
|
|
|
|
|
2019-09-10 17:09:14 +02:00
|
|
|
*count = query->view->result_count;
|
2019-09-10 17:09:11 +02:00
|
|
|
|
|
|
|
done:
|
2019-11-28 13:21:09 +01:00
|
|
|
if (!ret) free_associations( ret, query->view->result_count );
|
2019-09-10 17:09:11 +02:00
|
|
|
free_query( query );
|
|
|
|
free_query( query2 );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_logicaldisktopartition( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_logicaldisktopartition *rec;
|
|
|
|
UINT i, row = 0, offset = 0, count = 0;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
struct association *assoc;
|
|
|
|
|
|
|
|
if (!(assoc = get_logicaldisktopartition_pairs( &count ))) return FILL_STATUS_FAILED;
|
|
|
|
if (!count)
|
|
|
|
{
|
2019-11-28 13:21:09 +01:00
|
|
|
free_associations( assoc, count );
|
2019-09-10 17:09:11 +02:00
|
|
|
return FILL_STATUS_UNFILTERED;
|
|
|
|
}
|
|
|
|
if (!resize_table( table, count, sizeof(*rec) ))
|
|
|
|
{
|
2019-11-28 13:21:09 +01:00
|
|
|
free_associations( assoc, count );
|
2019-09-10 17:09:11 +02:00
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
rec = (struct record_logicaldisktopartition *)(table->data + offset);
|
|
|
|
rec->antecedent = assoc[i].ref;
|
|
|
|
rec->dependent = assoc[i].ref2;
|
|
|
|
if (!match_row( table, row, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, row );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
offset += sizeof(*rec);
|
|
|
|
row++;
|
|
|
|
}
|
|
|
|
|
|
|
|
heap_free( assoc );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
WCHAR *ret;
|
|
|
|
if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( ret, 18, L"%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
|
2012-07-13 11:34:17 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2019-01-24 14:49:46 +01:00
|
|
|
static const WCHAR *get_adaptertype( DWORD type, int *id, int *physical )
|
2012-10-10 12:01:22 +02:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
2019-01-24 14:49:46 +01:00
|
|
|
case IF_TYPE_ETHERNET_CSMACD:
|
|
|
|
*id = 0;
|
|
|
|
*physical = -1;
|
2020-04-20 10:38:10 +02:00
|
|
|
return L"Ethernet 802.3";
|
|
|
|
|
2019-01-24 14:49:46 +01:00
|
|
|
case IF_TYPE_IEEE80211:
|
|
|
|
*id = 9;
|
|
|
|
*physical = -1;
|
2020-04-20 10:38:10 +02:00
|
|
|
return L"Wireless";
|
|
|
|
|
2019-01-24 14:49:46 +01:00
|
|
|
case IF_TYPE_IEEE1394:
|
|
|
|
*id = 13;
|
|
|
|
*physical = -1;
|
2020-04-20 10:38:10 +02:00
|
|
|
return L"1394";
|
|
|
|
|
2019-01-24 14:49:46 +01:00
|
|
|
case IF_TYPE_TUNNEL:
|
|
|
|
*id = 15;
|
|
|
|
*physical = 0;
|
2020-04-20 10:38:10 +02:00
|
|
|
return L"Tunnel";
|
|
|
|
|
2019-01-24 14:49:46 +01:00
|
|
|
default:
|
|
|
|
*id = -1;
|
|
|
|
*physical = 0;
|
|
|
|
return NULL;
|
2012-10-10 12:01:22 +02:00
|
|
|
}
|
|
|
|
}
|
2012-06-25 11:20:09 +02:00
|
|
|
|
2021-01-21 12:36:39 +01:00
|
|
|
#define GUID_SIZE 39
|
|
|
|
static WCHAR *guid_to_str( const GUID *ptr )
|
|
|
|
{
|
|
|
|
WCHAR *ret;
|
|
|
|
if (!(ret = heap_alloc( GUID_SIZE * sizeof(WCHAR) ))) return NULL;
|
|
|
|
swprintf( ret, GUID_SIZE, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
|
|
|
|
ptr->Data1, ptr->Data2, ptr->Data3, ptr->Data4[0], ptr->Data4[1], ptr->Data4[2],
|
|
|
|
ptr->Data4[3], ptr->Data4[4], ptr->Data4[5], ptr->Data4[6], ptr->Data4[7] );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_networkadapter_guid( const IF_LUID *luid )
|
|
|
|
{
|
|
|
|
GUID guid;
|
|
|
|
if (ConvertInterfaceLuidToGuid( luid, &guid )) return NULL;
|
|
|
|
return guid_to_str( &guid );
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
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;
|
2019-01-24 14:49:46 +01:00
|
|
|
int adaptertypeid, physical;
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2012-06-25 11:20:09 +02:00
|
|
|
|
2019-07-04 09:27:39 +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;
|
2019-07-04 09:27:39 +02:00
|
|
|
if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
|
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
|
|
|
}
|
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);
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( device_id, ARRAY_SIZE( device_id ), L"%u", aa->u.s.IfIndex );
|
2019-01-24 14:49:46 +01:00
|
|
|
rec->adaptertype = get_adaptertype( aa->IfType, &adaptertypeid, &physical );
|
|
|
|
rec->adaptertypeid = adaptertypeid;
|
2019-01-24 14:49:54 +01:00
|
|
|
rec->description = heap_strdupW( aa->Description );
|
2012-06-25 11:20:09 +02:00
|
|
|
rec->device_id = heap_strdupW( device_id );
|
2021-01-21 12:36:39 +01:00
|
|
|
rec->guid = get_networkadapter_guid( &aa->Luid );
|
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 );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->manufacturer = L"The Wine Project";
|
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;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->pnpdevice_id = L"PCI\\VEN_8086&DEV_100E&SUBSYS_001E8086&REV_02\\3&267A616A&1&18";
|
2021-01-21 12:36:42 +01:00
|
|
|
rec->servicename = heap_strdupW( aa->FriendlyName );
|
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
|
|
|
}
|
|
|
|
|
2015-01-07 15:26:50 +01:00
|
|
|
static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr )
|
|
|
|
{
|
|
|
|
const SOCKET_ADDRESS *sa = &addr->Address;
|
2019-07-04 09:27:39 +02:00
|
|
|
WCHAR buf[NI_MAXHOST];
|
2015-01-07 15:26:50 +01:00
|
|
|
|
|
|
|
if (!addr) return NULL;
|
2018-09-11 22:08:07 +02:00
|
|
|
if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, ARRAY_SIZE( buf ), NULL,
|
2019-07-04 09:27:39 +02:00
|
|
|
0, NI_NAMEREQD )) return NULL;
|
2015-01-07 15:26:50 +01:00
|
|
|
return heap_strdupW( buf );
|
|
|
|
}
|
2015-12-23 11:07:38 +01:00
|
|
|
static struct array *get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS *list )
|
|
|
|
{
|
|
|
|
IP_ADAPTER_GATEWAY_ADDRESS *gateway;
|
|
|
|
struct array *ret;
|
|
|
|
ULONG buflen, i = 0, count = 0;
|
|
|
|
WCHAR **ptr, buf[54]; /* max IPv6 address length */
|
|
|
|
|
|
|
|
if (!list) return NULL;
|
|
|
|
for (gateway = list; gateway; gateway = gateway->Next) count++;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
|
|
|
|
if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (gateway = list; gateway; gateway = gateway->Next)
|
|
|
|
{
|
2018-09-11 22:08:07 +02:00
|
|
|
buflen = ARRAY_SIZE( buf );
|
2015-12-23 11:07:38 +01:00
|
|
|
if (WSAAddressToStringW( gateway->Address.lpSockaddr, gateway->Address.iSockaddrLength,
|
|
|
|
NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf )))
|
|
|
|
{
|
|
|
|
for (; i > 0; i--) heap_free( ptr[i - 1] );
|
|
|
|
heap_free( ptr );
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2019-08-27 16:35:55 +02:00
|
|
|
ret->elem_size = sizeof(*ptr);
|
|
|
|
ret->count = count;
|
|
|
|
ret->ptr = ptr;
|
2015-12-23 11:07:38 +01:00
|
|
|
return ret;
|
|
|
|
}
|
2015-12-23 11:07:41 +01:00
|
|
|
static struct array *get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS *list )
|
|
|
|
{
|
|
|
|
IP_ADAPTER_DNS_SERVER_ADDRESS *server;
|
|
|
|
struct array *ret;
|
|
|
|
ULONG buflen, i = 0, count = 0;
|
|
|
|
WCHAR **ptr, *p, buf[54]; /* max IPv6 address length */
|
|
|
|
|
|
|
|
if (!list) return NULL;
|
|
|
|
for (server = list; server; server = server->Next) count++;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
|
|
|
|
if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (server = list; server; server = server->Next)
|
|
|
|
{
|
2018-09-11 22:08:07 +02:00
|
|
|
buflen = ARRAY_SIZE( buf );
|
2015-12-23 11:07:41 +01:00
|
|
|
if (WSAAddressToStringW( server->Address.lpSockaddr, server->Address.iSockaddrLength,
|
|
|
|
NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf )))
|
|
|
|
{
|
|
|
|
for (; i > 0; i--) heap_free( ptr[i - 1] );
|
|
|
|
heap_free( ptr );
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-07-04 09:27:39 +02:00
|
|
|
if ((p = wcsrchr( ptr[i - 1], ':' ))) *p = 0;
|
2015-12-23 11:07:41 +01:00
|
|
|
}
|
2019-08-27 16:35:55 +02:00
|
|
|
ret->elem_size = sizeof(*ptr);
|
|
|
|
ret->count = count;
|
|
|
|
ret->ptr = ptr;
|
2015-12-23 11:07:41 +01:00
|
|
|
return ret;
|
|
|
|
}
|
2018-08-01 17:23:23 +02:00
|
|
|
static struct array *get_ipaddress( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
|
|
|
|
{
|
|
|
|
IP_ADAPTER_UNICAST_ADDRESS_LH *address;
|
|
|
|
struct array *ret;
|
|
|
|
ULONG buflen, i = 0, count = 0;
|
|
|
|
WCHAR **ptr, buf[54]; /* max IPv6 address length */
|
|
|
|
|
|
|
|
if (!list) return NULL;
|
|
|
|
for (address = list; address; address = address->Next) count++;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
|
|
|
|
if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (address = list; address; address = address->Next)
|
|
|
|
{
|
2018-09-11 22:08:07 +02:00
|
|
|
buflen = ARRAY_SIZE( buf );
|
2018-08-01 17:23:23 +02:00
|
|
|
if (WSAAddressToStringW( address->Address.lpSockaddr, address->Address.iSockaddrLength,
|
|
|
|
NULL, buf, &buflen) || !(ptr[i++] = heap_strdupW( buf )))
|
|
|
|
{
|
|
|
|
for (; i > 0; i--) heap_free( ptr[i - 1] );
|
|
|
|
heap_free( ptr );
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2019-08-27 16:35:55 +02:00
|
|
|
ret->elem_size = sizeof(*ptr);
|
|
|
|
ret->count = count;
|
|
|
|
ret->ptr = ptr;
|
2018-08-01 17:23:23 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2018-08-01 17:23:29 +02:00
|
|
|
static struct array *get_ipsubnet( IP_ADAPTER_UNICAST_ADDRESS_LH *list )
|
|
|
|
{
|
|
|
|
IP_ADAPTER_UNICAST_ADDRESS_LH *address;
|
|
|
|
struct array *ret;
|
|
|
|
ULONG i = 0, count = 0;
|
|
|
|
WCHAR **ptr;
|
|
|
|
|
|
|
|
if (!list) return NULL;
|
|
|
|
for (address = list; address; address = address->Next) count++;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
|
|
|
|
if (!(ptr = heap_alloc( sizeof(*ptr) * count )))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (address = list; address; address = address->Next)
|
|
|
|
{
|
2019-07-04 09:27:39 +02:00
|
|
|
if (address->Address.lpSockaddr->sa_family == AF_INET)
|
2018-08-01 17:23:29 +02:00
|
|
|
{
|
|
|
|
WCHAR buf[INET_ADDRSTRLEN];
|
|
|
|
SOCKADDR_IN addr;
|
2018-09-11 22:08:07 +02:00
|
|
|
ULONG buflen = ARRAY_SIZE( buf );
|
2018-08-01 17:23:29 +02:00
|
|
|
|
|
|
|
memset( &addr, 0, sizeof(addr) );
|
2019-07-04 09:27:39 +02:00
|
|
|
addr.sin_family = AF_INET;
|
2018-08-01 17:23:29 +02:00
|
|
|
if (ConvertLengthToIpv4Mask( address->OnLinkPrefixLength, &addr.sin_addr.S_un.S_addr ) != NO_ERROR
|
|
|
|
|| WSAAddressToStringW( (SOCKADDR*)&addr, sizeof(addr), NULL, buf, &buflen))
|
|
|
|
ptr[i] = NULL;
|
|
|
|
else
|
|
|
|
ptr[i] = heap_strdupW( buf );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WCHAR buf[11];
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( buf, ARRAY_SIZE( buf ), L"%u", address->OnLinkPrefixLength );
|
2018-08-01 17:23:29 +02:00
|
|
|
ptr[i] = heap_strdupW( buf );
|
|
|
|
}
|
|
|
|
if (!ptr[i++])
|
|
|
|
{
|
|
|
|
for (; i > 0; i--) heap_free( ptr[i - 1] );
|
|
|
|
heap_free( ptr );
|
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2019-08-27 16:35:55 +02:00
|
|
|
ret->elem_size = sizeof(*ptr);
|
|
|
|
ret->count = count;
|
|
|
|
ret->ptr = ptr;
|
2018-08-01 17:23:29 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2015-12-23 11:07:42 +01:00
|
|
|
static WCHAR *get_settingid( UINT32 index )
|
|
|
|
{
|
|
|
|
GUID guid;
|
|
|
|
memset( &guid, 0, sizeof(guid) );
|
|
|
|
guid.Data1 = index;
|
2021-01-21 12:36:39 +01:00
|
|
|
return guid_to_str( &guid );
|
2015-12-23 11:07:42 +01:00
|
|
|
}
|
2015-01-07 15:26:50 +01: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;
|
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
ret = GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, NULL, &size );
|
2013-11-04 11:54:51 +01:00
|
|
|
if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
|
2019-07-04 09:27:39 +02:00
|
|
|
if (GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_INCLUDE_ALL_GATEWAYS, NULL, buffer, &size ))
|
2013-11-04 11:54:51 +01:00
|
|
|
{
|
|
|
|
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);
|
2015-12-23 11:07:41 +01:00
|
|
|
rec->defaultipgateway = get_defaultipgateway( aa->FirstGatewayAddress );
|
|
|
|
rec->description = heap_strdupW( aa->Description );
|
|
|
|
rec->dhcpenabled = -1;
|
|
|
|
rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
|
|
|
|
rec->dnsserversearchorder = get_dnsserversearchorder( aa->FirstDnsServerAddress );
|
|
|
|
rec->index = aa->u.s.IfIndex;
|
2018-08-01 17:23:23 +02:00
|
|
|
rec->ipaddress = get_ipaddress( aa->FirstUnicastAddress );
|
2015-12-23 11:07:41 +01:00
|
|
|
rec->ipconnectionmetric = 20;
|
|
|
|
rec->ipenabled = -1;
|
2018-08-01 17:23:29 +02:00
|
|
|
rec->ipsubnet = get_ipsubnet( aa->FirstUnicastAddress );
|
2015-12-23 11:07:41 +01:00
|
|
|
rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
|
2015-12-23 11:07:42 +01:00
|
|
|
rec->settingid = get_settingid( rec->index );
|
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;
|
|
|
|
}
|
|
|
|
|
2014-04-03 12:34:18 +02:00
|
|
|
static enum fill_status fill_physicalmemory( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_physicalmemory *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0;
|
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
rec = (struct record_physicalmemory *)table->data;
|
2020-07-07 09:54:22 +02:00
|
|
|
rec->banklabel = L"BANK 0";
|
2019-09-17 13:41:44 +02:00
|
|
|
rec->capacity = get_total_physical_memory();
|
2020-07-07 09:54:22 +02:00
|
|
|
rec->caption = L"Physical Memory";
|
|
|
|
rec->configuredclockspeed = 1600;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->devicelocator = L"DIMM 0";
|
2020-02-25 11:39:51 +01:00
|
|
|
rec->formfactor = 8; /* DIMM */
|
2019-09-17 13:41:44 +02:00
|
|
|
rec->memorytype = 9; /* RAM */
|
2020-08-12 15:35:16 +02:00
|
|
|
rec->partnumber = L"";
|
|
|
|
rec->serial = L"";
|
2014-04-03 12:34:18 +02:00
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2018-08-06 18:11:15 +02:00
|
|
|
static enum fill_status fill_pnpentity( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_pnpentity *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
HDEVINFO device_info_set;
|
|
|
|
SP_DEVINFO_DATA devinfo = {0};
|
|
|
|
DWORD idx;
|
|
|
|
|
|
|
|
device_info_set = SetupDiGetClassDevsW( NULL, NULL, NULL, DIGCF_ALLCLASSES|DIGCF_PRESENT );
|
|
|
|
|
|
|
|
devinfo.cbSize = sizeof(devinfo);
|
|
|
|
|
|
|
|
idx = 0;
|
|
|
|
while (SetupDiEnumDeviceInfo( device_info_set, idx++, &devinfo ))
|
|
|
|
{
|
|
|
|
/* noop */
|
|
|
|
}
|
|
|
|
|
|
|
|
resize_table( table, idx, sizeof(*rec) );
|
|
|
|
table->num_rows = 0;
|
|
|
|
rec = (struct record_pnpentity *)table->data;
|
|
|
|
|
|
|
|
idx = 0;
|
|
|
|
while (SetupDiEnumDeviceInfo( device_info_set, idx++, &devinfo ))
|
|
|
|
{
|
|
|
|
WCHAR device_id[MAX_PATH];
|
|
|
|
if (SetupDiGetDeviceInstanceIdW( device_info_set, &devinfo, device_id,
|
|
|
|
ARRAY_SIZE(device_id), NULL ))
|
|
|
|
{
|
|
|
|
rec->device_id = heap_strdupW( device_id );
|
|
|
|
|
|
|
|
table->num_rows++;
|
|
|
|
if (!match_row( table, table->num_rows - 1, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, table->num_rows - 1 );
|
|
|
|
table->num_rows--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rec++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SetupDiDestroyDeviceInfoList( device_info_set );
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2015-04-02 16:20:27 +02:00
|
|
|
static enum fill_status fill_printer( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_printer *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
PRINTER_INFO_2W *info;
|
2017-01-27 09:16:55 +01:00
|
|
|
DWORD i, offset = 0, count = 0, size = 0, num_rows = 0;
|
2018-03-02 11:54:59 +01:00
|
|
|
WCHAR id[20];
|
2015-04-02 16:20:27 +02:00
|
|
|
|
|
|
|
EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count );
|
2019-08-28 14:14:26 +02:00
|
|
|
if (!count) return FILL_STATUS_UNFILTERED;
|
2015-04-02 16:20:27 +02:00
|
|
|
|
|
|
|
if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
|
|
|
|
if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count ))
|
|
|
|
{
|
|
|
|
heap_free( info );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
if (!resize_table( table, count, sizeof(*rec) ))
|
|
|
|
{
|
|
|
|
heap_free( info );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
rec = (struct record_printer *)(table->data + offset);
|
|
|
|
rec->attributes = info[i].Attributes;
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( id, ARRAY_SIZE( id ), L"Printer%u", i );
|
2018-03-02 11:54:59 +01:00
|
|
|
rec->device_id = heap_strdupW( id );
|
2015-04-02 16:20:27 +02:00
|
|
|
rec->drivername = heap_strdupW( info[i].pDriverName );
|
|
|
|
rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality;
|
|
|
|
rec->local = -1;
|
2018-03-02 11:54:59 +01:00
|
|
|
rec->location = heap_strdupW( info[i].pLocation );
|
2015-04-02 16:20:27 +02:00
|
|
|
rec->name = heap_strdupW( info[i].pPrinterName );
|
|
|
|
rec->network = 0;
|
2018-03-02 11:54:59 +01:00
|
|
|
rec->portname = heap_strdupW( info[i].pPortName );
|
2015-04-02 16:20:27 +02:00
|
|
|
if (!match_row( table, i, cond, &status ))
|
|
|
|
{
|
|
|
|
free_row_values( table, i );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
offset += sizeof(*rec);
|
2017-01-27 09:16:55 +01:00
|
|
|
num_rows++;
|
2015-04-02 16:20:27 +02:00
|
|
|
}
|
2017-01-27 09:16:55 +01:00
|
|
|
TRACE("created %u rows\n", num_rows);
|
|
|
|
table->num_rows = num_rows;
|
2015-04-02 16:20:27 +02:00
|
|
|
|
|
|
|
heap_free( info );
|
|
|
|
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
|
|
|
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
|
|
|
|
{
|
2019-08-28 14:14:26 +02:00
|
|
|
if (!resize_table( table, row + 1, sizeof(*rec) ))
|
|
|
|
{
|
|
|
|
status = FILL_STATUS_FAILED;
|
|
|
|
goto done;
|
|
|
|
}
|
2013-06-04 13:28:21 +02:00
|
|
|
|
2012-06-18 09:32:02 +02:00
|
|
|
rec = (struct record_process *)(table->data + offset);
|
2015-06-22 12:14:21 +02:00
|
|
|
rec->caption = heap_strdupW( entry.szExeFile );
|
|
|
|
rec->commandline = get_cmdline( entry.th32ProcessID );
|
|
|
|
rec->description = heap_strdupW( entry.szExeFile );
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( handle, ARRAY_SIZE( handle ), L"%u", entry.th32ProcessID );
|
2015-06-22 12:14:21 +02:00
|
|
|
rec->handle = heap_strdupW( handle );
|
|
|
|
rec->name = heap_strdupW( entry.szExeFile );
|
|
|
|
rec->process_id = entry.th32ProcessID;
|
|
|
|
rec->pprocess_id = entry.th32ParentProcessID;
|
|
|
|
rec->thread_count = entry.cntThreads;
|
|
|
|
rec->workingsetsize = 0;
|
|
|
|
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;
|
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
|
|
|
}
|
|
|
|
|
2020-05-05 02:52:56 +02:00
|
|
|
void do_cpuid( unsigned int ax, int *p )
|
2012-06-29 13:39:19 +02:00
|
|
|
{
|
2020-05-05 02:52:56 +02:00
|
|
|
#if defined(__i386__) || defined(__x86_64__)
|
2019-01-25 10:44:10 +01:00
|
|
|
__cpuid( p, ax );
|
2015-02-22 21:20:25 +01:00
|
|
|
#else
|
2019-01-25 10:44:10 +01:00
|
|
|
FIXME("\n");
|
|
|
|
#endif
|
2020-05-05 02:52:56 +02:00
|
|
|
}
|
2019-01-25 10:44:10 +01:00
|
|
|
|
2019-01-25 10:44:12 +01:00
|
|
|
static unsigned int get_processor_model( unsigned int reg0, unsigned int *stepping, unsigned int *family )
|
|
|
|
{
|
|
|
|
unsigned int model, family_id = (reg0 & (0x0f << 8)) >> 8;
|
|
|
|
|
|
|
|
model = (reg0 & (0x0f << 4)) >> 4;
|
|
|
|
if (family_id == 6 || family_id == 15) model |= (reg0 & (0x0f << 16)) >> 12;
|
|
|
|
if (family)
|
|
|
|
{
|
|
|
|
*family = family_id;
|
|
|
|
if (family_id == 15) *family += (reg0 & (0xff << 20)) >> 20;
|
|
|
|
}
|
|
|
|
*stepping = reg0 & 0x0f;
|
|
|
|
return model;
|
|
|
|
}
|
2020-05-05 02:52:56 +02:00
|
|
|
static void regs_to_str( int *regs, unsigned int len, WCHAR *buffer )
|
2019-01-25 10:44:13 +01:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
unsigned char *p = (unsigned char *)regs;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) { buffer[i] = *p++; }
|
|
|
|
buffer[i] = 0;
|
|
|
|
}
|
2019-07-04 09:27:39 +02:00
|
|
|
static void get_processor_manufacturer( WCHAR *manufacturer, UINT len )
|
2019-01-25 10:44:13 +01:00
|
|
|
{
|
2020-05-05 02:52:56 +02:00
|
|
|
int tmp, regs[4] = {0, 0, 0, 0};
|
2019-01-25 10:44:13 +01:00
|
|
|
|
|
|
|
do_cpuid( 0, regs );
|
|
|
|
tmp = regs[2]; /* swap edx and ecx */
|
|
|
|
regs[2] = regs[3];
|
|
|
|
regs[3] = tmp;
|
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
regs_to_str( regs + 1, min( 12, len ), manufacturer );
|
2019-01-25 10:44:13 +01:00
|
|
|
}
|
|
|
|
static const WCHAR *get_osarchitecture(void)
|
|
|
|
{
|
|
|
|
SYSTEM_INFO info;
|
|
|
|
GetNativeSystemInfo( &info );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return L"64-bit";
|
|
|
|
return L"32-bit";
|
2019-01-25 10:44:13 +01:00
|
|
|
}
|
2019-07-04 09:27:39 +02:00
|
|
|
static void get_processor_caption( WCHAR *caption, UINT len )
|
2015-04-02 16:19:32 +02:00
|
|
|
{
|
2019-01-25 10:44:13 +01:00
|
|
|
const WCHAR *arch;
|
|
|
|
WCHAR manufacturer[13];
|
2020-05-05 02:52:56 +02:00
|
|
|
int regs[4] = {0, 0, 0, 0};
|
|
|
|
unsigned int family, model, stepping;
|
2012-06-29 13:39:19 +02:00
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
get_processor_manufacturer( manufacturer, ARRAY_SIZE( manufacturer ) );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!wcscmp( get_osarchitecture(), L"32-bit" )) arch = L"x86";
|
|
|
|
else if (!wcscmp( manufacturer, L"AuthenticAMD" )) arch = L"AMD64";
|
|
|
|
else arch = L"Intel64";
|
2019-01-25 10:44:13 +01:00
|
|
|
|
2015-04-02 16:19:32 +02:00
|
|
|
do_cpuid( 1, regs );
|
2019-01-25 10:44:12 +01:00
|
|
|
|
|
|
|
model = get_processor_model( regs[0], &stepping, &family );
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( caption, len, L"%s Family %u Model %u Stepping %u", arch, family, model, stepping );
|
2015-04-02 16:19:32 +02:00
|
|
|
}
|
2019-07-04 09:27:39 +02:00
|
|
|
static void get_processor_version( WCHAR *version, UINT len )
|
2015-04-02 16:19:32 +02:00
|
|
|
{
|
2020-05-05 02:52:56 +02:00
|
|
|
int regs[4] = {0, 0, 0, 0};
|
|
|
|
unsigned int model, stepping;
|
2015-04-02 16:19:32 +02:00
|
|
|
|
|
|
|
do_cpuid( 1, regs );
|
2019-01-25 10:44:12 +01:00
|
|
|
|
|
|
|
model = get_processor_model( regs[0], &stepping, NULL );
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( version, len, L"Model %u Stepping %u", model, stepping );
|
2015-04-02 16:19:32 +02:00
|
|
|
}
|
2018-02-05 16:08:17 +01:00
|
|
|
static UINT16 get_processor_revision(void)
|
|
|
|
{
|
2020-05-05 02:52:56 +02:00
|
|
|
int regs[4] = {0, 0, 0, 0};
|
2018-02-05 16:08:17 +01:00
|
|
|
do_cpuid( 1, regs );
|
|
|
|
return regs[0];
|
|
|
|
}
|
2019-07-04 09:27:39 +02:00
|
|
|
static void get_processor_id( WCHAR *processor_id, UINT len )
|
2012-07-04 10:32:55 +02:00
|
|
|
{
|
2020-05-05 02:52:56 +02:00
|
|
|
int regs[4] = {0, 0, 0, 0};
|
2012-07-04 10:32:55 +02:00
|
|
|
|
|
|
|
do_cpuid( 1, regs );
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( processor_id, len, L"%08X%08X", regs[3], regs[0] );
|
2012-07-04 10:32:55 +02:00
|
|
|
}
|
|
|
|
static void get_processor_name( WCHAR *name )
|
|
|
|
{
|
2020-05-05 02:52:56 +02:00
|
|
|
int regs[4] = {0, 0, 0, 0};
|
2019-01-25 10:44:11 +01:00
|
|
|
int i;
|
2012-07-04 10:32:55 +02:00
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
2019-07-04 09:27:39 +02:00
|
|
|
for (i = lstrlenW(name) - 1; i >= 0 && name[i] == ' '; i--) name[i] = 0;
|
2012-07-04 10:32:55 +02:00
|
|
|
}
|
2014-04-30 10:20:05 +02:00
|
|
|
static UINT get_processor_currentclockspeed( UINT index )
|
2012-09-06 14:03:38 +02:00
|
|
|
{
|
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 );
|
2014-04-30 10:20:05 +02:00
|
|
|
if (!status) ret = info[index].CurrentMhz;
|
|
|
|
heap_free( info );
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
static UINT get_processor_maxclockspeed( UINT index )
|
|
|
|
{
|
|
|
|
PROCESSOR_POWER_INFORMATION *info;
|
|
|
|
UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
|
|
|
|
NTSTATUS status;
|
|
|
|
|
|
|
|
if ((info = heap_alloc( size )))
|
|
|
|
{
|
|
|
|
status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
|
|
|
|
if (!status) ret = info[index].MaxMhz;
|
2012-09-17 12:18:46 +02:00
|
|
|
heap_free( info );
|
|
|
|
}
|
|
|
|
return ret;
|
2012-09-06 14:03:38 +02:00
|
|
|
}
|
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
|
|
|
{
|
2015-04-02 16:19:32 +02:00
|
|
|
WCHAR caption[100], device_id[14], processor_id[17], manufacturer[13], name[49] = {0}, version[50];
|
2012-06-26 16:03:32 +02:00
|
|
|
struct record_processor *rec;
|
2019-01-25 10:44:14 +01:00
|
|
|
UINT i, offset = 0, num_rows = 0, num_logical, num_physical, num_packages;
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2012-06-26 16:03:32 +02:00
|
|
|
|
2019-01-25 10:44:14 +01:00
|
|
|
num_logical = get_logical_processor_count( &num_physical, &num_packages );
|
|
|
|
|
|
|
|
if (!resize_table( table, num_packages, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
2012-06-26 16:03:32 +02:00
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
get_processor_caption( caption, ARRAY_SIZE( caption ) );
|
|
|
|
get_processor_id( processor_id, ARRAY_SIZE( processor_id ) );
|
|
|
|
get_processor_manufacturer( manufacturer, ARRAY_SIZE( manufacturer ) );
|
2012-07-04 10:32:55 +02:00
|
|
|
get_processor_name( name );
|
2019-07-04 09:27:39 +02:00
|
|
|
get_processor_version( version, ARRAY_SIZE( version ) );
|
2012-07-04 10:32:55 +02:00
|
|
|
|
2019-01-25 10:44:14 +01:00
|
|
|
for (i = 0; i < num_packages; i++)
|
2012-06-26 16:03:32 +02:00
|
|
|
{
|
|
|
|
rec = (struct record_processor *)(table->data + offset);
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->addresswidth = !wcscmp( get_osarchitecture(), L"32-bit" ) ? 32 : 64;
|
|
|
|
rec->architecture = !wcscmp( get_osarchitecture(), L"32-bit" ) ? 0 : 9;
|
2015-04-02 16:19:32 +02:00
|
|
|
rec->caption = heap_strdupW( caption );
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->cpu_status = 1; /* CPU Enabled */
|
2014-04-30 10:20:05 +02:00
|
|
|
rec->currentclockspeed = get_processor_currentclockspeed( i );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->datawidth = !wcscmp( get_osarchitecture(), L"32-bit" ) ? 32 : 64;
|
2015-04-02 16:19:32 +02:00
|
|
|
rec->description = heap_strdupW( caption );
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( device_id, ARRAY_SIZE( device_id ), L"CPU%u", 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 */
|
2018-02-05 16:08:17 +01:00
|
|
|
rec->level = 15;
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->manufacturer = heap_strdupW( manufacturer );
|
2014-04-30 10:20:05 +02:00
|
|
|
rec->maxclockspeed = get_processor_maxclockspeed( i );
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->name = heap_strdupW( name );
|
2019-01-25 10:44:14 +01:00
|
|
|
rec->num_cores = num_physical / num_packages;
|
|
|
|
rec->num_logical_processors = num_logical / num_packages;
|
2012-09-06 14:03:24 +02:00
|
|
|
rec->processor_id = heap_strdupW( processor_id );
|
2015-01-22 05:07:48 +01:00
|
|
|
rec->processortype = 3; /* central processor */
|
2018-02-05 16:08:17 +01:00
|
|
|
rec->revision = get_processor_revision();
|
2012-10-04 15:37:57 +02:00
|
|
|
rec->unique_id = NULL;
|
2015-04-02 16:19:32 +02:00
|
|
|
rec->version = heap_strdupW( version );
|
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);
|
2017-01-27 09:16:55 +01:00
|
|
|
num_rows++;
|
2012-06-26 16:03:32 +02:00
|
|
|
}
|
2012-06-27 11:33:31 +02:00
|
|
|
|
2017-01-27 09:16:55 +01:00
|
|
|
TRACE("created %u rows\n", num_rows);
|
|
|
|
table->num_rows = num_rows;
|
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)
|
|
|
|
{
|
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 );
|
2020-06-25 12:30:00 +02:00
|
|
|
RtlTimeToTimeFields( &ti.BootTime, &tf );
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( ret, 26, L"%04u%02u%02u%02u%02u%02u.%06u+000", 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)
|
|
|
|
{
|
|
|
|
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);
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( ret, 26, L"%04u%02u%02u%02u%02u%02u.%06u%+03d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute,
|
|
|
|
st.wSecond, st.wMilliseconds * 1000, -Bias );
|
2013-09-08 16:47:16 +02:00
|
|
|
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;
|
|
|
|
}
|
2019-04-24 12:58:11 +02:00
|
|
|
static WCHAR *get_systemdrive(void)
|
|
|
|
{
|
|
|
|
WCHAR *ret = heap_alloc( 3 * sizeof(WCHAR) ); /* "c:" */
|
2020-04-20 10:38:10 +02:00
|
|
|
if (ret && GetEnvironmentVariableW( L"SystemDrive", ret, 3 )) return ret;
|
2019-04-24 12:58:11 +02:00
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
|
|
|
}
|
2013-06-14 10:04:11 +02:00
|
|
|
static WCHAR *get_codeset(void)
|
|
|
|
{
|
|
|
|
WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (ret) swprintf( ret, 11, L"%u", GetACP() );
|
2013-06-14 10:04:11 +02:00
|
|
|
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;
|
|
|
|
}
|
2016-10-05 09:46:28 +02:00
|
|
|
static WCHAR *get_osbuildnumber( OSVERSIONINFOEXW *ver )
|
|
|
|
{
|
|
|
|
WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (ret) swprintf( ret, 11, L"%u", ver->dwBuildNumber );
|
2016-10-05 09:46:28 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
static WCHAR *get_oscaption( OSVERSIONINFOEXW *ver )
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
static const WCHAR windowsW[] = L"Microsoft Windows ";
|
|
|
|
static const WCHAR win2000W[] = L"2000 Professional";
|
|
|
|
static const WCHAR win2003W[] = L"Server 2003 Standard Edition";
|
|
|
|
static const WCHAR winxpW[] = L"XP Professional";
|
|
|
|
static const WCHAR winxp64W[] = L"XP Professional x64 Edition";
|
|
|
|
static const WCHAR vistaW[] = L"Vista Ultimate";
|
|
|
|
static const WCHAR win2008W[] = L"Server 2008 Standard";
|
|
|
|
static const WCHAR win7W[] = L"7 Professional";
|
|
|
|
static const WCHAR win2008r2W[] = L"Server 2008 R2 Standard";
|
|
|
|
static const WCHAR win8W[] = L"8 Pro";
|
|
|
|
static const WCHAR win81W[] = L"8.1 Pro";
|
|
|
|
static const WCHAR win10W[] = L"10 Pro";
|
|
|
|
int len = ARRAY_SIZE( windowsW ) - 1;
|
2016-10-05 09:46:28 +02:00
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(win2003W) ))) return NULL;
|
|
|
|
memcpy( ret, windowsW, sizeof(windowsW) );
|
|
|
|
if (ver->dwMajorVersion == 10 && ver->dwMinorVersion == 0) memcpy( ret + len, win10W, sizeof(win10W) );
|
2021-02-03 10:32:32 +01:00
|
|
|
else if (ver->dwMajorVersion == 6 && ver->dwMinorVersion == 3) memcpy( ret + len, win81W, sizeof(win81W) );
|
|
|
|
else if (ver->dwMajorVersion == 6 && ver->dwMinorVersion == 2) memcpy( ret + len, win8W, sizeof(win8W) );
|
2016-10-05 09:46:28 +02:00
|
|
|
else if (ver->dwMajorVersion == 6 && ver->dwMinorVersion == 1)
|
|
|
|
{
|
|
|
|
if (ver->wProductType == VER_NT_WORKSTATION) memcpy( ret + len, win7W, sizeof(win7W) );
|
|
|
|
else memcpy( ret + len, win2008r2W, sizeof(win2008r2W) );
|
|
|
|
}
|
|
|
|
else if (ver->dwMajorVersion == 6 && ver->dwMinorVersion == 0)
|
|
|
|
{
|
|
|
|
if (ver->wProductType == VER_NT_WORKSTATION) memcpy( ret + len, vistaW, sizeof(vistaW) );
|
|
|
|
else memcpy( ret + len, win2008W, sizeof(win2008W) );
|
|
|
|
}
|
|
|
|
else if (ver->dwMajorVersion == 5 && ver->dwMinorVersion == 2)
|
|
|
|
{
|
|
|
|
if (ver->wProductType == VER_NT_WORKSTATION) memcpy( ret + len, winxp64W, sizeof(winxp64W) );
|
|
|
|
else memcpy( ret + len, win2003W, sizeof(win2003W) );
|
|
|
|
}
|
|
|
|
else if (ver->dwMajorVersion == 5 && ver->dwMinorVersion == 1) memcpy( ret + len, winxpW, sizeof(winxpW) );
|
|
|
|
else memcpy( ret + len, win2000W, sizeof(win2000W) );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
static WCHAR *get_osname( const WCHAR *caption )
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
static const WCHAR partitionW[] = L"|C:\\WINDOWS|\\Device\\Harddisk0\\Partition1";
|
2019-07-04 09:27:39 +02:00
|
|
|
int len = lstrlenW( caption );
|
2016-10-05 09:46:28 +02:00
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( len * sizeof(WCHAR) + sizeof(partitionW) ))) return NULL;
|
|
|
|
memcpy( ret, caption, len * sizeof(WCHAR) );
|
|
|
|
memcpy( ret + len, partitionW, sizeof(partitionW) );
|
|
|
|
return ret;
|
|
|
|
}
|
2020-05-18 09:49:40 +02:00
|
|
|
static WCHAR *get_osserialnumber(void)
|
|
|
|
{
|
|
|
|
HKEY hkey = 0;
|
|
|
|
DWORD size, type;
|
|
|
|
WCHAR *ret = NULL;
|
|
|
|
|
|
|
|
if (!RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_READ, &hkey ) &&
|
|
|
|
!RegQueryValueExW( hkey, L"ProductId", NULL, &type, NULL, &size ) && type == REG_SZ &&
|
|
|
|
(ret = heap_alloc( size + sizeof(WCHAR) )))
|
|
|
|
{
|
|
|
|
size += sizeof(WCHAR);
|
|
|
|
if (RegQueryValueExW( hkey, L"ProductId", NULL, NULL, (BYTE *)ret, &size ))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
|
|
|
ret = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (hkey) RegCloseKey( hkey );
|
|
|
|
if (!ret) return heap_strdupW( L"12345-OEM-1234567-12345" );
|
|
|
|
return ret;
|
|
|
|
}
|
2016-10-05 09:46:28 +02:00
|
|
|
static WCHAR *get_osversion( OSVERSIONINFOEXW *ver )
|
|
|
|
{
|
|
|
|
WCHAR *ret = heap_alloc( 33 * sizeof(WCHAR) );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (ret) swprintf( ret, 33, L"%u.%u.%u", ver->dwMajorVersion, ver->dwMinorVersion, ver->dwBuildNumber );
|
2016-10-05 09:46:28 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2019-03-25 10:06:05 +01:00
|
|
|
static DWORD get_operatingsystemsku(void)
|
|
|
|
{
|
|
|
|
DWORD ret = PRODUCT_UNDEFINED;
|
|
|
|
GetProductInfo( 6, 0, 0, 0, &ret );
|
|
|
|
return ret;
|
|
|
|
}
|
2019-09-17 13:41:43 +02:00
|
|
|
static INT16 get_currenttimezone(void)
|
|
|
|
{
|
|
|
|
TIME_ZONE_INFORMATION info;
|
|
|
|
DWORD status = GetTimeZoneInformation( &info );
|
|
|
|
if (status == TIME_ZONE_ID_INVALID) return 0;
|
|
|
|
if (status == TIME_ZONE_ID_DAYLIGHT) return -(info.Bias + info.DaylightBias);
|
|
|
|
return -(info.Bias + info.StandardBias);
|
|
|
|
}
|
2012-06-19 10:21:47 +02:00
|
|
|
|
2019-09-17 13:41:43 +02:00
|
|
|
static enum fill_status fill_operatingsystem( 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;
|
2021-02-02 14:25:20 +01:00
|
|
|
RTL_OSVERSIONINFOEXW ver;
|
2013-05-22 10:10:16 +02:00
|
|
|
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
|
|
|
|
2016-10-05 09:46:28 +02:00
|
|
|
ver.dwOSVersionInfoSize = sizeof(ver);
|
2021-02-02 14:25:20 +01:00
|
|
|
RtlGetVersion( &ver );
|
2016-10-05 09:46:28 +02:00
|
|
|
|
2012-09-18 13:11:59 +02:00
|
|
|
rec = (struct record_operatingsystem *)table->data;
|
2016-10-05 09:46:28 +02:00
|
|
|
rec->buildnumber = get_osbuildnumber( &ver );
|
|
|
|
rec->caption = get_oscaption( &ver );
|
2014-12-04 22:32:35 +01:00
|
|
|
rec->codeset = get_codeset();
|
|
|
|
rec->countrycode = get_countrycode();
|
2016-10-05 09:46:28 +02:00
|
|
|
rec->csdversion = ver.szCSDVersion[0] ? heap_strdupW( ver.szCSDVersion ) : NULL;
|
2019-09-17 13:41:43 +02:00
|
|
|
rec->csname = get_computername();
|
|
|
|
rec->currenttimezone = get_currenttimezone();
|
2018-03-02 11:54:57 +01:00
|
|
|
rec->freephysicalmemory = get_available_physical_memory() / 1024;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->installdate = L"20140101000000.000000+000";
|
2014-12-04 22:32:35 +01:00
|
|
|
rec->lastbootuptime = get_lastbootuptime();
|
|
|
|
rec->localdatetime = get_localdatetime();
|
|
|
|
rec->locale = get_locale();
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->manufacturer = L"The Wine Project";
|
2016-10-05 09:46:28 +02:00
|
|
|
rec->name = get_osname( rec->caption );
|
2019-03-25 10:06:05 +01:00
|
|
|
rec->operatingsystemsku = get_operatingsystemsku();
|
2014-12-04 22:32:35 +01:00
|
|
|
rec->osarchitecture = get_osarchitecture();
|
|
|
|
rec->oslanguage = GetSystemDefaultLangID();
|
|
|
|
rec->osproductsuite = 2461140; /* Windows XP Professional */
|
|
|
|
rec->ostype = 18; /* WINNT */
|
2015-06-22 12:13:56 +02:00
|
|
|
rec->primary = -1;
|
2021-03-14 21:22:51 +01:00
|
|
|
rec->producttype = 1;
|
2020-05-18 09:49:40 +02:00
|
|
|
rec->serialnumber = get_osserialnumber();
|
2016-10-05 09:46:28 +02:00
|
|
|
rec->servicepackmajor = ver.wServicePackMajor;
|
|
|
|
rec->servicepackminor = ver.wServicePackMinor;
|
2014-12-04 22:32:35 +01:00
|
|
|
rec->suitemask = 272; /* Single User + Terminal */
|
|
|
|
rec->systemdirectory = get_systemdirectory();
|
2019-04-24 12:58:11 +02:00
|
|
|
rec->systemdrive = get_systemdrive();
|
2016-11-16 17:01:53 +01:00
|
|
|
rec->totalvirtualmemorysize = get_total_physical_memory() / 1024;
|
|
|
|
rec->totalvisiblememorysize = rec->totalvirtualmemorysize;
|
2016-10-05 09:46:28 +02:00
|
|
|
rec->version = get_osversion( &ver );
|
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 )
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
if (type & SERVICE_KERNEL_DRIVER) return L"Kernel Driver";
|
|
|
|
else if (type & SERVICE_FILE_SYSTEM_DRIVER) return L"File System Driver";
|
|
|
|
else if (type & SERVICE_WIN32_OWN_PROCESS) return L"Own Process";
|
|
|
|
else if (type & SERVICE_WIN32_SHARE_PROCESS) return L"Share Process";
|
2012-07-27 14:04:03 +02:00
|
|
|
else ERR("unhandled type 0x%08x\n", type);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
static const WCHAR *get_service_state( DWORD state )
|
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
case SERVICE_STOPPED: return L"Stopped";
|
|
|
|
case SERVICE_START_PENDING: return L"Start Pending";
|
|
|
|
case SERVICE_STOP_PENDING: return L"Stop Pending";
|
|
|
|
case SERVICE_RUNNING: return L"Running";
|
2012-07-27 14:04:03 +02:00
|
|
|
default:
|
|
|
|
ERR("unknown state %u\n", state);
|
2020-04-20 10:38:10 +02:00
|
|
|
return L"Unknown";
|
2012-07-27 14:04:03 +02:00
|
|
|
}
|
|
|
|
}
|
2012-08-26 19:29:29 +02:00
|
|
|
static const WCHAR *get_service_startmode( DWORD mode )
|
|
|
|
{
|
|
|
|
switch (mode)
|
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
case SERVICE_BOOT_START: return L"Boot";
|
|
|
|
case SERVICE_SYSTEM_START: return L"System";
|
|
|
|
case SERVICE_AUTO_START: return L"Auto";
|
|
|
|
case SERVICE_DEMAND_START: return L"Manual";
|
|
|
|
case SERVICE_DISABLED: return L"Disabled";
|
2012-08-26 19:29:29 +02:00
|
|
|
default:
|
|
|
|
ERR("unknown mode 0x%x\n", mode);
|
2020-04-20 10:38:10 +02:00
|
|
|
return L"Unknown";
|
2012-08-26 19:29:29 +02:00
|
|
|
}
|
|
|
|
}
|
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];
|
2018-09-11 22:08:07 +02:00
|
|
|
DWORD len = ARRAY_SIZE( sysnameW );
|
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
|
|
|
}
|
|
|
|
|
2015-02-13 13:40:36 +01:00
|
|
|
static WCHAR *get_accountname( LSA_TRANSLATED_NAME *name )
|
|
|
|
{
|
|
|
|
if (!name || !name->Name.Buffer) return NULL;
|
|
|
|
return heap_strdupW( name->Name.Buffer );
|
|
|
|
}
|
2015-04-17 09:38:15 +02:00
|
|
|
static struct array *get_binaryrepresentation( PSID sid, UINT len )
|
2015-02-13 13:40:36 +01:00
|
|
|
{
|
2019-08-27 16:35:55 +02:00
|
|
|
struct array *ret;
|
|
|
|
UINT8 *ptr;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
|
|
|
|
if (!(ptr = heap_alloc( len )))
|
2015-04-17 09:38:15 +02:00
|
|
|
{
|
2019-08-27 16:35:55 +02:00
|
|
|
heap_free( ret );
|
|
|
|
return NULL;
|
2015-04-17 09:38:15 +02:00
|
|
|
}
|
2019-08-27 16:35:55 +02:00
|
|
|
memcpy( ptr, sid, len );
|
|
|
|
ret->elem_size = sizeof(*ptr);
|
|
|
|
ret->count = len;
|
|
|
|
ret->ptr = ptr;
|
|
|
|
return ret;
|
2015-02-13 13:40:36 +01:00
|
|
|
}
|
|
|
|
static WCHAR *get_referenceddomainname( LSA_REFERENCED_DOMAIN_LIST *domain )
|
|
|
|
{
|
|
|
|
if (!domain || !domain->Domains || !domain->Domains->Name.Buffer) return NULL;
|
|
|
|
return heap_strdupW( domain->Domains->Name.Buffer );
|
|
|
|
}
|
|
|
|
static const WCHAR *find_sid_str( const struct expr *cond )
|
|
|
|
{
|
|
|
|
const struct expr *left, *right;
|
|
|
|
const WCHAR *ret = NULL;
|
|
|
|
|
|
|
|
if (!cond || cond->type != EXPR_COMPLEX || cond->u.expr.op != OP_EQ) return NULL;
|
|
|
|
|
|
|
|
left = cond->u.expr.left;
|
|
|
|
right = cond->u.expr.right;
|
2020-04-20 10:38:10 +02:00
|
|
|
if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !wcsicmp( left->u.propval->name, L"SID" ))
|
2015-02-13 13:40:36 +01:00
|
|
|
{
|
|
|
|
ret = right->u.sval;
|
|
|
|
}
|
2020-04-20 10:38:10 +02:00
|
|
|
else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !wcsicmp( right->u.propval->name, L"SID" ))
|
2015-02-13 13:40:36 +01:00
|
|
|
{
|
|
|
|
ret = left->u.sval;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_sid( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
PSID sid;
|
|
|
|
LSA_REFERENCED_DOMAIN_LIST *domain;
|
|
|
|
LSA_TRANSLATED_NAME *name;
|
|
|
|
LSA_HANDLE handle;
|
|
|
|
LSA_OBJECT_ATTRIBUTES attrs;
|
|
|
|
const WCHAR *str;
|
|
|
|
struct record_sid *rec;
|
|
|
|
UINT len;
|
|
|
|
|
|
|
|
if (!(str = find_sid_str( cond ))) return FILL_STATUS_FAILED;
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
if (!ConvertStringSidToSidW( str, &sid )) return FILL_STATUS_FAILED;
|
|
|
|
len = GetLengthSid( sid );
|
|
|
|
|
|
|
|
memset( &attrs, 0, sizeof(attrs) );
|
|
|
|
attrs.Length = sizeof(attrs);
|
|
|
|
if (LsaOpenPolicy( NULL, &attrs, POLICY_ALL_ACCESS, &handle ))
|
|
|
|
{
|
|
|
|
LocalFree( sid );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
if (LsaLookupSids( handle, 1, &sid, &domain, &name ))
|
|
|
|
{
|
|
|
|
LocalFree( sid );
|
|
|
|
LsaClose( handle );
|
|
|
|
return FILL_STATUS_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
rec = (struct record_sid *)table->data;
|
|
|
|
rec->accountname = get_accountname( name );
|
|
|
|
rec->binaryrepresentation = get_binaryrepresentation( sid, len );
|
|
|
|
rec->referenceddomainname = get_referenceddomainname( domain );
|
|
|
|
rec->sid = heap_strdupW( str );
|
|
|
|
rec->sidlength = len;
|
|
|
|
|
|
|
|
TRACE("created 1 row\n");
|
|
|
|
table->num_rows = 1;
|
|
|
|
|
|
|
|
LsaFreeMemory( domain );
|
|
|
|
LsaFreeMemory( name );
|
|
|
|
LocalFree( sid );
|
|
|
|
LsaClose( handle );
|
|
|
|
return FILL_STATUS_FILTERED;
|
|
|
|
}
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
static WCHAR *get_systemenclosure_string( BYTE id, const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_chassis *chassis;
|
|
|
|
UINT offset;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_CHASSIS, buf, len ))) return NULL;
|
|
|
|
|
|
|
|
chassis = (const struct smbios_chassis *)hdr;
|
|
|
|
offset = (const char *)chassis - buf + chassis->hdr.length;
|
|
|
|
return get_smbios_string( id, buf, offset, len );
|
|
|
|
}
|
|
|
|
|
|
|
|
static WCHAR *get_systemenclosure_manufacturer( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
WCHAR *ret = get_systemenclosure_string( 1, buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
if (!ret) return heap_strdupW( L"Wine" );
|
2019-08-27 16:35:56 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_systemenclosure_lockpresent( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_chassis *chassis;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_CHASSIS, buf, len )) || hdr->length < sizeof(*chassis)) return 0;
|
|
|
|
|
|
|
|
chassis = (const struct smbios_chassis *)hdr;
|
|
|
|
return (chassis->type & 0x80) ? -1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct array *dup_array( const struct array *src )
|
|
|
|
{
|
|
|
|
struct array *dst;
|
|
|
|
if (!(dst = heap_alloc( sizeof(*dst) ))) return NULL;
|
|
|
|
if (!(dst->ptr = heap_alloc( src->count * src->elem_size )))
|
|
|
|
{
|
|
|
|
heap_free( dst );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
memcpy( dst->ptr, src->ptr, src->count * src->elem_size );
|
|
|
|
dst->elem_size = src->elem_size;
|
|
|
|
dst->count = src->count;
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct array *get_systemenclosure_chassistypes( const char *buf, UINT len )
|
|
|
|
{
|
|
|
|
const struct smbios_header *hdr;
|
|
|
|
const struct smbios_chassis *chassis;
|
|
|
|
struct array *ret = NULL;
|
|
|
|
UINT16 *types;
|
|
|
|
|
|
|
|
if (!(hdr = find_smbios_entry( SMBIOS_TYPE_CHASSIS, buf, len )) || hdr->length < sizeof(*chassis)) goto done;
|
|
|
|
chassis = (const struct smbios_chassis *)hdr;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( sizeof(*ret) ))) goto done;
|
|
|
|
if (!(types = heap_alloc( sizeof(*types) )))
|
|
|
|
{
|
|
|
|
heap_free( ret );
|
2019-09-05 01:48:51 +02:00
|
|
|
return NULL;
|
2019-08-27 16:35:56 +02:00
|
|
|
}
|
|
|
|
types[0] = chassis->type & ~0x80;
|
|
|
|
|
|
|
|
ret->elem_size = sizeof(*types);
|
|
|
|
ret->count = 1;
|
|
|
|
ret->ptr = types;
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (!ret) ret = dup_array( &systemenclosure_chassistypes_array );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_systemenclosure( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_systemenclosure *rec;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
UINT row = 0, len;
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
len = GetSystemFirmwareTable( RSMB, 0, NULL, 0 );
|
|
|
|
if (!(buf = heap_alloc( len ))) return FILL_STATUS_FAILED;
|
|
|
|
GetSystemFirmwareTable( RSMB, 0, buf, len );
|
|
|
|
|
|
|
|
rec = (struct record_systemenclosure *)table->data;
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->caption = L"System Enclosure";
|
2019-08-27 16:35:56 +02:00
|
|
|
rec->chassistypes = get_systemenclosure_chassistypes( buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->description = L"System Enclosure";
|
2019-08-27 16:35:56 +02:00
|
|
|
rec->lockpresent = get_systemenclosure_lockpresent( buf, len );
|
|
|
|
rec->manufacturer = get_systemenclosure_manufacturer( buf, len );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->name = L"System Enclosure";
|
|
|
|
rec->tag = L"System Enclosure 0";
|
2019-08-27 16:35:56 +02:00
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
|
|
|
|
|
|
|
heap_free( buf );
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2020-10-29 13:15:48 +01:00
|
|
|
static WCHAR *get_videocontroller_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
|
2013-01-30 16:27:22 +01:00
|
|
|
{
|
2020-05-11 18:11:01 +02:00
|
|
|
static const WCHAR fmtW[] = L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X\\0&DEADBEEF&0&DEAD";
|
2019-07-04 09:27:39 +02:00
|
|
|
UINT len = sizeof(fmtW) + 2;
|
2013-01-30 16:27:22 +01:00
|
|
|
WCHAR *ret;
|
|
|
|
|
2019-07-04 09:27:39 +02:00
|
|
|
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
|
|
|
swprintf( ret, len, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
|
2013-01-30 16:27:22 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-03-01 17:20:38 +01:00
|
|
|
#define HW_VENDOR_AMD 0x1002
|
|
|
|
#define HW_VENDOR_NVIDIA 0x10de
|
|
|
|
#define HW_VENDOR_VMWARE 0x15ad
|
|
|
|
#define HW_VENDOR_INTEL 0x8086
|
|
|
|
|
2020-10-29 13:15:48 +01:00
|
|
|
static const WCHAR *get_videocontroller_installeddriver( UINT vendorid )
|
2018-03-01 17:20:38 +01:00
|
|
|
{
|
2018-03-15 18:12:35 +01:00
|
|
|
/* FIXME: wined3d has a better table, but we cannot access this information through dxgi */
|
2018-03-01 17:20:38 +01:00
|
|
|
|
2020-04-20 10:38:10 +02:00
|
|
|
if (vendorid == HW_VENDOR_AMD) return L"aticfx32.dll";
|
|
|
|
else if (vendorid == HW_VENDOR_NVIDIA) return L"nvd3dum.dll";
|
|
|
|
else if (vendorid == HW_VENDOR_INTEL) return L"igdudim32.dll";
|
|
|
|
return L"wine.dll";
|
2018-03-01 17:20:38 +01:00
|
|
|
}
|
|
|
|
|
2020-10-29 13:15:48 +01:00
|
|
|
static BOOL get_dxgi_adapter_desc( DXGI_ADAPTER_DESC *desc )
|
|
|
|
{
|
|
|
|
IDXGIFactory *factory;
|
|
|
|
IDXGIAdapter *adapter;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
memset( desc, 0, sizeof(*desc) );
|
|
|
|
hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
|
|
|
|
if (FAILED( hr )) return FALSE;
|
|
|
|
|
|
|
|
hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
|
|
|
|
if (FAILED( hr ))
|
|
|
|
{
|
|
|
|
IDXGIFactory_Release( factory );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IDXGIAdapter_GetDesc( adapter, desc );
|
|
|
|
IDXGIAdapter_Release( adapter );
|
|
|
|
IDXGIFactory_Release( factory );
|
|
|
|
return SUCCEEDED( hr );
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
DXGI_ADAPTER_DESC desc;
|
2016-01-06 14:44:34 +01:00
|
|
|
UINT row = 0, hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
|
2020-04-20 10:38:10 +02:00
|
|
|
const WCHAR *name = L"VideoController1";
|
2013-05-22 10:10:16 +02:00
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
2016-01-06 14:44:34 +01:00
|
|
|
WCHAR mode[44];
|
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;
|
|
|
|
|
2020-10-29 13:15:48 +01:00
|
|
|
if (get_dxgi_adapter_desc( &desc ))
|
2012-06-28 09:24:05 +02:00
|
|
|
{
|
2020-09-30 12:37:40 +02:00
|
|
|
if (desc.DedicatedVideoMemory > UINT_MAX) vidmem = 0xfff00000;
|
|
|
|
else vidmem = desc.DedicatedVideoMemory;
|
|
|
|
name = desc.Description;
|
2012-06-28 09:24:05 +02:00
|
|
|
}
|
2012-06-22 09:23:36 +02:00
|
|
|
|
|
|
|
rec = (struct record_videocontroller *)table->data;
|
2020-04-20 10:38:11 +02:00
|
|
|
rec->adapter_compatibility = L"(Standard display types)";
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->adapter_dactype = L"Integrated RAMDAC";
|
2012-06-28 09:24:05 +02:00
|
|
|
rec->adapter_ram = vidmem;
|
2014-04-03 12:36:33 +02:00
|
|
|
rec->availability = 3; /* Running or Full Power */
|
2018-03-01 17:20:36 +01:00
|
|
|
rec->config_errorcode = 0; /* no error */
|
2015-04-02 16:19:58 +02:00
|
|
|
rec->caption = heap_strdupW( name );
|
2019-09-20 13:37:15 +02:00
|
|
|
rec->current_bitsperpixel = get_bitsperpixel( &hres, &vres );
|
2012-06-28 09:24:05 +02:00
|
|
|
rec->current_horizontalres = hres;
|
2015-04-02 16:19:58 +02:00
|
|
|
rec->current_refreshrate = 0; /* default refresh rate */
|
|
|
|
rec->current_scanmode = 2; /* Unknown */
|
2012-06-28 09:24:05 +02:00
|
|
|
rec->current_verticalres = vres;
|
2012-09-17 12:19:30 +02:00
|
|
|
rec->description = heap_strdupW( name );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->device_id = L"VideoController1";
|
|
|
|
rec->driverdate = L"20170101000000.000000+000";
|
|
|
|
rec->driverversion = L"1.0";
|
2020-10-29 13:15:48 +01:00
|
|
|
rec->installeddriver = get_videocontroller_installeddriver( desc.VendorId );
|
2012-06-28 09:24:05 +02:00
|
|
|
rec->name = heap_strdupW( name );
|
2020-10-29 13:15:48 +01:00
|
|
|
rec->pnpdevice_id = get_videocontroller_pnpdeviceid( &desc );
|
2020-04-20 10:38:10 +02:00
|
|
|
rec->status = L"OK";
|
2015-04-02 16:19:58 +02:00
|
|
|
rec->videoarchitecture = 2; /* Unknown */
|
|
|
|
rec->videomemorytype = 2; /* Unknown */
|
2020-04-20 10:38:10 +02:00
|
|
|
swprintf( mode, ARRAY_SIZE( mode ), L"%u x %u x %I64u colors", hres, vres, (UINT64)1 << rec->current_bitsperpixel );
|
2016-01-06 14:44:34 +01:00
|
|
|
rec->videomodedescription = heap_strdupW( mode );
|
2015-01-07 15:26:34 +01:00
|
|
|
rec->videoprocessor = heap_strdupW( name );
|
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;
|
2020-10-29 13:15:48 +01:00
|
|
|
return status;
|
|
|
|
}
|
2012-06-22 09:23:36 +02:00
|
|
|
|
2020-10-29 13:15:48 +01:00
|
|
|
static WCHAR *get_sounddevice_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
|
|
|
|
{
|
|
|
|
static const WCHAR fmtW[] = L"HDAUDIO\\FUNC_01&VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%04X\\0&DEADBEEF&0&DEAD";
|
|
|
|
UINT len = sizeof(fmtW) + 2;
|
|
|
|
WCHAR *ret;
|
|
|
|
|
|
|
|
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
|
|
|
swprintf( ret, len, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static enum fill_status fill_sounddevice( struct table *table, const struct expr *cond )
|
|
|
|
{
|
|
|
|
struct record_sounddevice *rec;
|
|
|
|
DXGI_ADAPTER_DESC desc;
|
|
|
|
UINT row = 0;
|
|
|
|
enum fill_status status = FILL_STATUS_UNFILTERED;
|
|
|
|
|
|
|
|
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
|
|
|
|
|
|
|
|
get_dxgi_adapter_desc( &desc );
|
|
|
|
|
|
|
|
rec = (struct record_sounddevice *)table->data;
|
|
|
|
rec->deviceid = get_sounddevice_pnpdeviceid( &desc );
|
|
|
|
rec->manufacturer = L"The Wine Project";
|
|
|
|
rec->name = L"Wine Audio Device";
|
|
|
|
rec->pnpdeviceid = get_sounddevice_pnpdeviceid( &desc );
|
|
|
|
rec->productname = L"Wine Audio Device";
|
|
|
|
rec->status = L"OK";
|
|
|
|
rec->statusinfo = 3;
|
|
|
|
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
|
|
|
|
else row++;
|
|
|
|
|
|
|
|
TRACE("created %u rows\n", row);
|
|
|
|
table->num_rows = row;
|
2013-05-22 10:10:16 +02:00
|
|
|
return status;
|
2012-06-22 09:23:36 +02:00
|
|
|
}
|
|
|
|
|
2019-08-27 16:35:56 +02:00
|
|
|
#define C(c) sizeof(c)/sizeof(c[0]), c
|
|
|
|
#define D(d) sizeof(d)/sizeof(d[0]), 0, (BYTE *)d
|
2012-07-13 11:35:39 +02:00
|
|
|
static struct table builtin_classes[] =
|
2012-06-15 15:47:28 +02:00
|
|
|
{
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"__ASSOCIATORS", C(col_associator), D(data_associator) },
|
|
|
|
{ L"__PARAMETERS", C(col_param), D(data_param) },
|
|
|
|
{ L"__QUALIFIERS", C(col_qualifier), D(data_qualifier) },
|
|
|
|
{ L"__SystemSecurity", C(col_systemsecurity), D(data_systemsecurity) },
|
|
|
|
{ L"CIM_DataFile", C(col_datafile), 0, 0, NULL, fill_datafile },
|
|
|
|
{ L"CIM_LogicalDisk", C(col_logicaldisk), 0, 0, NULL, fill_logicaldisk },
|
|
|
|
{ L"CIM_Processor", C(col_processor), 0, 0, NULL, fill_processor },
|
|
|
|
{ L"StdRegProv", C(col_stdregprov), D(data_stdregprov) },
|
2021-01-20 11:15:57 +01:00
|
|
|
{ L"SystemRestore", C(col_sysrestore), D(data_sysrestore) },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Win32_BIOS", C(col_bios), 0, 0, NULL, fill_bios },
|
|
|
|
{ L"Win32_BaseBoard", C(col_baseboard), 0, 0, NULL, fill_baseboard },
|
|
|
|
{ L"Win32_CDROMDrive", C(col_cdromdrive), 0, 0, NULL, fill_cdromdrive },
|
|
|
|
{ L"Win32_ComputerSystem", C(col_compsys), 0, 0, NULL, fill_compsys },
|
|
|
|
{ L"Win32_ComputerSystemProduct", C(col_compsysproduct), 0, 0, NULL, fill_compsysproduct },
|
|
|
|
{ L"Win32_DesktopMonitor", C(col_desktopmonitor), 0, 0, NULL, fill_desktopmonitor },
|
|
|
|
{ L"Win32_Directory", C(col_directory), 0, 0, NULL, fill_directory },
|
|
|
|
{ L"Win32_DiskDrive", C(col_diskdrive), 0, 0, NULL, fill_diskdrive },
|
|
|
|
{ L"Win32_DiskDriveToDiskPartition", C(col_diskdrivetodiskpartition), 0, 0, NULL, fill_diskdrivetodiskpartition },
|
|
|
|
{ L"Win32_DiskPartition", C(col_diskpartition), 0, 0, NULL, fill_diskpartition },
|
|
|
|
{ L"Win32_DisplayControllerConfiguration", C(col_displaycontrollerconfig), 0, 0, NULL, fill_displaycontrollerconfig },
|
|
|
|
{ L"Win32_IP4RouteTable", C(col_ip4routetable), 0, 0, NULL, fill_ip4routetable },
|
|
|
|
{ L"Win32_LogicalDisk", C(col_logicaldisk), 0, 0, NULL, fill_logicaldisk },
|
|
|
|
{ L"Win32_LogicalDiskToPartition", C(col_logicaldisktopartition), 0, 0, NULL, fill_logicaldisktopartition },
|
|
|
|
{ L"Win32_NetworkAdapter", C(col_networkadapter), 0, 0, NULL, fill_networkadapter },
|
|
|
|
{ L"Win32_NetworkAdapterConfiguration", C(col_networkadapterconfig), 0, 0, NULL, fill_networkadapterconfig },
|
|
|
|
{ L"Win32_OperatingSystem", C(col_operatingsystem), 0, 0, NULL, fill_operatingsystem },
|
|
|
|
{ L"Win32_PhysicalMedia", C(col_physicalmedia), D(data_physicalmedia) },
|
|
|
|
{ L"Win32_PhysicalMemory", C(col_physicalmemory), 0, 0, NULL, fill_physicalmemory },
|
|
|
|
{ L"Win32_PnPEntity", C(col_pnpentity), 0, 0, NULL, fill_pnpentity },
|
|
|
|
{ L"Win32_Printer", C(col_printer), 0, 0, NULL, fill_printer },
|
|
|
|
{ L"Win32_Process", C(col_process), 0, 0, NULL, fill_process },
|
|
|
|
{ L"Win32_Processor", C(col_processor), 0, 0, NULL, fill_processor },
|
|
|
|
{ L"Win32_QuickFixEngineering", C(col_quickfixengineering), D(data_quickfixengineering) },
|
|
|
|
{ L"Win32_SID", C(col_sid), 0, 0, NULL, fill_sid },
|
|
|
|
{ L"Win32_Service", C(col_service), 0, 0, NULL, fill_service },
|
2020-10-29 13:15:48 +01:00
|
|
|
{ L"Win32_SoundDevice", C(col_sounddevice), 0, 0, NULL, fill_sounddevice },
|
2020-04-20 10:38:10 +02:00
|
|
|
{ L"Win32_SystemEnclosure", C(col_systemenclosure), 0, 0, NULL, fill_systemenclosure },
|
|
|
|
{ L"Win32_VideoController", C(col_videocontroller), 0, 0, NULL, fill_videocontroller },
|
|
|
|
{ L"Win32_WinSAT", C(col_winsat), D(data_winsat) },
|
2019-08-27 16:35:56 +02:00
|
|
|
};
|
|
|
|
#undef C
|
|
|
|
#undef D
|
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;
|
|
|
|
|
2018-11-15 20:59:48 +01:00
|
|
|
for (i = 0; i < ARRAY_SIZE(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
|
|
|
}
|