1 /* 2 * Copyright 2012 Hans Leidekker for CodeWeavers 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19 #define COBJMACROS 20 21 #include <stdio.h> 22 #include "windows.h" 23 #include "ocidl.h" 24 #include "sddl.h" 25 #include "initguid.h" 26 #include "objidl.h" 27 #include "wbemcli.h" 28 #include "wine/test.h" 29 30 static const WCHAR wqlW[] = {'w','q','l',0}; 31 32 static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemClassObject **result ) 33 { 34 static const WCHAR captionW[] = {'C','a','p','t','i','o','n',0}; 35 static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; 36 HRESULT hr; 37 IWbemClassObject *obj; 38 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( str ); 39 LONG flags = WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY; 40 ULONG count; 41 42 hr = IWbemServices_ExecQuery( services, wql, query, flags, NULL, result ); 43 if (hr == S_OK) 44 { 45 trace("%s\n", wine_dbgstr_w(str)); 46 for (;;) 47 { 48 VARIANT var; 49 50 IEnumWbemClassObject_Next( *result, 10000, 1, &obj, &count ); 51 if (!count) break; 52 53 if (IWbemClassObject_Get( obj, captionW, 0, &var, NULL, NULL ) == WBEM_S_NO_ERROR) 54 { 55 trace("caption: %s\n", wine_dbgstr_w(V_BSTR(&var))); 56 VariantClear( &var ); 57 } 58 if (IWbemClassObject_Get( obj, descriptionW, 0, &var, NULL, NULL ) == WBEM_S_NO_ERROR) 59 { 60 trace("description: %s\n", wine_dbgstr_w(V_BSTR(&var))); 61 VariantClear( &var ); 62 } 63 IWbemClassObject_Release( obj ); 64 } 65 } 66 SysFreeString( wql ); 67 SysFreeString( query ); 68 return hr; 69 } 70 71 static void test_select( IWbemServices *services ) 72 { 73 static const WCHAR emptyW[] = {0}; 74 static const WCHAR sqlW[] = {'S','Q','L',0}; 75 static const WCHAR query1[] = 76 {'S','E','L','E','C','T',' ','H','O','T','F','I','X','I','D',' ','F','R','O','M',' ', 77 'W','i','n','3','2','_','Q','u','i','c','k','F','i','x','E','n','g','i','n','e','e','r','i','n','g',0}; 78 static const WCHAR query2[] = 79 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','B','I','O','S',0}; 80 static const WCHAR query3[] = 81 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 82 'L','o','g','i','c','a','l','D','i','s','k',' ','W','H','E','R','E',' ', 83 '\"','N','T','F','S','\"',' ','=',' ','F','i','l','e','S','y','s','t','e','m',0}; 84 static const WCHAR query4[] = 85 {'S','E','L','E','C','T',' ','a',' ','F','R','O','M',' ','b',0}; 86 static const WCHAR query5[] = 87 {'S','E','L','E','C','T',' ','a',' ','F','R','O','M',' ','W','i','n','3','2','_','B','i','o','s',0}; 88 static const WCHAR query6[] = 89 {'S','E','L','E','C','T',' ','D','e','s','c','r','i','p','t','i','o','n',' ','F','R','O','M',' ', 90 'W','i','n','3','2','_','B','i','o','s',0}; 91 static const WCHAR query7[] = 92 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 93 'P','r','o','c','e','s','s',' ','W','H','E','R','E',' ','C','a','p','t','i','o','n',' ', 94 'L','I','K','E',' ','\'','%','%','R','E','G','E','D','I','T','%','\'',0}; 95 static const WCHAR query8[] = 96 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 97 'D','i','s','k','D','r','i','v','e',' ','W','H','E','R','E',' ','D','e','v','i','c','e','I','D','=', 98 '\"','\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0','\"',0}; 99 static const WCHAR query9[] = 100 {'S','E','L','E','C','T','\n','a','\r','F','R','O','M','\t','b',0}; 101 static const WCHAR query10[] = 102 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 103 'P','r','o','c','e','s','s',' ','W','H','E','R','E',' ','C','a','p','t','i','o','n',' ', 104 'L','I','K','E',' ','"','%','f','i','r','e','f','o','x','.','e','x','e','"',0}; 105 static const WCHAR query11[] = 106 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', 107 'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',' ','w','h','e','r','e',' ', 108 'a','v','a','i','l','a','b','i','l','i','t','y',' ','=',' ','\'','3','\'',0}; 109 static const WCHAR query12[] = 110 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','B','I','O','S', 111 ' ','W','H','E','R','E',' ','N','A','M','E',' ','<','>',' ','N','U','L','L', 0}; 112 static const WCHAR query13[] = 113 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_','B','I','O','S', 114 ' ','W','H','E','R','E',' ','N','U','L','L',' ','=',' ','N','A','M','E', 0}; 115 static const WCHAR *test[] = { query1, query2, query3, query4, query5, query6, query7, query8, query9, query10, 116 query11, query12, query13 }; 117 HRESULT hr; 118 IEnumWbemClassObject *result; 119 BSTR wql = SysAllocString( wqlW ); 120 BSTR sql = SysAllocString( sqlW ); 121 BSTR query = SysAllocString( query1 ); 122 UINT i; 123 124 hr = IWbemServices_ExecQuery( services, NULL, NULL, 0, NULL, &result ); 125 ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr ); 126 127 hr = IWbemServices_ExecQuery( services, NULL, query, 0, NULL, &result ); 128 ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr ); 129 130 hr = IWbemServices_ExecQuery( services, wql, NULL, 0, NULL, &result ); 131 ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr ); 132 133 hr = IWbemServices_ExecQuery( services, sql, query, 0, NULL, &result ); 134 ok( hr == WBEM_E_INVALID_QUERY_TYPE, "query failed %08x\n", hr ); 135 136 hr = IWbemServices_ExecQuery( services, sql, NULL, 0, NULL, &result ); 137 ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr ); 138 139 SysFreeString( query ); 140 query = SysAllocString( emptyW ); 141 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 142 ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr ); 143 144 for (i = 0; i < sizeof(test)/sizeof(test[0]); i++) 145 { 146 hr = exec_query( services, test[i], &result ); 147 ok( hr == S_OK, "query %u failed: %08x\n", i, hr ); 148 if (result) IEnumWbemClassObject_Release( result ); 149 } 150 151 SysFreeString( wql ); 152 SysFreeString( sql ); 153 SysFreeString( query ); 154 } 155 156 static void test_associators( IWbemServices *services ) 157 { 158 static const WCHAR query1[] = 159 {'A','S','S','O','C','I','A','T','O','R','S',' ','O','F',' ','{','W','i','n','3','2','_', 160 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','=','"','C',':','"','}',0}; 161 static const WCHAR query2[] = 162 {'A','S','S','O','C','I','A','T','O','R','S',' ','O','F',' ','{','W','i','n','3','2','_', 163 'L','o','g','i','c','a','l','D','i','s','k','.','D','e','v','i','c','e','I','D','=','"','C',':','"','}',' ', 164 'W','H','E','R','E',' ','A','s','s','o','c','C','l','a','s','s',' ','=',' ','W','i','n','3','2','_', 165 'L','o','g','i','c','a','l','D','i','s','k','T','o','P','a','r','t','i','t','i','o','n',0}; 166 static const WCHAR *test[] = { query1, query2 }; 167 HRESULT hr; 168 IEnumWbemClassObject *result; 169 UINT i; 170 171 for (i = 0; i < sizeof(test)/sizeof(test[0]); i++) 172 { 173 hr = exec_query( services, test[i], &result ); 174 todo_wine ok( hr == S_OK, "query %u failed: %08x\n", i, hr ); 175 if (result) IEnumWbemClassObject_Release( result ); 176 } 177 } 178 179 static void test_Win32_Service( IWbemServices *services ) 180 { 181 static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; 182 static const WCHAR pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0}; 183 static const WCHAR resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0}; 184 static const WCHAR startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0}; 185 static const WCHAR stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0}; 186 static const WCHAR stateW[] = {'S','t','a','t','e',0}; 187 static const WCHAR stoppedW[] = {'S','t','o','p','p','e','d',0}; 188 static const WCHAR serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e','.', 189 'N','a','m','e','=','"','S','p','o','o','l','e','r','"',0}; 190 static const WCHAR emptyW[] = {0}; 191 BSTR class = SysAllocString( serviceW ), empty = SysAllocString( emptyW ), method; 192 IWbemClassObject *service, *out; 193 VARIANT state, retval; 194 CIMTYPE type; 195 HRESULT hr; 196 197 hr = IWbemServices_GetObject( services, class, 0, NULL, &service, NULL ); 198 if (hr != S_OK) 199 { 200 win_skip( "Win32_Service not available\n" ); 201 goto out; 202 } 203 type = 0xdeadbeef; 204 VariantInit( &state ); 205 hr = IWbemClassObject_Get( service, stateW, 0, &state, &type, NULL ); 206 ok( hr == S_OK, "failed to get service state %08x\n", hr ); 207 ok( V_VT( &state ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &state ) ); 208 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 209 210 if (!lstrcmpW( V_BSTR( &state ), stoppedW )) 211 { 212 out = NULL; 213 method = SysAllocString( startserviceW ); 214 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL ); 215 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 216 SysFreeString( method ); 217 218 VariantInit( &retval ); 219 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, NULL, NULL ); 220 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 221 ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) ); 222 IWbemClassObject_Release( out ); 223 } 224 out = NULL; 225 method = SysAllocString( pauseserviceW ); 226 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL ); 227 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 228 SysFreeString( method ); 229 230 VariantInit( &retval ); 231 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, NULL, NULL ); 232 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 233 ok( V_I4( &retval ), "unexpected success\n" ); 234 IWbemClassObject_Release( out ); 235 236 out = NULL; 237 method = SysAllocString( resumeserviceW ); 238 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL ); 239 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 240 SysFreeString( method ); 241 242 VariantInit( &retval ); 243 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, NULL, NULL ); 244 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 245 ok( V_I4( &retval ), "unexpected success\n" ); 246 IWbemClassObject_Release( out ); 247 248 if (!lstrcmpW( V_BSTR( &state ), stoppedW )) 249 { 250 out = NULL; 251 method = SysAllocString( stopserviceW ); 252 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL ); 253 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 254 SysFreeString( method ); 255 256 VariantInit( &retval ); 257 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, NULL, NULL ); 258 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 259 ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) ); 260 IWbemClassObject_Release( out ); 261 } 262 VariantClear( &state ); 263 IWbemClassObject_Release( service ); 264 265 service = NULL; 266 hr = IWbemServices_GetObject( services, NULL, 0, NULL, &service, NULL ); 267 ok( hr == S_OK, "got %08x\n", hr ); 268 if (service) IWbemClassObject_Release( service ); 269 270 service = NULL; 271 hr = IWbemServices_GetObject( services, empty, 0, NULL, &service, NULL ); 272 ok( hr == S_OK, "got %08x\n", hr ); 273 if (service) IWbemClassObject_Release( service ); 274 275 out: 276 SysFreeString( empty ); 277 SysFreeString( class ); 278 } 279 280 static void test_Win32_Bios( IWbemServices *services ) 281 { 282 static const WCHAR queryW[] = 283 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 'B','i','o','s',0}; 284 static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; 285 static const WCHAR identificationcodeW[] = {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0}; 286 static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; 287 static const WCHAR nameW[] = {'N','a','m','e',0}; 288 static const WCHAR releasedateW[] = {'R','e','l','e','a','s','e','D','a','t','e',0}; 289 static const WCHAR serialnumberW[] = {'S','e','r','i','a','l','N','u','m','b','e','r',0}; 290 static const WCHAR smbiosbiosversionW[] = {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0}; 291 static const WCHAR smbiosmajorversionW[] = {'S','M','B','I','O','S','M','a','j','o','r','V','e','r','s','i','o','n',0}; 292 static const WCHAR smbiosminorversionW[] = {'S','M','B','I','O','S','M','i','n','o','r','V','e','r','s','i','o','n',0}; 293 static const WCHAR versionW[] = {'V','e','r','s','i','o','n',0}; 294 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 295 IEnumWbemClassObject *result; 296 IWbemClassObject *obj; 297 CIMTYPE type; 298 ULONG count; 299 VARIANT val; 300 HRESULT hr; 301 302 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 303 ok( hr == S_OK, "IWbemServices_ExecQuery failed %08x\n", hr ); 304 305 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 306 ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); 307 308 type = 0xdeadbeef; 309 VariantInit( &val ); 310 hr = IWbemClassObject_Get( obj, descriptionW, 0, &val, &type, NULL ); 311 ok( hr == S_OK, "failed to get description %08x\n", hr ); 312 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 313 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 314 trace( "description: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 315 VariantClear( &val ); 316 317 type = 0xdeadbeef; 318 VariantInit( &val ); 319 hr = IWbemClassObject_Get( obj, identificationcodeW, 0, &val, &type, NULL ); 320 ok( hr == S_OK, "failed to get identication code %08x\n", hr ); 321 ok( V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); 322 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 323 VariantClear( &val ); 324 325 type = 0xdeadbeef; 326 VariantInit( &val ); 327 hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); 328 ok( hr == S_OK, "failed to get manufacturer %08x\n", hr ); 329 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 330 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 331 trace( "manufacturer: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 332 VariantClear( &val ); 333 334 type = 0xdeadbeef; 335 VariantInit( &val ); 336 hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); 337 ok( hr == S_OK, "failed to get name %08x\n", hr ); 338 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 339 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 340 trace( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 341 VariantClear( &val ); 342 343 type = 0xdeadbeef; 344 VariantInit( &val ); 345 hr = IWbemClassObject_Get( obj, releasedateW, 0, &val, &type, NULL ); 346 ok( hr == S_OK, "failed to get release date %08x\n", hr ); 347 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 348 ok( type == CIM_DATETIME, "unexpected type 0x%x\n", type ); 349 trace( "release date: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 350 VariantClear( &val ); 351 352 type = 0xdeadbeef; 353 VariantInit( &val ); 354 hr = IWbemClassObject_Get( obj, serialnumberW, 0, &val, &type, NULL ); 355 ok( hr == S_OK, "failed to get serial number %08x\n", hr ); 356 ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL /* Testbot VMs */, 357 "unexpected variant type 0x%x\n", V_VT( &val ) ); 358 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 359 VariantClear( &val ); 360 361 type = 0xdeadbeef; 362 VariantInit( &val ); 363 hr = IWbemClassObject_Get( obj, smbiosbiosversionW, 0, &val, &type, NULL ); 364 ok( hr == S_OK, "failed to get bios version %08x\n", hr ); 365 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 366 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 367 trace( "bios version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 368 VariantClear( &val ); 369 370 type = 0xdeadbeef; 371 VariantInit( &val ); 372 hr = IWbemClassObject_Get( obj, smbiosmajorversionW, 0, &val, &type, NULL ); 373 ok( hr == S_OK, "failed to get bios major version %08x\n", hr ); 374 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 375 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 376 trace( "bios major version: %u\n", V_I4( &val ) ); 377 378 type = 0xdeadbeef; 379 VariantInit( &val ); 380 hr = IWbemClassObject_Get( obj, smbiosminorversionW, 0, &val, &type, NULL ); 381 ok( hr == S_OK, "failed to get bios minor version %08x\n", hr ); 382 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 383 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 384 trace( "bios minor version: %u\n", V_I4( &val ) ); 385 386 type = 0xdeadbeef; 387 VariantInit( &val ); 388 hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL ); 389 ok( hr == S_OK, "failed to get version %08x\n", hr ); 390 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 391 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 392 trace( "version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 393 VariantClear( &val ); 394 395 IWbemClassObject_Release( obj ); 396 IEnumWbemClassObject_Release( result ); 397 SysFreeString( query ); 398 SysFreeString( wql ); 399 } 400 401 static void test_Win32_Process( IWbemServices *services ) 402 { 403 static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; 404 static const WCHAR getownerW[] = {'G','e','t','O','w','n','e','r',0}; 405 static const WCHAR userW[] = {'U','s','e','r',0}; 406 static const WCHAR domainW[] = {'D','o','m','a','i','n',0}; 407 static const WCHAR processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0}; 408 static const WCHAR idW[] = {'I','D',0}; 409 static const WCHAR fmtW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s','.', 410 'H','a','n','d','l','e','=','"','%','u','"',0}; 411 static const LONG expected_flavor = WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | 412 WBEM_FLAVOR_NOT_OVERRIDABLE | 413 WBEM_FLAVOR_ORIGIN_PROPAGATED; 414 BSTR class, method; 415 IWbemClassObject *process, *out; 416 IWbemQualifierSet *qualifiers; 417 VARIANT user, domain, retval, val; 418 LONG flavor; 419 CIMTYPE type; 420 HRESULT hr; 421 422 class = SysAllocString( processW ); 423 hr = IWbemServices_GetObject( services, class, 0, NULL, &process, NULL ); 424 SysFreeString( class ); 425 if (hr != S_OK) 426 { 427 win_skip( "Win32_Process not available\n" ); 428 return; 429 } 430 hr = IWbemClassObject_GetMethod( process, getownerW, 0, NULL, NULL ); 431 ok( hr == S_OK, "failed to get GetOwner method %08x\n", hr ); 432 IWbemClassObject_Release( process ); 433 434 out = NULL; 435 method = SysAllocString( getownerW ); 436 class = SysAllocStringLen( NULL, sizeof(fmtW)/sizeof(fmtW[0]) + 10 ); 437 wsprintfW( class, fmtW, GetCurrentProcessId() ); 438 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL ); 439 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 440 SysFreeString( method ); 441 SysFreeString( class ); 442 443 type = 0xdeadbeef; 444 VariantInit( &retval ); 445 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, &type, NULL ); 446 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 447 ok( V_VT( &retval ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &retval ) ); 448 ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); 449 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 450 451 type = 0xdeadbeef; 452 VariantInit( &user ); 453 hr = IWbemClassObject_Get( out, userW, 0, &user, &type, NULL ); 454 ok( hr == S_OK, "failed to get user %08x\n", hr ); 455 ok( V_VT( &user ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &user ) ); 456 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 457 trace("%s\n", wine_dbgstr_w(V_BSTR(&user))); 458 459 type = 0xdeadbeef; 460 VariantInit( &domain ); 461 hr = IWbemClassObject_Get( out, domainW, 0, &domain, &type, NULL ); 462 ok( hr == S_OK, "failed to get domain %08x\n", hr ); 463 ok( V_VT( &domain ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &domain ) ); 464 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 465 trace("%s\n", wine_dbgstr_w(V_BSTR(&domain))); 466 467 hr = IWbemClassObject_GetPropertyQualifierSet( out, userW, &qualifiers ); 468 ok( hr == S_OK, "failed to get qualifier set %08x\n", hr ); 469 470 flavor = -1; 471 V_I4(&val) = -1; 472 V_VT(&val) = VT_ERROR; 473 hr = IWbemQualifierSet_Get( qualifiers, idW, 0, &val, &flavor ); 474 ok( hr == S_OK, "got %08x\n", hr ); 475 ok( flavor == expected_flavor, "got %d\n", flavor ); 476 ok( V_VT(&val) == VT_I4, "got %u\n", V_VT(&val) ); 477 ok( V_I4(&val) == 0, "got %u\n", V_I4(&val) ); 478 VariantClear( &val ); 479 480 IWbemQualifierSet_Release( qualifiers ); 481 hr = IWbemClassObject_GetPropertyQualifierSet( out, domainW, &qualifiers ); 482 ok( hr == S_OK, "failed to get qualifier set %08x\n", hr ); 483 484 flavor = -1; 485 V_I4(&val) = -1; 486 V_VT(&val) = VT_ERROR; 487 hr = IWbemQualifierSet_Get( qualifiers, idW, 0, &val, &flavor ); 488 ok( hr == S_OK, "got %08x\n", hr ); 489 ok( flavor == expected_flavor, "got %d\n", flavor ); 490 ok( V_VT(&val) == VT_I4, "got %u\n", V_VT(&val) ); 491 ok( V_I4(&val) == 1, "got %u\n", V_I4(&val) ); 492 VariantClear( &val ); 493 494 IWbemQualifierSet_Release( qualifiers ); 495 hr = IWbemClassObject_GetPropertyQualifierSet( out, returnvalueW, &qualifiers ); 496 ok( hr == S_OK, "failed to get qualifier set %08x\n", hr ); 497 498 hr = IWbemQualifierSet_Get( qualifiers, idW, 0, &val, &flavor ); 499 ok( hr == WBEM_E_NOT_FOUND, "got %08x\n", hr ); 500 501 IWbemQualifierSet_Release( qualifiers ); 502 VariantClear( &user ); 503 VariantClear( &domain ); 504 IWbemClassObject_Release( out ); 505 } 506 507 static void test_Win32_ComputerSystem( IWbemServices *services ) 508 { 509 static const WCHAR backslashW[] = {'\\',0}; 510 static const WCHAR memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0}; 511 static const WCHAR modelW[] = {'M','o','d','e','l',0}; 512 static const WCHAR nameW[] = {'N','a','m','e',0}; 513 static const WCHAR usernameW[] = {'U','s','e','r','N','a','m','e',0}; 514 static const WCHAR queryW[] = 515 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 516 'C','o','m','p','u','t','e','r','S','y','s','t','e','m',0}; 517 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 518 IEnumWbemClassObject *result; 519 IWbemClassObject *service; 520 VARIANT value; 521 CIMTYPE type; 522 HRESULT hr; 523 WCHAR compname[MAX_COMPUTERNAME_LENGTH + 1]; 524 WCHAR username[128]; 525 DWORD len, count; 526 527 len = sizeof(compname) / sizeof(compname[0]); 528 if (!GetComputerNameW( compname, &len )) 529 compname[0] = 0; 530 531 lstrcpyW( username, compname ); 532 lstrcatW( username, backslashW ); 533 len = sizeof(username) / sizeof(username[0]) - lstrlenW( username ); 534 if (!GetUserNameW( username + lstrlenW( username ), &len )) 535 username[0] = 0; 536 537 if (!compname[0] || !username[0]) 538 { 539 skip( "Failed to get user or computer name\n" ); 540 goto out; 541 } 542 543 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 544 if (hr != S_OK) 545 { 546 win_skip( "Win32_ComputerSystem not available\n" ); 547 goto out; 548 } 549 550 hr = IEnumWbemClassObject_Next( result, 10000, 1, &service, &count ); 551 ok( hr == S_OK, "got %08x\n", hr ); 552 553 type = 0xdeadbeef; 554 VariantInit( &value ); 555 hr = IWbemClassObject_Get( service, memorytypeW, 0, &value, &type, NULL ); 556 ok( hr == WBEM_E_NOT_FOUND, "got %08x\n", hr ); 557 558 type = 0xdeadbeef; 559 VariantInit( &value ); 560 hr = IWbemClassObject_Get( service, modelW, 0, &value, &type, NULL ); 561 ok( hr == S_OK, "failed to get model %08x\n", hr ); 562 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 563 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 564 trace( "model: %s\n", wine_dbgstr_w(V_BSTR( &value )) ); 565 VariantClear( &value ); 566 567 type = 0xdeadbeef; 568 VariantInit( &value ); 569 hr = IWbemClassObject_Get( service, nameW, 0, &value, &type, NULL ); 570 ok( hr == S_OK, "failed to get computer name %08x\n", hr ); 571 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 572 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 573 ok( !lstrcmpiW( V_BSTR( &value ), compname ), "got %s, expected %s\n", wine_dbgstr_w(V_BSTR(&value)), wine_dbgstr_w(compname) ); 574 VariantClear( &value ); 575 576 type = 0xdeadbeef; 577 VariantInit( &value ); 578 hr = IWbemClassObject_Get( service, usernameW, 0, &value, &type, NULL ); 579 ok( hr == S_OK, "failed to get computer name %08x\n", hr ); 580 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 581 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 582 ok( !lstrcmpiW( V_BSTR( &value ), username ), "got %s, expected %s\n", wine_dbgstr_w(V_BSTR(&value)), wine_dbgstr_w(username) ); 583 VariantClear( &value ); 584 585 IWbemClassObject_Release( service ); 586 IEnumWbemClassObject_Release( result ); 587 out: 588 SysFreeString( query ); 589 SysFreeString( wql ); 590 } 591 592 static void test_Win32_SystemEnclosure( IWbemServices *services ) 593 { 594 static const WCHAR queryW[] = 595 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 596 'S','y','s','t','e','m','E','n','c','l','o','s','u','r','e',0}; 597 static const WCHAR captionW[] = {'C','a','p','t','i','o','n',0}; 598 static const WCHAR chassistypesW[] = {'C','h','a','s','s','i','s','T','y','p','e','s',0}; 599 static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; 600 static const WCHAR lockpresentW[] = {'L','o','c','k','P','r','e','s','e','n','t',0}; 601 static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; 602 static const WCHAR nameW[] = {'N','a','m','e',0}; 603 static const WCHAR tagW[] = {'T','a','g',0}; 604 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 605 IEnumWbemClassObject *result; 606 IWbemClassObject *obj; 607 CIMTYPE type; 608 ULONG count; 609 VARIANT val; 610 DWORD *data; 611 HRESULT hr; 612 613 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 614 ok( hr == S_OK, "IWbemServices_ExecQuery failed %08x\n", hr ); 615 616 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 617 ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); 618 619 type = 0xdeadbeef; 620 VariantInit( &val ); 621 hr = IWbemClassObject_Get( obj, captionW, 0, &val, &type, NULL ); 622 ok( hr == S_OK, "failed to get caption %08x\n", hr ); 623 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 624 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 625 trace( "caption: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 626 VariantClear( &val ); 627 628 type = 0xdeadbeef; 629 VariantInit( &val ); 630 hr = IWbemClassObject_Get( obj, chassistypesW, 0, &val, &type, NULL ); 631 ok( hr == S_OK, "failed to get chassis types %08x\n", hr ); 632 ok( V_VT( &val ) == (VT_I4|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &val ) ); 633 ok( type == (CIM_UINT16|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); 634 hr = SafeArrayAccessData( V_ARRAY( &val ), (void **)&data ); 635 ok( hr == S_OK, "SafeArrayAccessData failed %x\n", hr ); 636 if (SUCCEEDED(hr)) 637 { 638 LONG i, lower, upper; 639 640 hr = SafeArrayGetLBound( V_ARRAY( &val ), 1, &lower ); 641 ok( hr == S_OK, "SafeArrayGetLBound failed %x\n", hr ); 642 hr = SafeArrayGetUBound( V_ARRAY( &val ), 1, &upper ); 643 ok( hr == S_OK, "SafeArrayGetUBound failed %x\n", hr ); 644 if (V_VT( &val ) == (VT_I4|VT_ARRAY)) 645 { 646 for (i = 0; i < upper - lower + 1; i++) 647 trace( "chassis type: %u\n", data[i] ); 648 } 649 hr = SafeArrayUnaccessData( V_ARRAY( &val ) ); 650 ok( hr == S_OK, "SafeArrayUnaccessData failed %x\n", hr ); 651 } 652 VariantClear( &val ); 653 654 type = 0xdeadbeef; 655 VariantInit( &val ); 656 hr = IWbemClassObject_Get( obj, descriptionW, 0, &val, &type, NULL ); 657 ok( hr == S_OK, "failed to get description %08x\n", hr ); 658 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 659 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 660 trace( "description: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 661 VariantClear( &val ); 662 663 type = 0xdeadbeef; 664 VariantInit( &val ); 665 hr = IWbemClassObject_Get( obj, lockpresentW, 0, &val, &type, NULL ); 666 ok( hr == S_OK, "failed to get lockpresent %08x\n", hr ); 667 ok( V_VT( &val ) == VT_BOOL, "unexpected variant type 0x%x\n", V_VT( &val ) ); 668 ok( type == CIM_BOOLEAN, "unexpected type 0x%x\n", type ); 669 trace( "lockpresent: %u\n", V_BOOL( &val ) ); 670 VariantClear( &val ); 671 672 type = 0xdeadbeef; 673 VariantInit( &val ); 674 hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); 675 ok( hr == S_OK, "failed to get manufacturer %08x\n", hr ); 676 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 677 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 678 trace( "manufacturer: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 679 VariantClear( &val ); 680 681 type = 0xdeadbeef; 682 VariantInit( &val ); 683 hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); 684 ok( hr == S_OK, "failed to get name %08x\n", hr ); 685 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 686 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 687 trace( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 688 VariantClear( &val ); 689 690 type = 0xdeadbeef; 691 VariantInit( &val ); 692 hr = IWbemClassObject_Get( obj, tagW, 0, &val, &type, NULL ); 693 ok( hr == S_OK, "failed to get tag %08x\n", hr ); 694 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 695 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 696 trace( "tag: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 697 VariantClear( &val ); 698 699 IWbemClassObject_Release( obj ); 700 IEnumWbemClassObject_Release( result ); 701 SysFreeString( query ); 702 SysFreeString( wql ); 703 } 704 705 static void test_StdRegProv( IWbemServices *services ) 706 { 707 static const WCHAR enumkeyW[] = {'E','n','u','m','K','e','y',0}; 708 static const WCHAR enumvaluesW[] = {'E','n','u','m','V','a','l','u','e','s',0}; 709 static const WCHAR getstringvalueW[] = {'G','e','t','S','t','r','i','n','g','V','a','l','u','e',0}; 710 static const WCHAR stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0}; 711 static const WCHAR defkeyW[] = {'h','D','e','f','K','e','y',0}; 712 static const WCHAR subkeynameW[] = {'s','S','u','b','K','e','y','N','a','m','e',0}; 713 static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; 714 static const WCHAR namesW[] = {'s','N','a','m','e','s',0}; 715 static const WCHAR typesW[] = {'T','y','p','e','s',0}; 716 static const WCHAR valueW[] = {'s','V','a','l','u','e',0}; 717 static const WCHAR valuenameW[] = {'s','V','a','l','u','e','N','a','m','e',0}; 718 static const WCHAR programfilesW[] = {'P','r','o','g','r','a','m','F','i','l','e','s','D','i','r',0}; 719 static const WCHAR windowsW[] = 720 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', 721 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',0}; 722 BSTR class = SysAllocString( stdregprovW ), method; 723 IWbemClassObject *reg, *sig_in, *in, *out; 724 VARIANT defkey, subkey, retval, names, types, value, valuename; 725 CIMTYPE type; 726 HRESULT hr; 727 728 hr = IWbemServices_GetObject( services, class, 0, NULL, ®, NULL ); 729 if (hr != S_OK) 730 { 731 win_skip( "StdRegProv not available\n" ); 732 return; 733 } 734 hr = IWbemClassObject_GetMethod( reg, enumkeyW, 0, &sig_in, NULL ); 735 ok( hr == S_OK, "failed to get EnumKey method %08x\n", hr ); 736 737 hr = IWbemClassObject_SpawnInstance( sig_in, 0, &in ); 738 ok( hr == S_OK, "failed to spawn instance %08x\n", hr ); 739 740 V_VT( &defkey ) = VT_I4; 741 V_I4( &defkey ) = 0x80000002; 742 hr = IWbemClassObject_Put( in, defkeyW, 0, &defkey, 0 ); 743 ok( hr == S_OK, "failed to set root %08x\n", hr ); 744 745 V_VT( &subkey ) = VT_BSTR; 746 V_BSTR( &subkey ) = SysAllocString( windowsW ); 747 hr = IWbemClassObject_Put( in, subkeynameW, 0, &subkey, 0 ); 748 ok( hr == S_OK, "failed to set subkey %08x\n", hr ); 749 750 out = NULL; 751 method = SysAllocString( enumkeyW ); 752 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, in, &out, NULL ); 753 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 754 SysFreeString( method ); 755 756 type = 0xdeadbeef; 757 VariantInit( &retval ); 758 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, &type, NULL ); 759 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 760 ok( V_VT( &retval ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &retval ) ); 761 ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) ); 762 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 763 764 type = 0xdeadbeef; 765 VariantInit( &names ); 766 hr = IWbemClassObject_Get( out, namesW, 0, &names, &type, NULL ); 767 ok( hr == S_OK, "failed to get names %08x\n", hr ); 768 ok( V_VT( &names ) == (VT_BSTR|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &names ) ); 769 ok( type == (CIM_STRING|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); 770 771 VariantClear( &names ); 772 VariantClear( &subkey ); 773 IWbemClassObject_Release( in ); 774 IWbemClassObject_Release( out ); 775 IWbemClassObject_Release( sig_in ); 776 777 hr = IWbemClassObject_GetMethod( reg, enumvaluesW, 0, &sig_in, NULL ); 778 ok( hr == S_OK, "failed to get EnumValues method %08x\n", hr ); 779 780 hr = IWbemClassObject_SpawnInstance( sig_in, 0, &in ); 781 ok( hr == S_OK, "failed to spawn instance %08x\n", hr ); 782 783 V_VT( &defkey ) = VT_I4; 784 V_I4( &defkey ) = 0x80000002; 785 hr = IWbemClassObject_Put( in, defkeyW, 0, &defkey, 0 ); 786 ok( hr == S_OK, "failed to set root %08x\n", hr ); 787 788 V_VT( &subkey ) = VT_BSTR; 789 V_BSTR( &subkey ) = SysAllocString( windowsW ); 790 hr = IWbemClassObject_Put( in, subkeynameW, 0, &subkey, 0 ); 791 ok( hr == S_OK, "failed to set subkey %08x\n", hr ); 792 793 out = NULL; 794 method = SysAllocString( enumvaluesW ); 795 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, in, &out, NULL ); 796 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 797 SysFreeString( method ); 798 799 type = 0xdeadbeef; 800 VariantInit( &retval ); 801 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, &type, NULL ); 802 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 803 ok( V_VT( &retval ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &retval ) ); 804 ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); 805 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 806 807 type = 0xdeadbeef; 808 VariantInit( &names ); 809 hr = IWbemClassObject_Get( out, namesW, 0, &names, &type, NULL ); 810 ok( hr == S_OK, "failed to get names %08x\n", hr ); 811 ok( V_VT( &names ) == (VT_BSTR|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &names ) ); 812 ok( type == (CIM_STRING|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); 813 814 type = 0xdeadbeef; 815 VariantInit( &types ); 816 hr = IWbemClassObject_Get( out, typesW, 0, &types, &type, NULL ); 817 ok( hr == S_OK, "failed to get names %08x\n", hr ); 818 ok( V_VT( &types ) == (VT_I4|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &types ) ); 819 ok( type == (CIM_SINT32|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); 820 821 VariantClear( &types ); 822 VariantClear( &names ); 823 VariantClear( &subkey ); 824 IWbemClassObject_Release( in ); 825 IWbemClassObject_Release( out ); 826 IWbemClassObject_Release( sig_in ); 827 828 hr = IWbemClassObject_GetMethod( reg, getstringvalueW, 0, &sig_in, NULL ); 829 ok( hr == S_OK, "failed to get GetStringValue method %08x\n", hr ); 830 831 hr = IWbemClassObject_SpawnInstance( sig_in, 0, &in ); 832 ok( hr == S_OK, "failed to spawn instance %08x\n", hr ); 833 834 V_VT( &defkey ) = VT_I4; 835 V_I4( &defkey ) = 0x80000002; 836 hr = IWbemClassObject_Put( in, defkeyW, 0, &defkey, 0 ); 837 ok( hr == S_OK, "failed to set root %08x\n", hr ); 838 839 V_VT( &subkey ) = VT_BSTR; 840 V_BSTR( &subkey ) = SysAllocString( windowsW ); 841 hr = IWbemClassObject_Put( in, subkeynameW, 0, &subkey, 0 ); 842 ok( hr == S_OK, "failed to set subkey %08x\n", hr ); 843 844 V_VT( &valuename ) = VT_BSTR; 845 V_BSTR( &valuename ) = SysAllocString( programfilesW ); 846 hr = IWbemClassObject_Put( in, valuenameW, 0, &valuename, 0 ); 847 ok( hr == S_OK, "failed to set value name %08x\n", hr ); 848 849 out = NULL; 850 method = SysAllocString( getstringvalueW ); 851 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, in, &out, NULL ); 852 ok( hr == S_OK, "failed to execute method %08x\n", hr ); 853 SysFreeString( method ); 854 855 type = 0xdeadbeef; 856 VariantInit( &retval ); 857 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, &type, NULL ); 858 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 859 ok( V_VT( &retval ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &retval ) ); 860 ok( !V_I4( &retval ), "unexpected error %u\n", V_I4( &retval ) ); 861 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 862 863 type = 0xdeadbeef; 864 VariantInit( &value ); 865 hr = IWbemClassObject_Get( out, valueW, 0, &value, &type, NULL ); 866 ok( hr == S_OK, "failed to get value %08x\n", hr ); 867 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 868 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 869 870 VariantClear( &value ); 871 VariantClear( &valuename ); 872 VariantClear( &subkey ); 873 IWbemClassObject_Release( in ); 874 IWbemClassObject_Release( out ); 875 IWbemClassObject_Release( sig_in ); 876 877 IWbemClassObject_Release( reg ); 878 SysFreeString( class ); 879 } 880 881 static HRESULT WINAPI sink_QueryInterface( 882 IWbemObjectSink *iface, REFIID riid, void **ppv ) 883 { 884 *ppv = NULL; 885 if (IsEqualGUID( &IID_IUnknown, riid ) || IsEqualGUID( &IID_IWbemObjectSink, riid )) 886 { 887 *ppv = iface; 888 IWbemObjectSink_AddRef( iface ); 889 return S_OK; 890 } 891 return E_NOINTERFACE; 892 } 893 894 static ULONG sink_refs; 895 896 static ULONG WINAPI sink_AddRef( 897 IWbemObjectSink *iface ) 898 { 899 return ++sink_refs; 900 } 901 902 static ULONG WINAPI sink_Release( 903 IWbemObjectSink *iface ) 904 { 905 return --sink_refs; 906 } 907 908 static HRESULT WINAPI sink_Indicate( 909 IWbemObjectSink *iface, LONG count, IWbemClassObject **objects ) 910 { 911 trace("Indicate: %d, %p\n", count, objects); 912 return S_OK; 913 } 914 915 static HRESULT WINAPI sink_SetStatus( 916 IWbemObjectSink *iface, LONG flags, HRESULT hresult, BSTR str_param, IWbemClassObject *obj_param ) 917 { 918 trace("SetStatus: %08x, %08x, %s, %p\n", flags, hresult, wine_dbgstr_w(str_param), obj_param); 919 return S_OK; 920 } 921 922 static IWbemObjectSinkVtbl sink_vtbl = 923 { 924 sink_QueryInterface, 925 sink_AddRef, 926 sink_Release, 927 sink_Indicate, 928 sink_SetStatus 929 }; 930 931 static IWbemObjectSink sink = { &sink_vtbl }; 932 933 static void test_notification_query_async( IWbemServices *services ) 934 { 935 static const WCHAR queryW[] = 936 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 937 'D','e','v','i','c','e','C','h','a','n','g','e','E','v','e','n','t',0}; 938 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 939 ULONG prev_sink_refs; 940 HRESULT hr; 941 942 hr = IWbemServices_ExecNotificationQueryAsync( services, wql, query, 0, NULL, NULL ); 943 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr ); 944 945 prev_sink_refs = sink_refs; 946 hr = IWbemServices_ExecNotificationQueryAsync( services, wql, query, 0, NULL, &sink ); 947 ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND), "got %08x\n", hr ); 948 ok( sink_refs > prev_sink_refs || broken(!sink_refs), "got %u refs\n", sink_refs ); 949 950 hr = IWbemServices_CancelAsyncCall( services, &sink ); 951 ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND), "got %08x\n", hr ); 952 953 SysFreeString( wql ); 954 SysFreeString( query ); 955 } 956 957 static void test_query_async( IWbemServices *services ) 958 { 959 static const WCHAR queryW[] = 960 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 961 'P','r','o','c','e','s','s',0}; 962 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 963 HRESULT hr; 964 965 hr = IWbemServices_ExecQueryAsync( services, wql, query, 0, NULL, NULL ); 966 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr ); 967 968 hr = IWbemServices_ExecQueryAsync( services, wql, query, 0, NULL, &sink ); 969 ok( hr == S_OK || broken(hr == WBEM_E_NOT_FOUND), "got %08x\n", hr ); 970 971 hr = IWbemServices_CancelAsyncCall( services, NULL ); 972 ok( hr == WBEM_E_INVALID_PARAMETER, "got %08x\n", hr ); 973 974 hr = IWbemServices_CancelAsyncCall( services, &sink ); 975 ok( hr == S_OK, "got %08x\n", hr ); 976 977 SysFreeString( wql ); 978 SysFreeString( query ); 979 } 980 981 static void test_GetNames( IWbemServices *services ) 982 { 983 static const WCHAR queryW[] = 984 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 985 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0}; 986 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 987 IEnumWbemClassObject *result; 988 HRESULT hr; 989 990 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 991 ok( hr == S_OK, "got %08x\n", hr ); 992 993 for (;;) 994 { 995 IWbemClassObject *obj; 996 SAFEARRAY *names; 997 ULONG count; 998 VARIANT val; 999 1000 IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1001 if (!count) break; 1002 1003 VariantInit( &val ); 1004 hr = IWbemClassObject_GetNames( obj, NULL, WBEM_FLAG_NONSYSTEM_ONLY, &val, &names ); 1005 ok( hr == S_OK, "got %08x\n", hr ); 1006 1007 SafeArrayDestroy( names ); 1008 IWbemClassObject_Release( obj ); 1009 } 1010 IEnumWbemClassObject_Release( result ); 1011 SysFreeString( query ); 1012 SysFreeString( wql ); 1013 } 1014 1015 static void test_SystemSecurity( IWbemServices *services ) 1016 { 1017 static const WCHAR systemsecurityW[] = {'_','_','S','y','s','t','e','m','S','e','c','u','r','i','t','y',0}; 1018 static const WCHAR getsdW[] = {'G','e','t','S','D',0}; 1019 static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; 1020 static const WCHAR sdW[] = {'S','D',0}; 1021 BSTR class = SysAllocString( systemsecurityW ), method; 1022 IWbemClassObject *reg, *out; 1023 VARIANT retval, var_sd; 1024 void *data; 1025 SECURITY_DESCRIPTOR_RELATIVE *sd; 1026 CIMTYPE type; 1027 HRESULT hr; 1028 BYTE sid_admin_buffer[SECURITY_MAX_SID_SIZE]; 1029 SID *sid_admin = (SID*)sid_admin_buffer; 1030 DWORD sid_size; 1031 BOOL ret; 1032 1033 hr = IWbemServices_GetObject( services, class, 0, NULL, ®, NULL ); 1034 if (hr != S_OK) 1035 { 1036 win_skip( "__SystemSecurity not available\n" ); 1037 return; 1038 } 1039 IWbemClassObject_Release( reg ); 1040 1041 sid_size = sizeof(sid_admin_buffer); 1042 ret = CreateWellKnownSid( WinBuiltinAdministratorsSid, NULL, sid_admin, &sid_size ); 1043 ok( ret, "CreateWellKnownSid failed\n" ); 1044 1045 out = NULL; 1046 method = SysAllocString( getsdW ); 1047 hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL ); 1048 ok( hr == S_OK || hr == WBEM_E_ACCESS_DENIED, "failed to execute method %08x\n", hr ); 1049 SysFreeString( method ); 1050 1051 if (SUCCEEDED(hr)) 1052 { 1053 type = 0xdeadbeef; 1054 VariantInit( &retval ); 1055 hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, &type, NULL ); 1056 ok( hr == S_OK, "failed to get return value %08x\n", hr ); 1057 ok( V_VT( &retval ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &retval ) ); 1058 ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) ); 1059 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 1060 1061 type = 0xdeadbeef; 1062 VariantInit( &var_sd ); 1063 hr = IWbemClassObject_Get( out, sdW, 0, &var_sd, &type, NULL ); 1064 ok( hr == S_OK, "failed to get names %08x\n", hr ); 1065 ok( V_VT( &var_sd ) == (VT_UI1|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &var_sd ) ); 1066 ok( type == (CIM_UINT8|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); 1067 1068 hr = SafeArrayAccessData( V_ARRAY( &var_sd ), &data ); 1069 ok( hr == S_OK, "SafeArrayAccessData failed %x\n", hr ); 1070 if (SUCCEEDED(hr)) 1071 { 1072 sd = data; 1073 1074 ok( (sd->Control & SE_SELF_RELATIVE) == SE_SELF_RELATIVE, "relative flag unset\n" ); 1075 ok( sd->Owner != 0, "no owner SID\n"); 1076 ok( sd->Group != 0, "no owner SID\n"); 1077 ok( EqualSid( (PSID)((LPBYTE)sd + sd->Owner), sid_admin ), "unexpected owner SID\n" ); 1078 ok( EqualSid( (PSID)((LPBYTE)sd + sd->Group), sid_admin ), "unexpected group SID\n" ); 1079 1080 hr = SafeArrayUnaccessData( V_ARRAY( &var_sd ) ); 1081 ok( hr == S_OK, "SafeArrayUnaccessData failed %x\n", hr ); 1082 } 1083 1084 VariantClear( &var_sd ); 1085 IWbemClassObject_Release( out ); 1086 } 1087 else if (hr == WBEM_E_ACCESS_DENIED) 1088 win_skip( "insufficient privs to test __SystemSecurity\n" ); 1089 1090 SysFreeString( class ); 1091 } 1092 1093 static void test_Win32_OperatingSystem( IWbemServices *services ) 1094 { 1095 static const WCHAR queryW[] = 1096 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 1097 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0}; 1098 static const WCHAR buildnumberW[] = {'B','u','i','l','d','N','u','m','b','e','r',0}; 1099 static const WCHAR captionW[] = {'C','a','p','t','i','o','n',0}; 1100 static const WCHAR csdversionW[] = {'C','S','D','V','e','r','s','i','o','n',0}; 1101 static const WCHAR freephysicalmemoryW[] = {'F','r','e','e','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; 1102 static const WCHAR nameW[] = {'N','a','m','e',0}; 1103 static const WCHAR osproductsuiteW[] = {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0}; 1104 static const WCHAR ostypeW[] = {'O','S','T','y','p','e',0}; 1105 static const WCHAR suitemaskW[] = {'S','u','i','t','e','M','a','s','k',0}; 1106 static const WCHAR versionW[] = {'V','e','r','s','i','o','n',0}; 1107 static const WCHAR servicepackmajorW[] = 1108 {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0}; 1109 static const WCHAR servicepackminorW[] = 1110 {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0}; 1111 static const WCHAR totalvisiblememorysizeW[] = 1112 {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0}; 1113 static const WCHAR totalvirtualmemorysizeW[] = 1114 {'T','o','t','a','l','V','i','r','t','u','a','l','M','e','m','o','r','y','S','i','z','e',0}; 1115 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 1116 IEnumWbemClassObject *result; 1117 IWbemClassObject *obj; 1118 CIMTYPE type; 1119 ULONG count; 1120 VARIANT val; 1121 HRESULT hr; 1122 1123 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 1124 ok( hr == S_OK, "IWbemServices_ExecQuery failed %08x\n", hr ); 1125 1126 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1127 ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); 1128 1129 type = 0xdeadbeef; 1130 VariantInit( &val ); 1131 hr = IWbemClassObject_Get( obj, buildnumberW, 0, &val, &type, NULL ); 1132 ok( hr == S_OK, "failed to get buildnumber %08x\n", hr ); 1133 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1134 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1135 trace( "buildnumber: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1136 VariantClear( &val ); 1137 1138 type = 0xdeadbeef; 1139 VariantInit( &val ); 1140 hr = IWbemClassObject_Get( obj, captionW, 0, &val, &type, NULL ); 1141 ok( hr == S_OK, "failed to get caption %08x\n", hr ); 1142 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1143 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1144 trace( "caption: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1145 VariantClear( &val ); 1146 1147 type = 0xdeadbeef; 1148 VariantInit( &val ); 1149 hr = IWbemClassObject_Get( obj, csdversionW, 0, &val, &type, NULL ); 1150 ok( hr == S_OK, "failed to get csdversion %08x\n", hr ); 1151 ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1152 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1153 trace( "csdversion: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1154 VariantClear( &val ); 1155 1156 type = 0xdeadbeef; 1157 VariantInit( &val ); 1158 hr = IWbemClassObject_Get( obj, freephysicalmemoryW, 0, &val, &type, NULL ); 1159 ok( hr == S_OK, "failed to get free physical memory size %08x\n", hr ); 1160 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1161 ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); 1162 trace( "freephysicalmemory %s\n", wine_dbgstr_w(V_BSTR(&val)) ); 1163 VariantClear( &val ); 1164 1165 type = 0xdeadbeef; 1166 VariantInit( &val ); 1167 hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); 1168 ok( hr == S_OK, "failed to get name %08x\n", hr ); 1169 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1170 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1171 trace( "name: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1172 VariantClear( &val ); 1173 1174 type = 0xdeadbeef; 1175 VariantInit( &val ); 1176 hr = IWbemClassObject_Get( obj, osproductsuiteW, 0, &val, &type, NULL ); 1177 ok( hr == S_OK, "failed to get osproductsuite %08x\n", hr ); 1178 ok( V_VT( &val ) == VT_I4 || broken(V_VT( &val ) == VT_NULL) /* winxp */, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1179 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 1180 trace( "osproductsuite: %d (%08x)\n", V_I4( &val ), V_I4( &val ) ); 1181 VariantClear( &val ); 1182 1183 type = 0xdeadbeef; 1184 VariantInit( &val ); 1185 hr = IWbemClassObject_Get( obj, ostypeW, 0, &val, &type, NULL ); 1186 ok( hr == S_OK, "failed to get ostype %08x\n", hr ); 1187 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1188 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1189 trace( "ostype: %d\n", V_I4( &val ) ); 1190 VariantClear( &val ); 1191 1192 type = 0xdeadbeef; 1193 VariantInit( &val ); 1194 hr = IWbemClassObject_Get( obj, servicepackmajorW, 0, &val, &type, NULL ); 1195 ok( hr == S_OK, "failed to get servicepackmajor %08x\n", hr ); 1196 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1197 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1198 trace( "servicepackmajor: %d\n", V_I4( &val ) ); 1199 VariantClear( &val ); 1200 1201 type = 0xdeadbeef; 1202 VariantInit( &val ); 1203 hr = IWbemClassObject_Get( obj, servicepackminorW, 0, &val, &type, NULL ); 1204 ok( hr == S_OK, "failed to get servicepackminor %08x\n", hr ); 1205 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1206 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1207 trace( "servicepackminor: %d\n", V_I4( &val ) ); 1208 VariantClear( &val ); 1209 1210 type = 0xdeadbeef; 1211 VariantInit( &val ); 1212 hr = IWbemClassObject_Get( obj, suitemaskW, 0, &val, &type, NULL ); 1213 ok( hr == S_OK, "failed to get suitemask %08x\n", hr ); 1214 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1215 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 1216 trace( "suitemask: %d (%08x)\n", V_I4( &val ), V_I4( &val ) ); 1217 VariantClear( &val ); 1218 1219 type = 0xdeadbeef; 1220 VariantInit( &val ); 1221 hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL ); 1222 ok( hr == S_OK, "failed to get version %08x\n", hr ); 1223 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1224 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1225 trace( "version: %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1226 VariantClear( &val ); 1227 1228 type = 0xdeadbeef; 1229 VariantInit( &val ); 1230 hr = IWbemClassObject_Get( obj, totalvisiblememorysizeW, 0, &val, &type, NULL ); 1231 ok( hr == S_OK, "failed to get visible memory size %08x\n", hr ); 1232 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1233 ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); 1234 trace( "totalvisiblememorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) ); 1235 VariantClear( &val ); 1236 1237 type = 0xdeadbeef; 1238 VariantInit( &val ); 1239 hr = IWbemClassObject_Get( obj, totalvirtualmemorysizeW, 0, &val, &type, NULL ); 1240 ok( hr == S_OK, "failed to get virtual memory size %08x\n", hr ); 1241 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1242 ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); 1243 trace( "totalvirtualmemorysize %s\n", wine_dbgstr_w(V_BSTR(&val)) ); 1244 VariantClear( &val ); 1245 1246 IWbemClassObject_Release( obj ); 1247 IEnumWbemClassObject_Release( result ); 1248 SysFreeString( query ); 1249 SysFreeString( wql ); 1250 } 1251 1252 static void test_Win32_ComputerSystemProduct( IWbemServices *services ) 1253 { 1254 static const WCHAR identifyingnumberW[] = 1255 {'I','d','e','n','t','i','f','y','i','n','g','N','u','m','b','e','r',0}; 1256 static const WCHAR nameW[] = 1257 {'N','a','m','e',0}; 1258 static const WCHAR skunumberW[] = 1259 {'S','K','U','N','u','m','b','e','r',0}; 1260 static const WCHAR uuidW[] = 1261 {'U','U','I','D',0}; 1262 static const WCHAR vendorW[] = 1263 {'V','e','n','d','o','r',0}; 1264 static const WCHAR versionW[] = 1265 {'V','e','r','s','i','o','n',0}; 1266 static const WCHAR queryW[] = 1267 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 1268 'C','o','m','p','u','t','e','r','S','y','s','t','e','m','P','r','o','d','u','c','t',0}; 1269 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 1270 IEnumWbemClassObject *result; 1271 IWbemClassObject *obj; 1272 VARIANT value; 1273 CIMTYPE type; 1274 HRESULT hr; 1275 DWORD count; 1276 1277 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 1278 if (hr != S_OK) 1279 { 1280 win_skip( "Win32_ComputerSystemProduct not available\n" ); 1281 return; 1282 } 1283 1284 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1285 ok( hr == S_OK, "got %08x\n", hr ); 1286 1287 type = 0xdeadbeef; 1288 VariantInit( &value ); 1289 hr = IWbemClassObject_Get( obj, identifyingnumberW, 0, &value, &type, NULL ); 1290 ok( hr == S_OK, "got %08x\n", hr ); 1291 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 1292 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1293 trace( "identifyingnumber %s\n", wine_dbgstr_w(V_BSTR(&value)) ); 1294 VariantClear( &value ); 1295 1296 type = 0xdeadbeef; 1297 VariantInit( &value ); 1298 hr = IWbemClassObject_Get( obj, nameW, 0, &value, &type, NULL ); 1299 ok( hr == S_OK, "got %08x\n", hr ); 1300 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 1301 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1302 trace( "name %s\n", wine_dbgstr_w(V_BSTR(&value)) ); 1303 VariantClear( &value ); 1304 1305 type = 0xdeadbeef; 1306 VariantInit( &value ); 1307 hr = IWbemClassObject_Get( obj, skunumberW, 0, &value, &type, NULL ); 1308 ok( hr == S_OK, "got %08x\n", hr ); 1309 ok( V_VT( &value ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &value ) ); 1310 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1311 VariantClear( &value ); 1312 1313 type = 0xdeadbeef; 1314 VariantInit( &value ); 1315 hr = IWbemClassObject_Get( obj, uuidW, 0, &value, &type, NULL ); 1316 ok( hr == S_OK, "got %08x\n", hr ); 1317 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 1318 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1319 trace( "uuid %s\n", wine_dbgstr_w(V_BSTR(&value)) ); 1320 VariantClear( &value ); 1321 1322 type = 0xdeadbeef; 1323 VariantInit( &value ); 1324 hr = IWbemClassObject_Get( obj, vendorW, 0, &value, &type, NULL ); 1325 ok( hr == S_OK, "got %08x\n", hr ); 1326 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 1327 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1328 trace( "vendor %s\n", wine_dbgstr_w(V_BSTR(&value)) ); 1329 VariantClear( &value ); 1330 1331 type = 0xdeadbeef; 1332 VariantInit( &value ); 1333 hr = IWbemClassObject_Get( obj, versionW, 0, &value, &type, NULL ); 1334 ok( hr == S_OK, "got %08x\n", hr ); 1335 ok( V_VT( &value ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &value ) ); 1336 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1337 trace( "version %s\n", wine_dbgstr_w(V_BSTR(&value)) ); 1338 VariantClear( &value ); 1339 1340 IWbemClassObject_Release( obj ); 1341 IEnumWbemClassObject_Release( result ); 1342 SysFreeString( query ); 1343 SysFreeString( wql ); 1344 } 1345 1346 static void test_Win32_PhysicalMemory( IWbemServices *services ) 1347 { 1348 static const WCHAR capacityW[] = {'C','a','p','a','c','i','t','y',0}; 1349 static const WCHAR memorytypeW[] = {'M','e','m','o','r','y','T','y','p','e',0}; 1350 static const WCHAR queryW[] = 1351 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 1352 'P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; 1353 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 1354 IEnumWbemClassObject *result; 1355 IWbemClassObject *obj; 1356 VARIANT val; 1357 CIMTYPE type; 1358 HRESULT hr; 1359 DWORD count; 1360 1361 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 1362 if (hr != S_OK) 1363 { 1364 win_skip( "Win32_PhysicalMemory not available\n" ); 1365 return; 1366 } 1367 1368 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1369 ok( hr == S_OK, "got %08x\n", hr ); 1370 1371 type = 0xdeadbeef; 1372 VariantInit( &val ); 1373 hr = IWbemClassObject_Get( obj, capacityW, 0, &val, &type, NULL ); 1374 ok( hr == S_OK, "failed to get capacity %08x\n", hr ); 1375 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1376 ok( type == CIM_UINT64, "unexpected type 0x%x\n", type ); 1377 trace( "capacity %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1378 VariantClear( &val ); 1379 1380 type = 0xdeadbeef; 1381 VariantInit( &val ); 1382 hr = IWbemClassObject_Get( obj, memorytypeW, 0, &val, &type, NULL ); 1383 ok( hr == S_OK, "failed to get memory type %08x\n", hr ); 1384 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1385 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1386 trace( "memorytype %u\n", V_I4( &val ) ); 1387 VariantClear( &val ); 1388 1389 IWbemClassObject_Release( obj ); 1390 IEnumWbemClassObject_Release( result ); 1391 SysFreeString( query ); 1392 SysFreeString( wql ); 1393 } 1394 1395 static void test_Win32_IP4RouteTable( IWbemServices *services ) 1396 { 1397 static const WCHAR destinationW[] = {'D','e','s','t','i','n','a','t','i','o','n',0}; 1398 static const WCHAR interfaceindexW[] = {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0}; 1399 static const WCHAR nexthopW[] = {'N','e','x','t','H','o','p',0}; 1400 static const WCHAR queryW[] = 1401 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 1402 'I','P','4','R','o','u','t','e','T','a','b','l','e',0}; 1403 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 1404 IEnumWbemClassObject *result; 1405 IWbemClassObject *obj; 1406 VARIANT val; 1407 CIMTYPE type; 1408 HRESULT hr; 1409 DWORD count; 1410 1411 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 1412 if (hr != S_OK) 1413 { 1414 win_skip( "Win32_IP4RouteTable not available\n" ); 1415 return; 1416 } 1417 1418 for (;;) 1419 { 1420 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1421 if (hr != S_OK) break; 1422 1423 type = 0xdeadbeef; 1424 VariantInit( &val ); 1425 hr = IWbemClassObject_Get( obj, destinationW, 0, &val, &type, NULL ); 1426 ok( hr == S_OK, "failed to get destination %08x\n", hr ); 1427 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1428 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1429 trace( "destination %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1430 VariantClear( &val ); 1431 1432 type = 0xdeadbeef; 1433 VariantInit( &val ); 1434 hr = IWbemClassObject_Get( obj, interfaceindexW, 0, &val, &type, NULL ); 1435 ok( hr == S_OK, "failed to get interface index %08x\n", hr ); 1436 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1437 ok( type == CIM_SINT32, "unexpected type 0x%x\n", type ); 1438 trace( "interfaceindex %d\n", V_I4( &val ) ); 1439 VariantClear( &val ); 1440 1441 type = 0xdeadbeef; 1442 VariantInit( &val ); 1443 hr = IWbemClassObject_Get( obj, nexthopW, 0, &val, &type, NULL ); 1444 ok( hr == S_OK, "failed to get nexthop %08x\n", hr ); 1445 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1446 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1447 trace( "nexthop %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1448 VariantClear( &val ); 1449 1450 IWbemClassObject_Release( obj ); 1451 } 1452 1453 SysFreeString( query ); 1454 SysFreeString( wql ); 1455 } 1456 1457 static void test_Win32_Processor( IWbemServices *services ) 1458 { 1459 static const WCHAR architectureW[] = 1460 {'A','r','c','h','i','t','e','c','t','u','r','e',0}; 1461 static const WCHAR familyW[] = 1462 {'F','a','m','i','l','y',0}; 1463 static const WCHAR levelW[] = 1464 {'L','e','v','e','l',0}; 1465 static const WCHAR manufacturerW[] = 1466 {'M','a','n','u','f','a','c','t','u','r','e','r',0}; 1467 static const WCHAR nameW[] = 1468 {'N','a','m','e',0}; 1469 static const WCHAR processoridW[] = 1470 {'P','r','o','c','e','s','s','o','r','I','d',0}; 1471 static const WCHAR revisionW[] = 1472 {'R','e','v','i','s','i','o','n',0}; 1473 static const WCHAR versionW[] = 1474 {'V','e','r','s','i','o','n',0}; 1475 static const WCHAR queryW[] = 1476 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 1477 'P','r','o','c','e','s','s','o','r',0}; 1478 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 1479 IEnumWbemClassObject *result; 1480 IWbemClassObject *obj; 1481 VARIANT val; 1482 CIMTYPE type; 1483 HRESULT hr; 1484 DWORD count; 1485 1486 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 1487 ok( hr == S_OK, "got %08x\n", hr ); 1488 1489 for (;;) 1490 { 1491 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1492 if (hr != S_OK) break; 1493 1494 type = 0xdeadbeef; 1495 VariantInit( &val ); 1496 hr = IWbemClassObject_Get( obj, architectureW, 0, &val, &type, NULL ); 1497 ok( hr == S_OK, "got %08x\n", hr ); 1498 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1499 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1500 trace( "architecture %u\n", V_I4( &val ) ); 1501 1502 type = 0xdeadbeef; 1503 VariantInit( &val ); 1504 hr = IWbemClassObject_Get( obj, familyW, 0, &val, &type, NULL ); 1505 ok( hr == S_OK, "got %08x\n", hr ); 1506 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1507 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1508 trace( "family %u\n", V_I4( &val ) ); 1509 1510 type = 0xdeadbeef; 1511 VariantInit( &val ); 1512 hr = IWbemClassObject_Get( obj, levelW, 0, &val, &type, NULL ); 1513 ok( hr == S_OK, "got %08x\n", hr ); 1514 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1515 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1516 trace( "level %u\n", V_I4( &val ) ); 1517 1518 type = 0xdeadbeef; 1519 VariantInit( &val ); 1520 hr = IWbemClassObject_Get( obj, manufacturerW, 0, &val, &type, NULL ); 1521 ok( hr == S_OK, "got %08x\n", hr ); 1522 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1523 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1524 trace( "manufacturer %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1525 VariantClear( &val ); 1526 1527 type = 0xdeadbeef; 1528 VariantInit( &val ); 1529 hr = IWbemClassObject_Get( obj, nameW, 0, &val, &type, NULL ); 1530 ok( hr == S_OK, "got %08x\n", hr ); 1531 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1532 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1533 trace( "name %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1534 VariantClear( &val ); 1535 1536 type = 0xdeadbeef; 1537 VariantInit( &val ); 1538 hr = IWbemClassObject_Get( obj, processoridW, 0, &val, &type, NULL ); 1539 ok( hr == S_OK, "got %08x\n", hr ); 1540 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1541 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1542 trace( "processorid %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1543 VariantClear( &val ); 1544 1545 type = 0xdeadbeef; 1546 VariantInit( &val ); 1547 hr = IWbemClassObject_Get( obj, revisionW, 0, &val, &type, NULL ); 1548 ok( hr == S_OK, "got %08x\n", hr ); 1549 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1550 ok( type == CIM_UINT16, "unexpected type 0x%x\n", type ); 1551 trace( "revision %u\n", V_I4( &val ) ); 1552 1553 type = 0xdeadbeef; 1554 VariantInit( &val ); 1555 hr = IWbemClassObject_Get( obj, versionW, 0, &val, &type, NULL ); 1556 ok( hr == S_OK, "got %08x\n", hr ); 1557 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1558 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1559 trace( "version %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1560 VariantClear( &val ); 1561 1562 IWbemClassObject_Release( obj ); 1563 } 1564 1565 SysFreeString( query ); 1566 SysFreeString( wql ); 1567 } 1568 1569 static void test_Win32_VideoController( IWbemServices *services ) 1570 { 1571 static const WCHAR configmanagererrorcodeW[] = 1572 {'C','o','n','f','i','g','M','a','n','a','g','e','r','E','r','r','o','r','C','o','d','e',0}; 1573 static const WCHAR driverdateW[] = 1574 {'D','r','i','v','e','r','D','a','t','e',0}; 1575 static const WCHAR installeddisplaydriversW[]= 1576 {'I','n','s','t','a','l','l','e','d','D','i','s','p','l','a','y','D','r','i','v','e','r','s',0}; 1577 static const WCHAR statusW[] = 1578 {'S','t','a','t','u','s',0}; 1579 static const WCHAR queryW[] = 1580 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 1581 'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0}; 1582 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 1583 IEnumWbemClassObject *result; 1584 IWbemClassObject *obj; 1585 VARIANT val; 1586 CIMTYPE type; 1587 HRESULT hr; 1588 DWORD count; 1589 1590 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 1591 if (hr != S_OK) 1592 { 1593 win_skip( "Win32_VideoController not available\n" ); 1594 return; 1595 } 1596 1597 for (;;) 1598 { 1599 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1600 if (hr != S_OK) break; 1601 1602 type = 0xdeadbeef; 1603 VariantInit( &val ); 1604 hr = IWbemClassObject_Get( obj, configmanagererrorcodeW, 0, &val, &type, NULL ); 1605 ok( hr == S_OK, "got %08x\n", hr ); 1606 ok( V_VT( &val ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1607 ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); 1608 trace( "configmanagererrorcode %d\n", V_I4( &val ) ); 1609 1610 type = 0xdeadbeef; 1611 VariantInit( &val ); 1612 hr = IWbemClassObject_Get( obj, driverdateW, 0, &val, &type, NULL ); 1613 ok( hr == S_OK, "got %08x\n", hr ); 1614 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1615 ok( type == CIM_DATETIME, "unexpected type 0x%x\n", type ); 1616 trace( "driverdate %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1617 VariantClear( &val ); 1618 1619 type = 0xdeadbeef; 1620 VariantInit( &val ); 1621 hr = IWbemClassObject_Get( obj, installeddisplaydriversW, 0, &val, &type, NULL ); 1622 ok( hr == S_OK, "got %08x\n", hr ); 1623 ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1624 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1625 trace( "installeddisplaydrivers %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1626 VariantClear( &val ); 1627 1628 type = 0xdeadbeef; 1629 VariantInit( &val ); 1630 hr = IWbemClassObject_Get( obj, statusW, 0, &val, &type, NULL ); 1631 ok( hr == S_OK, "got %08x\n", hr ); 1632 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1633 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1634 trace( "status %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1635 VariantClear( &val ); 1636 1637 IWbemClassObject_Release( obj ); 1638 } 1639 1640 SysFreeString( query ); 1641 SysFreeString( wql ); 1642 } 1643 1644 static void test_Win32_Printer( IWbemServices *services ) 1645 { 1646 static const WCHAR deviceidW[] = 1647 {'D','e','v','i','c','e','I','d',0}; 1648 static const WCHAR locationW[] = 1649 {'L','o','c','a','t','i','o','n',0}; 1650 static const WCHAR portnameW[] = 1651 {'P','o','r','t','N','a','m','e',0}; 1652 static const WCHAR queryW[] = 1653 {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', 1654 'P','r','i','n','t','e','r',0}; 1655 BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); 1656 IEnumWbemClassObject *result; 1657 IWbemClassObject *obj; 1658 VARIANT val; 1659 CIMTYPE type; 1660 HRESULT hr; 1661 DWORD count; 1662 1663 hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); 1664 if (hr != S_OK) 1665 { 1666 win_skip( "Win32_Printer not available\n" ); 1667 return; 1668 } 1669 1670 for (;;) 1671 { 1672 hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); 1673 if (hr != S_OK) break; 1674 1675 type = 0xdeadbeef; 1676 memset( &val, 0, sizeof(val) ); 1677 hr = IWbemClassObject_Get( obj, deviceidW, 0, &val, &type, NULL ); 1678 ok( hr == S_OK, "got %08x\n", hr ); 1679 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1680 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1681 trace( "deviceid %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1682 VariantClear( &val ); 1683 1684 type = 0xdeadbeef; 1685 memset( &val, 0, sizeof(val) ); 1686 hr = IWbemClassObject_Get( obj, locationW, 0, &val, &type, NULL ); 1687 ok( hr == S_OK, "got %08x\n", hr ); 1688 ok( V_VT( &val ) == VT_BSTR || V_VT( &val ) == VT_NULL, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1689 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1690 trace( "location %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1691 VariantClear( &val ); 1692 1693 type = 0xdeadbeef; 1694 memset( &val, 0, sizeof(val) ); 1695 hr = IWbemClassObject_Get( obj, portnameW, 0, &val, &type, NULL ); 1696 ok( hr == S_OK, "got %08x\n", hr ); 1697 ok( V_VT( &val ) == VT_BSTR, "unexpected variant type 0x%x\n", V_VT( &val ) ); 1698 ok( type == CIM_STRING, "unexpected type 0x%x\n", type ); 1699 trace( "portname %s\n", wine_dbgstr_w(V_BSTR( &val )) ); 1700 VariantClear( &val ); 1701 1702 IWbemClassObject_Release( obj ); 1703 } 1704 1705 SysFreeString( query ); 1706 SysFreeString( wql ); 1707 } 1708 1709 START_TEST(query) 1710 { 1711 static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; 1712 BSTR path = SysAllocString( cimv2W ); 1713 IWbemLocator *locator; 1714 IWbemServices *services; 1715 HRESULT hr; 1716 1717 CoInitialize( NULL ); 1718 CoInitializeSecurity( NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, 1719 RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL ); 1720 hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, 1721 (void **)&locator ); 1722 if (hr != S_OK) 1723 { 1724 win_skip("can't create instance of WbemLocator\n"); 1725 return; 1726 } 1727 hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services ); 1728 ok( hr == S_OK, "failed to get IWbemServices interface %08x\n", hr ); 1729 1730 hr = CoSetProxyBlanket( (IUnknown *)services, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, 1731 RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); 1732 ok( hr == S_OK, "failed to set proxy blanket %08x\n", hr ); 1733 1734 test_select( services ); 1735 test_associators( services ); 1736 test_Win32_Bios( services ); 1737 test_Win32_Process( services ); 1738 test_Win32_Service( services ); 1739 test_Win32_ComputerSystem( services ); 1740 test_Win32_SystemEnclosure( services ); 1741 test_StdRegProv( services ); 1742 test_notification_query_async( services ); 1743 test_query_async( services ); 1744 test_GetNames( services ); 1745 test_SystemSecurity( services ); 1746 test_Win32_OperatingSystem( services ); 1747 test_Win32_ComputerSystemProduct( services ); 1748 test_Win32_PhysicalMemory( services ); 1749 test_Win32_IP4RouteTable( services ); 1750 test_Win32_Processor( services ); 1751 test_Win32_VideoController( services ); 1752 test_Win32_Printer( services ); 1753 1754 SysFreeString( path ); 1755 IWbemServices_Release( services ); 1756 IWbemLocator_Release( locator ); 1757 CoUninitialize(); 1758 } 1759