riched20: Initial support for changing font properties.
[wine/multimedia.git] / dlls / wbemprox / builtin.c
blobb55e9ad4a614b043a0b04f01637953521beb26bc
1 /*
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
19 #define COBJMACROS
20 #define NONAMELESSUNION
21 #define NONAMELESSSTRUCT
23 #include "config.h"
24 #include <stdarg.h>
26 #include "ntstatus.h"
27 #define WIN32_NO_STATUS
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winsock2.h"
31 #include "ws2tcpip.h"
32 #include "initguid.h"
33 #include "wbemcli.h"
34 #include "wbemprov.h"
35 #include "iphlpapi.h"
36 #include "tlhelp32.h"
37 #include "d3d10.h"
38 #include "winternl.h"
39 #include "winioctl.h"
40 #include "winsvc.h"
41 #include "winver.h"
42 #include "sddl.h"
43 #include "ntsecapi.h"
44 #include "winspool.h"
46 #include "wine/debug.h"
47 #include "wbemprox_private.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
51 static const WCHAR class_baseboardW[] =
52 {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0};
53 static const WCHAR class_biosW[] =
54 {'W','i','n','3','2','_','B','I','O','S',0};
55 static const WCHAR class_cdromdriveW[] =
56 {'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0};
57 static const WCHAR class_compsysW[] =
58 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
59 static const WCHAR class_compsysproductW[] =
60 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m','P','r','o','d','u','c','t',0};
61 static const WCHAR class_datafileW[] =
62 {'C','I','M','_','D','a','t','a','F','i','l','e',0};
63 static const WCHAR class_directoryW[] =
64 {'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0};
65 static const WCHAR class_diskdriveW[] =
66 {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0};
67 static const WCHAR class_diskpartitionW[] =
68 {'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
69 static const WCHAR class_logicaldiskW[] =
70 {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
71 static const WCHAR class_logicaldisk2W[] =
72 {'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0};
73 static const WCHAR class_networkadapterW[] =
74 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
75 static const WCHAR class_networkadapterconfigW[] =
76 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',
77 'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
78 static const WCHAR class_osW[] =
79 {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
80 static const WCHAR class_paramsW[] =
81 {'_','_','P','A','R','A','M','E','T','E','R','S',0};
82 static const WCHAR class_physicalmediaW[] =
83 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0};
84 static const WCHAR class_physicalmemoryW[] =
85 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
86 static const WCHAR class_qualifiersW[] =
87 {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
88 static const WCHAR class_printerW[] =
89 {'W','i','n','3','2','_','P','r','i','n','t','e','r',0};
90 static const WCHAR class_process_getowner_outW[] =
91 {'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W',
92 'N','E','R','_','O','U','T',0};
93 static const WCHAR class_processorW[] =
94 {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
95 static const WCHAR class_processor2W[] =
96 {'C','I','M','_','P','r','o','c','e','s','s','o','r',0};
97 static const WCHAR class_sidW[] =
98 {'W','i','n','3','2','_','S','I','D',0};
99 static const WCHAR class_sounddeviceW[] =
100 {'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0};
101 static const WCHAR class_systemenclosureW[] =
102 {'W','i','n','3','2','_','S','y','s','t','e','m','E','n','c','l','o','s','u','r','e',0};
103 static const WCHAR class_videocontrollerW[] =
104 {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
106 static const WCHAR prop_accountnameW[] =
107 {'A','c','c','o','u','n','t','N','a','m','e',0};
108 static const WCHAR prop_acceptpauseW[] =
109 {'A','c','c','e','p','t','P','a','u','s','e',0};
110 static const WCHAR prop_acceptstopW[] =
111 {'A','c','c','e','p','t','S','t','o','p',0};
112 static const WCHAR prop_accessmaskW[] =
113 {'A','c','c','e','s','s','M','a','s','k',0};
114 static const WCHAR prop_adapterdactypeW[] =
115 {'A','d','a','p','t','e','r','D','A','C','T','y','p','e',0};
116 static const WCHAR prop_adapterramW[] =
117 {'A','d','a','p','t','e','r','R','A','M',0};
118 static const WCHAR prop_adaptertypeW[] =
119 {'A','d','a','p','t','e','r','T','y','p','e',0};
120 static const WCHAR prop_addresswidthW[] =
121 {'A','d','d','r','e','s','s','W','i','d','t','h',0};
122 static const WCHAR prop_attributesW[] =
123 {'A','t','t','r','i','b','u','t','e','s',0};
124 static const WCHAR prop_availabilityW[] =
125 {'A','v','a','i','l','a','b','i','l','i','t','y',0};
126 static const WCHAR prop_binaryrepresentationW[] =
127 {'B','i','n','a','r','y','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0};
128 static const WCHAR prop_bootableW[] =
129 {'B','o','o','t','a','b','l','e',0};
130 static const WCHAR prop_bootpartitionW[] =
131 {'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
132 static const WCHAR prop_buildnumberW[] =
133 {'B','u','i','l','d','N','u','m','b','e','r',0};
134 static const WCHAR prop_capacityW[] =
135 {'C','a','p','a','c','i','t','y',0};
136 static const WCHAR prop_captionW[] =
137 {'C','a','p','t','i','o','n',0};
138 static const WCHAR prop_chassistypesW[] =
139 {'C','h','a','s','s','i','s','T','y','p','e','s',0};
140 static const WCHAR prop_classW[] =
141 {'C','l','a','s','s',0};
142 static const WCHAR prop_codesetW[] =
143 {'C','o','d','e','S','e','t',0};
144 static const WCHAR prop_commandlineW[] =
145 {'C','o','m','m','a','n','d','L','i','n','e',0};
146 static const WCHAR prop_countrycodeW[] =
147 {'C','o','u','n','t','r','y','C','o','d','e',0};
148 static const WCHAR prop_cpustatusW[] =
149 {'C','p','u','S','t','a','t','u','s',0};
150 static const WCHAR prop_csdversionW[] =
151 {'C','S','D','V','e','r','s','i','o','n',0};
152 static const WCHAR prop_currentbitsperpixelW[] =
153 {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
154 static const WCHAR prop_currentclockspeedW[] =
155 {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0};
156 static const WCHAR prop_currenthorizontalresW[] =
157 {'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};
158 static const WCHAR prop_currentrefreshrateW[] =
159 {'C','u','r','r','e','n','t','R','e','f','r','e','s','h','R','a','t','e',0};
160 static const WCHAR prop_currentscanmodeW[] =
161 {'C','u','r','r','e','n','t','S','c','a','n','M','o','d','e',0};
162 static const WCHAR prop_currentverticalresW[] =
163 {'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};
164 static const WCHAR prop_datawidthW[] =
165 {'D','a','t','a','W','i','d','t','h',0};
166 static const WCHAR prop_defaultvalueW[] =
167 {'D','e','f','a','u','l','t','V','a','l','u','e',0};
168 static const WCHAR prop_descriptionW[] =
169 {'D','e','s','c','r','i','p','t','i','o','n',0};
170 static const WCHAR prop_deviceidW[] =
171 {'D','e','v','i','c','e','I','d',0};
172 static const WCHAR prop_directionW[] =
173 {'D','i','r','e','c','t','i','o','n',0};
174 static const WCHAR prop_displaynameW[] =
175 {'D','i','s','p','l','a','y','N','a','m','e',0};
176 static const WCHAR prop_diskindexW[] =
177 {'D','i','s','k','I','n','d','e','x',0};
178 static const WCHAR prop_dnshostnameW[] =
179 {'D','N','S','H','o','s','t','N','a','m','e',0};
180 static const WCHAR prop_domainW[] =
181 {'D','o','m','a','i','n',0};
182 static const WCHAR prop_domainroleW[] =
183 {'D','o','m','a','i','n','R','o','l','e',0};
184 static const WCHAR prop_driveW[] =
185 {'D','r','i','v','e',0};
186 static const WCHAR prop_drivernameW[] =
187 {'D','r','i','v','e','r','N','a','m','e',0};
188 static const WCHAR prop_driverversionW[] =
189 {'D','r','i','v','e','r','V','e','r','s','i','o','n',0};
190 static const WCHAR prop_drivetypeW[] =
191 {'D','r','i','v','e','T','y','p','e',0};
192 static const WCHAR prop_familyW[] =
193 {'F','a','m','i','l','y',0};
194 static const WCHAR prop_filesystemW[] =
195 {'F','i','l','e','S','y','s','t','e','m',0};
196 static const WCHAR prop_flavorW[] =
197 {'F','l','a','v','o','r',0};
198 static const WCHAR prop_freespaceW[] =
199 {'F','r','e','e','S','p','a','c','e',0};
200 static const WCHAR prop_handleW[] =
201 {'H','a','n','d','l','e',0};
202 static const WCHAR prop_horizontalresolutionW[] =
203 {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
204 static const WCHAR prop_idW[] =
205 {'I','D',0};
206 static const WCHAR prop_identificationcodeW[] =
207 {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
208 static const WCHAR prop_identifyingnumberW[] =
209 {'I','d','e','n','t','i','f','y','i','n','g','N','u','m','b','e','r',0};
210 static const WCHAR prop_indexW[] =
211 {'I','n','d','e','x',0};
212 static const WCHAR prop_installdateW[] =
213 {'I','n','s','t','a','l','l','D','a','t','e',0};
214 static const WCHAR prop_interfaceindexW[] =
215 {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
216 static const WCHAR prop_interfacetypeW[] =
217 {'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
218 static const WCHAR prop_intvalueW[] =
219 {'I','n','t','e','g','e','r','V','a','l','u','e',0};
220 static const WCHAR prop_ipconnectionmetricW[] =
221 {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
222 static const WCHAR prop_ipenabledW[] =
223 {'I','P','E','n','a','b','l','e','d',0};
224 static const WCHAR prop_lastbootuptimeW[] =
225 {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
226 static const WCHAR prop_localW[] =
227 {'L','o','c','a','l',0};
228 static const WCHAR prop_localdatetimeW[] =
229 {'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
230 static const WCHAR prop_localeW[] =
231 {'L','o','c','a','l','e',0};
232 static const WCHAR prop_lockpresentW[] =
233 {'L','o','c','k','P','r','e','s','e','n','t',0};
234 static const WCHAR prop_macaddressW[] =
235 {'M','A','C','A','d','d','r','e','s','s',0};
236 static const WCHAR prop_manufacturerW[] =
237 {'M','a','n','u','f','a','c','t','u','r','e','r',0};
238 static const WCHAR prop_maxclockspeedW[] =
239 {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
240 static const WCHAR prop_mediatypeW[] =
241 {'M','e','d','i','a','T','y','p','e',0};
242 static const WCHAR prop_memberW[] =
243 {'M','e','m','b','e','r',0};
244 static const WCHAR prop_methodW[] =
245 {'M','e','t','h','o','d',0};
246 static const WCHAR prop_modelW[] =
247 {'M','o','d','e','l',0};
248 static const WCHAR prop_netconnectionstatusW[] =
249 {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
250 static const WCHAR prop_networkW[] =
251 {'N','e','t','w','o','r','k',0};
252 static const WCHAR prop_numcoresW[] =
253 {'N','u','m','b','e','r','O','f','C','o','r','e','s',0};
254 static const WCHAR prop_numlogicalprocessorsW[] =
255 {'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};
256 static const WCHAR prop_numprocessorsW[] =
257 {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
258 static const WCHAR prop_osarchitectureW[] =
259 {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
260 static const WCHAR prop_oslanguageW[] =
261 {'O','S','L','a','n','g','u','a','g','e',0};
262 static const WCHAR prop_osproductsuiteW[] =
263 {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
264 static const WCHAR prop_ostypeW[] =
265 {'O','S','T','y','p','e',0};
266 static const WCHAR prop_parameterW[] =
267 {'P','a','r','a','m','e','t','e','r',0};
268 static const WCHAR prop_physicaladapterW[] =
269 {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
270 static const WCHAR prop_pnpdeviceidW[] =
271 {'P','N','P','D','e','v','i','c','e','I','D',0};
272 static const WCHAR prop_pprocessidW[] =
273 {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
274 static const WCHAR prop_processidW[] =
275 {'P','r','o','c','e','s','s','I','D',0};
276 static const WCHAR prop_processoridW[] =
277 {'P','r','o','c','e','s','s','o','r','I','d',0};
278 static const WCHAR prop_processortypeW[] =
279 {'P','r','o','c','e','s','s','o','r','T','y','p','e',0};
280 static const WCHAR prop_productW[] =
281 {'P','r','o','d','u','c','t',0};
282 static const WCHAR prop_productnameW[] =
283 {'P','r','o','d','u','c','t','N','a','m','e',0};
284 static const WCHAR prop_referenceddomainnameW[] =
285 {'R','e','f','e','r','e','n','c','e','d','D','o','m','a','i','n','N','a','m','e',0};
286 static const WCHAR prop_releasedateW[] =
287 {'R','e','l','e','a','s','e','D','a','t','e',0};
288 static const WCHAR prop_serialnumberW[] =
289 {'S','e','r','i','a','l','N','u','m','b','e','r',0};
290 static const WCHAR prop_servicepackmajorW[] =
291 {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
292 static const WCHAR prop_servicepackminorW[] =
293 {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
294 static const WCHAR prop_servicetypeW[] =
295 {'S','e','r','v','i','c','e','T','y','p','e',0};
296 static const WCHAR prop_smbiosbiosversionW[] =
297 {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
298 static const WCHAR prop_startmodeW[] =
299 {'S','t','a','r','t','M','o','d','e',0};
300 static const WCHAR prop_sidW[] =
301 {'S','I','D',0};
302 static const WCHAR prop_sidlengthW[] =
303 {'S','i','d','L','e','n','g','t','h',0};
304 static const WCHAR prop_sizeW[] =
305 {'S','i','z','e',0};
306 static const WCHAR prop_speedW[] =
307 {'S','p','e','e','d',0};
308 static const WCHAR prop_startingoffsetW[] =
309 {'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0};
310 static const WCHAR prop_stateW[] =
311 {'S','t','a','t','e',0};
312 static const WCHAR prop_statusinfoW[] =
313 {'S','t','a','t','u','s','I','n','f','o',0};
314 static const WCHAR prop_strvalueW[] =
315 {'S','t','r','i','n','g','V','a','l','u','e',0};
316 static const WCHAR prop_suitemaskW[] =
317 {'S','u','i','t','e','M','a','s','k',0};
318 static const WCHAR prop_systemdirectoryW[] =
319 {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
320 static const WCHAR prop_systemnameW[] =
321 {'S','y','s','t','e','m','N','a','m','e',0};
322 static const WCHAR prop_tagW[] =
323 {'T','a','g',0};
324 static const WCHAR prop_threadcountW[] =
325 {'T','h','r','e','a','d','C','o','u','n','t',0};
326 static const WCHAR prop_totalphysicalmemoryW[] =
327 {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
328 static const WCHAR prop_totalvisiblememorysizeW[] =
329 {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0};
330 static const WCHAR prop_typeW[] =
331 {'T','y','p','e',0};
332 static const WCHAR prop_uniqueidW[] =
333 {'U','n','i','q','u','e','I','d',0};
334 static const WCHAR prop_usernameW[] =
335 {'U','s','e','r','N','a','m','e',0};
336 static const WCHAR prop_uuidW[] =
337 {'U','U','I','D',0};
338 static const WCHAR prop_varianttypeW[] =
339 {'V','a','r','i','a','n','t','T','y','p','e',0};
340 static const WCHAR prop_versionW[] =
341 {'V','e','r','s','i','o','n',0};
342 static const WCHAR prop_videoarchitectureW[] =
343 {'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0};
344 static const WCHAR prop_videomemorytypeW[] =
345 {'V','i','d','e','o','M','e','m','o','r','y','T','y','p','e',0};
346 static const WCHAR prop_videoprocessorW[] =
347 {'V','i','d','e','o','P','r','o','c','e','s','s','o','r',0};
348 static const WCHAR prop_volumenameW[] =
349 {'V','o','l','u','m','e','N','a','m','e',0};
350 static const WCHAR prop_volumeserialnumberW[] =
351 {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
353 /* column definitions must be kept in sync with record structures below */
354 static const struct column col_baseboard[] =
356 { prop_manufacturerW, CIM_STRING },
357 { prop_modelW, CIM_STRING },
358 { prop_nameW, CIM_STRING },
359 { prop_productW, CIM_STRING },
360 { prop_serialnumberW, CIM_STRING },
361 { prop_tagW, CIM_STRING|COL_FLAG_KEY },
362 { prop_versionW, CIM_STRING }
364 static const struct column col_bios[] =
366 { prop_descriptionW, CIM_STRING },
367 { prop_identificationcodeW, CIM_STRING },
368 { prop_manufacturerW, CIM_STRING },
369 { prop_releasedateW, CIM_DATETIME },
370 { prop_serialnumberW, CIM_STRING },
371 { prop_smbiosbiosversionW, CIM_STRING },
372 { prop_versionW, CIM_STRING|COL_FLAG_KEY }
374 static const struct column col_cdromdrive[] =
376 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
377 { prop_driveW, CIM_STRING|COL_FLAG_DYNAMIC },
378 { prop_mediatypeW, CIM_STRING },
379 { prop_nameW, CIM_STRING },
380 { prop_pnpdeviceidW, CIM_STRING }
382 static const struct column col_compsys[] =
384 { prop_descriptionW, CIM_STRING },
385 { prop_domainW, CIM_STRING },
386 { prop_domainroleW, CIM_UINT16, VT_I4 },
387 { prop_manufacturerW, CIM_STRING },
388 { prop_modelW, CIM_STRING },
389 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
390 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
391 { prop_numprocessorsW, CIM_UINT32, VT_I4 },
392 { prop_totalphysicalmemoryW, CIM_UINT64 },
393 { prop_usernameW, CIM_STRING|COL_FLAG_DYNAMIC }
395 static const struct column col_compsysproduct[] =
397 { prop_identifyingnumberW, CIM_STRING|COL_FLAG_KEY },
398 { prop_uuidW, CIM_STRING }
400 static const struct column col_datafile[] =
402 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
403 { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
405 static const struct column col_directory[] =
407 { prop_accessmaskW, CIM_UINT32 },
408 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }
410 static const struct column col_diskdrive[] =
412 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
413 { prop_indexW, CIM_UINT32, VT_I4 },
414 { prop_interfacetypeW, CIM_STRING },
415 { prop_manufacturerW, CIM_STRING },
416 { prop_mediatypeW, CIM_STRING },
417 { prop_modelW, CIM_STRING },
418 { prop_pnpdeviceidW, CIM_STRING },
419 { prop_serialnumberW, CIM_STRING },
420 { prop_sizeW, CIM_UINT64 }
422 static const struct column col_diskpartition[] =
424 { prop_bootableW, CIM_BOOLEAN },
425 { prop_bootpartitionW, CIM_BOOLEAN },
426 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
427 { prop_diskindexW, CIM_UINT32, VT_I4 },
428 { prop_indexW, CIM_UINT32, VT_I4 },
429 { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
430 { prop_sizeW, CIM_UINT64 },
431 { prop_startingoffsetW, CIM_UINT64 },
432 { prop_typeW, CIM_STRING|COL_FLAG_DYNAMIC }
434 static const struct column col_logicaldisk[] =
436 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
437 { prop_drivetypeW, CIM_UINT32, VT_I4 },
438 { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC },
439 { prop_freespaceW, CIM_UINT64 },
440 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
441 { prop_sizeW, CIM_UINT64 },
442 { prop_volumenameW, CIM_STRING|COL_FLAG_DYNAMIC },
443 { prop_volumeserialnumberW, CIM_STRING|COL_FLAG_DYNAMIC }
445 static const struct column col_networkadapter[] =
447 { prop_adaptertypeW, CIM_STRING },
448 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
449 { prop_indexW, CIM_UINT32, VT_I4 },
450 { prop_interfaceindexW, CIM_UINT32, VT_I4 },
451 { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
452 { prop_manufacturerW, CIM_STRING },
453 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
454 { prop_netconnectionstatusW, CIM_UINT16, VT_I4 },
455 { prop_physicaladapterW, CIM_BOOLEAN },
456 { prop_pnpdeviceidW, CIM_STRING },
457 { prop_speedW, CIM_UINT64 }
459 static const struct column col_networkadapterconfig[] =
461 { prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC },
462 { prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 },
463 { prop_ipconnectionmetricW, CIM_UINT32, VT_I4 },
464 { prop_ipenabledW, CIM_BOOLEAN },
465 { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }
467 static const struct column col_os[] =
469 { prop_buildnumberW, CIM_STRING },
470 { prop_captionW, CIM_STRING },
471 { prop_codesetW, CIM_STRING|COL_FLAG_DYNAMIC },
472 { prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC },
473 { prop_csdversionW, CIM_STRING },
474 { prop_installdateW, CIM_DATETIME },
475 { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
476 { prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
477 { prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC },
478 { prop_nameW, CIM_STRING },
479 { prop_osarchitectureW, CIM_STRING },
480 { prop_oslanguageW, CIM_UINT32, VT_I4 },
481 { prop_osproductsuiteW, CIM_UINT32, VT_I4 },
482 { prop_ostypeW, CIM_UINT16, VT_I4 },
483 { prop_serialnumberW, CIM_STRING },
484 { prop_servicepackmajorW, CIM_UINT16, VT_I4 },
485 { prop_servicepackminorW, CIM_UINT16, VT_I4 },
486 { prop_suitemaskW, CIM_UINT32, VT_I4 },
487 { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC },
488 { prop_totalvisiblememorysizeW, CIM_UINT64 },
489 { prop_versionW, CIM_STRING }
491 static const struct column col_param[] =
493 { prop_classW, CIM_STRING },
494 { prop_methodW, CIM_STRING },
495 { prop_directionW, CIM_SINT32 },
496 { prop_parameterW, CIM_STRING },
497 { prop_typeW, CIM_UINT32 },
498 { prop_varianttypeW, CIM_UINT32 },
499 { prop_defaultvalueW, CIM_UINT32 }
501 static const struct column col_physicalmedia[] =
503 { prop_serialnumberW, CIM_STRING },
504 { prop_tagW, CIM_STRING }
506 static const struct column col_physicalmemory[] =
508 { prop_capacityW, CIM_UINT64 }
510 static const struct column col_printer[] =
512 { prop_attributesW, CIM_UINT32 },
513 { prop_drivernameW, CIM_STRING|COL_FLAG_DYNAMIC },
514 { prop_horizontalresolutionW, CIM_UINT32 },
515 { prop_localW, CIM_BOOLEAN },
516 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
517 { prop_networkW, CIM_BOOLEAN }
519 static const struct column col_process[] =
521 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
522 { prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC },
523 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
524 { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
525 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
526 { prop_pprocessidW, CIM_UINT32, VT_I4 },
527 { prop_processidW, CIM_UINT32, VT_I4 },
528 { prop_threadcountW, CIM_UINT32, VT_I4 },
529 /* methods */
530 { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
532 static const struct column col_processor[] =
534 { prop_addresswidthW, CIM_UINT16, VT_I4 },
535 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
536 { prop_cpustatusW, CIM_UINT16 },
537 { prop_currentclockspeedW, CIM_UINT32, VT_I4 },
538 { prop_datawidthW, CIM_UINT16, VT_I4 },
539 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
540 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
541 { prop_familyW, CIM_UINT16, VT_I4 },
542 { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
543 { prop_maxclockspeedW, CIM_UINT32, VT_I4 },
544 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
545 { prop_numcoresW, CIM_UINT32, VT_I4 },
546 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
547 { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC },
548 { prop_processortypeW, CIM_UINT16, VT_I4 },
549 { prop_uniqueidW, CIM_STRING },
550 { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
552 static const struct column col_qualifier[] =
554 { prop_classW, CIM_STRING },
555 { prop_memberW, CIM_STRING },
556 { prop_typeW, CIM_UINT32 },
557 { prop_flavorW, CIM_SINT32 },
558 { prop_nameW, CIM_STRING },
559 { prop_intvalueW, CIM_SINT32 },
560 { prop_strvalueW, CIM_STRING }
562 static const struct column col_service[] =
564 { prop_acceptpauseW, CIM_BOOLEAN },
565 { prop_acceptstopW, CIM_BOOLEAN },
566 { prop_displaynameW, CIM_STRING|COL_FLAG_DYNAMIC },
567 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
568 { prop_processidW, CIM_UINT32 },
569 { prop_servicetypeW, CIM_STRING },
570 { prop_startmodeW, CIM_STRING },
571 { prop_stateW, CIM_STRING },
572 { prop_systemnameW, CIM_STRING|COL_FLAG_DYNAMIC },
573 /* methods */
574 { method_pauseserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
575 { method_resumeserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
576 { method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
577 { method_stopserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
579 static const struct column col_sid[] =
581 { prop_accountnameW, CIM_STRING|COL_FLAG_DYNAMIC },
582 { prop_binaryrepresentationW, CIM_UINT8|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
583 { prop_referenceddomainnameW, CIM_STRING|COL_FLAG_DYNAMIC },
584 { prop_sidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
585 { prop_sidlengthW, CIM_UINT32 }
587 static const struct column col_sounddevice[] =
589 { prop_nameW, CIM_STRING },
590 { prop_productnameW, CIM_STRING },
591 { prop_statusinfoW, CIM_UINT16, VT_I4 }
593 static const struct column col_stdregprov[] =
595 { method_enumkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
596 { method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
597 { method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
599 static const struct column col_systemenclosure[] =
601 { prop_captionW, CIM_STRING },
602 { prop_chassistypesW, CIM_UINT16|CIM_FLAG_ARRAY },
603 { prop_descriptionW, CIM_STRING },
604 { prop_lockpresentW, CIM_BOOLEAN },
605 { prop_manufacturerW, CIM_STRING },
606 { prop_nameW, CIM_STRING },
607 { prop_tagW, CIM_STRING },
609 static const struct column col_systemsecurity[] =
611 { method_getsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
612 { method_setsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
614 static const struct column col_videocontroller[] =
616 { prop_adapterdactypeW, CIM_STRING },
617 { prop_adapterramW, CIM_UINT32, VT_I4 },
618 { prop_availabilityW, CIM_UINT16 },
619 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
620 { prop_currentbitsperpixelW, CIM_UINT32, VT_I4 },
621 { prop_currenthorizontalresW, CIM_UINT32, VT_I4 },
622 { prop_currentrefreshrateW, CIM_UINT32, VT_I4 },
623 { prop_currentscanmodeW, CIM_UINT16, VT_I4 },
624 { prop_currentverticalresW, CIM_UINT32, VT_I4 },
625 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
626 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
627 { prop_driverversionW, CIM_STRING },
628 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
629 { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
630 { prop_videoarchitectureW, CIM_UINT16, VT_I4 },
631 { prop_videomemorytypeW, CIM_UINT16, VT_I4 },
632 { prop_videoprocessorW, CIM_STRING|COL_FLAG_DYNAMIC }
635 static const WCHAR baseboard_manufacturerW[] =
636 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
637 static const WCHAR baseboard_serialnumberW[] =
638 {'N','o','n','e',0};
639 static const WCHAR baseboard_tagW[] =
640 {'B','a','s','e',' ','B','o','a','r','d',0};
641 static const WCHAR baseboard_versionW[] =
642 {'1','.','0',0};
643 static const WCHAR bios_descriptionW[] =
644 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
645 static const WCHAR bios_manufacturerW[] =
646 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
647 static const WCHAR bios_releasedateW[] =
648 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
649 static const WCHAR bios_serialnumberW[] =
650 {'0',0};
651 static const WCHAR bios_smbiosbiosversionW[] =
652 {'W','i','n','e',0};
653 static const WCHAR bios_versionW[] =
654 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
655 static const WCHAR cdromdrive_mediatypeW[] =
656 {'C','D','-','R','O','M',0};
657 static const WCHAR cdromdrive_nameW[] =
658 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
659 static const WCHAR cdromdrive_pnpdeviceidW[]=
660 {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
661 '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
662 '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
663 'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
664 static const WCHAR compsys_descriptionW[] =
665 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
666 static const WCHAR compsys_domainW[] =
667 {'W','O','R','K','G','R','O','U','P',0};
668 static const WCHAR compsys_manufacturerW[] =
669 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
670 static const WCHAR compsys_modelW[] =
671 {'W','i','n','e',0};
672 static const WCHAR compsysproduct_identifyingnumberW[] =
673 {'0',0};
674 static const WCHAR compsysproduct_uuidW[] =
675 {'0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-',
676 '0','0','0','0','0','0','0','0','0','0','0','0',0};
677 static const WCHAR diskdrive_interfacetypeW[] =
678 {'I','D','E',0};
679 static const WCHAR diskdrive_manufacturerW[] =
680 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
681 static const WCHAR diskdrive_mediatype_fixedW[] =
682 {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
683 static const WCHAR diskdrive_mediatype_removableW[] =
684 {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
685 static const WCHAR diskdrive_modelW[] =
686 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
687 static const WCHAR diskdrive_pnpdeviceidW[] =
688 {'I','D','E','\\','D','i','s','k','\\','V','E','N','_','W','I','N','E',0};
689 static const WCHAR diskdrive_serialW[] =
690 {'W','I','N','E','H','D','I','S','K',0};
691 static const WCHAR networkadapter_pnpdeviceidW[]=
692 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
693 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
694 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
695 static const WCHAR os_32bitW[] =
696 {'3','2','-','b','i','t',0};
697 static const WCHAR os_64bitW[] =
698 {'6','4','-','b','i','t',0};
699 static const WCHAR os_buildnumberW[] =
700 {'2','6','0','0',0};
701 static const WCHAR os_captionW[] =
702 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
703 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
704 static const WCHAR os_csdversionW[] =
705 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
706 static const WCHAR os_installdateW[] =
707 {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
708 static const WCHAR os_nameW[] =
709 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
710 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
711 '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
712 '\\','P','a','r','t','i','t','i','o','n','1',0};
713 static const WCHAR os_serialnumberW[] =
714 {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
715 static const WCHAR os_versionW[] =
716 {'5','.','1','.','2','6','0','0',0};
717 static const WCHAR physicalmedia_tagW[] =
718 {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
719 static const WCHAR sounddevice_productnameW[] =
720 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
721 static const WCHAR systemenclosure_systemenclosureW[] =
722 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',0};
723 static const WCHAR systemenclosure_tagW[] =
724 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',' ','0',0};
725 static const WCHAR systemenclosure_manufacturerW[] =
726 {'W','i','n','e',0};
727 static const WCHAR videocontroller_dactypeW[] =
728 {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
729 static const WCHAR videocontroller_deviceidW[] =
730 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
731 static const WCHAR videocontroller_driverversionW[] =
732 {'1','.','0',0};
734 #include "pshpack1.h"
735 struct record_baseboard
737 const WCHAR *manufacturer;
738 const WCHAR *model;
739 const WCHAR *name;
740 const WCHAR *product;
741 const WCHAR *serialnumber;
742 const WCHAR *tag;
743 const WCHAR *version;
745 struct record_bios
747 const WCHAR *description;
748 const WCHAR *identificationcode;
749 const WCHAR *manufacturer;
750 const WCHAR *releasedate;
751 const WCHAR *serialnumber;
752 const WCHAR *smbiosbiosversion;
753 const WCHAR *version;
755 struct record_cdromdrive
757 const WCHAR *device_id;
758 const WCHAR *drive;
759 const WCHAR *mediatype;
760 const WCHAR *name;
761 const WCHAR *pnpdevice_id;
763 struct record_computersystem
765 const WCHAR *description;
766 const WCHAR *domain;
767 UINT16 domainrole;
768 const WCHAR *manufacturer;
769 const WCHAR *model;
770 const WCHAR *name;
771 UINT32 num_logical_processors;
772 UINT32 num_processors;
773 UINT64 total_physical_memory;
774 const WCHAR *username;
776 struct record_computersystemproduct
778 const WCHAR *identifyingnumber;
779 const WCHAR *uuid;
781 struct record_datafile
783 const WCHAR *name;
784 const WCHAR *version;
786 struct record_directory
788 UINT32 accessmask;
789 const WCHAR *name;
791 struct record_diskdrive
793 const WCHAR *device_id;
794 UINT32 index;
795 const WCHAR *interfacetype;
796 const WCHAR *manufacturer;
797 const WCHAR *mediatype;
798 const WCHAR *model;
799 const WCHAR *pnpdevice_id;
800 const WCHAR *serialnumber;
801 UINT64 size;
803 struct record_diskpartition
805 int bootable;
806 int bootpartition;
807 const WCHAR *device_id;
808 UINT32 diskindex;
809 UINT32 index;
810 const WCHAR *pnpdevice_id;
811 UINT64 size;
812 UINT64 startingoffset;
813 const WCHAR *type;
815 struct record_logicaldisk
817 const WCHAR *device_id;
818 UINT32 drivetype;
819 const WCHAR *filesystem;
820 UINT64 freespace;
821 const WCHAR *name;
822 UINT64 size;
823 const WCHAR *volumename;
824 const WCHAR *volumeserialnumber;
826 struct record_networkadapter
828 const WCHAR *adaptertype;
829 const WCHAR *device_id;
830 UINT32 index;
831 UINT32 interface_index;
832 const WCHAR *mac_address;
833 const WCHAR *manufacturer;
834 const WCHAR *name;
835 UINT16 netconnection_status;
836 int physicaladapter;
837 const WCHAR *pnpdevice_id;
838 UINT64 speed;
840 struct record_networkadapterconfig
842 const WCHAR *dnshostname;
843 UINT32 index;
844 UINT32 ipconnectionmetric;
845 int ipenabled;
846 const WCHAR *mac_address;
848 struct record_operatingsystem
850 const WCHAR *buildnumber;
851 const WCHAR *caption;
852 const WCHAR *codeset;
853 const WCHAR *countrycode;
854 const WCHAR *csdversion;
855 const WCHAR *installdate;
856 const WCHAR *lastbootuptime;
857 const WCHAR *localdatetime;
858 const WCHAR *locale;
859 const WCHAR *name;
860 const WCHAR *osarchitecture;
861 UINT32 oslanguage;
862 UINT32 osproductsuite;
863 UINT16 ostype;
864 const WCHAR *serialnumber;
865 UINT16 servicepackmajor;
866 UINT16 servicepackminor;
867 UINT32 suitemask;
868 const WCHAR *systemdirectory;
869 UINT64 totalvisiblememorysize;
870 const WCHAR *version;
872 struct record_param
874 const WCHAR *class;
875 const WCHAR *method;
876 INT32 direction;
877 const WCHAR *parameter;
878 UINT32 type;
879 UINT32 varianttype;
880 UINT32 defaultvalue;
882 struct record_physicalmedia
884 const WCHAR *serialnumber;
885 const WCHAR *tag;
887 struct record_physicalmemory
889 UINT64 capacity;
891 struct record_printer
893 UINT32 attributes;
894 const WCHAR *drivername;
895 UINT32 horizontalresolution;
896 int local;
897 const WCHAR *name;
898 int network;
900 struct record_process
902 const WCHAR *caption;
903 const WCHAR *commandline;
904 const WCHAR *description;
905 const WCHAR *handle;
906 const WCHAR *name;
907 UINT32 pprocess_id;
908 UINT32 process_id;
909 UINT32 thread_count;
910 /* methods */
911 class_method *get_owner;
913 struct record_processor
915 UINT16 addresswidth;
916 const WCHAR *caption;
917 UINT16 cpu_status;
918 UINT32 currentclockspeed;
919 UINT16 datawidth;
920 const WCHAR *description;
921 const WCHAR *device_id;
922 UINT16 family;
923 const WCHAR *manufacturer;
924 UINT32 maxclockspeed;
925 const WCHAR *name;
926 UINT32 num_cores;
927 UINT32 num_logical_processors;
928 const WCHAR *processor_id;
929 UINT16 processortype;
930 const WCHAR *unique_id;
931 const WCHAR *version;
933 struct record_qualifier
935 const WCHAR *class;
936 const WCHAR *member;
937 UINT32 type;
938 INT32 flavor;
939 const WCHAR *name;
940 INT32 intvalue;
941 const WCHAR *strvalue;
943 struct record_service
945 int accept_pause;
946 int accept_stop;
947 const WCHAR *displayname;
948 const WCHAR *name;
949 UINT32 process_id;
950 const WCHAR *servicetype;
951 const WCHAR *startmode;
952 const WCHAR *state;
953 const WCHAR *systemname;
954 /* methods */
955 class_method *pause_service;
956 class_method *resume_service;
957 class_method *start_service;
958 class_method *stop_service;
960 struct record_sid
962 const WCHAR *accountname;
963 const struct array *binaryrepresentation;
964 const WCHAR *referenceddomainname;
965 const WCHAR *sid;
966 UINT32 sidlength;
968 struct record_sounddevice
970 const WCHAR *name;
971 const WCHAR *productname;
972 UINT16 statusinfo;
974 struct record_stdregprov
976 class_method *enumkey;
977 class_method *enumvalues;
978 class_method *getstringvalue;
980 struct record_systemsecurity
982 class_method *getsd;
983 class_method *setsd;
985 struct record_systemenclosure
987 const WCHAR *caption;
988 const struct array *chassistypes;
989 const WCHAR *description;
990 int lockpresent;
991 const WCHAR *manufacturer;
992 const WCHAR *name;
993 const WCHAR *tag;
995 struct record_videocontroller
997 const WCHAR *adapter_dactype;
998 UINT32 adapter_ram;
999 UINT16 availability;
1000 const WCHAR *caption;
1001 UINT32 current_bitsperpixel;
1002 UINT32 current_horizontalres;
1003 UINT32 current_refreshrate;
1004 UINT16 current_scanmode;
1005 UINT32 current_verticalres;
1006 const WCHAR *description;
1007 const WCHAR *device_id;
1008 const WCHAR *driverversion;
1009 const WCHAR *name;
1010 const WCHAR *pnpdevice_id;
1011 UINT16 videoarchitecture;
1012 UINT16 videomemorytype;
1013 const WCHAR *videoprocessor;
1015 #include "poppack.h"
1017 static const struct record_baseboard data_baseboard[] =
1019 { baseboard_manufacturerW, baseboard_tagW, baseboard_tagW, baseboard_tagW, baseboard_serialnumberW, baseboard_versionW }
1021 static const struct record_bios data_bios[] =
1023 { bios_descriptionW, bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW,
1024 bios_smbiosbiosversionW, bios_versionW }
1026 static const struct record_computersystemproduct data_compsysproduct[] =
1028 { compsysproduct_identifyingnumberW, compsysproduct_uuidW }
1030 static const struct record_param data_param[] =
1032 { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1033 { class_processW, method_getownerW, -1, param_userW, CIM_STRING },
1034 { class_processW, method_getownerW, -1, param_domainW, CIM_STRING },
1035 { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1036 { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1037 { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1038 { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1039 { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1040 { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING },
1041 { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1042 { class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
1043 { class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1044 { class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING },
1045 { class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1046 { class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
1047 { class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY },
1048 { class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1049 { class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING },
1050 { class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING },
1051 { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1052 { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING },
1053 { class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1054 { class_systemsecurityW, method_getsdW, -1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
1055 { class_systemsecurityW, method_setsdW, 1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
1056 { class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1059 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
1060 WBEM_FLAVOR_ORIGIN_PROPAGATED)
1062 static const struct record_physicalmedia data_physicalmedia[] =
1064 { diskdrive_serialW, physicalmedia_tagW }
1066 static const struct record_qualifier data_qualifier[] =
1068 { class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 },
1069 { class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 }
1071 static const struct record_sounddevice data_sounddevice[] =
1073 { sounddevice_productnameW, sounddevice_productnameW, 3 /* enabled */ }
1075 static const struct record_stdregprov data_stdregprov[] =
1077 { reg_enum_key, reg_enum_values, reg_get_stringvalue }
1079 static UINT16 systemenclosure_chassistypes[] =
1083 static const struct array systemenclosure_chassistypes_array =
1085 SIZEOF(systemenclosure_chassistypes),
1086 &systemenclosure_chassistypes
1088 static const struct record_systemenclosure data_systemenclosure[] =
1091 systemenclosure_systemenclosureW,
1092 &systemenclosure_chassistypes_array,
1093 systemenclosure_systemenclosureW,
1094 FALSE,
1095 systemenclosure_manufacturerW,
1096 systemenclosure_systemenclosureW,
1097 systemenclosure_tagW,
1100 static const struct record_systemsecurity data_systemsecurity[] =
1102 { security_get_sd, security_set_sd }
1105 /* check if row matches condition and update status */
1106 static BOOL match_row( const struct table *table, UINT row, const struct expr *cond, enum fill_status *status )
1108 LONGLONG val;
1109 UINT type;
1111 if (!cond)
1113 *status = FILL_STATUS_UNFILTERED;
1114 return TRUE;
1116 if (eval_cond( table, row, cond, &val, &type ) != S_OK)
1118 *status = FILL_STATUS_FAILED;
1119 return FALSE;
1121 *status = FILL_STATUS_FILTERED;
1122 return val != 0;
1125 static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
1127 if (!table->num_rows_allocated)
1129 if (!(table->data = heap_alloc( row_count * row_size ))) return FALSE;
1130 table->num_rows_allocated = row_count;
1131 return TRUE;
1133 if (row_count > table->num_rows_allocated)
1135 BYTE *data;
1136 UINT count = max( row_count, table->num_rows_allocated * 2 );
1137 if (!(data = heap_realloc( table->data, count * row_size ))) return FALSE;
1138 table->data = data;
1139 table->num_rows_allocated = count;
1141 return TRUE;
1144 static enum fill_status fill_cdromdrive( struct table *table, const struct expr *cond )
1146 static const WCHAR fmtW[] = {'%','c',':',0};
1147 WCHAR drive[3], root[] = {'A',':','\\',0};
1148 struct record_cdromdrive *rec;
1149 UINT i, row = 0, offset = 0;
1150 DWORD drives = GetLogicalDrives();
1151 enum fill_status status = FILL_STATUS_UNFILTERED;
1153 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1155 for (i = 0; i < sizeof(drives); i++)
1157 if (drives & (1 << i))
1159 root[0] = 'A' + i;
1160 if (GetDriveTypeW( root ) != DRIVE_CDROM)
1161 continue;
1163 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1165 rec = (struct record_cdromdrive *)(table->data + offset);
1166 rec->device_id = cdromdrive_pnpdeviceidW;
1167 sprintfW( drive, fmtW, 'A' + i );
1168 rec->drive = heap_strdupW( drive );
1169 rec->mediatype = cdromdrive_mediatypeW;
1170 rec->name = cdromdrive_nameW;
1171 rec->pnpdevice_id = cdromdrive_pnpdeviceidW;
1172 if (!match_row( table, row, cond, &status ))
1174 free_row_values( table, row );
1175 continue;
1177 offset += sizeof(*rec);
1178 row++;
1181 TRACE("created %u rows\n", row);
1182 table->num_rows = row;
1183 return status;
1186 static UINT get_processor_count(void)
1188 SYSTEM_BASIC_INFORMATION info;
1190 if (NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )) return 1;
1191 return info.NumberOfProcessors;
1194 static UINT get_logical_processor_count( UINT *num_cores )
1196 SYSTEM_LOGICAL_PROCESSOR_INFORMATION *info;
1197 UINT i, j, count = 0;
1198 NTSTATUS status;
1199 ULONG len;
1201 if (num_cores) *num_cores = get_processor_count();
1202 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, NULL, 0, &len );
1203 if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count();
1205 if (!(info = heap_alloc( len ))) return get_processor_count();
1206 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, info, len, &len );
1207 if (status != STATUS_SUCCESS)
1209 heap_free( info );
1210 return get_processor_count();
1212 if (num_cores) *num_cores = 0;
1213 for (i = 0; i < len / sizeof(*info); i++)
1215 if (info[i].Relationship == RelationProcessorCore)
1217 for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) count++;
1219 else if (info[i].Relationship == RelationProcessorPackage && num_cores)
1221 for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) (*num_cores)++;
1224 heap_free( info );
1225 return count;
1228 static UINT64 get_total_physical_memory(void)
1230 MEMORYSTATUSEX status;
1232 status.dwLength = sizeof(status);
1233 if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
1234 return status.ullTotalPhys;
1237 static WCHAR *get_computername(void)
1239 WCHAR *ret;
1240 DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
1242 if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
1243 GetComputerNameW( ret, &size );
1244 return ret;
1247 static WCHAR *get_username(void)
1249 WCHAR *ret;
1250 DWORD compsize, usersize;
1251 DWORD size;
1253 compsize = 0;
1254 GetComputerNameW( NULL, &compsize );
1255 usersize = 0;
1256 GetUserNameW( NULL, &usersize );
1257 size = compsize + usersize; /* two null terminators account for the \ */
1258 if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
1259 GetComputerNameW( ret, &compsize );
1260 ret[compsize] = '\\';
1261 GetUserNameW( ret + compsize + 1, &usersize );
1262 return ret;
1265 static enum fill_status fill_compsys( struct table *table, const struct expr *cond )
1267 struct record_computersystem *rec;
1268 enum fill_status status = FILL_STATUS_UNFILTERED;
1269 UINT row = 0;
1271 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1273 rec = (struct record_computersystem *)table->data;
1274 rec->description = compsys_descriptionW;
1275 rec->domain = compsys_domainW;
1276 rec->domainrole = 0; /* standalone workstation */
1277 rec->manufacturer = compsys_manufacturerW;
1278 rec->model = compsys_modelW;
1279 rec->name = get_computername();
1280 rec->num_logical_processors = get_logical_processor_count( NULL );
1281 rec->num_processors = get_processor_count();
1282 rec->total_physical_memory = get_total_physical_memory();
1283 rec->username = get_username();
1284 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
1285 else row++;
1287 TRACE("created %u rows\n", row);
1288 table->num_rows = row;
1289 return status;
1292 struct dirstack
1294 WCHAR **dirs;
1295 UINT *len_dirs;
1296 UINT num_dirs;
1297 UINT num_allocated;
1300 static struct dirstack *alloc_dirstack( UINT size )
1302 struct dirstack *dirstack;
1304 if (!(dirstack = heap_alloc( sizeof(*dirstack) ))) return NULL;
1305 if (!(dirstack->dirs = heap_alloc( sizeof(WCHAR *) * size )))
1307 heap_free( dirstack );
1308 return NULL;
1310 if (!(dirstack->len_dirs = heap_alloc( sizeof(UINT) * size )))
1312 heap_free( dirstack->dirs );
1313 heap_free( dirstack );
1314 return NULL;
1316 dirstack->num_dirs = 0;
1317 dirstack->num_allocated = size;
1318 return dirstack;
1321 static void clear_dirstack( struct dirstack *dirstack )
1323 UINT i;
1324 for (i = 0; i < dirstack->num_dirs; i++) heap_free( dirstack->dirs[i] );
1325 dirstack->num_dirs = 0;
1328 static void free_dirstack( struct dirstack *dirstack )
1330 clear_dirstack( dirstack );
1331 heap_free( dirstack->dirs );
1332 heap_free( dirstack->len_dirs );
1333 heap_free( dirstack );
1336 static BOOL push_dir( struct dirstack *dirstack, WCHAR *dir, UINT len )
1338 UINT size, i = dirstack->num_dirs;
1340 if (!dir) return FALSE;
1342 if (i == dirstack->num_allocated)
1344 WCHAR **tmp;
1345 UINT *len_tmp;
1347 size = dirstack->num_allocated * 2;
1348 if (!(tmp = heap_realloc( dirstack->dirs, size * sizeof(WCHAR *) ))) return FALSE;
1349 dirstack->dirs = tmp;
1350 if (!(len_tmp = heap_realloc( dirstack->len_dirs, size * sizeof(UINT) ))) return FALSE;
1351 dirstack->len_dirs = len_tmp;
1352 dirstack->num_allocated = size;
1354 dirstack->dirs[i] = dir;
1355 dirstack->len_dirs[i] = len;
1356 dirstack->num_dirs++;
1357 return TRUE;
1360 static WCHAR *pop_dir( struct dirstack *dirstack, UINT *len )
1362 if (!dirstack->num_dirs)
1364 *len = 0;
1365 return NULL;
1367 dirstack->num_dirs--;
1368 *len = dirstack->len_dirs[dirstack->num_dirs];
1369 return dirstack->dirs[dirstack->num_dirs];
1372 static const WCHAR *peek_dir( struct dirstack *dirstack )
1374 if (!dirstack->num_dirs) return NULL;
1375 return dirstack->dirs[dirstack->num_dirs - 1];
1378 static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len )
1380 UINT i = 0;
1381 WCHAR *ret;
1383 if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
1384 ret[i++] = drive;
1385 ret[i++] = ':';
1386 ret[i++] = '\\';
1387 if (path && len)
1389 memcpy( ret + i, path, len * sizeof(WCHAR) );
1390 i += len;
1391 ret[i++] = '\\';
1393 ret[i++] = '*';
1394 ret[i] = 0;
1395 return ret;
1398 static WCHAR *build_name( WCHAR drive, const WCHAR *path )
1400 UINT i = 0, len = 0;
1401 const WCHAR *p;
1402 WCHAR *ret;
1404 for (p = path; *p; p++)
1406 if (*p == '\\') len += 2;
1407 else len++;
1409 if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
1410 ret[i++] = drive;
1411 ret[i++] = ':';
1412 ret[i++] = '\\';
1413 ret[i++] = '\\';
1414 for (p = path; *p; p++)
1416 if (*p != '\\') ret[i++] = *p;
1417 else
1419 ret[i++] = '\\';
1420 ret[i++] = '\\';
1423 ret[i] = 0;
1424 return ret;
1427 static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
1429 const WCHAR *p = path, *start;
1430 UINT len, i;
1431 WCHAR *ret;
1433 if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
1434 start = path + 4;
1435 len = strlenW( start );
1436 p = start + len - 1;
1437 if (*p == '\\') return NULL;
1439 while (p >= start && *p != '\\') { len--; p--; };
1440 while (p >= start && *p == '\\') { len--; p--; };
1442 if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
1443 for (i = 0, p = start; p < start + len; p++)
1445 if (p[0] == '\\' && p[1] == '\\')
1447 ret[i++] = '\\';
1448 p++;
1450 else ret[i++] = *p;
1452 ret[i] = 0;
1453 *ret_len = i;
1454 return ret;
1457 static BOOL seen_dir( struct dirstack *dirstack, const WCHAR *path )
1459 UINT i;
1460 for (i = 0; i < dirstack->num_dirs; i++) if (!strcmpW( dirstack->dirs[i], path )) return TRUE;
1461 return FALSE;
1464 /* optimize queries of the form WHERE Name='...' [OR Name='...']* */
1465 static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR root, UINT *count )
1467 const struct expr *left, *right;
1469 if (!cond || cond->type != EXPR_COMPLEX) return *count = 0;
1471 left = cond->u.expr.left;
1472 right = cond->u.expr.right;
1473 if (cond->u.expr.op == OP_EQ)
1475 UINT len;
1476 WCHAR *path;
1477 const WCHAR *str = NULL;
1479 if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL &&
1480 !strcmpW( left->u.propval->name, prop_nameW ) &&
1481 toupperW( right->u.sval[0] ) == toupperW( root ))
1483 str = right->u.sval;
1485 else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL &&
1486 !strcmpW( right->u.propval->name, prop_nameW ) &&
1487 toupperW( left->u.sval[0] ) == toupperW( root ))
1489 str = left->u.sval;
1491 if (str && (path = build_dirname( str, &len )))
1493 if (seen_dir( dirstack, path ))
1495 heap_free( path );
1496 return ++*count;
1498 else if (push_dir( dirstack, path, len )) return ++*count;
1499 heap_free( path );
1500 return *count = 0;
1503 else if (cond->u.expr.op == OP_OR)
1505 UINT left_count = 0, right_count = 0;
1507 if (!(seed_dirs( dirstack, left, root, &left_count ))) return *count = 0;
1508 if (!(seed_dirs( dirstack, right, root, &right_count ))) return *count = 0;
1509 return *count += left_count + right_count;
1511 return *count = 0;
1514 static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len )
1516 UINT len_path = 0, len_segment = strlenW( segment );
1517 WCHAR *ret;
1519 *len = 0;
1520 if (path) len_path = strlenW( path );
1521 if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
1522 if (path && len_path)
1524 memcpy( ret, path, len_path * sizeof(WCHAR) );
1525 ret[len_path] = '\\';
1526 *len += len_path + 1;
1528 memcpy( ret + *len, segment, len_segment * sizeof(WCHAR) );
1529 *len += len_segment;
1530 ret[*len] = 0;
1531 return ret;
1534 static WCHAR *get_file_version( const WCHAR *filename )
1536 static const WCHAR slashW[] = {'\\',0}, fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
1537 VS_FIXEDFILEINFO *info;
1538 DWORD size;
1539 void *block;
1540 WCHAR *ret;
1542 if (!(ret = heap_alloc( (4 * 5 + sizeof(fmtW) / sizeof(fmtW[0])) * sizeof(WCHAR) ))) return NULL;
1543 if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size )))
1545 heap_free( ret );
1546 return NULL;
1548 if (!GetFileVersionInfoW( filename, 0, size, block ) ||
1549 !VerQueryValueW( block, slashW, (void **)&info, &size ))
1551 heap_free( block );
1552 heap_free( ret );
1553 return NULL;
1555 sprintfW( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff,
1556 info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff );
1557 heap_free( block );
1558 return ret;
1561 static enum fill_status fill_datafile( struct table *table, const struct expr *cond )
1563 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
1564 struct record_datafile *rec;
1565 UINT i, len, row = 0, offset = 0, num_expected_rows;
1566 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
1567 DWORD drives = GetLogicalDrives();
1568 WIN32_FIND_DATAW data;
1569 HANDLE handle;
1570 struct dirstack *dirstack;
1571 enum fill_status status = FILL_STATUS_UNFILTERED;
1573 if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED;
1575 dirstack = alloc_dirstack(2);
1577 for (i = 0; i < sizeof(drives); i++)
1579 if (!(drives & (1 << i))) continue;
1581 root[0] = 'A' + i;
1582 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
1584 num_expected_rows = 0;
1585 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
1587 for (;;)
1589 path = pop_dir( dirstack, &len );
1590 if (!(glob = build_glob( root[0], path, len )))
1592 status = FILL_STATUS_FAILED;
1593 goto done;
1595 if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
1599 if (!resize_table( table, row + 1, sizeof(*rec) ))
1601 status = FILL_STATUS_FAILED;
1602 FindClose( handle );
1603 goto done;
1605 if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue;
1606 new_path = append_path( path, data.cFileName, &len );
1608 if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
1610 if (push_dir( dirstack, new_path, len )) continue;
1611 heap_free( new_path );
1612 FindClose( handle );
1613 status = FILL_STATUS_FAILED;
1614 goto done;
1616 rec = (struct record_datafile *)(table->data + offset);
1617 rec->name = build_name( root[0], new_path );
1618 rec->version = get_file_version( rec->name );
1619 if (!match_row( table, row, cond, &status ))
1621 free_row_values( table, row );
1622 continue;
1624 else if (num_expected_rows && row == num_expected_rows - 1)
1626 row++;
1627 FindClose( handle );
1628 status = FILL_STATUS_FILTERED;
1629 goto done;
1631 offset += sizeof(*rec);
1632 row++;
1634 while (FindNextFileW( handle, &data ));
1635 FindClose( handle );
1637 if (!peek_dir( dirstack )) break;
1638 heap_free( glob );
1639 heap_free( path );
1643 done:
1644 free_dirstack( dirstack );
1645 heap_free( glob );
1646 heap_free( path );
1648 TRACE("created %u rows\n", row);
1649 table->num_rows = row;
1650 return status;
1653 static enum fill_status fill_directory( struct table *table, const struct expr *cond )
1655 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
1656 struct record_directory *rec;
1657 UINT i, len, row = 0, offset = 0, num_expected_rows;
1658 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
1659 DWORD drives = GetLogicalDrives();
1660 WIN32_FIND_DATAW data;
1661 HANDLE handle;
1662 struct dirstack *dirstack;
1663 enum fill_status status = FILL_STATUS_UNFILTERED;
1665 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1667 dirstack = alloc_dirstack(2);
1669 for (i = 0; i < sizeof(drives); i++)
1671 if (!(drives & (1 << i))) continue;
1673 root[0] = 'A' + i;
1674 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
1676 num_expected_rows = 0;
1677 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
1679 for (;;)
1681 path = pop_dir( dirstack, &len );
1682 if (!(glob = build_glob( root[0], path, len )))
1684 status = FILL_STATUS_FAILED;
1685 goto done;
1687 if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
1691 if (!resize_table( table, row + 1, sizeof(*rec) ))
1693 FindClose( handle );
1694 status = FILL_STATUS_FAILED;
1695 goto done;
1697 if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
1698 !strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW ))
1699 continue;
1701 new_path = append_path( path, data.cFileName, &len );
1702 if (!(push_dir( dirstack, new_path, len )))
1704 heap_free( new_path );
1705 FindClose( handle );
1706 status = FILL_STATUS_FAILED;
1707 goto done;
1709 rec = (struct record_directory *)(table->data + offset);
1710 rec->accessmask = FILE_ALL_ACCESS;
1711 rec->name = build_name( root[0], new_path );
1712 if (!match_row( table, row, cond, &status ))
1714 free_row_values( table, row );
1715 continue;
1717 else if (num_expected_rows && row == num_expected_rows - 1)
1719 row++;
1720 FindClose( handle );
1721 status = FILL_STATUS_FILTERED;
1722 goto done;
1724 offset += sizeof(*rec);
1725 row++;
1727 while (FindNextFileW( handle, &data ));
1728 FindClose( handle );
1730 if (!peek_dir( dirstack )) break;
1731 heap_free( glob );
1732 heap_free( path );
1736 done:
1737 free_dirstack( dirstack );
1738 heap_free( glob );
1739 heap_free( path );
1741 TRACE("created %u rows\n", row);
1742 table->num_rows = row;
1743 return status;
1746 static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
1748 WCHAR root[] = {'\\','\\','.','\\','A',':',0};
1749 ULARGE_INTEGER free;
1750 DISK_GEOMETRY_EX info;
1751 HANDLE handle;
1752 DWORD bytes_returned;
1754 free.QuadPart = 512 * 1024 * 1024;
1755 GetDiskFreeSpaceExW( dir, NULL, NULL, &free );
1757 root[4] = dir[0];
1758 handle = CreateFileW( root, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
1759 if (handle != INVALID_HANDLE_VALUE)
1761 if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &info, sizeof(info), &bytes_returned, NULL ))
1762 *disksize = info.DiskSize.QuadPart;
1763 CloseHandle( handle );
1765 return free.QuadPart;
1768 static enum fill_status fill_diskdrive( struct table *table, const struct expr *cond )
1770 static const WCHAR fmtW[] =
1771 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
1772 WCHAR device_id[sizeof(fmtW)/sizeof(fmtW[0]) + 10], root[] = {'A',':','\\',0};
1773 struct record_diskdrive *rec;
1774 UINT i, row = 0, offset = 0, index = 0, type;
1775 UINT64 size = 1024 * 1024 * 1024;
1776 DWORD drives = GetLogicalDrives();
1777 enum fill_status status = FILL_STATUS_UNFILTERED;
1779 if (!resize_table( table, 2, sizeof(*rec) )) return FILL_STATUS_FAILED;
1781 for (i = 0; i < sizeof(drives); i++)
1783 if (drives & (1 << i))
1785 root[0] = 'A' + i;
1786 type = GetDriveTypeW( root );
1787 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
1788 continue;
1790 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1792 rec = (struct record_diskdrive *)(table->data + offset);
1793 sprintfW( device_id, fmtW, index );
1794 rec->device_id = heap_strdupW( device_id );
1795 rec->index = index;
1796 rec->interfacetype = diskdrive_interfacetypeW;
1797 rec->manufacturer = diskdrive_manufacturerW;
1798 if (type == DRIVE_FIXED)
1799 rec->mediatype = diskdrive_mediatype_fixedW;
1800 else
1801 rec->mediatype = diskdrive_mediatype_removableW;
1802 rec->model = diskdrive_modelW;
1803 rec->pnpdevice_id = diskdrive_pnpdeviceidW;
1804 rec->serialnumber = diskdrive_serialW;
1805 get_freespace( root, &size );
1806 rec->size = size;
1807 if (!match_row( table, row, cond, &status ))
1809 free_row_values( table, row );
1810 continue;
1812 offset += sizeof(*rec);
1813 index++;
1814 row++;
1817 TRACE("created %u rows\n", row);
1818 table->num_rows = row;
1819 return status;
1822 static WCHAR *get_filesystem( const WCHAR *root )
1824 static const WCHAR ntfsW[] = {'N','T','F','S',0};
1825 WCHAR buffer[MAX_PATH + 1];
1827 if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
1828 return heap_strdupW( buffer );
1829 return heap_strdupW( ntfsW );
1832 static enum fill_status fill_diskpartition( struct table *table, const struct expr *cond )
1834 static const WCHAR fmtW[] =
1835 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
1836 WCHAR device_id[32], root[] = {'A',':','\\',0};
1837 struct record_diskpartition *rec;
1838 UINT i, row = 0, offset = 0, type, index = 0;
1839 UINT64 size = 1024 * 1024 * 1024;
1840 DWORD drives = GetLogicalDrives();
1841 enum fill_status status = FILL_STATUS_UNFILTERED;
1843 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1845 for (i = 0; i < sizeof(drives); i++)
1847 if (drives & (1 << i))
1849 root[0] = 'A' + i;
1850 type = GetDriveTypeW( root );
1851 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
1852 continue;
1854 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1856 rec = (struct record_diskpartition *)(table->data + offset);
1857 rec->bootable = (i == 2) ? -1 : 0;
1858 rec->bootpartition = (i == 2) ? -1 : 0;
1859 sprintfW( device_id, fmtW, index );
1860 rec->device_id = heap_strdupW( device_id );
1861 rec->diskindex = index;
1862 rec->index = 0;
1863 rec->pnpdevice_id = heap_strdupW( device_id );
1864 get_freespace( root, &size );
1865 rec->size = size;
1866 rec->startingoffset = 0;
1867 rec->type = get_filesystem( root );
1868 if (!match_row( table, row, cond, &status ))
1870 free_row_values( table, row );
1871 continue;
1873 offset += sizeof(*rec);
1874 row++;
1875 index++;
1878 TRACE("created %u rows\n", row);
1879 table->num_rows = row;
1880 return status;
1883 static WCHAR *get_volumename( const WCHAR *root )
1885 WCHAR buf[MAX_PATH + 1] = {0};
1886 GetVolumeInformationW( root, buf, sizeof(buf)/sizeof(buf[0]), NULL, NULL, NULL, NULL, 0 );
1887 return heap_strdupW( buf );
1889 static WCHAR *get_volumeserialnumber( const WCHAR *root )
1891 static const WCHAR fmtW[] = {'%','0','8','X',0};
1892 DWORD serial = 0;
1893 WCHAR buffer[9];
1895 GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 );
1896 sprintfW( buffer, fmtW, serial );
1897 return heap_strdupW( buffer );
1900 static enum fill_status fill_logicaldisk( struct table *table, const struct expr *cond )
1902 static const WCHAR fmtW[] = {'%','c',':',0};
1903 WCHAR device_id[3], root[] = {'A',':','\\',0};
1904 struct record_logicaldisk *rec;
1905 UINT i, row = 0, offset = 0, type;
1906 UINT64 size = 1024 * 1024 * 1024;
1907 DWORD drives = GetLogicalDrives();
1908 enum fill_status status = FILL_STATUS_UNFILTERED;
1910 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1912 for (i = 0; i < sizeof(drives); i++)
1914 if (drives & (1 << i))
1916 root[0] = 'A' + i;
1917 type = GetDriveTypeW( root );
1918 if (type != DRIVE_FIXED && type != DRIVE_CDROM && type != DRIVE_REMOVABLE)
1919 continue;
1921 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1923 rec = (struct record_logicaldisk *)(table->data + offset);
1924 sprintfW( device_id, fmtW, 'A' + i );
1925 rec->device_id = heap_strdupW( device_id );
1926 rec->drivetype = type;
1927 rec->filesystem = get_filesystem( root );
1928 rec->freespace = get_freespace( root, &size );
1929 rec->name = heap_strdupW( device_id );
1930 rec->size = size;
1931 rec->volumename = get_volumename( root );
1932 rec->volumeserialnumber = get_volumeserialnumber( root );
1933 if (!match_row( table, row, cond, &status ))
1935 free_row_values( table, row );
1936 continue;
1938 offset += sizeof(*rec);
1939 row++;
1942 TRACE("created %u rows\n", row);
1943 table->num_rows = row;
1944 return status;
1947 static UINT16 get_connection_status( IF_OPER_STATUS status )
1949 switch (status)
1951 case IfOperStatusDown:
1952 return 0; /* Disconnected */
1953 case IfOperStatusUp:
1954 return 2; /* Connected */
1955 default:
1956 ERR("unhandled status %u\n", status);
1957 break;
1959 return 0;
1961 static WCHAR *get_mac_address( const BYTE *addr, DWORD len )
1963 static const WCHAR fmtW[] =
1964 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
1965 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
1966 WCHAR *ret;
1968 if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
1969 sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
1970 return ret;
1972 static const WCHAR *get_adaptertype( DWORD type, int *physical )
1974 static const WCHAR ethernetW[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
1975 static const WCHAR wirelessW[] = {'W','i','r','e','l','e','s','s',0};
1976 static const WCHAR firewireW[] = {'1','3','9','4',0};
1977 static const WCHAR tunnelW[] = {'T','u','n','n','e','l',0};
1979 switch (type)
1981 case IF_TYPE_ETHERNET_CSMACD: *physical = -1; return ethernetW;
1982 case IF_TYPE_IEEE80211: *physical = -1; return wirelessW;
1983 case IF_TYPE_IEEE1394: *physical = -1; return firewireW;
1984 case IF_TYPE_TUNNEL: *physical = 0; return tunnelW;
1985 default: *physical = 0; return NULL;
1989 static enum fill_status fill_networkadapter( struct table *table, const struct expr *cond )
1991 static const WCHAR fmtW[] = {'%','u',0};
1992 WCHAR device_id[11];
1993 struct record_networkadapter *rec;
1994 IP_ADAPTER_ADDRESSES *aa, *buffer;
1995 UINT row = 0, offset = 0, count = 0;
1996 DWORD size = 0, ret;
1997 int physical;
1998 enum fill_status status = FILL_STATUS_UNFILTERED;
2000 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
2001 if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
2003 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
2004 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
2006 heap_free( buffer );
2007 return FILL_STATUS_FAILED;
2009 for (aa = buffer; aa; aa = aa->Next)
2011 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
2013 if (!resize_table( table, count, sizeof(*rec) ))
2015 heap_free( buffer );
2016 return FILL_STATUS_FAILED;
2018 for (aa = buffer; aa; aa = aa->Next)
2020 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
2022 rec = (struct record_networkadapter *)(table->data + offset);
2023 sprintfW( device_id, fmtW, aa->u.s.IfIndex );
2024 rec->adaptertype = get_adaptertype( aa->IfType, &physical );
2025 rec->device_id = heap_strdupW( device_id );
2026 rec->index = aa->u.s.IfIndex;
2027 rec->interface_index = aa->u.s.IfIndex;
2028 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
2029 rec->manufacturer = compsys_manufacturerW;
2030 rec->name = heap_strdupW( aa->FriendlyName );
2031 rec->netconnection_status = get_connection_status( aa->OperStatus );
2032 rec->physicaladapter = physical;
2033 rec->pnpdevice_id = networkadapter_pnpdeviceidW;
2034 rec->speed = 1000000;
2035 if (!match_row( table, row, cond, &status ))
2037 free_row_values( table, row );
2038 continue;
2040 offset += sizeof(*rec);
2041 row++;
2043 TRACE("created %u rows\n", row);
2044 table->num_rows = row;
2046 heap_free( buffer );
2047 return status;
2050 static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr )
2052 const SOCKET_ADDRESS *sa = &addr->Address;
2053 WCHAR buf[NI_MAXHOST];
2055 if (!addr) return NULL;
2056 if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, sizeof(buf)/sizeof(buf[0]), NULL,
2057 0, NI_NAMEREQD )) return NULL;
2058 return heap_strdupW( buf );
2061 static enum fill_status fill_networkadapterconfig( struct table *table, const struct expr *cond )
2063 struct record_networkadapterconfig *rec;
2064 IP_ADAPTER_ADDRESSES *aa, *buffer;
2065 UINT row = 0, offset = 0, count = 0;
2066 DWORD size = 0, ret;
2067 enum fill_status status = FILL_STATUS_UNFILTERED;
2069 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
2070 if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
2072 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
2073 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
2075 heap_free( buffer );
2076 return FILL_STATUS_FAILED;
2078 for (aa = buffer; aa; aa = aa->Next)
2080 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
2082 if (!resize_table( table, count, sizeof(*rec) ))
2084 heap_free( buffer );
2085 return FILL_STATUS_FAILED;
2087 for (aa = buffer; aa; aa = aa->Next)
2089 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
2091 rec = (struct record_networkadapterconfig *)(table->data + offset);
2092 rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
2093 rec->index = aa->u.s.IfIndex;
2094 rec->ipconnectionmetric = 20;
2095 rec->ipenabled = -1;
2096 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
2097 if (!match_row( table, row, cond, &status ))
2099 free_row_values( table, row );
2100 continue;
2102 offset += sizeof(*rec);
2103 row++;
2105 TRACE("created %u rows\n", row);
2106 table->num_rows = row;
2108 heap_free( buffer );
2109 return status;
2112 static enum fill_status fill_physicalmemory( struct table *table, const struct expr *cond )
2114 struct record_physicalmemory *rec;
2115 enum fill_status status = FILL_STATUS_UNFILTERED;
2116 UINT row = 0;
2118 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2120 rec = (struct record_physicalmemory *)table->data;
2121 rec->capacity = get_total_physical_memory();
2122 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2123 else row++;
2125 TRACE("created %u rows\n", row);
2126 table->num_rows = row;
2127 return status;
2130 static enum fill_status fill_printer( struct table *table, const struct expr *cond )
2132 struct record_printer *rec;
2133 enum fill_status status = FILL_STATUS_UNFILTERED;
2134 PRINTER_INFO_2W *info;
2135 DWORD i, offset = 0, count = 0, size = 0;
2137 EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count );
2138 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FILL_STATUS_FAILED;
2140 if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
2141 if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count ))
2143 heap_free( info );
2144 return FILL_STATUS_FAILED;
2146 if (!resize_table( table, count, sizeof(*rec) ))
2148 heap_free( info );
2149 return FILL_STATUS_FAILED;
2152 for (i = 0; i < count; i++)
2154 rec = (struct record_printer *)(table->data + offset);
2155 rec->attributes = info[i].Attributes;
2156 rec->drivername = heap_strdupW( info[i].pDriverName );
2157 rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality;
2158 rec->local = -1;
2159 rec->name = heap_strdupW( info[i].pPrinterName );
2160 rec->network = 0;
2161 if (!match_row( table, i, cond, &status ))
2163 free_row_values( table, i );
2164 continue;
2166 offset += sizeof(*rec);
2168 TRACE("created %u rows\n", count);
2169 table->num_rows = count;
2171 heap_free( info );
2172 return status;
2175 static WCHAR *get_cmdline( DWORD process_id )
2177 if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
2178 return NULL; /* FIXME handle different process case */
2181 static enum fill_status fill_process( struct table *table, const struct expr *cond )
2183 static const WCHAR fmtW[] = {'%','u',0};
2184 WCHAR handle[11];
2185 struct record_process *rec;
2186 PROCESSENTRY32W entry;
2187 HANDLE snap;
2188 enum fill_status status = FILL_STATUS_FAILED;
2189 UINT row = 0, offset = 0;
2191 snap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
2192 if (snap == INVALID_HANDLE_VALUE) return FILL_STATUS_FAILED;
2194 entry.dwSize = sizeof(entry);
2195 if (!Process32FirstW( snap, &entry )) goto done;
2196 if (!resize_table( table, 8, sizeof(*rec) )) goto done;
2200 if (!resize_table( table, row + 1, sizeof(*rec) )) goto done;
2202 rec = (struct record_process *)(table->data + offset);
2203 rec->caption = heap_strdupW( entry.szExeFile );
2204 rec->commandline = get_cmdline( entry.th32ProcessID );
2205 rec->description = heap_strdupW( entry.szExeFile );
2206 sprintfW( handle, fmtW, entry.th32ProcessID );
2207 rec->handle = heap_strdupW( handle );
2208 rec->name = heap_strdupW( entry.szExeFile );
2209 rec->process_id = entry.th32ProcessID;
2210 rec->pprocess_id = entry.th32ParentProcessID;
2211 rec->thread_count = entry.cntThreads;
2212 rec->get_owner = process_get_owner;
2213 if (!match_row( table, row, cond, &status ))
2215 free_row_values( table, row );
2216 continue;
2218 offset += sizeof(*rec);
2219 row++;
2220 } while (Process32NextW( snap, &entry ));
2222 TRACE("created %u rows\n", row);
2223 table->num_rows = row;
2224 status = FILL_STATUS_UNFILTERED;
2226 done:
2227 CloseHandle( snap );
2228 return status;
2231 static inline void do_cpuid( unsigned int ax, unsigned int *p )
2233 #ifdef __i386__
2234 #ifdef _MSC_VER
2235 __cpuid(p, ax);
2236 #else
2237 __asm__("pushl %%ebx\n\t"
2238 "cpuid\n\t"
2239 "movl %%ebx, %%esi\n\t"
2240 "popl %%ebx"
2241 : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3])
2242 : "0" (ax));
2243 #endif
2244 #endif
2246 static const WCHAR *get_osarchitecture(void)
2248 SYSTEM_INFO info;
2249 GetNativeSystemInfo( &info );
2250 if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW;
2251 return os_32bitW;
2253 static void get_processor_caption( WCHAR *caption )
2255 static const WCHAR fmtW[] =
2256 {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ',
2257 'M','o','d','e','l',' ','%','u',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2258 static const WCHAR x86W[] = {'x','8','6',0};
2259 static const WCHAR intel64W[] = {'I','n','t','e','l','6','4',0};
2260 const WCHAR *arch = (get_osarchitecture() == os_32bitW) ? x86W : intel64W;
2261 unsigned int regs[4] = {0, 0, 0, 0};
2263 do_cpuid( 1, regs );
2264 sprintfW( caption, fmtW, arch, (regs[0] & (15 << 8)) >> 8, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 );
2266 static void get_processor_version( WCHAR *version )
2268 static const WCHAR fmtW[] =
2269 {'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2270 unsigned int regs[4] = {0, 0, 0, 0};
2272 do_cpuid( 1, regs );
2273 sprintfW( version, fmtW, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 );
2275 static void get_processor_id( WCHAR *processor_id )
2277 static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0};
2278 unsigned int regs[4] = {0, 0, 0, 0};
2280 do_cpuid( 1, regs );
2281 sprintfW( processor_id, fmtW, regs[3], regs[0] );
2283 static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer )
2285 unsigned int i;
2286 unsigned char *p = (unsigned char *)regs;
2288 for (i = 0; i < len; i++) { buffer[i] = *p++; }
2289 buffer[i] = 0;
2291 static void get_processor_manufacturer( WCHAR *manufacturer )
2293 unsigned int tmp, regs[4] = {0, 0, 0, 0};
2295 do_cpuid( 0, regs );
2296 tmp = regs[2]; /* swap edx and ecx */
2297 regs[2] = regs[3];
2298 regs[3] = tmp;
2300 regs_to_str( regs + 1, 12, manufacturer );
2302 static void get_processor_name( WCHAR *name )
2304 unsigned int regs[4] = {0, 0, 0, 0};
2306 do_cpuid( 0x80000000, regs );
2307 if (regs[0] >= 0x80000004)
2309 do_cpuid( 0x80000002, regs );
2310 regs_to_str( regs, 16, name );
2311 do_cpuid( 0x80000003, regs );
2312 regs_to_str( regs, 16, name + 16 );
2313 do_cpuid( 0x80000004, regs );
2314 regs_to_str( regs, 16, name + 32 );
2317 static UINT get_processor_currentclockspeed( UINT index )
2319 PROCESSOR_POWER_INFORMATION *info;
2320 UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
2321 NTSTATUS status;
2323 if ((info = heap_alloc( size )))
2325 status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
2326 if (!status) ret = info[index].CurrentMhz;
2327 heap_free( info );
2329 return ret;
2331 static UINT get_processor_maxclockspeed( UINT index )
2333 PROCESSOR_POWER_INFORMATION *info;
2334 UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
2335 NTSTATUS status;
2337 if ((info = heap_alloc( size )))
2339 status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
2340 if (!status) ret = info[index].MaxMhz;
2341 heap_free( info );
2343 return ret;
2346 static enum fill_status fill_processor( struct table *table, const struct expr *cond )
2348 static const WCHAR fmtW[] = {'C','P','U','%','u',0};
2349 WCHAR caption[100], device_id[14], processor_id[17], manufacturer[13], name[49] = {0}, version[50];
2350 struct record_processor *rec;
2351 UINT i, offset = 0, num_cores, num_logical_processors, count = get_processor_count();
2352 enum fill_status status = FILL_STATUS_UNFILTERED;
2354 if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED;
2356 get_processor_caption( caption );
2357 get_processor_id( processor_id );
2358 get_processor_manufacturer( manufacturer );
2359 get_processor_name( name );
2360 get_processor_version( version );
2362 num_logical_processors = get_logical_processor_count( &num_cores ) / count;
2363 num_cores /= count;
2365 for (i = 0; i < count; i++)
2367 rec = (struct record_processor *)(table->data + offset);
2368 rec->addresswidth = get_osarchitecture() == os_32bitW ? 32 : 64;
2369 rec->caption = heap_strdupW( caption );
2370 rec->cpu_status = 1; /* CPU Enabled */
2371 rec->currentclockspeed = get_processor_currentclockspeed( i );
2372 rec->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64;
2373 rec->description = heap_strdupW( caption );
2374 sprintfW( device_id, fmtW, i );
2375 rec->device_id = heap_strdupW( device_id );
2376 rec->family = 2; /* Unknown */
2377 rec->manufacturer = heap_strdupW( manufacturer );
2378 rec->maxclockspeed = get_processor_maxclockspeed( i );
2379 rec->name = heap_strdupW( name );
2380 rec->num_cores = num_cores;
2381 rec->num_logical_processors = num_logical_processors;
2382 rec->processor_id = heap_strdupW( processor_id );
2383 rec->processortype = 3; /* central processor */
2384 rec->unique_id = NULL;
2385 rec->version = heap_strdupW( version );
2386 if (!match_row( table, i, cond, &status ))
2388 free_row_values( table, i );
2389 continue;
2391 offset += sizeof(*rec);
2394 TRACE("created %u rows\n", count);
2395 table->num_rows = count;
2396 return status;
2399 static WCHAR *get_lastbootuptime(void)
2401 static const WCHAR fmtW[] =
2402 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2403 '.','%','0','6','u','+','0','0','0',0};
2404 SYSTEM_TIMEOFDAY_INFORMATION ti;
2405 TIME_FIELDS tf;
2406 WCHAR *ret;
2408 if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
2410 NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
2411 RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
2412 sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
2413 return ret;
2415 static WCHAR *get_localdatetime(void)
2417 static const WCHAR fmtW[] =
2418 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2419 '.','%','0','6','u','%','+','0','3','d',0};
2420 TIME_ZONE_INFORMATION tzi;
2421 SYSTEMTIME st;
2422 WCHAR *ret;
2423 DWORD Status;
2424 LONG Bias;
2426 Status = GetTimeZoneInformation(&tzi);
2428 if(Status == TIME_ZONE_ID_INVALID) return NULL;
2429 Bias = tzi.Bias;
2430 if(Status == TIME_ZONE_ID_DAYLIGHT)
2431 Bias+= tzi.DaylightBias;
2432 else
2433 Bias+= tzi.StandardBias;
2434 if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
2436 GetLocalTime(&st);
2437 sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias);
2438 return ret;
2440 static WCHAR *get_systemdirectory(void)
2442 void *redir;
2443 WCHAR *ret;
2445 if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
2446 Wow64DisableWow64FsRedirection( &redir );
2447 GetSystemDirectoryW( ret, MAX_PATH );
2448 Wow64RevertWow64FsRedirection( redir );
2449 return ret;
2451 static WCHAR *get_codeset(void)
2453 static const WCHAR fmtW[] = {'%','u',0};
2454 WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
2455 if (ret) sprintfW( ret, fmtW, GetACP() );
2456 return ret;
2458 static WCHAR *get_countrycode(void)
2460 WCHAR *ret = heap_alloc( 6 * sizeof(WCHAR) );
2461 if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, ret, 6 );
2462 return ret;
2464 static WCHAR *get_locale(void)
2466 WCHAR *ret = heap_alloc( 5 * sizeof(WCHAR) );
2467 if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, ret, 5 );
2468 return ret;
2471 static enum fill_status fill_os( struct table *table, const struct expr *cond )
2473 struct record_operatingsystem *rec;
2474 enum fill_status status = FILL_STATUS_UNFILTERED;
2475 UINT row = 0;
2477 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2479 rec = (struct record_operatingsystem *)table->data;
2480 rec->buildnumber = os_buildnumberW;
2481 rec->caption = os_captionW;
2482 rec->codeset = get_codeset();
2483 rec->countrycode = get_countrycode();
2484 rec->csdversion = os_csdversionW;
2485 rec->installdate = os_installdateW;
2486 rec->lastbootuptime = get_lastbootuptime();
2487 rec->localdatetime = get_localdatetime();
2488 rec->locale = get_locale();
2489 rec->name = os_nameW;
2490 rec->osarchitecture = get_osarchitecture();
2491 rec->oslanguage = GetSystemDefaultLangID();
2492 rec->osproductsuite = 2461140; /* Windows XP Professional */
2493 rec->ostype = 18; /* WINNT */
2494 rec->serialnumber = os_serialnumberW;
2495 rec->servicepackmajor = 3;
2496 rec->servicepackminor = 0;
2497 rec->suitemask = 272; /* Single User + Terminal */
2498 rec->systemdirectory = get_systemdirectory();
2499 rec->totalvisiblememorysize = get_total_physical_memory() / 1024;
2500 rec->version = os_versionW;
2501 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2502 else row++;
2504 TRACE("created %u rows\n", row);
2505 table->num_rows = row;
2506 return status;
2509 static const WCHAR *get_service_type( DWORD type )
2511 static const WCHAR filesystem_driverW[] =
2512 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
2513 static const WCHAR kernel_driverW[] =
2514 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
2515 static const WCHAR own_processW[] =
2516 {'O','w','n',' ','P','r','o','c','e','s','s',0};
2517 static const WCHAR share_processW[] =
2518 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
2520 if (type & SERVICE_KERNEL_DRIVER) return kernel_driverW;
2521 else if (type & SERVICE_FILE_SYSTEM_DRIVER) return filesystem_driverW;
2522 else if (type & SERVICE_WIN32_OWN_PROCESS) return own_processW;
2523 else if (type & SERVICE_WIN32_SHARE_PROCESS) return share_processW;
2524 else ERR("unhandled type 0x%08x\n", type);
2525 return NULL;
2527 static const WCHAR *get_service_state( DWORD state )
2529 static const WCHAR runningW[] =
2530 {'R','u','n','n','i','n','g',0};
2531 static const WCHAR start_pendingW[] =
2532 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
2533 static const WCHAR stop_pendingW[] =
2534 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
2535 static const WCHAR stoppedW[] =
2536 {'S','t','o','p','p','e','d',0};
2537 static const WCHAR unknownW[] =
2538 {'U','n','k','n','o','w','n',0};
2540 switch (state)
2542 case SERVICE_STOPPED: return stoppedW;
2543 case SERVICE_START_PENDING: return start_pendingW;
2544 case SERVICE_STOP_PENDING: return stop_pendingW;
2545 case SERVICE_RUNNING: return runningW;
2546 default:
2547 ERR("unknown state %u\n", state);
2548 return unknownW;
2551 static const WCHAR *get_service_startmode( DWORD mode )
2553 static const WCHAR bootW[] = {'B','o','o','t',0};
2554 static const WCHAR systemW[] = {'S','y','s','t','e','m',0};
2555 static const WCHAR autoW[] = {'A','u','t','o',0};
2556 static const WCHAR manualW[] = {'M','a','n','u','a','l',0};
2557 static const WCHAR disabledW[] = {'D','i','s','a','b','l','e','d',0};
2558 static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',0};
2560 switch (mode)
2562 case SERVICE_BOOT_START: return bootW;
2563 case SERVICE_SYSTEM_START: return systemW;
2564 case SERVICE_AUTO_START: return autoW;
2565 case SERVICE_DEMAND_START: return manualW;
2566 case SERVICE_DISABLED: return disabledW;
2567 default:
2568 ERR("unknown mode 0x%x\n", mode);
2569 return unknownW;
2572 static QUERY_SERVICE_CONFIGW *query_service_config( SC_HANDLE manager, const WCHAR *name )
2574 QUERY_SERVICE_CONFIGW *config = NULL;
2575 SC_HANDLE service;
2576 DWORD size;
2578 if (!(service = OpenServiceW( manager, name, SERVICE_QUERY_CONFIG ))) return NULL;
2579 QueryServiceConfigW( service, NULL, 0, &size );
2580 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
2581 if (!(config = heap_alloc( size ))) goto done;
2582 if (QueryServiceConfigW( service, config, size, &size )) goto done;
2583 heap_free( config );
2584 config = NULL;
2586 done:
2587 CloseServiceHandle( service );
2588 return config;
2591 static enum fill_status fill_service( struct table *table, const struct expr *cond )
2593 struct record_service *rec;
2594 SC_HANDLE manager;
2595 ENUM_SERVICE_STATUS_PROCESSW *tmp, *services = NULL;
2596 SERVICE_STATUS_PROCESS *status;
2597 WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1];
2598 DWORD len = sizeof(sysnameW) / sizeof(sysnameW[0]);
2599 UINT i, row = 0, offset = 0, size = 256, needed, count;
2600 enum fill_status fill_status = FILL_STATUS_FAILED;
2601 BOOL ret;
2603 if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) return FILL_STATUS_FAILED;
2604 if (!(services = heap_alloc( size ))) goto done;
2606 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
2607 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
2608 &count, NULL, NULL );
2609 if (!ret)
2611 if (GetLastError() != ERROR_MORE_DATA) goto done;
2612 size = needed;
2613 if (!(tmp = heap_realloc( services, size ))) goto done;
2614 services = tmp;
2615 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
2616 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
2617 &count, NULL, NULL );
2618 if (!ret) goto done;
2620 if (!resize_table( table, count, sizeof(*rec) )) goto done;
2622 GetComputerNameW( sysnameW, &len );
2623 fill_status = FILL_STATUS_UNFILTERED;
2625 for (i = 0; i < count; i++)
2627 QUERY_SERVICE_CONFIGW *config;
2629 if (!(config = query_service_config( manager, services[i].lpServiceName ))) continue;
2631 status = &services[i].ServiceStatusProcess;
2632 rec = (struct record_service *)(table->data + offset);
2633 rec->accept_pause = (status->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) ? -1 : 0;
2634 rec->accept_stop = (status->dwControlsAccepted & SERVICE_ACCEPT_STOP) ? -1 : 0;
2635 rec->displayname = heap_strdupW( services[i].lpDisplayName );
2636 rec->name = heap_strdupW( services[i].lpServiceName );
2637 rec->process_id = status->dwProcessId;
2638 rec->servicetype = get_service_type( status->dwServiceType );
2639 rec->startmode = get_service_startmode( config->dwStartType );
2640 rec->state = get_service_state( status->dwCurrentState );
2641 rec->systemname = heap_strdupW( sysnameW );
2642 rec->pause_service = service_pause_service;
2643 rec->resume_service = service_resume_service;
2644 rec->start_service = service_start_service;
2645 rec->stop_service = service_stop_service;
2646 heap_free( config );
2647 if (!match_row( table, row, cond, &fill_status ))
2649 free_row_values( table, row );
2650 continue;
2652 offset += sizeof(*rec);
2653 row++;
2656 TRACE("created %u rows\n", row);
2657 table->num_rows = row;
2659 done:
2660 CloseServiceHandle( manager );
2661 heap_free( services );
2662 return fill_status;
2665 static WCHAR *get_accountname( LSA_TRANSLATED_NAME *name )
2667 if (!name || !name->Name.Buffer) return NULL;
2668 return heap_strdupW( name->Name.Buffer );
2670 static struct array *get_binaryrepresentation( PSID sid, UINT len )
2672 struct array *array = heap_alloc( sizeof(struct array) );
2673 if (array)
2675 UINT8 *ret = heap_alloc( len );
2676 if (ret)
2678 memcpy( ret, sid, len );
2679 array->count = len;
2680 array->ptr = ret;
2681 return array;
2683 heap_free( array );
2685 return NULL;
2687 static WCHAR *get_referenceddomainname( LSA_REFERENCED_DOMAIN_LIST *domain )
2689 if (!domain || !domain->Domains || !domain->Domains->Name.Buffer) return NULL;
2690 return heap_strdupW( domain->Domains->Name.Buffer );
2692 static const WCHAR *find_sid_str( const struct expr *cond )
2694 const struct expr *left, *right;
2695 const WCHAR *ret = NULL;
2697 if (!cond || cond->type != EXPR_COMPLEX || cond->u.expr.op != OP_EQ) return NULL;
2699 left = cond->u.expr.left;
2700 right = cond->u.expr.right;
2701 if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !strcmpiW( left->u.propval->name, prop_sidW ))
2703 ret = right->u.sval;
2705 else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !strcmpiW( right->u.propval->name, prop_sidW ))
2707 ret = left->u.sval;
2709 return ret;
2712 static enum fill_status fill_sid( struct table *table, const struct expr *cond )
2714 PSID sid;
2715 LSA_REFERENCED_DOMAIN_LIST *domain;
2716 LSA_TRANSLATED_NAME *name;
2717 LSA_HANDLE handle;
2718 LSA_OBJECT_ATTRIBUTES attrs;
2719 const WCHAR *str;
2720 struct record_sid *rec;
2721 UINT len;
2723 if (!(str = find_sid_str( cond ))) return FILL_STATUS_FAILED;
2724 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2726 if (!ConvertStringSidToSidW( str, &sid )) return FILL_STATUS_FAILED;
2727 len = GetLengthSid( sid );
2729 memset( &attrs, 0, sizeof(attrs) );
2730 attrs.Length = sizeof(attrs);
2731 if (LsaOpenPolicy( NULL, &attrs, POLICY_ALL_ACCESS, &handle ))
2733 LocalFree( sid );
2734 return FILL_STATUS_FAILED;
2736 if (LsaLookupSids( handle, 1, &sid, &domain, &name ))
2738 LocalFree( sid );
2739 LsaClose( handle );
2740 return FILL_STATUS_FAILED;
2743 rec = (struct record_sid *)table->data;
2744 rec->accountname = get_accountname( name );
2745 rec->binaryrepresentation = get_binaryrepresentation( sid, len );
2746 rec->referenceddomainname = get_referenceddomainname( domain );
2747 rec->sid = heap_strdupW( str );
2748 rec->sidlength = len;
2750 TRACE("created 1 row\n");
2751 table->num_rows = 1;
2753 LsaFreeMemory( domain );
2754 LsaFreeMemory( name );
2755 LocalFree( sid );
2756 LsaClose( handle );
2757 return FILL_STATUS_FILTERED;
2760 static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres )
2762 HDC hdc = GetDC( NULL );
2763 UINT32 ret;
2765 if (!hdc) return 32;
2766 ret = GetDeviceCaps( hdc, BITSPIXEL );
2767 *hres = GetDeviceCaps( hdc, HORZRES );
2768 *vres = GetDeviceCaps( hdc, VERTRES );
2769 ReleaseDC( NULL, hdc );
2770 return ret;
2772 static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
2774 static const WCHAR fmtW[] =
2775 {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
2776 '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
2777 '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
2778 WCHAR *ret;
2780 if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL;
2781 sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
2782 return ret;
2785 static enum fill_status fill_videocontroller( struct table *table, const struct expr *cond )
2788 struct record_videocontroller *rec;
2789 HRESULT hr;
2790 IDXGIFactory *factory = NULL;
2791 IDXGIAdapter *adapter = NULL;
2792 DXGI_ADAPTER_DESC desc;
2793 UINT hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
2794 const WCHAR *name = videocontroller_deviceidW;
2795 enum fill_status status = FILL_STATUS_UNFILTERED;
2796 UINT row = 0;
2798 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2800 memset (&desc, 0, sizeof(desc));
2801 hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
2802 if (FAILED(hr)) goto done;
2804 hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
2805 if (FAILED(hr)) goto done;
2807 hr = IDXGIAdapter_GetDesc( adapter, &desc );
2808 if (SUCCEEDED(hr))
2810 vidmem = desc.DedicatedVideoMemory;
2811 name = desc.Description;
2814 done:
2815 rec = (struct record_videocontroller *)table->data;
2816 rec->adapter_dactype = videocontroller_dactypeW;
2817 rec->adapter_ram = vidmem;
2818 rec->availability = 3; /* Running or Full Power */
2819 rec->caption = heap_strdupW( name );
2820 rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres );
2821 rec->current_horizontalres = hres;
2822 rec->current_refreshrate = 0; /* default refresh rate */
2823 rec->current_scanmode = 2; /* Unknown */
2824 rec->current_verticalres = vres;
2825 rec->description = heap_strdupW( name );
2826 rec->device_id = videocontroller_deviceidW;
2827 rec->driverversion = videocontroller_driverversionW;
2828 rec->name = heap_strdupW( name );
2829 rec->pnpdevice_id = get_pnpdeviceid( &desc );
2830 rec->videoarchitecture = 2; /* Unknown */
2831 rec->videomemorytype = 2; /* Unknown */
2832 rec->videoprocessor = heap_strdupW( name );
2833 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2834 else row++;
2836 TRACE("created %u rows\n", row);
2837 table->num_rows = row;
2839 if (adapter) IDXGIAdapter_Release( adapter );
2840 if (factory) IDXGIFactory_Release( factory );
2841 return status;
2844 static struct table builtin_classes[] =
2846 { class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), 0, (BYTE *)data_baseboard },
2847 { class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), 0, (BYTE *)data_bios },
2848 { class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive },
2849 { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
2850 { class_compsysproductW, SIZEOF(col_compsysproduct), col_compsysproduct, SIZEOF(data_compsysproduct), 0, (BYTE *)data_compsysproduct },
2851 { class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
2852 { class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory },
2853 { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive },
2854 { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },
2855 { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
2856 { class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
2857 { class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter },
2858 { class_networkadapterconfigW, SIZEOF(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig },
2859 { class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os },
2860 { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param },
2861 { class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia },
2862 { class_physicalmemoryW, SIZEOF(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory },
2863 { class_printerW, SIZEOF(col_printer), col_printer, 0, 0, NULL, fill_printer },
2864 { class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process },
2865 { class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
2866 { class_processor2W, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
2867 { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier },
2868 { class_serviceW, SIZEOF(col_service), col_service, 0, 0, NULL, fill_service },
2869 { class_sidW, SIZEOF(col_sid), col_sid, 0, 0, NULL, fill_sid },
2870 { class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), 0, (BYTE *)data_sounddevice },
2871 { class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), 0, (BYTE *)data_stdregprov },
2872 { class_systemsecurityW, SIZEOF(col_systemsecurity), col_systemsecurity, SIZEOF(data_systemsecurity), 0, (BYTE *)data_systemsecurity },
2873 { class_systemenclosureW, SIZEOF(col_systemenclosure), col_systemenclosure, SIZEOF(data_systemenclosure), 0, (BYTE *)data_systemenclosure },
2874 { class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller }
2877 void init_table_list( void )
2879 static struct list tables = LIST_INIT( tables );
2880 UINT i;
2882 for (i = 0; i < SIZEOF(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry );
2883 table_list = &tables;