2 * Copyright 2012 Hans Leidekker for CodeWeavers
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.
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.
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
20 #define NONAMELESSUNION
21 #define NONAMELESSSTRUCT
27 #define WIN32_NO_STATUS
41 #include "wine/debug.h"
42 #include "wbemprox_private.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
46 static const WCHAR class_baseboardW[] =
47 {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0};
48 static const WCHAR class_biosW[] =
49 {'W','i','n','3','2','_','B','I','O','S',0};
50 static const WCHAR class_cdromdriveW[] =
51 {'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0};
52 static const WCHAR class_compsysW[] =
53 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
54 static const WCHAR class_diskdriveW[] =
55 {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0};
56 static const WCHAR class_logicaldiskW[] =
57 {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
58 static const WCHAR class_networkadapterW[] =
59 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
60 static const WCHAR class_osW[] =
61 {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
62 static const WCHAR class_paramsW[] =
63 {'_','_','P','A','R','A','M','E','T','E','R','S',0};
64 static const WCHAR class_qualifiersW[] =
65 {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
66 static const WCHAR class_process_getowner_outW[] =
67 {'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W',
68 'N','E','R','_','O','U','T',0};
69 static const WCHAR class_processorW[] =
70 {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
71 static const WCHAR class_sounddeviceW[] =
72 {'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0};
73 static const WCHAR class_videocontrollerW[] =
74 {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
76 static const WCHAR prop_adaptertypeW[] =
77 {'A','d','a','p','t','e','r','T','y','p','e',0};
78 static const WCHAR prop_acceptpauseW[] =
79 {'A','c','c','e','p','t','P','a','u','s','e',0};
80 static const WCHAR prop_acceptstopW[] =
81 {'A','c','c','e','p','t','S','t','o','p',0};
82 static const WCHAR prop_adapterramW[] =
83 {'A','d','a','p','t','e','r','R','A','M',0};
84 static const WCHAR prop_captionW[] =
85 {'C','a','p','t','i','o','n',0};
86 static const WCHAR prop_classW[] =
87 {'C','l','a','s','s',0};
88 static const WCHAR prop_commandlineW[] =
89 {'C','o','m','m','a','n','d','L','i','n','e',0};
90 static const WCHAR prop_cpustatusW[] =
91 {'C','p','u','S','t','a','t','u','s',0};
92 static const WCHAR prop_csdversionW[] =
93 {'C','S','D','V','e','r','s','i','o','n',0};
94 static const WCHAR prop_currentbitsperpixelW[] =
95 {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
96 static const WCHAR prop_currenthorizontalresW[] =
97 {'C','u','r','r','e','n','t','H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
98 static const WCHAR prop_currentverticalresW[] =
99 {'C','u','r','r','e','n','t','V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0};
100 static const WCHAR prop_defaultvalueW[] =
101 {'D','e','f','a','u','l','t','V','a','l','u','e',0};
102 static const WCHAR prop_descriptionW[] =
103 {'D','e','s','c','r','i','p','t','i','o','n',0};
104 static const WCHAR prop_deviceidW[] =
105 {'D','e','v','i','c','e','I','d',0};
106 static const WCHAR prop_directionW[] =
107 {'D','i','r','e','c','t','i','o','n',0};
108 static const WCHAR prop_displaynameW[] =
109 {'D','i','s','p','l','a','y','N','a','m','e',0};
110 static const WCHAR prop_domainW[] =
111 {'D','o','m','a','i','n',0};
112 static const WCHAR prop_domainroleW[] =
113 {'D','o','m','a','i','n','R','o','l','e',0};
114 static const WCHAR prop_drivetypeW[] =
115 {'D','r','i','v','e','T','y','p','e',0};
116 static const WCHAR prop_filesystemW[] =
117 {'F','i','l','e','S','y','s','t','e','m',0};
118 static const WCHAR prop_flavorW[] =
119 {'F','l','a','v','o','r',0};
120 static const WCHAR prop_freespaceW[] =
121 {'F','r','e','e','S','p','a','c','e',0};
122 static const WCHAR prop_handleW[] =
123 {'H','a','n','d','l','e',0};
124 static const WCHAR prop_idW[] =
126 static const WCHAR prop_interfaceindexW[] =
127 {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
128 static const WCHAR prop_intvalueW[] =
129 {'I','n','t','e','g','e','r','V','a','l','u','e',0};
130 static const WCHAR prop_lastbootuptimeW[] =
131 {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
132 static const WCHAR prop_macaddressW[] =
133 {'M','A','C','A','d','d','r','e','s','s',0};
134 static const WCHAR prop_manufacturerW[] =
135 {'M','a','n','u','f','a','c','t','u','r','e','r',0};
136 static const WCHAR prop_maxclockspeedW[] =
137 {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
138 static const WCHAR prop_memberW[] =
139 {'M','e','m','b','e','r',0};
140 static const WCHAR prop_methodW[] =
141 {'M','e','t','h','o','d',0};
142 static const WCHAR prop_modelW[] =
143 {'M','o','d','e','l',0};
144 static const WCHAR prop_netconnectionstatusW[] =
145 {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
146 static const WCHAR prop_numlogicalprocessorsW[] =
147 {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0};
148 static const WCHAR prop_numprocessorsW[] =
149 {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
150 static const WCHAR prop_osarchitectureW[] =
151 {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
152 static const WCHAR prop_oslanguageW[] =
153 {'O','S','L','a','n','g','u','a','g','e',0};
154 static const WCHAR prop_parameterW[] =
155 {'P','a','r','a','m','e','t','e','r',0};
156 static const WCHAR prop_pnpdeviceidW[] =
157 {'P','N','P','D','e','v','i','c','e','I','D',0};
158 static const WCHAR prop_pprocessidW[] =
159 {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
160 static const WCHAR prop_processidW[] =
161 {'P','r','o','c','e','s','s','I','D',0};
162 static const WCHAR prop_processoridW[] =
163 {'P','r','o','c','e','s','s','o','r','I','d',0};
164 static const WCHAR prop_productnameW[] =
165 {'P','r','o','d','u','c','t','N','a','m','e',0};
166 static const WCHAR prop_releasedateW[] =
167 {'R','e','l','e','a','s','e','D','a','t','e',0};
168 static const WCHAR prop_serialnumberW[] =
169 {'S','e','r','i','a','l','N','u','m','b','e','r',0};
170 static const WCHAR prop_servicetypeW[] =
171 {'S','e','r','v','i','c','e','T','y','p','e',0};
172 static const WCHAR prop_startmodeW[] =
173 {'S','t','a','r','t','M','o','d','e',0};
174 static const WCHAR prop_sizeW[] =
176 static const WCHAR prop_speedW[] =
177 {'S','p','e','e','d',0};
178 static const WCHAR prop_stateW[] =
179 {'S','t','a','t','e',0};
180 static const WCHAR prop_strvalueW[] =
181 {'S','t','r','i','n','g','V','a','l','u','e',0};
182 static const WCHAR prop_systemdirectoryW[] =
183 {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
184 static const WCHAR prop_systemnameW[] =
185 {'S','y','s','t','e','m','N','a','m','e',0};
186 static const WCHAR prop_tagW[] =
188 static const WCHAR prop_threadcountW[] =
189 {'T','h','r','e','a','d','C','o','u','n','t',0};
190 static const WCHAR prop_totalphysicalmemoryW[] =
191 {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
192 static const WCHAR prop_typeW[] =
194 static const WCHAR prop_uniqueidW[] =
195 {'U','n','i','q','u','e','I','d',0};
196 static const WCHAR prop_varianttypeW[] =
197 {'V','a','r','i','a','n','t','T','y','p','e',0};
198 static const WCHAR prop_versionW[] =
199 {'V','e','r','s','i','o','n',0};
201 /* column definitions must be kept in sync with record structures below */
202 static const struct column col_baseboard[] =
204 { prop_manufacturerW, CIM_STRING },
205 { prop_serialnumberW, CIM_STRING },
206 { prop_tagW, CIM_STRING|COL_FLAG_KEY }
208 static const struct column col_bios[] =
210 { prop_descriptionW, CIM_STRING },
211 { prop_manufacturerW, CIM_STRING },
212 { prop_releasedateW, CIM_DATETIME },
213 { prop_serialnumberW, CIM_STRING },
214 { prop_versionW, CIM_STRING|COL_FLAG_KEY }
216 static const struct column col_cdromdrive[] =
218 { prop_nameW, CIM_STRING }
220 static const struct column col_compsys[] =
222 { prop_descriptionW, CIM_STRING },
223 { prop_domainW, CIM_STRING },
224 { prop_domainroleW, CIM_UINT16 },
225 { prop_manufacturerW, CIM_STRING },
226 { prop_modelW, CIM_STRING },
227 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
228 { prop_numprocessorsW, CIM_UINT32, VT_I4 },
229 { prop_totalphysicalmemoryW, CIM_UINT64 }
231 static const struct column col_diskdrive[] =
233 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
234 { prop_manufacturerW, CIM_STRING },
235 { prop_modelW, CIM_STRING },
236 { prop_serialnumberW, CIM_STRING }
238 static const struct column col_logicaldisk[] =
240 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
241 { prop_drivetypeW, CIM_UINT32, VT_I4 },
242 { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC },
243 { prop_freespaceW, CIM_UINT64 },
244 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
245 { prop_sizeW, CIM_UINT64 }
247 static const struct column col_networkadapter[] =
249 { prop_adaptertypeW, CIM_STRING },
250 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
251 { prop_interfaceindexW, CIM_UINT32, VT_I4 },
252 { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
253 { prop_manufacturerW, CIM_STRING },
254 { prop_netconnectionstatusW, CIM_UINT16, VT_I4 },
255 { prop_pnpdeviceidW, CIM_STRING },
256 { prop_speedW, CIM_UINT64 }
258 static const struct column col_os[] =
260 { prop_captionW, CIM_STRING },
261 { prop_csdversionW, CIM_STRING },
262 { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
263 { prop_osarchitectureW, CIM_STRING },
264 { prop_oslanguageW, CIM_UINT32, VT_I4 },
265 { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC }
267 static const struct column col_param[] =
269 { prop_classW, CIM_STRING },
270 { prop_methodW, CIM_STRING },
271 { prop_directionW, CIM_SINT32 },
272 { prop_parameterW, CIM_STRING },
273 { prop_typeW, CIM_UINT32 },
274 { prop_varianttypeW, CIM_UINT32 },
275 { prop_defaultvalueW, CIM_UINT32 }
277 static const struct column col_process[] =
279 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
280 { prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC },
281 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
282 { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
283 { prop_pprocessidW, CIM_UINT32, VT_I4 },
284 { prop_processidW, CIM_UINT32, VT_I4 },
285 { prop_threadcountW, CIM_UINT32, VT_I4 },
287 { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
289 static const struct column col_processor[] =
291 { prop_cpustatusW, CIM_UINT16 },
292 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
293 { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
294 { prop_maxclockspeedW, CIM_UINT32, VT_I4 },
295 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
296 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
297 { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC },
298 { prop_uniqueidW, CIM_STRING }
300 static const struct column col_qualifier[] =
302 { prop_classW, CIM_STRING },
303 { prop_memberW, CIM_STRING },
304 { prop_typeW, CIM_UINT32 },
305 { prop_flavorW, CIM_SINT32 },
306 { prop_nameW, CIM_STRING },
307 { prop_intvalueW, CIM_SINT32 },
308 { prop_strvalueW, CIM_STRING }
310 static const struct column col_service[] =
312 { prop_acceptpauseW, CIM_BOOLEAN },
313 { prop_acceptstopW, CIM_BOOLEAN },
314 { prop_displaynameW, CIM_STRING|COL_FLAG_DYNAMIC },
315 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
316 { prop_processidW, CIM_UINT32 },
317 { prop_servicetypeW, CIM_STRING },
318 { prop_startmodeW, CIM_STRING },
319 { prop_stateW, CIM_STRING },
320 { prop_systemnameW, CIM_STRING|COL_FLAG_DYNAMIC },
322 { method_pauseserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
323 { method_resumeserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
324 { method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
325 { method_stopserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
327 static const struct column col_sounddevice[] =
329 { prop_productnameW, CIM_STRING }
331 static const struct column col_stdregprov[] =
333 { method_enumkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
334 { method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
335 { method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
337 static const struct column col_videocontroller[] =
339 { prop_adapterramW, CIM_UINT32 },
340 { prop_currentbitsperpixelW, CIM_UINT32 },
341 { prop_currenthorizontalresW, CIM_UINT32 },
342 { prop_currentverticalresW, CIM_UINT32 },
343 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
344 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
345 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }
348 static const WCHAR baseboard_manufacturerW[] =
349 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
350 static const WCHAR baseboard_serialnumberW[] =
352 static const WCHAR baseboard_tagW[] =
353 {'B','a','s','e',' ','B','o','a','r','d',0};
354 static const WCHAR bios_descriptionW[] =
355 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
356 static const WCHAR bios_manufacturerW[] =
357 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
358 static const WCHAR bios_releasedateW[] =
359 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
360 static const WCHAR bios_serialnumberW[] =
362 static const WCHAR bios_versionW[] =
363 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
364 static const WCHAR cdromdrive_nameW[] =
365 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
366 static const WCHAR compsys_descriptionW[] =
367 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
368 static const WCHAR compsys_domainW[] =
369 {'W','O','R','K','G','R','O','U','P',0};
370 static const WCHAR compsys_manufacturerW[] =
371 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
372 static const WCHAR compsys_modelW[] =
374 static const WCHAR diskdrive_deviceidW[] =
375 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
376 static const WCHAR diskdrive_modelW[] =
377 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
378 static const WCHAR diskdrive_manufacturerW[] =
379 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
380 static const WCHAR networkadapter_pnpdeviceidW[]=
381 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
382 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
383 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
384 static const WCHAR os_captionW[] =
385 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
386 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
387 static const WCHAR os_csdversionW[] =
388 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
389 static const WCHAR os_32bitW[] =
390 {'3','2','-','b','i','t',0};
391 static const WCHAR os_64bitW[] =
392 {'6','4','-','b','i','t',0};
393 static const WCHAR sounddevice_productnameW[] =
394 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
395 static const WCHAR videocontroller_deviceidW[] =
396 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
398 #include "pshpack1.h"
399 struct record_baseboard
401 const WCHAR *manufacturer;
402 const WCHAR *serialnumber;
407 const WCHAR *description;
408 const WCHAR *manufacturer;
409 const WCHAR *releasedate;
410 const WCHAR *serialnumber;
411 const WCHAR *version;
413 struct record_cdromdrive
417 struct record_computersystem
419 const WCHAR *description;
422 const WCHAR *manufacturer;
424 UINT32 num_logical_processors;
425 UINT32 num_processors;
426 UINT64 total_physical_memory;
428 struct record_diskdrive
430 const WCHAR *device_id;
431 const WCHAR *manufacturer;
433 const WCHAR *serialnumber;
435 struct record_logicaldisk
437 const WCHAR *device_id;
439 const WCHAR *filesystem;
444 struct record_networkadapter
446 const WCHAR *adaptertype;
447 const WCHAR *device_id;
448 INT32 interface_index;
449 const WCHAR *mac_address;
450 const WCHAR *manufacturer;
451 UINT16 netconnection_status;
452 const WCHAR *pnpdevice_id;
455 struct record_operatingsystem
457 const WCHAR *caption;
458 const WCHAR *csdversion;
459 const WCHAR *lastbootuptime;
460 const WCHAR *osarchitecture;
462 const WCHAR *systemdirectory;
469 const WCHAR *parameter;
474 struct record_process
476 const WCHAR *caption;
477 const WCHAR *commandline;
478 const WCHAR *description;
484 class_method *get_owner;
486 struct record_processor
489 const WCHAR *device_id;
490 const WCHAR *manufacturer;
491 UINT32 maxclockspeed;
493 UINT32 num_logical_processors;
494 const WCHAR *processor_id;
495 const WCHAR *unique_id;
497 struct record_qualifier
505 const WCHAR *strvalue;
507 struct record_service
511 const WCHAR *displayname;
514 const WCHAR *servicetype;
515 const WCHAR *startmode;
517 const WCHAR *systemname;
519 class_method *pause_service;
520 class_method *resume_service;
521 class_method *start_service;
522 class_method *stop_service;
524 struct record_sounddevice
526 const WCHAR *productname;
528 struct record_stdregprov
530 class_method *enumkey;
531 class_method *enumvalues;
532 class_method *getstringvalue;
534 struct record_videocontroller
537 UINT32 current_bitsperpixel;
538 UINT32 current_horizontalres;
539 UINT32 current_verticalres;
540 const WCHAR *description;
541 const WCHAR *device_id;
546 static const struct record_baseboard data_baseboard[] =
548 { baseboard_manufacturerW, baseboard_serialnumberW, baseboard_tagW }
550 static const struct record_bios data_bios[] =
552 { bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW, bios_versionW }
554 static const struct record_cdromdrive data_cdromdrive[] =
558 static const struct record_diskdrive data_diskdrive[] =
560 { diskdrive_deviceidW, diskdrive_manufacturerW, diskdrive_modelW }
562 static const struct record_param data_param[] =
564 { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
565 { class_processW, method_getownerW, -1, param_userW, CIM_STRING },
566 { class_processW, method_getownerW, -1, param_domainW, CIM_STRING },
567 { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
568 { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
569 { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
570 { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
571 { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
572 { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING },
573 { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
574 { class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
575 { class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
576 { class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING },
577 { class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
578 { class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
579 { class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY },
580 { class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
581 { class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING },
582 { class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING },
583 { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
584 { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING }
587 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
588 WBEM_FLAVOR_ORIGIN_PROPAGATED)
590 static const struct record_qualifier data_qualifier[] =
592 { class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 },
593 { class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 }
595 static const struct record_sounddevice data_sounddevice[] =
597 { sounddevice_productnameW }
599 static const struct record_stdregprov data_stdregprov[] =
601 { reg_enum_key, reg_enum_values, reg_get_stringvalue }
604 static UINT get_processor_count(void)
606 SYSTEM_BASIC_INFORMATION info;
608 if (NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )) return 1;
609 return info.NumberOfProcessors;
612 static UINT get_logical_processor_count(void)
614 SYSTEM_LOGICAL_PROCESSOR_INFORMATION *info;
615 UINT i, j, count = 0;
619 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, NULL, 0, &len );
620 if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count();
622 if (!(info = heap_alloc( len ))) return get_processor_count();
623 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, info, len, &len );
624 if (status != STATUS_SUCCESS)
627 return get_processor_count();
629 for (i = 0; i < len / sizeof(*info); i++)
631 if (info[i].Relationship != RelationProcessorCore) continue;
632 for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) count++;
638 static UINT64 get_total_physical_memory(void)
640 MEMORYSTATUSEX status;
642 status.dwLength = sizeof(status);
643 if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
644 return status.ullTotalPhys;
647 static void fill_compsys( struct table *table )
649 struct record_computersystem *rec;
651 if (!(table->data = heap_alloc( sizeof(*rec) ))) return;
653 rec = (struct record_computersystem *)table->data;
654 rec->description = compsys_descriptionW;
655 rec->domain = compsys_domainW;
656 rec->domainrole = 0; /* standalone workstation */
657 rec->manufacturer = compsys_manufacturerW;
658 rec->model = compsys_modelW;
659 rec->num_logical_processors = get_logical_processor_count();
660 rec->num_processors = get_processor_count();
661 rec->total_physical_memory = get_total_physical_memory();
663 TRACE("created 1 row\n");
667 static WCHAR *get_filesystem( const WCHAR *root )
669 static const WCHAR ntfsW[] = {'N','T','F','S',0};
670 WCHAR buffer[MAX_PATH + 1];
672 if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
673 return heap_strdupW( buffer );
674 return heap_strdupW( ntfsW );
677 static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
679 WCHAR root[] = {'\\','\\','.','\\','A',':',0};
681 DISK_GEOMETRY_EX info;
684 free.QuadPart = 512 * 1024 * 1024;
685 GetDiskFreeSpaceExW( dir, NULL, NULL, &free );
688 handle = CreateFileW( root, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
689 if (handle != INVALID_HANDLE_VALUE)
691 if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &info, sizeof(info), NULL, NULL ))
692 *disksize = info.DiskSize.QuadPart;
693 CloseHandle( handle );
695 return free.QuadPart;
698 static void fill_logicaldisk( struct table *table )
700 static const WCHAR fmtW[] = {'%','c',':',0};
701 WCHAR device_id[3], root[] = {'A',':','\\',0};
702 struct record_logicaldisk *rec;
703 UINT i, num_rows = 0, offset = 0, count = 4, type;
704 UINT64 size = 1024 * 1024 * 1024;
705 DWORD drives = GetLogicalDrives();
707 if (!(table->data = heap_alloc( count * sizeof(*rec) ))) return;
709 for (i = 0; i < sizeof(drives); i++)
711 if (drives & (1 << i))
714 type = GetDriveTypeW( root );
715 if (type != DRIVE_FIXED && type != DRIVE_CDROM && type != DRIVE_REMOVABLE)
718 if (num_rows > count)
722 if (!(data = heap_realloc( table->data, count * sizeof(*rec) ))) return;
725 rec = (struct record_logicaldisk *)(table->data + offset);
726 sprintfW( device_id, fmtW, 'A' + i );
727 rec->device_id = heap_strdupW( device_id );
728 rec->drivetype = type;
729 rec->filesystem = get_filesystem( root );
730 rec->freespace = get_freespace( root, &size );
731 rec->name = heap_strdupW( device_id );
733 offset += sizeof(*rec);
737 TRACE("created %u rows\n", num_rows);
738 table->num_rows = num_rows;
741 static UINT16 get_connection_status( IF_OPER_STATUS status )
745 case IfOperStatusDown:
746 return 0; /* Disconnected */
748 return 2; /* Connected */
750 ERR("unhandled status %u\n", status);
755 static WCHAR *get_mac_address( const BYTE *addr, DWORD len )
757 static const WCHAR fmtW[] =
758 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
759 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
762 if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
763 sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
766 static const WCHAR *get_adaptertype( DWORD type )
768 static const WCHAR ethernetW[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
769 static const WCHAR wirelessW[] = {'W','i','r','e','l','e','s','s',0};
770 static const WCHAR firewireW[] = {'1','3','9','4',0};
771 static const WCHAR tunnelW[] = {'T','u','n','n','e','l',0};
775 case IF_TYPE_ETHERNET_CSMACD: return ethernetW;
776 case IF_TYPE_IEEE80211: return wirelessW;
777 case IF_TYPE_IEEE1394: return firewireW;
778 case IF_TYPE_TUNNEL: return tunnelW;
784 static void fill_networkadapter( struct table *table )
786 static const WCHAR fmtW[] = {'%','u',0};
788 struct record_networkadapter *rec;
789 IP_ADAPTER_ADDRESSES *aa, *buffer;
790 UINT num_rows = 0, offset = 0;
793 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
794 if (ret != ERROR_BUFFER_OVERFLOW) return;
796 if (!(buffer = heap_alloc( size ))) return;
797 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
802 for (aa = buffer; aa; aa = aa->Next) num_rows++;
803 if (!(table->data = heap_alloc( sizeof(*rec) * num_rows )))
808 for (aa = buffer; aa; aa = aa->Next)
810 rec = (struct record_networkadapter *)(table->data + offset);
811 sprintfW( device_id, fmtW, aa->u.s.IfIndex );
812 rec->adaptertype = get_adaptertype( aa->IfType );
813 rec->device_id = heap_strdupW( device_id );
814 rec->interface_index = aa->u.s.IfIndex;
815 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
816 rec->manufacturer = compsys_manufacturerW;
817 rec->netconnection_status = get_connection_status( aa->OperStatus );
818 rec->pnpdevice_id = networkadapter_pnpdeviceidW;
819 rec->speed = 1000000;
820 offset += sizeof(*rec);
822 TRACE("created %u rows\n", num_rows);
823 table->num_rows = num_rows;
828 static WCHAR *get_cmdline( DWORD process_id )
830 if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
831 return NULL; /* FIXME handle different process case */
834 static void fill_process( struct table *table )
836 static const WCHAR fmtW[] = {'%','u',0};
838 struct record_process *rec;
839 PROCESSENTRY32W entry;
841 UINT num_rows = 0, offset = 0, count = 8;
843 snap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
844 if (snap == INVALID_HANDLE_VALUE) return;
846 entry.dwSize = sizeof(entry);
847 if (!Process32FirstW( snap, &entry )) goto done;
848 if (!(table->data = heap_alloc( count * sizeof(*rec) ))) goto done;
852 if (num_rows > count)
856 if (!(data = heap_realloc( table->data, count * sizeof(*rec) ))) goto done;
859 rec = (struct record_process *)(table->data + offset);
860 rec->caption = heap_strdupW( entry.szExeFile );
861 rec->commandline = get_cmdline( entry.th32ProcessID );
862 rec->description = heap_strdupW( entry.szExeFile );
863 sprintfW( handle, fmtW, entry.th32ProcessID );
864 rec->handle = heap_strdupW( handle );
865 rec->process_id = entry.th32ProcessID;
866 rec->pprocess_id = entry.th32ParentProcessID;
867 rec->thread_count = entry.cntThreads;
868 rec->get_owner = process_get_owner;
869 offset += sizeof(*rec);
871 } while (Process32NextW( snap, &entry ));
873 TRACE("created %u rows\n", num_rows);
874 table->num_rows = num_rows;
880 static inline void do_cpuid( unsigned int ax, unsigned int *p )
883 __asm__("pushl %%ebx\n\t"
885 "movl %%ebx, %%esi\n\t"
887 : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3])
892 static void get_processor_id( WCHAR *processor_id )
894 static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0};
895 unsigned int regs[4] = {0, 0, 0, 0};
898 sprintfW( processor_id, fmtW, regs[3], regs[0] );
900 static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer )
903 unsigned char *p = (unsigned char *)regs;
905 for (i = 0; i < len; i++)
911 static void get_processor_manufacturer( WCHAR *manufacturer )
913 unsigned int tmp, regs[4] = {0, 0, 0, 0};
916 tmp = regs[2]; /* swap edx and ecx */
920 regs_to_str( regs + 1, 12, manufacturer );
922 static void get_processor_name( WCHAR *name )
924 unsigned int regs[4] = {0, 0, 0, 0};
926 do_cpuid( 0x80000000, regs );
927 if (regs[0] >= 0x80000004)
929 do_cpuid( 0x80000002, regs );
930 regs_to_str( regs, 16, name );
931 do_cpuid( 0x80000003, regs );
932 regs_to_str( regs, 16, name + 16 );
933 do_cpuid( 0x80000004, regs );
934 regs_to_str( regs, 16, name + 32 );
937 static UINT get_processor_maxclockspeed( void )
939 PROCESSOR_POWER_INFORMATION *info;
940 UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
943 if ((info = heap_alloc( size )))
945 status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
946 if (!status) ret = info[0].MaxMhz;
952 static void fill_processor( struct table *table )
954 static const WCHAR fmtW[] = {'C','P','U','%','u',0};
955 WCHAR device_id[14], processor_id[17], manufacturer[13], name[49] = {0};
956 struct record_processor *rec;
957 UINT i, offset = 0, maxclockspeed, num_logical_processors, count = get_processor_count();
959 if (!(table->data = heap_alloc( sizeof(*rec) * count ))) return;
961 get_processor_id( processor_id );
962 get_processor_manufacturer( manufacturer );
963 get_processor_name( name );
965 maxclockspeed = get_processor_maxclockspeed();
966 num_logical_processors = get_logical_processor_count() / count;
968 for (i = 0; i < count; i++)
970 rec = (struct record_processor *)(table->data + offset);
971 rec->cpu_status = 1; /* CPU Enabled */
972 sprintfW( device_id, fmtW, i );
973 rec->device_id = heap_strdupW( device_id );
974 rec->manufacturer = heap_strdupW( manufacturer );
975 rec->maxclockspeed = maxclockspeed;
976 rec->name = heap_strdupW( name );
977 rec->num_logical_processors = num_logical_processors;
978 rec->processor_id = heap_strdupW( processor_id );
979 rec->unique_id = NULL;
980 offset += sizeof(*rec);
983 TRACE("created %u rows\n", count);
984 table->num_rows = count;
987 static WCHAR *get_lastbootuptime(void)
989 static const WCHAR fmtW[] =
990 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
991 '.','%','0','6','u','+','0','0','0',0};
992 SYSTEM_TIMEOFDAY_INFORMATION ti;
996 if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
998 NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
999 RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
1000 sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
1003 static const WCHAR *get_osarchitecture(void)
1006 GetNativeSystemInfo( &info );
1007 if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW;
1010 static WCHAR *get_systemdirectory(void)
1015 if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
1016 Wow64DisableWow64FsRedirection( &redir );
1017 GetSystemDirectoryW( ret, MAX_PATH );
1018 Wow64RevertWow64FsRedirection( redir );
1022 static void fill_os( struct table *table )
1024 struct record_operatingsystem *rec;
1026 if (!(table->data = heap_alloc( sizeof(*rec) ))) return;
1028 rec = (struct record_operatingsystem *)table->data;
1029 rec->caption = os_captionW;
1030 rec->csdversion = os_csdversionW;
1031 rec->lastbootuptime = get_lastbootuptime();
1032 rec->osarchitecture = get_osarchitecture();
1033 rec->oslanguage = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
1034 rec->systemdirectory = get_systemdirectory();
1036 TRACE("created 1 row\n");
1037 table->num_rows = 1;
1040 static const WCHAR *get_service_type( DWORD type )
1042 static const WCHAR filesystem_driverW[] =
1043 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
1044 static const WCHAR kernel_driverW[] =
1045 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
1046 static const WCHAR own_processW[] =
1047 {'O','w','n',' ','P','r','o','c','e','s','s',0};
1048 static const WCHAR share_processW[] =
1049 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
1051 if (type & SERVICE_KERNEL_DRIVER) return kernel_driverW;
1052 else if (type & SERVICE_FILE_SYSTEM_DRIVER) return filesystem_driverW;
1053 else if (type & SERVICE_WIN32_OWN_PROCESS) return own_processW;
1054 else if (type & SERVICE_WIN32_SHARE_PROCESS) return share_processW;
1055 else ERR("unhandled type 0x%08x\n", type);
1058 static const WCHAR *get_service_state( DWORD state )
1060 static const WCHAR runningW[] =
1061 {'R','u','n','n','i','n','g',0};
1062 static const WCHAR start_pendingW[] =
1063 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
1064 static const WCHAR stop_pendingW[] =
1065 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
1066 static const WCHAR stoppedW[] =
1067 {'S','t','o','p','p','e','d',0};
1068 static const WCHAR unknownW[] =
1069 {'U','n','k','n','o','w','n',0};
1073 case SERVICE_STOPPED: return stoppedW;
1074 case SERVICE_START_PENDING: return start_pendingW;
1075 case SERVICE_STOP_PENDING: return stop_pendingW;
1076 case SERVICE_RUNNING: return runningW;
1078 ERR("unknown state %u\n", state);
1083 static const WCHAR *get_service_startmode( DWORD mode )
1085 static const WCHAR bootW[] = {'B','o','o','t',0};
1086 static const WCHAR systemW[] = {'S','y','s','t','e','m',0};
1087 static const WCHAR autoW[] = {'A','u','t','o',0};
1088 static const WCHAR manualW[] = {'M','a','n','u','a','l',0};
1089 static const WCHAR disabledW[] = {'D','i','s','a','b','l','e','d',0};
1090 static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',0};
1094 case SERVICE_BOOT_START: return bootW;
1095 case SERVICE_SYSTEM_START: return systemW;
1096 case SERVICE_AUTO_START: return autoW;
1097 case SERVICE_DEMAND_START: return manualW;
1098 case SERVICE_DISABLED: return disabledW;
1100 ERR("unknown mode 0x%x\n", mode);
1105 static QUERY_SERVICE_CONFIGW *query_service_config( SC_HANDLE manager, const WCHAR *name )
1107 QUERY_SERVICE_CONFIGW *config = NULL;
1111 if (!(service = OpenServiceW( manager, name, SERVICE_QUERY_CONFIG ))) return NULL;
1112 QueryServiceConfigW( service, NULL, 0, &size );
1113 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
1114 if (!(config = heap_alloc( size ))) goto done;
1115 if (QueryServiceConfigW( service, config, size, &size )) goto done;
1116 heap_free( config );
1120 CloseServiceHandle( service );
1124 static void fill_service( struct table *table )
1126 struct record_service *rec;
1128 ENUM_SERVICE_STATUS_PROCESSW *tmp, *services = NULL;
1129 SERVICE_STATUS_PROCESS *status;
1130 WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1];
1131 DWORD len = sizeof(sysnameW) / sizeof(sysnameW[0]);
1132 UINT i, num_rows = 0, offset = 0, size = 256, needed, count;
1135 if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) return;
1136 if (!(services = heap_alloc( size ))) goto done;
1138 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
1139 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
1140 &count, NULL, NULL );
1143 if (GetLastError() != ERROR_MORE_DATA) goto done;
1145 if (!(tmp = heap_realloc( services, size ))) goto done;
1147 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
1148 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
1149 &count, NULL, NULL );
1150 if (!ret) goto done;
1152 if (!(table->data = heap_alloc( sizeof(*rec) * count ))) goto done;
1154 GetComputerNameW( sysnameW, &len );
1156 for (i = 0; i < count; i++)
1158 QUERY_SERVICE_CONFIGW *config;
1160 if (!(config = query_service_config( manager, services[i].lpServiceName ))) continue;
1162 status = &services[i].ServiceStatusProcess;
1163 rec = (struct record_service *)(table->data + offset);
1164 rec->accept_pause = (status->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) ? -1 : 0;
1165 rec->accept_stop = (status->dwControlsAccepted & SERVICE_ACCEPT_STOP) ? -1 : 0;
1166 rec->displayname = heap_strdupW( services[i].lpDisplayName );
1167 rec->name = heap_strdupW( services[i].lpServiceName );
1168 rec->process_id = status->dwProcessId;
1169 rec->servicetype = get_service_type( status->dwServiceType );
1170 rec->startmode = get_service_startmode( config->dwStartType );
1171 rec->state = get_service_state( status->dwCurrentState );
1172 rec->systemname = heap_strdupW( sysnameW );
1173 rec->pause_service = service_pause_service;
1174 rec->resume_service = service_resume_service;
1175 rec->start_service = service_start_service;
1176 rec->stop_service = service_stop_service;
1177 heap_free( config );
1178 offset += sizeof(*rec);
1182 TRACE("created %u rows\n", num_rows);
1183 table->num_rows = num_rows;
1186 CloseServiceHandle( manager );
1187 heap_free( services );
1190 static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres )
1192 HDC hdc = GetDC( NULL );
1195 if (!hdc) return 32;
1196 ret = GetDeviceCaps( hdc, BITSPIXEL );
1197 *hres = GetDeviceCaps( hdc, HORZRES );
1198 *vres = GetDeviceCaps( hdc, VERTRES );
1199 ReleaseDC( NULL, hdc );
1203 static void fill_videocontroller( struct table *table )
1206 struct record_videocontroller *rec;
1208 IDXGIFactory *factory = NULL;
1209 IDXGIAdapter *adapter = NULL;
1210 DXGI_ADAPTER_DESC desc;
1211 UINT hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
1212 const WCHAR *name = videocontroller_deviceidW;
1214 if (!(table->data = heap_alloc( sizeof(*rec) ))) return;
1216 hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
1217 if (FAILED(hr)) goto done;
1219 hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
1220 if (FAILED(hr)) goto done;
1222 hr = IDXGIAdapter_GetDesc( adapter, &desc );
1225 vidmem = desc.DedicatedVideoMemory;
1226 name = desc.Description;
1230 rec = (struct record_videocontroller *)table->data;
1231 rec->adapter_ram = vidmem;
1232 rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres );
1233 rec->current_horizontalres = hres;
1234 rec->current_verticalres = vres;
1235 rec->description = heap_strdupW( name );
1236 rec->device_id = videocontroller_deviceidW;
1237 rec->name = heap_strdupW( name );
1239 TRACE("created 1 row\n");
1240 table->num_rows = 1;
1242 if (adapter) IDXGIAdapter_Release( adapter );
1243 if (factory) IDXGIFactory_Release( factory );
1246 static struct table builtin_classes[] =
1248 { class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), (BYTE *)data_baseboard },
1249 { class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), (BYTE *)data_bios },
1250 { class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, SIZEOF(data_cdromdrive), (BYTE *)data_cdromdrive },
1251 { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, NULL, fill_compsys },
1252 { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, SIZEOF(data_diskdrive), (BYTE *)data_diskdrive },
1253 { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, NULL, fill_logicaldisk },
1254 { class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, NULL, fill_networkadapter },
1255 { class_osW, SIZEOF(col_os), col_os, 0, NULL, fill_os },
1256 { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), (BYTE *)data_param },
1257 { class_processW, SIZEOF(col_process), col_process, 0, NULL, fill_process },
1258 { class_processorW, SIZEOF(col_processor), col_processor, 0, NULL, fill_processor },
1259 { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), (BYTE *)data_qualifier },
1260 { class_serviceW, SIZEOF(col_service), col_service, 0, NULL, fill_service },
1261 { class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), (BYTE *)data_sounddevice },
1262 { class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), (BYTE *)data_stdregprov },
1263 { class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, NULL, fill_videocontroller }
1266 void init_table_list( void )
1268 static struct list tables = LIST_INIT( tables );
1271 for (i = 0; i < SIZEOF(builtin_classes); i++)
1273 list_add_tail( &tables, &builtin_classes[i].entry );
1275 table_list = &tables;