Sync with trunk r63174.
[reactos.git] / dll / win32 / wbemprox / builtin.c
index 628b0c2..c053be7 100644 (file)
@@ -51,10 +51,17 @@ static const WCHAR class_logicaldisk2W[] =
     {'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0};
 static const WCHAR class_networkadapterW[] =
     {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
+static const WCHAR class_networkadapterconfigW[] =
+    {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',
+     'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
 static const WCHAR class_osW[] =
     {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
 static const WCHAR class_paramsW[] =
     {'_','_','P','A','R','A','M','E','T','E','R','S',0};
+static const WCHAR class_physicalmediaW[] =
+    {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0};
+static const WCHAR class_physicalmemoryW[] =
+    {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
 static const WCHAR class_qualifiersW[] =
     {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
 static const WCHAR class_process_getowner_outW[] =
@@ -81,10 +88,16 @@ static const WCHAR prop_adaptertypeW[] =
     {'A','d','a','p','t','e','r','T','y','p','e',0};
 static const WCHAR prop_addresswidthW[] =
     {'A','d','d','r','e','s','s','W','i','d','t','h',0};
+static const WCHAR prop_availabilityW[] =
+    {'A','v','a','i','l','a','b','i','l','i','t','y',0};
 static const WCHAR prop_bootableW[] =
     {'B','o','o','t','a','b','l','e',0};
 static const WCHAR prop_bootpartitionW[] =
     {'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
+static const WCHAR prop_buildnumberW[] =
+    {'B','u','i','l','d','N','u','m','b','e','r',0};
+static const WCHAR prop_capacityW[] =
+    {'C','a','p','a','c','i','t','y',0};
 static const WCHAR prop_captionW[] =
     {'C','a','p','t','i','o','n',0};
 static const WCHAR prop_classW[] =
@@ -137,12 +150,22 @@ static const WCHAR prop_handleW[] =
     {'H','a','n','d','l','e',0};
 static const WCHAR prop_idW[] =
     {'I','D',0};
+static const WCHAR prop_identificationcodeW[] =
+    {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
 static const WCHAR prop_indexW[] =
     {'I','n','d','e','x',0};
+static const WCHAR prop_installdateW[] =
+    {'I','n','s','t','a','l','l','D','a','t','e',0};
 static const WCHAR prop_interfaceindexW[] =
     {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
+static const WCHAR prop_interfacetypeW[] =
+    {'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
 static const WCHAR prop_intvalueW[] =
     {'I','n','t','e','g','e','r','V','a','l','u','e',0};
+static const WCHAR prop_ipconnectionmetricW[] =
+    {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
+static const WCHAR prop_ipenabledW[] =
+    {'I','P','E','n','a','b','l','e','d',0};
 static const WCHAR prop_lastbootuptimeW[] =
     {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
 static const WCHAR prop_localdatetimeW[] =
@@ -155,6 +178,8 @@ static const WCHAR prop_manufacturerW[] =
     {'M','a','n','u','f','a','c','t','u','r','e','r',0};
 static const WCHAR prop_maxclockspeedW[] =
     {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
+static const WCHAR prop_mediatypeW[] =
+    {'M','e','d','i','a','T','y','p','e',0};
 static const WCHAR prop_memberW[] =
     {'M','e','m','b','e','r',0};
 static const WCHAR prop_methodW[] =
@@ -201,6 +226,8 @@ static const WCHAR prop_servicepackminorW[] =
     {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
 static const WCHAR prop_servicetypeW[] =
     {'S','e','r','v','i','c','e','T','y','p','e',0};
+static const WCHAR prop_smbiosbiosversionW[] =
+    {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
 static const WCHAR prop_startmodeW[] =
     {'S','t','a','r','t','M','o','d','e',0};
 static const WCHAR prop_sizeW[] =
@@ -233,26 +260,33 @@ static const WCHAR prop_varianttypeW[] =
     {'V','a','r','i','a','n','t','T','y','p','e',0};
 static const WCHAR prop_versionW[] =
     {'V','e','r','s','i','o','n',0};
+static const WCHAR prop_volumeserialnumberW[] =
+    {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
 
 /* column definitions must be kept in sync with record structures below */
 static const struct column col_baseboard[] =
 {
     { prop_manufacturerW,  CIM_STRING },
+    { prop_modelW,         CIM_STRING },
+    { prop_nameW,          CIM_STRING },
     { prop_serialnumberW,  CIM_STRING },
     { prop_tagW,           CIM_STRING|COL_FLAG_KEY }
 };
 static const struct column col_bios[] =
 {
-    { prop_descriptionW,  CIM_STRING },
-    { prop_manufacturerW, CIM_STRING },
-    { prop_releasedateW,  CIM_DATETIME },
-    { prop_serialnumberW, CIM_STRING },
-    { prop_versionW,      CIM_STRING|COL_FLAG_KEY }
+    { prop_descriptionW,        CIM_STRING },
+    { prop_identificationcodeW, CIM_STRING },
+    { prop_manufacturerW,       CIM_STRING },
+    { prop_releasedateW,        CIM_DATETIME },
+    { prop_serialnumberW,       CIM_STRING },
+    { prop_smbiosbiosversionW,  CIM_STRING },
+    { prop_versionW,            CIM_STRING|COL_FLAG_KEY }
 };
 static const struct column col_cdromdrive[] =
 {
     { prop_deviceidW,    CIM_STRING|COL_FLAG_KEY },
     { prop_driveW,       CIM_STRING|COL_FLAG_DYNAMIC },
+    { prop_mediatypeW,   CIM_STRING },
     { prop_nameW,        CIM_STRING },
     { prop_pnpdeviceidW, CIM_STRING }
 };
@@ -280,11 +314,14 @@ static const struct column col_directory[] =
 };
 static const struct column col_diskdrive[] =
 {
-    { prop_deviceidW,     CIM_STRING|COL_FLAG_KEY },
-    { prop_indexW,        CIM_UINT32, VT_I4 },
-    { prop_manufacturerW, CIM_STRING },
-    { prop_modelW,        CIM_STRING },
-    { prop_serialnumberW, CIM_STRING }
+    { prop_deviceidW,      CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
+    { prop_indexW,         CIM_UINT32, VT_I4 },
+    { prop_interfacetypeW, CIM_STRING },
+    { prop_manufacturerW,  CIM_STRING },
+    { prop_mediatypeW,     CIM_STRING },
+    { prop_modelW,         CIM_STRING },
+    { prop_serialnumberW,  CIM_STRING },
+    { prop_sizeW,          CIM_UINT64 }
 };
 static const struct column col_diskpartition[] =
 {
@@ -300,38 +337,52 @@ static const struct column col_diskpartition[] =
 };
 static const struct column col_logicaldisk[] =
 {
-    { prop_deviceidW,   CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
-    { prop_drivetypeW,  CIM_UINT32, VT_I4 },
-    { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC },
-    { prop_freespaceW,  CIM_UINT64 },
-    { prop_nameW,       CIM_STRING|COL_FLAG_DYNAMIC },
-    { prop_sizeW,       CIM_UINT64 }
+    { prop_deviceidW,           CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
+    { prop_drivetypeW,          CIM_UINT32, VT_I4 },
+    { prop_filesystemW,         CIM_STRING|COL_FLAG_DYNAMIC },
+    { prop_freespaceW,          CIM_UINT64 },
+    { prop_nameW,               CIM_STRING|COL_FLAG_DYNAMIC },
+    { prop_sizeW,               CIM_UINT64 },
+    { prop_volumeserialnumberW, CIM_STRING|COL_FLAG_DYNAMIC }
 };
 static const struct column col_networkadapter[] =
 {
     { prop_adaptertypeW,         CIM_STRING },
     { prop_deviceidW,            CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
+    { prop_indexW,               CIM_UINT32, VT_I4 },
     { prop_interfaceindexW,      CIM_UINT32, VT_I4 },
     { prop_macaddressW,          CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_manufacturerW,        CIM_STRING },
+    { prop_nameW,                CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_netconnectionstatusW, CIM_UINT16, VT_I4 },
     { prop_physicaladapterW,     CIM_BOOLEAN },
     { prop_pnpdeviceidW,         CIM_STRING },
     { prop_speedW,               CIM_UINT64 }
 };
+static const struct column col_networkadapterconfig[] =
+{
+    { prop_indexW,              CIM_UINT32|COL_FLAG_KEY },
+    { prop_ipconnectionmetricW, CIM_UINT32 },
+    { prop_ipenabledW,          CIM_BOOLEAN },
+    { prop_macaddressW,         CIM_STRING|COL_FLAG_DYNAMIC }
+};
 static const struct column col_os[] =
 {
+    { prop_buildnumberW,      CIM_STRING },
     { prop_captionW,          CIM_STRING },
     { prop_codesetW,          CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_countrycodeW,      CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_csdversionW,       CIM_STRING },
+    { prop_installdateW,      CIM_DATETIME },
     { prop_lastbootuptimeW,   CIM_DATETIME|COL_FLAG_DYNAMIC },
     { prop_localdatetimeW,    CIM_DATETIME|COL_FLAG_DYNAMIC },
     { prop_localeW,           CIM_STRING|COL_FLAG_DYNAMIC },
+    { prop_nameW,             CIM_STRING },
     { prop_osarchitectureW,   CIM_STRING },
     { prop_oslanguageW,       CIM_UINT32, VT_I4 },
     { prop_osproductsuiteW,   CIM_UINT32, VT_I4 },
     { prop_ostypeW,           CIM_UINT16, VT_I4 },
+    { prop_serialnumberW,     CIM_STRING },
     { prop_servicepackmajorW, CIM_UINT16, VT_I4 },
     { prop_servicepackminorW, CIM_UINT16, VT_I4 },
     { prop_suitemaskW,        CIM_UINT32, VT_I4 },
@@ -348,6 +399,15 @@ static const struct column col_param[] =
     { prop_varianttypeW,  CIM_UINT32 },
     { prop_defaultvalueW, CIM_UINT32 }
 };
+static const struct column col_physicalmedia[] =
+{
+    { prop_serialnumberW,       CIM_STRING },
+    { prop_tagW,                CIM_STRING }
+};
+static const struct column col_physicalmemory[] =
+{
+    { prop_capacityW,   CIM_UINT64 }
+};
 static const struct column col_process[] =
 {
     { prop_captionW,     CIM_STRING|COL_FLAG_DYNAMIC },
@@ -417,6 +477,7 @@ static const struct column col_videocontroller[] =
 {
     { prop_adapterdactypeW,       CIM_STRING },
     { prop_adapterramW,           CIM_UINT32, VT_I4 },
+    { prop_availabilityW,         CIM_UINT16 },
     { prop_currentbitsperpixelW,  CIM_UINT32 },
     { prop_currenthorizontalresW, CIM_UINT32 },
     { prop_currentverticalresW,   CIM_UINT32 },
@@ -440,8 +501,12 @@ static const WCHAR bios_releasedateW[] =
     {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
 static const WCHAR bios_serialnumberW[] =
     {'0',0};
+static const WCHAR bios_smbiosbiosversionW[] =
+    {'W','i','n','e',0};
 static const WCHAR bios_versionW[] =
     {'W','I','N','E',' ',' ',' ','-',' ','1',0};
+static const WCHAR cdromdrive_mediatypeW[] =
+    {'C','D','-','R','O','M',0};
 static const WCHAR cdromdrive_nameW[] =
     {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
 static const WCHAR cdromdrive_pnpdeviceidW[]=
@@ -457,29 +522,46 @@ static const WCHAR compsys_manufacturerW[] =
     {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
 static const WCHAR compsys_modelW[] =
     {'W','i','n','e',0};
-static const WCHAR diskdrive_deviceidW[] =
-    {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
-static const WCHAR diskdrive_modelW[] =
-    {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
+static const WCHAR diskdrive_interfacetypeW[] =
+    {'I','D','E',0};
 static const WCHAR diskdrive_manufacturerW[] =
     {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
+static const WCHAR diskdrive_mediatype_fixedW[] =
+    {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
+static const WCHAR diskdrive_mediatype_removableW[] =
+    {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
+static const WCHAR diskdrive_modelW[] =
+    {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
 static const WCHAR diskdrive_serialW[] =
     {'W','I','N','E','H','D','I','S','K',0};
 static const WCHAR networkadapter_pnpdeviceidW[]=
     {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
      'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
      '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
+static const WCHAR os_32bitW[] =
+    {'3','2','-','b','i','t',0};
+static const WCHAR os_64bitW[] =
+    {'6','4','-','b','i','t',0};
+static const WCHAR os_buildnumberW[] =
+    {'2','6','0','0',0};
 static const WCHAR os_captionW[] =
     {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
      'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
 static const WCHAR os_csdversionW[] =
     {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
-static const WCHAR os_32bitW[] =
-    {'3','2','-','b','i','t',0};
-static const WCHAR os_64bitW[] =
-    {'6','4','-','b','i','t',0};
+static const WCHAR os_installdateW[] =
+    {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
+static const WCHAR os_nameW[] =
+    {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
+     'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
+     '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
+     '\\','P','a','r','t','i','t','i','o','n','1',0};
+static const WCHAR os_serialnumberW[] =
+    {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
 static const WCHAR os_versionW[] =
     {'5','.','1','.','2','6','0','0',0};
+static const WCHAR physicalmedia_tagW[] =
+    {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
 static const WCHAR sounddevice_productnameW[] =
     {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
 static const WCHAR videocontroller_dactypeW[] =
@@ -491,21 +573,26 @@ static const WCHAR videocontroller_deviceidW[] =
 struct record_baseboard
 {
     const WCHAR *manufacturer;
+    const WCHAR *model;
+    const WCHAR *name;
     const WCHAR *serialnumber;
     const WCHAR *tag;
 };
 struct record_bios
 {
     const WCHAR *description;
+    const WCHAR *identificationcode;
     const WCHAR *manufacturer;
     const WCHAR *releasedate;
     const WCHAR *serialnumber;
+    const WCHAR *smbiosbiosversion;
     const WCHAR *version;
 };
 struct record_cdromdrive
 {
     const WCHAR *device_id;
     const WCHAR *drive;
+    const WCHAR *mediatype;
     const WCHAR *name;
     const WCHAR *pnpdevice_id;
 };
@@ -535,9 +622,12 @@ struct record_diskdrive
 {
     const WCHAR *device_id;
     UINT32       index;
+    const WCHAR *interfacetype;
     const WCHAR *manufacturer;
-    const WCHAR *name;
+    const WCHAR *mediatype;
+    const WCHAR *model;
     const WCHAR *serialnumber;
+    UINT64       size;
 };
 struct record_diskpartition
 {
@@ -559,32 +649,46 @@ struct record_logicaldisk
     UINT64       freespace;
     const WCHAR *name;
     UINT64       size;
+    const WCHAR *volumeserialnumber;
 };
 struct record_networkadapter
 {
     const WCHAR *adaptertype;
     const WCHAR *device_id;
-    INT32        interface_index;
+    UINT32       index;
+    UINT32       interface_index;
     const WCHAR *mac_address;
     const WCHAR *manufacturer;
+    const WCHAR *name;
     UINT16       netconnection_status;
     int          physicaladapter;
     const WCHAR *pnpdevice_id;
     UINT64       speed;
 };
+struct record_networkadapterconfig
+{
+    UINT32       index;
+    UINT32       ipconnectionmetric;
+    int          ipenabled;
+    const WCHAR *mac_address;
+};
 struct record_operatingsystem
 {
+    const WCHAR *buildnumber;
     const WCHAR *caption;
     const WCHAR *codeset;
     const WCHAR *countrycode;
     const WCHAR *csdversion;
+    const WCHAR *installdate;
     const WCHAR *lastbootuptime;
     const WCHAR *localdatetime;
     const WCHAR *locale;
+    const WCHAR *name;
     const WCHAR *osarchitecture;
     UINT32       oslanguage;
     UINT32       osproductsuite;
     UINT16       ostype;
+    const WCHAR *serialnumber;
     UINT16       servicepackmajor;
     UINT16       servicepackminor;
     UINT32       suitemask;
@@ -601,6 +705,15 @@ struct record_param
     UINT32       varianttype;
     UINT32       defaultvalue;
 };
+struct record_physicalmedia
+{
+    const WCHAR *serialnumber;
+    const WCHAR *tag;
+};
+struct record_physicalmemory
+{
+    UINT64 capacity;
+};
 struct record_process
 {
     const WCHAR *caption;
@@ -670,6 +783,7 @@ struct record_videocontroller
 {
     const WCHAR *adapter_dactype;
     UINT32       adapter_ram;
+    UINT16       availability;
     UINT32       current_bitsperpixel;
     UINT32       current_horizontalres;
     UINT32       current_verticalres;
@@ -682,15 +796,12 @@ struct record_videocontroller
 
 static const struct record_baseboard data_baseboard[] =
 {
-    { baseboard_manufacturerW, baseboard_serialnumberW, baseboard_tagW }
+    { baseboard_manufacturerW, baseboard_tagW, baseboard_tagW, baseboard_serialnumberW, baseboard_tagW }
 };
 static const struct record_bios data_bios[] =
 {
-    { bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW, bios_versionW }
-};
-static const struct record_diskdrive data_diskdrive[] =
-{
-    { diskdrive_deviceidW, 0, diskdrive_manufacturerW, diskdrive_modelW, diskdrive_serialW }
+    { bios_descriptionW, bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW,
+      bios_smbiosbiosversionW, bios_versionW }
 };
 static const struct record_param data_param[] =
 {
@@ -720,6 +831,10 @@ static const struct record_param data_param[] =
 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
                    WBEM_FLAVOR_ORIGIN_PROPAGATED)
 
+static const struct record_physicalmedia data_physicalmedia[] =
+{
+    { diskdrive_serialW, physicalmedia_tagW }
+};
 static const struct record_qualifier data_qualifier[] =
 {
     { class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 },
@@ -738,12 +853,14 @@ static const struct record_stdregprov data_stdregprov[] =
 static BOOL match_row( const struct table *table, UINT row, const struct expr *cond, enum fill_status *status )
 {
     LONGLONG val;
+    UINT type;
+
     if (!cond)
     {
         *status = FILL_STATUS_UNFILTERED;
         return TRUE;
     }
-    if (eval_cond( table, row, cond, &val ) != S_OK)
+    if (eval_cond( table, row, cond, &val, &type ) != S_OK)
     {
         *status = FILL_STATUS_FAILED;
         return FALSE;
@@ -796,6 +913,7 @@ static enum fill_status fill_cdromdrive( struct table *table, const struct expr
             rec->device_id    = cdromdrive_pnpdeviceidW;
             sprintfW( drive, fmtW, 'A' + i );
             rec->drive        = heap_strdupW( drive );
+            rec->mediatype    = cdromdrive_mediatypeW;
             rec->name         = cdromdrive_nameW;
             rec->pnpdevice_id = cdromdrive_pnpdeviceidW;
             if (!match_row( table, row, cond, &status ))
@@ -1177,11 +1295,13 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
     DWORD drives = GetLogicalDrives();
     WIN32_FIND_DATAW data;
     HANDLE handle;
-    struct dirstack *dirstack = alloc_dirstack(2);
+    struct dirstack *dirstack;
     enum fill_status status = FILL_STATUS_UNFILTERED;
 
     if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED;
 
+    dirstack = alloc_dirstack(2);
+
     for (i = 0; i < sizeof(drives); i++)
     {
         if (!(drives & (1 << i))) continue;
@@ -1207,6 +1327,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
                     if (!resize_table( table, row + 1, sizeof(*rec) ))
                     {
                         status = FILL_STATUS_FAILED;
+                        FindClose( handle );
                         goto done;
                     }
                     if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue;
@@ -1216,6 +1337,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
                     {
                         if (push_dir( dirstack, new_path, len )) continue;
                         heap_free( new_path );
+                        FindClose( handle );
                         status = FILL_STATUS_FAILED;
                         goto done;
                     }
@@ -1349,16 +1471,6 @@ done:
     return status;
 }
 
-static WCHAR *get_filesystem( const WCHAR *root )
-{
-    static const WCHAR ntfsW[] = {'N','T','F','S',0};
-    WCHAR buffer[MAX_PATH + 1];
-
-    if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
-        return heap_strdupW( buffer );
-    return heap_strdupW( ntfsW );
-}
-
 static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
 {
     WCHAR root[] = {'\\','\\','.','\\','A',':',0};
@@ -1380,6 +1492,69 @@ static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
     return free.QuadPart;
 }
 
+static enum fill_status fill_diskdrive( struct table *table, const struct expr *cond )
+{
+    static const WCHAR fmtW[] =
+        {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
+    WCHAR device_id[sizeof(fmtW)/sizeof(fmtW[0]) + 10], root[] = {'A',':','\\',0};
+    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;
+
+    for (i = 0; i < sizeof(drives); i++)
+    {
+        if (drives & (1 << i))
+        {
+            root[0] = 'A' + i;
+            type = GetDriveTypeW( root );
+            if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
+                continue;
+
+            if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
+
+            rec = (struct record_diskdrive *)(table->data + offset);
+            sprintfW( device_id, fmtW, index );
+            rec->device_id     = heap_strdupW( device_id );
+            rec->index         = index;
+            rec->interfacetype = diskdrive_interfacetypeW;
+            rec->manufacturer  = diskdrive_manufacturerW;
+            if (type == DRIVE_FIXED)
+                rec->mediatype = diskdrive_mediatype_fixedW;
+            else
+                rec->mediatype = diskdrive_mediatype_removableW;
+            rec->model         = diskdrive_modelW;
+            rec->serialnumber  = diskdrive_serialW;
+            get_freespace( root, &size );
+            rec->size          = size;
+            if (!match_row( table, row, cond, &status ))
+            {
+                free_row_values( table, row );
+                continue;
+            }
+            offset += sizeof(*rec);
+            index++;
+            row++;
+        }
+    }
+    TRACE("created %u rows\n", row);
+    table->num_rows = row;
+    return status;
+}
+
+static WCHAR *get_filesystem( const WCHAR *root )
+{
+    static const WCHAR ntfsW[] = {'N','T','F','S',0};
+    WCHAR buffer[MAX_PATH + 1];
+
+    if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
+        return heap_strdupW( buffer );
+    return heap_strdupW( ntfsW );
+}
+
 static enum fill_status fill_diskpartition( struct table *table, const struct expr *cond )
 {
     static const WCHAR fmtW[] =
@@ -1431,6 +1606,17 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex
     return status;
 }
 
+static WCHAR *get_volumeserialnumber( const WCHAR *root )
+{
+    static const WCHAR fmtW[] = {'%','0','8','X',0};
+    DWORD serial = 0;
+    WCHAR buffer[9];
+
+    GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 );
+    sprintfW( buffer, fmtW, serial );
+    return heap_strdupW( buffer );
+}
+
 static enum fill_status fill_logicaldisk( struct table *table, const struct expr *cond )
 {
     static const WCHAR fmtW[] = {'%','c',':',0};
@@ -1456,12 +1642,13 @@ static enum fill_status fill_logicaldisk( struct table *table, const struct expr
 
             rec = (struct record_logicaldisk *)(table->data + offset);
             sprintfW( device_id, fmtW, 'A' + i );
-            rec->device_id  = heap_strdupW( device_id );
-            rec->drivetype  = type;
-            rec->filesystem = get_filesystem( root );
-            rec->freespace  = get_freespace( root, &size );
-            rec->name       = heap_strdupW( device_id );
-            rec->size       = size;
+            rec->device_id          = heap_strdupW( device_id );
+            rec->drivetype          = type;
+            rec->filesystem         = get_filesystem( root );
+            rec->freespace          = get_freespace( root, &size );
+            rec->name               = heap_strdupW( device_id );
+            rec->size               = size;
+            rec->volumeserialnumber = get_volumeserialnumber( root );
             if (!match_row( table, row, cond, &status ))
             {
                 free_row_values( table, row );
@@ -1538,7 +1725,10 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
         heap_free( buffer );
         return FILL_STATUS_FAILED;
     }
-    for (aa = buffer; aa; aa = aa->Next) count++;
+    for (aa = buffer; aa; aa = aa->Next)
+    {
+        if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
+    }
     if (!resize_table( table, count, sizeof(*rec) ))
     {
         heap_free( buffer );
@@ -1546,13 +1736,17 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
     }
     for (aa = buffer; aa; aa = aa->Next)
     {
+        if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
+
         rec = (struct record_networkadapter *)(table->data + offset);
         sprintfW( device_id, fmtW, aa->u.s.IfIndex );
         rec->adaptertype          = get_adaptertype( aa->IfType, &physical );
         rec->device_id            = heap_strdupW( device_id );
+        rec->index                = aa->u.s.IfIndex;
         rec->interface_index      = aa->u.s.IfIndex;
         rec->mac_address          = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
         rec->manufacturer         = compsys_manufacturerW;
+        rec->name                 = heap_strdupW( aa->FriendlyName );
         rec->netconnection_status = get_connection_status( aa->OperStatus );
         rec->physicaladapter      = physical;
         rec->pnpdevice_id         = networkadapter_pnpdeviceidW;
@@ -1572,6 +1766,74 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
     return status;
 }
 
+static enum fill_status fill_networkadapterconfig( struct table *table, const struct expr *cond )
+{
+    struct record_networkadapterconfig *rec;
+    IP_ADAPTER_ADDRESSES *aa, *buffer;
+    UINT row = 0, offset = 0, count = 0;
+    DWORD size = 0, ret;
+    enum fill_status status = FILL_STATUS_UNFILTERED;
+
+    ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
+    if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
+
+    if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
+    if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
+    {
+        heap_free( buffer );
+        return FILL_STATUS_FAILED;
+    }
+    for (aa = buffer; aa; aa = aa->Next)
+    {
+        if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
+    }
+    if (!resize_table( table, count, sizeof(*rec) ))
+    {
+        heap_free( buffer );
+        return FILL_STATUS_FAILED;
+    }
+    for (aa = buffer; aa; aa = aa->Next)
+    {
+        if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
+
+        rec = (struct record_networkadapterconfig *)(table->data + offset);
+        rec->index              = aa->u.s.IfIndex;
+        rec->ipconnectionmetric = 20;
+        rec->ipenabled          = -1;
+        rec->mac_address        = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
+        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;
+}
+
+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;
+    rec->capacity = get_total_physical_memory();
+    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;
+}
+
 static WCHAR *get_cmdline( DWORD process_id )
 {
     if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
@@ -1835,17 +2097,21 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond )
     if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
 
     rec = (struct record_operatingsystem *)table->data;
+    rec->buildnumber      = os_buildnumberW;
     rec->caption          = os_captionW;
     rec->codeset          = get_codeset();
     rec->countrycode      = get_countrycode();
     rec->csdversion       = os_csdversionW;
+    rec->installdate      = os_installdateW;
     rec->lastbootuptime   = get_lastbootuptime();
     rec->localdatetime    = get_localdatetime();
     rec->locale           = get_locale();
+    rec->name             = os_nameW;
     rec->osarchitecture   = get_osarchitecture();
     rec->oslanguage       = GetSystemDefaultLangID();
     rec->osproductsuite   = 2461140; /* Windows XP Professional  */
     rec->ostype           = 18;      /* WINNT */
+    rec->serialnumber     = os_serialnumberW;
     rec->servicepackmajor = 3;
     rec->servicepackminor = 0;
     rec->suitemask        = 272;     /* Single User + Terminal */
@@ -2073,6 +2339,7 @@ done:
     rec = (struct record_videocontroller *)table->data;
     rec->adapter_dactype       = videocontroller_dactypeW;
     rec->adapter_ram           = vidmem;
+    rec->availability          = 3; /* Running or Full Power */
     rec->current_bitsperpixel  = get_bits_per_pixel( &hres, &vres );
     rec->current_horizontalres = hres;
     rec->current_verticalres   = vres;
@@ -2099,13 +2366,17 @@ static struct table builtin_classes[] =
     { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
     { class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
     { class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory },
-    { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, SIZEOF(data_diskdrive), 0, (BYTE *)data_diskdrive },
+    { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive },
     { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },
     { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
     { class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
     { class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter },
+    { class_networkadapterconfigW, SIZEOF(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL,
+      fill_networkadapterconfig },
     { class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os },
     { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param },
+    { class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia },
+    { class_physicalmemoryW, SIZEOF(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory },
     { class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process },
     { class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
     { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier },