kernel32: Support extended pathnames in GetShortPathName.
[wine.git] / dlls / wbemprox / builtin.c
blob8ba2642283bc9d61207fac88332b9d997b761126
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_videocontrollerW[] =
102 {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
104 static const WCHAR prop_accountnameW[] =
105 {'A','c','c','o','u','n','t','N','a','m','e',0};
106 static const WCHAR prop_acceptpauseW[] =
107 {'A','c','c','e','p','t','P','a','u','s','e',0};
108 static const WCHAR prop_acceptstopW[] =
109 {'A','c','c','e','p','t','S','t','o','p',0};
110 static const WCHAR prop_accessmaskW[] =
111 {'A','c','c','e','s','s','M','a','s','k',0};
112 static const WCHAR prop_adapterdactypeW[] =
113 {'A','d','a','p','t','e','r','D','A','C','T','y','p','e',0};
114 static const WCHAR prop_adapterramW[] =
115 {'A','d','a','p','t','e','r','R','A','M',0};
116 static const WCHAR prop_adaptertypeW[] =
117 {'A','d','a','p','t','e','r','T','y','p','e',0};
118 static const WCHAR prop_addresswidthW[] =
119 {'A','d','d','r','e','s','s','W','i','d','t','h',0};
120 static const WCHAR prop_attributesW[] =
121 {'A','t','t','r','i','b','u','t','e','s',0};
122 static const WCHAR prop_availabilityW[] =
123 {'A','v','a','i','l','a','b','i','l','i','t','y',0};
124 static const WCHAR prop_binaryrepresentationW[] =
125 {'B','i','n','a','r','y','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0};
126 static const WCHAR prop_bootableW[] =
127 {'B','o','o','t','a','b','l','e',0};
128 static const WCHAR prop_bootpartitionW[] =
129 {'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
130 static const WCHAR prop_buildnumberW[] =
131 {'B','u','i','l','d','N','u','m','b','e','r',0};
132 static const WCHAR prop_capacityW[] =
133 {'C','a','p','a','c','i','t','y',0};
134 static const WCHAR prop_captionW[] =
135 {'C','a','p','t','i','o','n',0};
136 static const WCHAR prop_classW[] =
137 {'C','l','a','s','s',0};
138 static const WCHAR prop_codesetW[] =
139 {'C','o','d','e','S','e','t',0};
140 static const WCHAR prop_commandlineW[] =
141 {'C','o','m','m','a','n','d','L','i','n','e',0};
142 static const WCHAR prop_countrycodeW[] =
143 {'C','o','u','n','t','r','y','C','o','d','e',0};
144 static const WCHAR prop_cpustatusW[] =
145 {'C','p','u','S','t','a','t','u','s',0};
146 static const WCHAR prop_csdversionW[] =
147 {'C','S','D','V','e','r','s','i','o','n',0};
148 static const WCHAR prop_currentbitsperpixelW[] =
149 {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
150 static const WCHAR prop_currentclockspeedW[] =
151 {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0};
152 static const WCHAR prop_currenthorizontalresW[] =
153 {'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};
154 static const WCHAR prop_currentrefreshrateW[] =
155 {'C','u','r','r','e','n','t','R','e','f','r','e','s','h','R','a','t','e',0};
156 static const WCHAR prop_currentscanmodeW[] =
157 {'C','u','r','r','e','n','t','S','c','a','n','M','o','d','e',0};
158 static const WCHAR prop_currentverticalresW[] =
159 {'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};
160 static const WCHAR prop_datawidthW[] =
161 {'D','a','t','a','W','i','d','t','h',0};
162 static const WCHAR prop_defaultvalueW[] =
163 {'D','e','f','a','u','l','t','V','a','l','u','e',0};
164 static const WCHAR prop_descriptionW[] =
165 {'D','e','s','c','r','i','p','t','i','o','n',0};
166 static const WCHAR prop_deviceidW[] =
167 {'D','e','v','i','c','e','I','d',0};
168 static const WCHAR prop_directionW[] =
169 {'D','i','r','e','c','t','i','o','n',0};
170 static const WCHAR prop_displaynameW[] =
171 {'D','i','s','p','l','a','y','N','a','m','e',0};
172 static const WCHAR prop_diskindexW[] =
173 {'D','i','s','k','I','n','d','e','x',0};
174 static const WCHAR prop_dnshostnameW[] =
175 {'D','N','S','H','o','s','t','N','a','m','e',0};
176 static const WCHAR prop_domainW[] =
177 {'D','o','m','a','i','n',0};
178 static const WCHAR prop_domainroleW[] =
179 {'D','o','m','a','i','n','R','o','l','e',0};
180 static const WCHAR prop_driveW[] =
181 {'D','r','i','v','e',0};
182 static const WCHAR prop_drivernameW[] =
183 {'D','r','i','v','e','r','N','a','m','e',0};
184 static const WCHAR prop_driverversionW[] =
185 {'D','r','i','v','e','r','V','e','r','s','i','o','n',0};
186 static const WCHAR prop_drivetypeW[] =
187 {'D','r','i','v','e','T','y','p','e',0};
188 static const WCHAR prop_familyW[] =
189 {'F','a','m','i','l','y',0};
190 static const WCHAR prop_filesystemW[] =
191 {'F','i','l','e','S','y','s','t','e','m',0};
192 static const WCHAR prop_flavorW[] =
193 {'F','l','a','v','o','r',0};
194 static const WCHAR prop_freespaceW[] =
195 {'F','r','e','e','S','p','a','c','e',0};
196 static const WCHAR prop_handleW[] =
197 {'H','a','n','d','l','e',0};
198 static const WCHAR prop_horizontalresolutionW[] =
199 {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
200 static const WCHAR prop_idW[] =
201 {'I','D',0};
202 static const WCHAR prop_identificationcodeW[] =
203 {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
204 static const WCHAR prop_identifyingnumberW[] =
205 {'I','d','e','n','t','i','f','y','i','n','g','N','u','m','b','e','r',0};
206 static const WCHAR prop_indexW[] =
207 {'I','n','d','e','x',0};
208 static const WCHAR prop_installdateW[] =
209 {'I','n','s','t','a','l','l','D','a','t','e',0};
210 static const WCHAR prop_interfaceindexW[] =
211 {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
212 static const WCHAR prop_interfacetypeW[] =
213 {'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
214 static const WCHAR prop_intvalueW[] =
215 {'I','n','t','e','g','e','r','V','a','l','u','e',0};
216 static const WCHAR prop_ipconnectionmetricW[] =
217 {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
218 static const WCHAR prop_ipenabledW[] =
219 {'I','P','E','n','a','b','l','e','d',0};
220 static const WCHAR prop_lastbootuptimeW[] =
221 {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
222 static const WCHAR prop_localW[] =
223 {'L','o','c','a','l',0};
224 static const WCHAR prop_localdatetimeW[] =
225 {'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
226 static const WCHAR prop_localeW[] =
227 {'L','o','c','a','l','e',0};
228 static const WCHAR prop_macaddressW[] =
229 {'M','A','C','A','d','d','r','e','s','s',0};
230 static const WCHAR prop_manufacturerW[] =
231 {'M','a','n','u','f','a','c','t','u','r','e','r',0};
232 static const WCHAR prop_maxclockspeedW[] =
233 {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
234 static const WCHAR prop_mediatypeW[] =
235 {'M','e','d','i','a','T','y','p','e',0};
236 static const WCHAR prop_memberW[] =
237 {'M','e','m','b','e','r',0};
238 static const WCHAR prop_methodW[] =
239 {'M','e','t','h','o','d',0};
240 static const WCHAR prop_modelW[] =
241 {'M','o','d','e','l',0};
242 static const WCHAR prop_netconnectionstatusW[] =
243 {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
244 static const WCHAR prop_networkW[] =
245 {'N','e','t','w','o','r','k',0};
246 static const WCHAR prop_numcoresW[] =
247 {'N','u','m','b','e','r','O','f','C','o','r','e','s',0};
248 static const WCHAR prop_numlogicalprocessorsW[] =
249 {'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};
250 static const WCHAR prop_numprocessorsW[] =
251 {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
252 static const WCHAR prop_osarchitectureW[] =
253 {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
254 static const WCHAR prop_oslanguageW[] =
255 {'O','S','L','a','n','g','u','a','g','e',0};
256 static const WCHAR prop_osproductsuiteW[] =
257 {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
258 static const WCHAR prop_ostypeW[] =
259 {'O','S','T','y','p','e',0};
260 static const WCHAR prop_parameterW[] =
261 {'P','a','r','a','m','e','t','e','r',0};
262 static const WCHAR prop_physicaladapterW[] =
263 {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
264 static const WCHAR prop_pnpdeviceidW[] =
265 {'P','N','P','D','e','v','i','c','e','I','D',0};
266 static const WCHAR prop_pprocessidW[] =
267 {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
268 static const WCHAR prop_processidW[] =
269 {'P','r','o','c','e','s','s','I','D',0};
270 static const WCHAR prop_processoridW[] =
271 {'P','r','o','c','e','s','s','o','r','I','d',0};
272 static const WCHAR prop_processortypeW[] =
273 {'P','r','o','c','e','s','s','o','r','T','y','p','e',0};
274 static const WCHAR prop_productW[] =
275 {'P','r','o','d','u','c','t',0};
276 static const WCHAR prop_productnameW[] =
277 {'P','r','o','d','u','c','t','N','a','m','e',0};
278 static const WCHAR prop_referenceddomainnameW[] =
279 {'R','e','f','e','r','e','n','c','e','d','D','o','m','a','i','n','N','a','m','e',0};
280 static const WCHAR prop_releasedateW[] =
281 {'R','e','l','e','a','s','e','D','a','t','e',0};
282 static const WCHAR prop_serialnumberW[] =
283 {'S','e','r','i','a','l','N','u','m','b','e','r',0};
284 static const WCHAR prop_servicepackmajorW[] =
285 {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
286 static const WCHAR prop_servicepackminorW[] =
287 {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
288 static const WCHAR prop_servicetypeW[] =
289 {'S','e','r','v','i','c','e','T','y','p','e',0};
290 static const WCHAR prop_smbiosbiosversionW[] =
291 {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
292 static const WCHAR prop_startmodeW[] =
293 {'S','t','a','r','t','M','o','d','e',0};
294 static const WCHAR prop_sidW[] =
295 {'S','I','D',0};
296 static const WCHAR prop_sidlengthW[] =
297 {'S','i','d','L','e','n','g','t','h',0};
298 static const WCHAR prop_sizeW[] =
299 {'S','i','z','e',0};
300 static const WCHAR prop_speedW[] =
301 {'S','p','e','e','d',0};
302 static const WCHAR prop_startingoffsetW[] =
303 {'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0};
304 static const WCHAR prop_stateW[] =
305 {'S','t','a','t','e',0};
306 static const WCHAR prop_statusinfoW[] =
307 {'S','t','a','t','u','s','I','n','f','o',0};
308 static const WCHAR prop_strvalueW[] =
309 {'S','t','r','i','n','g','V','a','l','u','e',0};
310 static const WCHAR prop_suitemaskW[] =
311 {'S','u','i','t','e','M','a','s','k',0};
312 static const WCHAR prop_systemdirectoryW[] =
313 {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
314 static const WCHAR prop_systemnameW[] =
315 {'S','y','s','t','e','m','N','a','m','e',0};
316 static const WCHAR prop_tagW[] =
317 {'T','a','g',0};
318 static const WCHAR prop_threadcountW[] =
319 {'T','h','r','e','a','d','C','o','u','n','t',0};
320 static const WCHAR prop_totalphysicalmemoryW[] =
321 {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
322 static const WCHAR prop_totalvisiblememorysizeW[] =
323 {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0};
324 static const WCHAR prop_typeW[] =
325 {'T','y','p','e',0};
326 static const WCHAR prop_uniqueidW[] =
327 {'U','n','i','q','u','e','I','d',0};
328 static const WCHAR prop_usernameW[] =
329 {'U','s','e','r','N','a','m','e',0};
330 static const WCHAR prop_uuidW[] =
331 {'U','U','I','D',0};
332 static const WCHAR prop_varianttypeW[] =
333 {'V','a','r','i','a','n','t','T','y','p','e',0};
334 static const WCHAR prop_versionW[] =
335 {'V','e','r','s','i','o','n',0};
336 static const WCHAR prop_videoarchitectureW[] =
337 {'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0};
338 static const WCHAR prop_videomemorytypeW[] =
339 {'V','i','d','e','o','M','e','m','o','r','y','T','y','p','e',0};
340 static const WCHAR prop_videoprocessorW[] =
341 {'V','i','d','e','o','P','r','o','c','e','s','s','o','r',0};
342 static const WCHAR prop_volumenameW[] =
343 {'V','o','l','u','m','e','N','a','m','e',0};
344 static const WCHAR prop_volumeserialnumberW[] =
345 {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
347 /* column definitions must be kept in sync with record structures below */
348 static const struct column col_baseboard[] =
350 { prop_manufacturerW, CIM_STRING },
351 { prop_modelW, CIM_STRING },
352 { prop_nameW, CIM_STRING },
353 { prop_productW, CIM_STRING },
354 { prop_serialnumberW, CIM_STRING },
355 { prop_tagW, CIM_STRING|COL_FLAG_KEY },
356 { prop_versionW, CIM_STRING }
358 static const struct column col_bios[] =
360 { prop_descriptionW, CIM_STRING },
361 { prop_identificationcodeW, CIM_STRING },
362 { prop_manufacturerW, CIM_STRING },
363 { prop_releasedateW, CIM_DATETIME },
364 { prop_serialnumberW, CIM_STRING },
365 { prop_smbiosbiosversionW, CIM_STRING },
366 { prop_versionW, CIM_STRING|COL_FLAG_KEY }
368 static const struct column col_cdromdrive[] =
370 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
371 { prop_driveW, CIM_STRING|COL_FLAG_DYNAMIC },
372 { prop_mediatypeW, CIM_STRING },
373 { prop_nameW, CIM_STRING },
374 { prop_pnpdeviceidW, CIM_STRING }
376 static const struct column col_compsys[] =
378 { prop_descriptionW, CIM_STRING },
379 { prop_domainW, CIM_STRING },
380 { prop_domainroleW, CIM_UINT16, VT_I4 },
381 { prop_manufacturerW, CIM_STRING },
382 { prop_modelW, CIM_STRING },
383 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
384 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
385 { prop_numprocessorsW, CIM_UINT32, VT_I4 },
386 { prop_totalphysicalmemoryW, CIM_UINT64 },
387 { prop_usernameW, CIM_STRING|COL_FLAG_DYNAMIC }
389 static const struct column col_compsysproduct[] =
391 { prop_identifyingnumberW, CIM_STRING|COL_FLAG_KEY },
392 { prop_uuidW, CIM_STRING }
394 static const struct column col_datafile[] =
396 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
397 { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
399 static const struct column col_directory[] =
401 { prop_accessmaskW, CIM_UINT32 },
402 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }
404 static const struct column col_diskdrive[] =
406 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
407 { prop_indexW, CIM_UINT32, VT_I4 },
408 { prop_interfacetypeW, CIM_STRING },
409 { prop_manufacturerW, CIM_STRING },
410 { prop_mediatypeW, CIM_STRING },
411 { prop_modelW, CIM_STRING },
412 { prop_pnpdeviceidW, CIM_STRING },
413 { prop_serialnumberW, CIM_STRING },
414 { prop_sizeW, CIM_UINT64 }
416 static const struct column col_diskpartition[] =
418 { prop_bootableW, CIM_BOOLEAN },
419 { prop_bootpartitionW, CIM_BOOLEAN },
420 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
421 { prop_diskindexW, CIM_UINT32, VT_I4 },
422 { prop_indexW, CIM_UINT32, VT_I4 },
423 { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
424 { prop_sizeW, CIM_UINT64 },
425 { prop_startingoffsetW, CIM_UINT64 },
426 { prop_typeW, CIM_STRING|COL_FLAG_DYNAMIC }
428 static const struct column col_logicaldisk[] =
430 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
431 { prop_drivetypeW, CIM_UINT32, VT_I4 },
432 { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC },
433 { prop_freespaceW, CIM_UINT64 },
434 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
435 { prop_sizeW, CIM_UINT64 },
436 { prop_volumenameW, CIM_STRING|COL_FLAG_DYNAMIC },
437 { prop_volumeserialnumberW, CIM_STRING|COL_FLAG_DYNAMIC }
439 static const struct column col_networkadapter[] =
441 { prop_adaptertypeW, CIM_STRING },
442 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
443 { prop_indexW, CIM_UINT32, VT_I4 },
444 { prop_interfaceindexW, CIM_UINT32, VT_I4 },
445 { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
446 { prop_manufacturerW, CIM_STRING },
447 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
448 { prop_netconnectionstatusW, CIM_UINT16, VT_I4 },
449 { prop_physicaladapterW, CIM_BOOLEAN },
450 { prop_pnpdeviceidW, CIM_STRING },
451 { prop_speedW, CIM_UINT64 }
453 static const struct column col_networkadapterconfig[] =
455 { prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC },
456 { prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 },
457 { prop_ipconnectionmetricW, CIM_UINT32, VT_I4 },
458 { prop_ipenabledW, CIM_BOOLEAN },
459 { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }
461 static const struct column col_os[] =
463 { prop_buildnumberW, CIM_STRING },
464 { prop_captionW, CIM_STRING },
465 { prop_codesetW, CIM_STRING|COL_FLAG_DYNAMIC },
466 { prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC },
467 { prop_csdversionW, CIM_STRING },
468 { prop_installdateW, CIM_DATETIME },
469 { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
470 { prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
471 { prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC },
472 { prop_nameW, CIM_STRING },
473 { prop_osarchitectureW, CIM_STRING },
474 { prop_oslanguageW, CIM_UINT32, VT_I4 },
475 { prop_osproductsuiteW, CIM_UINT32, VT_I4 },
476 { prop_ostypeW, CIM_UINT16, VT_I4 },
477 { prop_serialnumberW, CIM_STRING },
478 { prop_servicepackmajorW, CIM_UINT16, VT_I4 },
479 { prop_servicepackminorW, CIM_UINT16, VT_I4 },
480 { prop_suitemaskW, CIM_UINT32, VT_I4 },
481 { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC },
482 { prop_totalvisiblememorysizeW, CIM_UINT64 },
483 { prop_versionW, CIM_STRING }
485 static const struct column col_param[] =
487 { prop_classW, CIM_STRING },
488 { prop_methodW, CIM_STRING },
489 { prop_directionW, CIM_SINT32 },
490 { prop_parameterW, CIM_STRING },
491 { prop_typeW, CIM_UINT32 },
492 { prop_varianttypeW, CIM_UINT32 },
493 { prop_defaultvalueW, CIM_UINT32 }
495 static const struct column col_physicalmedia[] =
497 { prop_serialnumberW, CIM_STRING },
498 { prop_tagW, CIM_STRING }
500 static const struct column col_physicalmemory[] =
502 { prop_capacityW, CIM_UINT64 }
504 static const struct column col_printer[] =
506 { prop_attributesW, CIM_UINT32 },
507 { prop_drivernameW, CIM_STRING|COL_FLAG_DYNAMIC },
508 { prop_horizontalresolutionW, CIM_UINT32 },
509 { prop_localW, CIM_BOOLEAN },
510 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
511 { prop_networkW, CIM_BOOLEAN }
513 static const struct column col_process[] =
515 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
516 { prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC },
517 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
518 { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
519 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
520 { prop_pprocessidW, CIM_UINT32, VT_I4 },
521 { prop_processidW, CIM_UINT32, VT_I4 },
522 { prop_threadcountW, CIM_UINT32, VT_I4 },
523 /* methods */
524 { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
526 static const struct column col_processor[] =
528 { prop_addresswidthW, CIM_UINT16, VT_I4 },
529 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
530 { prop_cpustatusW, CIM_UINT16 },
531 { prop_currentclockspeedW, CIM_UINT32, VT_I4 },
532 { prop_datawidthW, CIM_UINT16, VT_I4 },
533 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
534 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
535 { prop_familyW, CIM_UINT16, VT_I4 },
536 { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
537 { prop_maxclockspeedW, CIM_UINT32, VT_I4 },
538 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
539 { prop_numcoresW, CIM_UINT32, VT_I4 },
540 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
541 { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC },
542 { prop_processortypeW, CIM_UINT16, VT_I4 },
543 { prop_uniqueidW, CIM_STRING },
544 { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
546 static const struct column col_qualifier[] =
548 { prop_classW, CIM_STRING },
549 { prop_memberW, CIM_STRING },
550 { prop_typeW, CIM_UINT32 },
551 { prop_flavorW, CIM_SINT32 },
552 { prop_nameW, CIM_STRING },
553 { prop_intvalueW, CIM_SINT32 },
554 { prop_strvalueW, CIM_STRING }
556 static const struct column col_service[] =
558 { prop_acceptpauseW, CIM_BOOLEAN },
559 { prop_acceptstopW, CIM_BOOLEAN },
560 { prop_displaynameW, CIM_STRING|COL_FLAG_DYNAMIC },
561 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
562 { prop_processidW, CIM_UINT32 },
563 { prop_servicetypeW, CIM_STRING },
564 { prop_startmodeW, CIM_STRING },
565 { prop_stateW, CIM_STRING },
566 { prop_systemnameW, CIM_STRING|COL_FLAG_DYNAMIC },
567 /* methods */
568 { method_pauseserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
569 { method_resumeserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
570 { method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
571 { method_stopserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
573 static const struct column col_sid[] =
575 { prop_accountnameW, CIM_STRING|COL_FLAG_DYNAMIC },
576 { prop_binaryrepresentationW, CIM_UINT8|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
577 { prop_referenceddomainnameW, CIM_STRING|COL_FLAG_DYNAMIC },
578 { prop_sidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
579 { prop_sidlengthW, CIM_UINT32 }
581 static const struct column col_sounddevice[] =
583 { prop_nameW, CIM_STRING },
584 { prop_productnameW, CIM_STRING },
585 { prop_statusinfoW, CIM_UINT16, VT_I4 }
587 static const struct column col_stdregprov[] =
589 { method_enumkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
590 { method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
591 { method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
593 static const struct column col_systemsecurity[] =
595 { method_getsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
596 { method_setsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
598 static const struct column col_videocontroller[] =
600 { prop_adapterdactypeW, CIM_STRING },
601 { prop_adapterramW, CIM_UINT32, VT_I4 },
602 { prop_availabilityW, CIM_UINT16 },
603 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
604 { prop_currentbitsperpixelW, CIM_UINT32, VT_I4 },
605 { prop_currenthorizontalresW, CIM_UINT32, VT_I4 },
606 { prop_currentrefreshrateW, CIM_UINT32, VT_I4 },
607 { prop_currentscanmodeW, CIM_UINT16, VT_I4 },
608 { prop_currentverticalresW, CIM_UINT32, VT_I4 },
609 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
610 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
611 { prop_driverversionW, CIM_STRING },
612 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
613 { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
614 { prop_videoarchitectureW, CIM_UINT16, VT_I4 },
615 { prop_videomemorytypeW, CIM_UINT16, VT_I4 },
616 { prop_videoprocessorW, CIM_STRING|COL_FLAG_DYNAMIC }
619 static const WCHAR baseboard_manufacturerW[] =
620 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
621 static const WCHAR baseboard_serialnumberW[] =
622 {'N','o','n','e',0};
623 static const WCHAR baseboard_tagW[] =
624 {'B','a','s','e',' ','B','o','a','r','d',0};
625 static const WCHAR baseboard_versionW[] =
626 {'1','.','0',0};
627 static const WCHAR bios_descriptionW[] =
628 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
629 static const WCHAR bios_manufacturerW[] =
630 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
631 static const WCHAR bios_releasedateW[] =
632 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
633 static const WCHAR bios_serialnumberW[] =
634 {'0',0};
635 static const WCHAR bios_smbiosbiosversionW[] =
636 {'W','i','n','e',0};
637 static const WCHAR bios_versionW[] =
638 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
639 static const WCHAR cdromdrive_mediatypeW[] =
640 {'C','D','-','R','O','M',0};
641 static const WCHAR cdromdrive_nameW[] =
642 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
643 static const WCHAR cdromdrive_pnpdeviceidW[]=
644 {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
645 '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
646 '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
647 'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
648 static const WCHAR compsys_descriptionW[] =
649 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
650 static const WCHAR compsys_domainW[] =
651 {'W','O','R','K','G','R','O','U','P',0};
652 static const WCHAR compsys_manufacturerW[] =
653 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
654 static const WCHAR compsys_modelW[] =
655 {'W','i','n','e',0};
656 static const WCHAR compsysproduct_identifyingnumberW[] =
657 {'0',0};
658 static const WCHAR compsysproduct_uuidW[] =
659 {'0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-',
660 '0','0','0','0','0','0','0','0','0','0','0','0',0};
661 static const WCHAR diskdrive_interfacetypeW[] =
662 {'I','D','E',0};
663 static const WCHAR diskdrive_manufacturerW[] =
664 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
665 static const WCHAR diskdrive_mediatype_fixedW[] =
666 {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
667 static const WCHAR diskdrive_mediatype_removableW[] =
668 {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
669 static const WCHAR diskdrive_modelW[] =
670 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
671 static const WCHAR diskdrive_pnpdeviceidW[] =
672 {'I','D','E','\\','D','i','s','k','\\','V','E','N','_','W','I','N','E',0};
673 static const WCHAR diskdrive_serialW[] =
674 {'W','I','N','E','H','D','I','S','K',0};
675 static const WCHAR networkadapter_pnpdeviceidW[]=
676 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
677 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
678 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
679 static const WCHAR os_32bitW[] =
680 {'3','2','-','b','i','t',0};
681 static const WCHAR os_64bitW[] =
682 {'6','4','-','b','i','t',0};
683 static const WCHAR os_buildnumberW[] =
684 {'2','6','0','0',0};
685 static const WCHAR os_captionW[] =
686 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
687 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
688 static const WCHAR os_csdversionW[] =
689 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
690 static const WCHAR os_installdateW[] =
691 {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
692 static const WCHAR os_nameW[] =
693 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
694 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
695 '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
696 '\\','P','a','r','t','i','t','i','o','n','1',0};
697 static const WCHAR os_serialnumberW[] =
698 {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
699 static const WCHAR os_versionW[] =
700 {'5','.','1','.','2','6','0','0',0};
701 static const WCHAR physicalmedia_tagW[] =
702 {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
703 static const WCHAR sounddevice_productnameW[] =
704 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
705 static const WCHAR videocontroller_dactypeW[] =
706 {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
707 static const WCHAR videocontroller_deviceidW[] =
708 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
709 static const WCHAR videocontroller_driverversionW[] =
710 {'1','.','0',0};
712 #include "pshpack1.h"
713 struct record_baseboard
715 const WCHAR *manufacturer;
716 const WCHAR *model;
717 const WCHAR *name;
718 const WCHAR *product;
719 const WCHAR *serialnumber;
720 const WCHAR *tag;
721 const WCHAR *version;
723 struct record_bios
725 const WCHAR *description;
726 const WCHAR *identificationcode;
727 const WCHAR *manufacturer;
728 const WCHAR *releasedate;
729 const WCHAR *serialnumber;
730 const WCHAR *smbiosbiosversion;
731 const WCHAR *version;
733 struct record_cdromdrive
735 const WCHAR *device_id;
736 const WCHAR *drive;
737 const WCHAR *mediatype;
738 const WCHAR *name;
739 const WCHAR *pnpdevice_id;
741 struct record_computersystem
743 const WCHAR *description;
744 const WCHAR *domain;
745 UINT16 domainrole;
746 const WCHAR *manufacturer;
747 const WCHAR *model;
748 const WCHAR *name;
749 UINT32 num_logical_processors;
750 UINT32 num_processors;
751 UINT64 total_physical_memory;
752 const WCHAR *username;
754 struct record_computersystemproduct
756 const WCHAR *identifyingnumber;
757 const WCHAR *uuid;
759 struct record_datafile
761 const WCHAR *name;
762 const WCHAR *version;
764 struct record_directory
766 UINT32 accessmask;
767 const WCHAR *name;
769 struct record_diskdrive
771 const WCHAR *device_id;
772 UINT32 index;
773 const WCHAR *interfacetype;
774 const WCHAR *manufacturer;
775 const WCHAR *mediatype;
776 const WCHAR *model;
777 const WCHAR *pnpdevice_id;
778 const WCHAR *serialnumber;
779 UINT64 size;
781 struct record_diskpartition
783 int bootable;
784 int bootpartition;
785 const WCHAR *device_id;
786 UINT32 diskindex;
787 UINT32 index;
788 const WCHAR *pnpdevice_id;
789 UINT64 size;
790 UINT64 startingoffset;
791 const WCHAR *type;
793 struct record_logicaldisk
795 const WCHAR *device_id;
796 UINT32 drivetype;
797 const WCHAR *filesystem;
798 UINT64 freespace;
799 const WCHAR *name;
800 UINT64 size;
801 const WCHAR *volumename;
802 const WCHAR *volumeserialnumber;
804 struct record_networkadapter
806 const WCHAR *adaptertype;
807 const WCHAR *device_id;
808 UINT32 index;
809 UINT32 interface_index;
810 const WCHAR *mac_address;
811 const WCHAR *manufacturer;
812 const WCHAR *name;
813 UINT16 netconnection_status;
814 int physicaladapter;
815 const WCHAR *pnpdevice_id;
816 UINT64 speed;
818 struct record_networkadapterconfig
820 const WCHAR *dnshostname;
821 UINT32 index;
822 UINT32 ipconnectionmetric;
823 int ipenabled;
824 const WCHAR *mac_address;
826 struct record_operatingsystem
828 const WCHAR *buildnumber;
829 const WCHAR *caption;
830 const WCHAR *codeset;
831 const WCHAR *countrycode;
832 const WCHAR *csdversion;
833 const WCHAR *installdate;
834 const WCHAR *lastbootuptime;
835 const WCHAR *localdatetime;
836 const WCHAR *locale;
837 const WCHAR *name;
838 const WCHAR *osarchitecture;
839 UINT32 oslanguage;
840 UINT32 osproductsuite;
841 UINT16 ostype;
842 const WCHAR *serialnumber;
843 UINT16 servicepackmajor;
844 UINT16 servicepackminor;
845 UINT32 suitemask;
846 const WCHAR *systemdirectory;
847 UINT64 totalvisiblememorysize;
848 const WCHAR *version;
850 struct record_param
852 const WCHAR *class;
853 const WCHAR *method;
854 INT32 direction;
855 const WCHAR *parameter;
856 UINT32 type;
857 UINT32 varianttype;
858 UINT32 defaultvalue;
860 struct record_physicalmedia
862 const WCHAR *serialnumber;
863 const WCHAR *tag;
865 struct record_physicalmemory
867 UINT64 capacity;
869 struct record_printer
871 UINT32 attributes;
872 const WCHAR *drivername;
873 UINT32 horizontalresolution;
874 int local;
875 const WCHAR *name;
876 int network;
878 struct record_process
880 const WCHAR *caption;
881 const WCHAR *commandline;
882 const WCHAR *description;
883 const WCHAR *handle;
884 const WCHAR *name;
885 UINT32 pprocess_id;
886 UINT32 process_id;
887 UINT32 thread_count;
888 /* methods */
889 class_method *get_owner;
891 struct record_processor
893 UINT16 addresswidth;
894 const WCHAR *caption;
895 UINT16 cpu_status;
896 UINT32 currentclockspeed;
897 UINT16 datawidth;
898 const WCHAR *description;
899 const WCHAR *device_id;
900 UINT16 family;
901 const WCHAR *manufacturer;
902 UINT32 maxclockspeed;
903 const WCHAR *name;
904 UINT32 num_cores;
905 UINT32 num_logical_processors;
906 const WCHAR *processor_id;
907 UINT16 processortype;
908 const WCHAR *unique_id;
909 const WCHAR *version;
911 struct record_qualifier
913 const WCHAR *class;
914 const WCHAR *member;
915 UINT32 type;
916 INT32 flavor;
917 const WCHAR *name;
918 INT32 intvalue;
919 const WCHAR *strvalue;
921 struct record_service
923 int accept_pause;
924 int accept_stop;
925 const WCHAR *displayname;
926 const WCHAR *name;
927 UINT32 process_id;
928 const WCHAR *servicetype;
929 const WCHAR *startmode;
930 const WCHAR *state;
931 const WCHAR *systemname;
932 /* methods */
933 class_method *pause_service;
934 class_method *resume_service;
935 class_method *start_service;
936 class_method *stop_service;
938 struct record_sid
940 const WCHAR *accountname;
941 const UINT8 *binaryrepresentation;
942 const WCHAR *referenceddomainname;
943 const WCHAR *sid;
944 UINT32 sidlength;
946 struct record_sounddevice
948 const WCHAR *name;
949 const WCHAR *productname;
950 UINT16 statusinfo;
952 struct record_stdregprov
954 class_method *enumkey;
955 class_method *enumvalues;
956 class_method *getstringvalue;
958 struct record_systemsecurity
960 class_method *getsd;
961 class_method *setsd;
963 struct record_videocontroller
965 const WCHAR *adapter_dactype;
966 UINT32 adapter_ram;
967 UINT16 availability;
968 const WCHAR *caption;
969 UINT32 current_bitsperpixel;
970 UINT32 current_horizontalres;
971 UINT32 current_refreshrate;
972 UINT16 current_scanmode;
973 UINT32 current_verticalres;
974 const WCHAR *description;
975 const WCHAR *device_id;
976 const WCHAR *driverversion;
977 const WCHAR *name;
978 const WCHAR *pnpdevice_id;
979 UINT16 videoarchitecture;
980 UINT16 videomemorytype;
981 const WCHAR *videoprocessor;
983 #include "poppack.h"
985 static const struct record_baseboard data_baseboard[] =
987 { baseboard_manufacturerW, baseboard_tagW, baseboard_tagW, baseboard_tagW, baseboard_serialnumberW, baseboard_versionW }
989 static const struct record_bios data_bios[] =
991 { bios_descriptionW, bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW,
992 bios_smbiosbiosversionW, bios_versionW }
994 static const struct record_computersystemproduct data_compsysproduct[] =
996 { compsysproduct_identifyingnumberW, compsysproduct_uuidW }
998 static const struct record_param data_param[] =
1000 { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1001 { class_processW, method_getownerW, -1, param_userW, CIM_STRING },
1002 { class_processW, method_getownerW, -1, param_domainW, CIM_STRING },
1003 { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1004 { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1005 { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1006 { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1007 { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1008 { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING },
1009 { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1010 { class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
1011 { class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1012 { class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING },
1013 { class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1014 { class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
1015 { class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY },
1016 { class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1017 { class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING },
1018 { class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING },
1019 { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1020 { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING },
1021 { class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1022 { class_systemsecurityW, method_getsdW, -1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
1023 { class_systemsecurityW, method_setsdW, 1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
1024 { class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1027 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
1028 WBEM_FLAVOR_ORIGIN_PROPAGATED)
1030 static const struct record_physicalmedia data_physicalmedia[] =
1032 { diskdrive_serialW, physicalmedia_tagW }
1034 static const struct record_qualifier data_qualifier[] =
1036 { class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 },
1037 { class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 }
1039 static const struct record_sounddevice data_sounddevice[] =
1041 { sounddevice_productnameW, sounddevice_productnameW, 3 /* enabled */ }
1043 static const struct record_stdregprov data_stdregprov[] =
1045 { reg_enum_key, reg_enum_values, reg_get_stringvalue }
1047 static const struct record_systemsecurity data_systemsecurity[] =
1049 { security_get_sd, security_set_sd }
1052 /* check if row matches condition and update status */
1053 static BOOL match_row( const struct table *table, UINT row, const struct expr *cond, enum fill_status *status )
1055 LONGLONG val;
1056 UINT type;
1058 if (!cond)
1060 *status = FILL_STATUS_UNFILTERED;
1061 return TRUE;
1063 if (eval_cond( table, row, cond, &val, &type ) != S_OK)
1065 *status = FILL_STATUS_FAILED;
1066 return FALSE;
1068 *status = FILL_STATUS_FILTERED;
1069 return val != 0;
1072 static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
1074 if (!table->num_rows_allocated)
1076 if (!(table->data = heap_alloc( row_count * row_size ))) return FALSE;
1077 table->num_rows_allocated = row_count;
1078 return TRUE;
1080 if (row_count > table->num_rows_allocated)
1082 BYTE *data;
1083 UINT count = max( row_count, table->num_rows_allocated * 2 );
1084 if (!(data = heap_realloc( table->data, count * row_size ))) return FALSE;
1085 table->data = data;
1086 table->num_rows_allocated = count;
1088 return TRUE;
1091 static enum fill_status fill_cdromdrive( struct table *table, const struct expr *cond )
1093 static const WCHAR fmtW[] = {'%','c',':',0};
1094 WCHAR drive[3], root[] = {'A',':','\\',0};
1095 struct record_cdromdrive *rec;
1096 UINT i, row = 0, offset = 0;
1097 DWORD drives = GetLogicalDrives();
1098 enum fill_status status = FILL_STATUS_UNFILTERED;
1100 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1102 for (i = 0; i < sizeof(drives); i++)
1104 if (drives & (1 << i))
1106 root[0] = 'A' + i;
1107 if (GetDriveTypeW( root ) != DRIVE_CDROM)
1108 continue;
1110 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1112 rec = (struct record_cdromdrive *)(table->data + offset);
1113 rec->device_id = cdromdrive_pnpdeviceidW;
1114 sprintfW( drive, fmtW, 'A' + i );
1115 rec->drive = heap_strdupW( drive );
1116 rec->mediatype = cdromdrive_mediatypeW;
1117 rec->name = cdromdrive_nameW;
1118 rec->pnpdevice_id = cdromdrive_pnpdeviceidW;
1119 if (!match_row( table, row, cond, &status ))
1121 free_row_values( table, row );
1122 continue;
1124 offset += sizeof(*rec);
1125 row++;
1128 TRACE("created %u rows\n", row);
1129 table->num_rows = row;
1130 return status;
1133 static UINT get_processor_count(void)
1135 SYSTEM_BASIC_INFORMATION info;
1137 if (NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )) return 1;
1138 return info.NumberOfProcessors;
1141 static UINT get_logical_processor_count( UINT *num_cores )
1143 SYSTEM_LOGICAL_PROCESSOR_INFORMATION *info;
1144 UINT i, j, count = 0;
1145 NTSTATUS status;
1146 ULONG len;
1148 if (num_cores) *num_cores = get_processor_count();
1149 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, NULL, 0, &len );
1150 if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count();
1152 if (!(info = heap_alloc( len ))) return get_processor_count();
1153 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, info, len, &len );
1154 if (status != STATUS_SUCCESS)
1156 heap_free( info );
1157 return get_processor_count();
1159 if (num_cores) *num_cores = 0;
1160 for (i = 0; i < len / sizeof(*info); i++)
1162 if (info[i].Relationship == RelationProcessorCore)
1164 for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) count++;
1166 else if (info[i].Relationship == RelationProcessorPackage && num_cores)
1168 for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) (*num_cores)++;
1171 heap_free( info );
1172 return count;
1175 static UINT64 get_total_physical_memory(void)
1177 MEMORYSTATUSEX status;
1179 status.dwLength = sizeof(status);
1180 if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
1181 return status.ullTotalPhys;
1184 static WCHAR *get_computername(void)
1186 WCHAR *ret;
1187 DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
1189 if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
1190 GetComputerNameW( ret, &size );
1191 return ret;
1194 static WCHAR *get_username(void)
1196 WCHAR *ret;
1197 DWORD compsize, usersize;
1198 DWORD size;
1200 compsize = 0;
1201 GetComputerNameW( NULL, &compsize );
1202 usersize = 0;
1203 GetUserNameW( NULL, &usersize );
1204 size = compsize + usersize; /* two null terminators account for the \ */
1205 if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
1206 GetComputerNameW( ret, &compsize );
1207 ret[compsize] = '\\';
1208 GetUserNameW( ret + compsize + 1, &usersize );
1209 return ret;
1212 static enum fill_status fill_compsys( struct table *table, const struct expr *cond )
1214 struct record_computersystem *rec;
1215 enum fill_status status = FILL_STATUS_UNFILTERED;
1216 UINT row = 0;
1218 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1220 rec = (struct record_computersystem *)table->data;
1221 rec->description = compsys_descriptionW;
1222 rec->domain = compsys_domainW;
1223 rec->domainrole = 0; /* standalone workstation */
1224 rec->manufacturer = compsys_manufacturerW;
1225 rec->model = compsys_modelW;
1226 rec->name = get_computername();
1227 rec->num_logical_processors = get_logical_processor_count( NULL );
1228 rec->num_processors = get_processor_count();
1229 rec->total_physical_memory = get_total_physical_memory();
1230 rec->username = get_username();
1231 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
1232 else row++;
1234 TRACE("created %u rows\n", row);
1235 table->num_rows = row;
1236 return status;
1239 struct dirstack
1241 WCHAR **dirs;
1242 UINT *len_dirs;
1243 UINT num_dirs;
1244 UINT num_allocated;
1247 static struct dirstack *alloc_dirstack( UINT size )
1249 struct dirstack *dirstack;
1251 if (!(dirstack = heap_alloc( sizeof(*dirstack) ))) return NULL;
1252 if (!(dirstack->dirs = heap_alloc( sizeof(WCHAR *) * size )))
1254 heap_free( dirstack );
1255 return NULL;
1257 if (!(dirstack->len_dirs = heap_alloc( sizeof(UINT) * size )))
1259 heap_free( dirstack->dirs );
1260 heap_free( dirstack );
1261 return NULL;
1263 dirstack->num_dirs = 0;
1264 dirstack->num_allocated = size;
1265 return dirstack;
1268 static void clear_dirstack( struct dirstack *dirstack )
1270 UINT i;
1271 for (i = 0; i < dirstack->num_dirs; i++) heap_free( dirstack->dirs[i] );
1272 dirstack->num_dirs = 0;
1275 static void free_dirstack( struct dirstack *dirstack )
1277 clear_dirstack( dirstack );
1278 heap_free( dirstack->dirs );
1279 heap_free( dirstack->len_dirs );
1280 heap_free( dirstack );
1283 static BOOL push_dir( struct dirstack *dirstack, WCHAR *dir, UINT len )
1285 UINT size, i = dirstack->num_dirs;
1287 if (!dir) return FALSE;
1289 if (i == dirstack->num_allocated)
1291 WCHAR **tmp;
1292 UINT *len_tmp;
1294 size = dirstack->num_allocated * 2;
1295 if (!(tmp = heap_realloc( dirstack->dirs, size * sizeof(WCHAR *) ))) return FALSE;
1296 dirstack->dirs = tmp;
1297 if (!(len_tmp = heap_realloc( dirstack->len_dirs, size * sizeof(UINT) ))) return FALSE;
1298 dirstack->len_dirs = len_tmp;
1299 dirstack->num_allocated = size;
1301 dirstack->dirs[i] = dir;
1302 dirstack->len_dirs[i] = len;
1303 dirstack->num_dirs++;
1304 return TRUE;
1307 static WCHAR *pop_dir( struct dirstack *dirstack, UINT *len )
1309 if (!dirstack->num_dirs)
1311 *len = 0;
1312 return NULL;
1314 dirstack->num_dirs--;
1315 *len = dirstack->len_dirs[dirstack->num_dirs];
1316 return dirstack->dirs[dirstack->num_dirs];
1319 static const WCHAR *peek_dir( struct dirstack *dirstack )
1321 if (!dirstack->num_dirs) return NULL;
1322 return dirstack->dirs[dirstack->num_dirs - 1];
1325 static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len )
1327 UINT i = 0;
1328 WCHAR *ret;
1330 if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
1331 ret[i++] = drive;
1332 ret[i++] = ':';
1333 ret[i++] = '\\';
1334 if (path && len)
1336 memcpy( ret + i, path, len * sizeof(WCHAR) );
1337 i += len;
1338 ret[i++] = '\\';
1340 ret[i++] = '*';
1341 ret[i] = 0;
1342 return ret;
1345 static WCHAR *build_name( WCHAR drive, const WCHAR *path )
1347 UINT i = 0, len = 0;
1348 const WCHAR *p;
1349 WCHAR *ret;
1351 for (p = path; *p; p++)
1353 if (*p == '\\') len += 2;
1354 else len++;
1356 if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
1357 ret[i++] = drive;
1358 ret[i++] = ':';
1359 ret[i++] = '\\';
1360 ret[i++] = '\\';
1361 for (p = path; *p; p++)
1363 if (*p != '\\') ret[i++] = *p;
1364 else
1366 ret[i++] = '\\';
1367 ret[i++] = '\\';
1370 ret[i] = 0;
1371 return ret;
1374 static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
1376 const WCHAR *p = path, *start;
1377 UINT len, i;
1378 WCHAR *ret;
1380 if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
1381 start = path + 4;
1382 len = strlenW( start );
1383 p = start + len - 1;
1384 if (*p == '\\') return NULL;
1386 while (p >= start && *p != '\\') { len--; p--; };
1387 while (p >= start && *p == '\\') { len--; p--; };
1389 if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
1390 for (i = 0, p = start; p < start + len; p++)
1392 if (p[0] == '\\' && p[1] == '\\')
1394 ret[i++] = '\\';
1395 p++;
1397 else ret[i++] = *p;
1399 ret[i] = 0;
1400 *ret_len = i;
1401 return ret;
1404 static BOOL seen_dir( struct dirstack *dirstack, const WCHAR *path )
1406 UINT i;
1407 for (i = 0; i < dirstack->num_dirs; i++) if (!strcmpW( dirstack->dirs[i], path )) return TRUE;
1408 return FALSE;
1411 /* optimize queries of the form WHERE Name='...' [OR Name='...']* */
1412 static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR root, UINT *count )
1414 const struct expr *left, *right;
1416 if (!cond || cond->type != EXPR_COMPLEX) return *count = 0;
1418 left = cond->u.expr.left;
1419 right = cond->u.expr.right;
1420 if (cond->u.expr.op == OP_EQ)
1422 UINT len;
1423 WCHAR *path;
1424 const WCHAR *str = NULL;
1426 if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL &&
1427 !strcmpW( left->u.propval->name, prop_nameW ) &&
1428 toupperW( right->u.sval[0] ) == toupperW( root ))
1430 str = right->u.sval;
1432 else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL &&
1433 !strcmpW( right->u.propval->name, prop_nameW ) &&
1434 toupperW( left->u.sval[0] ) == toupperW( root ))
1436 str = left->u.sval;
1438 if (str && (path = build_dirname( str, &len )))
1440 if (seen_dir( dirstack, path ))
1442 heap_free( path );
1443 return ++*count;
1445 else if (push_dir( dirstack, path, len )) return ++*count;
1446 heap_free( path );
1447 return *count = 0;
1450 else if (cond->u.expr.op == OP_OR)
1452 UINT left_count = 0, right_count = 0;
1454 if (!(seed_dirs( dirstack, left, root, &left_count ))) return *count = 0;
1455 if (!(seed_dirs( dirstack, right, root, &right_count ))) return *count = 0;
1456 return *count += left_count + right_count;
1458 return *count = 0;
1461 static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len )
1463 UINT len_path = 0, len_segment = strlenW( segment );
1464 WCHAR *ret;
1466 *len = 0;
1467 if (path) len_path = strlenW( path );
1468 if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
1469 if (path && len_path)
1471 memcpy( ret, path, len_path * sizeof(WCHAR) );
1472 ret[len_path] = '\\';
1473 *len += len_path + 1;
1475 memcpy( ret + *len, segment, len_segment * sizeof(WCHAR) );
1476 *len += len_segment;
1477 ret[*len] = 0;
1478 return ret;
1481 static WCHAR *get_file_version( const WCHAR *filename )
1483 static const WCHAR slashW[] = {'\\',0}, fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
1484 VS_FIXEDFILEINFO *info;
1485 DWORD size;
1486 void *block;
1487 WCHAR *ret;
1489 if (!(ret = heap_alloc( (4 * 5 + sizeof(fmtW) / sizeof(fmtW[0])) * sizeof(WCHAR) ))) return NULL;
1490 if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size )))
1492 heap_free( ret );
1493 return NULL;
1495 if (!GetFileVersionInfoW( filename, 0, size, block ) ||
1496 !VerQueryValueW( block, slashW, (void **)&info, &size ))
1498 heap_free( block );
1499 heap_free( ret );
1500 return NULL;
1502 sprintfW( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff,
1503 info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff );
1504 heap_free( block );
1505 return ret;
1508 static enum fill_status fill_datafile( struct table *table, const struct expr *cond )
1510 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
1511 struct record_datafile *rec;
1512 UINT i, len, row = 0, offset = 0, num_expected_rows;
1513 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
1514 DWORD drives = GetLogicalDrives();
1515 WIN32_FIND_DATAW data;
1516 HANDLE handle;
1517 struct dirstack *dirstack;
1518 enum fill_status status = FILL_STATUS_UNFILTERED;
1520 if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED;
1522 dirstack = alloc_dirstack(2);
1524 for (i = 0; i < sizeof(drives); i++)
1526 if (!(drives & (1 << i))) continue;
1528 root[0] = 'A' + i;
1529 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
1531 num_expected_rows = 0;
1532 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
1534 for (;;)
1536 path = pop_dir( dirstack, &len );
1537 if (!(glob = build_glob( root[0], path, len )))
1539 status = FILL_STATUS_FAILED;
1540 goto done;
1542 if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
1546 if (!resize_table( table, row + 1, sizeof(*rec) ))
1548 status = FILL_STATUS_FAILED;
1549 FindClose( handle );
1550 goto done;
1552 if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue;
1553 new_path = append_path( path, data.cFileName, &len );
1555 if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
1557 if (push_dir( dirstack, new_path, len )) continue;
1558 heap_free( new_path );
1559 FindClose( handle );
1560 status = FILL_STATUS_FAILED;
1561 goto done;
1563 rec = (struct record_datafile *)(table->data + offset);
1564 rec->name = build_name( root[0], new_path );
1565 rec->version = get_file_version( rec->name );
1566 if (!match_row( table, row, cond, &status ))
1568 free_row_values( table, row );
1569 continue;
1571 else if (num_expected_rows && row == num_expected_rows - 1)
1573 row++;
1574 FindClose( handle );
1575 status = FILL_STATUS_FILTERED;
1576 goto done;
1578 offset += sizeof(*rec);
1579 row++;
1581 while (FindNextFileW( handle, &data ));
1582 FindClose( handle );
1584 if (!peek_dir( dirstack )) break;
1585 heap_free( glob );
1586 heap_free( path );
1590 done:
1591 free_dirstack( dirstack );
1592 heap_free( glob );
1593 heap_free( path );
1595 TRACE("created %u rows\n", row);
1596 table->num_rows = row;
1597 return status;
1600 static enum fill_status fill_directory( struct table *table, const struct expr *cond )
1602 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
1603 struct record_directory *rec;
1604 UINT i, len, row = 0, offset = 0, num_expected_rows;
1605 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
1606 DWORD drives = GetLogicalDrives();
1607 WIN32_FIND_DATAW data;
1608 HANDLE handle;
1609 struct dirstack *dirstack;
1610 enum fill_status status = FILL_STATUS_UNFILTERED;
1612 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1614 dirstack = alloc_dirstack(2);
1616 for (i = 0; i < sizeof(drives); i++)
1618 if (!(drives & (1 << i))) continue;
1620 root[0] = 'A' + i;
1621 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
1623 num_expected_rows = 0;
1624 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
1626 for (;;)
1628 path = pop_dir( dirstack, &len );
1629 if (!(glob = build_glob( root[0], path, len )))
1631 status = FILL_STATUS_FAILED;
1632 goto done;
1634 if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
1638 if (!resize_table( table, row + 1, sizeof(*rec) ))
1640 FindClose( handle );
1641 status = FILL_STATUS_FAILED;
1642 goto done;
1644 if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
1645 !strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW ))
1646 continue;
1648 new_path = append_path( path, data.cFileName, &len );
1649 if (!(push_dir( dirstack, new_path, len )))
1651 heap_free( new_path );
1652 FindClose( handle );
1653 status = FILL_STATUS_FAILED;
1654 goto done;
1656 rec = (struct record_directory *)(table->data + offset);
1657 rec->accessmask = FILE_ALL_ACCESS;
1658 rec->name = build_name( root[0], new_path );
1659 if (!match_row( table, row, cond, &status ))
1661 free_row_values( table, row );
1662 continue;
1664 else if (num_expected_rows && row == num_expected_rows - 1)
1666 row++;
1667 FindClose( handle );
1668 status = FILL_STATUS_FILTERED;
1669 goto done;
1671 offset += sizeof(*rec);
1672 row++;
1674 while (FindNextFileW( handle, &data ));
1675 FindClose( handle );
1677 if (!peek_dir( dirstack )) break;
1678 heap_free( glob );
1679 heap_free( path );
1683 done:
1684 free_dirstack( dirstack );
1685 heap_free( glob );
1686 heap_free( path );
1688 TRACE("created %u rows\n", row);
1689 table->num_rows = row;
1690 return status;
1693 static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
1695 WCHAR root[] = {'\\','\\','.','\\','A',':',0};
1696 ULARGE_INTEGER free;
1697 DISK_GEOMETRY_EX info;
1698 HANDLE handle;
1699 DWORD bytes_returned;
1701 free.QuadPart = 512 * 1024 * 1024;
1702 GetDiskFreeSpaceExW( dir, NULL, NULL, &free );
1704 root[4] = dir[0];
1705 handle = CreateFileW( root, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
1706 if (handle != INVALID_HANDLE_VALUE)
1708 if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &info, sizeof(info), &bytes_returned, NULL ))
1709 *disksize = info.DiskSize.QuadPart;
1710 CloseHandle( handle );
1712 return free.QuadPart;
1715 static enum fill_status fill_diskdrive( struct table *table, const struct expr *cond )
1717 static const WCHAR fmtW[] =
1718 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
1719 WCHAR device_id[sizeof(fmtW)/sizeof(fmtW[0]) + 10], root[] = {'A',':','\\',0};
1720 struct record_diskdrive *rec;
1721 UINT i, row = 0, offset = 0, index = 0, type;
1722 UINT64 size = 1024 * 1024 * 1024;
1723 DWORD drives = GetLogicalDrives();
1724 enum fill_status status = FILL_STATUS_UNFILTERED;
1726 if (!resize_table( table, 2, sizeof(*rec) )) return FILL_STATUS_FAILED;
1728 for (i = 0; i < sizeof(drives); i++)
1730 if (drives & (1 << i))
1732 root[0] = 'A' + i;
1733 type = GetDriveTypeW( root );
1734 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
1735 continue;
1737 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1739 rec = (struct record_diskdrive *)(table->data + offset);
1740 sprintfW( device_id, fmtW, index );
1741 rec->device_id = heap_strdupW( device_id );
1742 rec->index = index;
1743 rec->interfacetype = diskdrive_interfacetypeW;
1744 rec->manufacturer = diskdrive_manufacturerW;
1745 if (type == DRIVE_FIXED)
1746 rec->mediatype = diskdrive_mediatype_fixedW;
1747 else
1748 rec->mediatype = diskdrive_mediatype_removableW;
1749 rec->model = diskdrive_modelW;
1750 rec->pnpdevice_id = diskdrive_pnpdeviceidW;
1751 rec->serialnumber = diskdrive_serialW;
1752 get_freespace( root, &size );
1753 rec->size = size;
1754 if (!match_row( table, row, cond, &status ))
1756 free_row_values( table, row );
1757 continue;
1759 offset += sizeof(*rec);
1760 index++;
1761 row++;
1764 TRACE("created %u rows\n", row);
1765 table->num_rows = row;
1766 return status;
1769 static WCHAR *get_filesystem( const WCHAR *root )
1771 static const WCHAR ntfsW[] = {'N','T','F','S',0};
1772 WCHAR buffer[MAX_PATH + 1];
1774 if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
1775 return heap_strdupW( buffer );
1776 return heap_strdupW( ntfsW );
1779 static enum fill_status fill_diskpartition( struct table *table, const struct expr *cond )
1781 static const WCHAR fmtW[] =
1782 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
1783 WCHAR device_id[32], root[] = {'A',':','\\',0};
1784 struct record_diskpartition *rec;
1785 UINT i, row = 0, offset = 0, type, index = 0;
1786 UINT64 size = 1024 * 1024 * 1024;
1787 DWORD drives = GetLogicalDrives();
1788 enum fill_status status = FILL_STATUS_UNFILTERED;
1790 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1792 for (i = 0; i < sizeof(drives); i++)
1794 if (drives & (1 << i))
1796 root[0] = 'A' + i;
1797 type = GetDriveTypeW( root );
1798 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
1799 continue;
1801 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1803 rec = (struct record_diskpartition *)(table->data + offset);
1804 rec->bootable = (i == 2) ? -1 : 0;
1805 rec->bootpartition = (i == 2) ? -1 : 0;
1806 sprintfW( device_id, fmtW, index );
1807 rec->device_id = heap_strdupW( device_id );
1808 rec->diskindex = index;
1809 rec->index = 0;
1810 rec->pnpdevice_id = heap_strdupW( device_id );
1811 get_freespace( root, &size );
1812 rec->size = size;
1813 rec->startingoffset = 0;
1814 rec->type = get_filesystem( root );
1815 if (!match_row( table, row, cond, &status ))
1817 free_row_values( table, row );
1818 continue;
1820 offset += sizeof(*rec);
1821 row++;
1822 index++;
1825 TRACE("created %u rows\n", row);
1826 table->num_rows = row;
1827 return status;
1830 static WCHAR *get_volumename( const WCHAR *root )
1832 WCHAR buf[MAX_PATH + 1] = {0};
1833 GetVolumeInformationW( root, buf, sizeof(buf)/sizeof(buf[0]), NULL, NULL, NULL, NULL, 0 );
1834 return heap_strdupW( buf );
1836 static WCHAR *get_volumeserialnumber( const WCHAR *root )
1838 static const WCHAR fmtW[] = {'%','0','8','X',0};
1839 DWORD serial = 0;
1840 WCHAR buffer[9];
1842 GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 );
1843 sprintfW( buffer, fmtW, serial );
1844 return heap_strdupW( buffer );
1847 static enum fill_status fill_logicaldisk( struct table *table, const struct expr *cond )
1849 static const WCHAR fmtW[] = {'%','c',':',0};
1850 WCHAR device_id[3], root[] = {'A',':','\\',0};
1851 struct record_logicaldisk *rec;
1852 UINT i, row = 0, offset = 0, type;
1853 UINT64 size = 1024 * 1024 * 1024;
1854 DWORD drives = GetLogicalDrives();
1855 enum fill_status status = FILL_STATUS_UNFILTERED;
1857 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1859 for (i = 0; i < sizeof(drives); i++)
1861 if (drives & (1 << i))
1863 root[0] = 'A' + i;
1864 type = GetDriveTypeW( root );
1865 if (type != DRIVE_FIXED && type != DRIVE_CDROM && type != DRIVE_REMOVABLE)
1866 continue;
1868 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1870 rec = (struct record_logicaldisk *)(table->data + offset);
1871 sprintfW( device_id, fmtW, 'A' + i );
1872 rec->device_id = heap_strdupW( device_id );
1873 rec->drivetype = type;
1874 rec->filesystem = get_filesystem( root );
1875 rec->freespace = get_freespace( root, &size );
1876 rec->name = heap_strdupW( device_id );
1877 rec->size = size;
1878 rec->volumename = get_volumename( root );
1879 rec->volumeserialnumber = get_volumeserialnumber( root );
1880 if (!match_row( table, row, cond, &status ))
1882 free_row_values( table, row );
1883 continue;
1885 offset += sizeof(*rec);
1886 row++;
1889 TRACE("created %u rows\n", row);
1890 table->num_rows = row;
1891 return status;
1894 static UINT16 get_connection_status( IF_OPER_STATUS status )
1896 switch (status)
1898 case IfOperStatusDown:
1899 return 0; /* Disconnected */
1900 case IfOperStatusUp:
1901 return 2; /* Connected */
1902 default:
1903 ERR("unhandled status %u\n", status);
1904 break;
1906 return 0;
1908 static WCHAR *get_mac_address( const BYTE *addr, DWORD len )
1910 static const WCHAR fmtW[] =
1911 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
1912 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
1913 WCHAR *ret;
1915 if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
1916 sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
1917 return ret;
1919 static const WCHAR *get_adaptertype( DWORD type, int *physical )
1921 static const WCHAR ethernetW[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
1922 static const WCHAR wirelessW[] = {'W','i','r','e','l','e','s','s',0};
1923 static const WCHAR firewireW[] = {'1','3','9','4',0};
1924 static const WCHAR tunnelW[] = {'T','u','n','n','e','l',0};
1926 switch (type)
1928 case IF_TYPE_ETHERNET_CSMACD: *physical = -1; return ethernetW;
1929 case IF_TYPE_IEEE80211: *physical = -1; return wirelessW;
1930 case IF_TYPE_IEEE1394: *physical = -1; return firewireW;
1931 case IF_TYPE_TUNNEL: *physical = 0; return tunnelW;
1932 default: *physical = 0; return NULL;
1936 static enum fill_status fill_networkadapter( struct table *table, const struct expr *cond )
1938 static const WCHAR fmtW[] = {'%','u',0};
1939 WCHAR device_id[11];
1940 struct record_networkadapter *rec;
1941 IP_ADAPTER_ADDRESSES *aa, *buffer;
1942 UINT row = 0, offset = 0, count = 0;
1943 DWORD size = 0, ret;
1944 int physical;
1945 enum fill_status status = FILL_STATUS_UNFILTERED;
1947 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
1948 if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
1950 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
1951 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
1953 heap_free( buffer );
1954 return FILL_STATUS_FAILED;
1956 for (aa = buffer; aa; aa = aa->Next)
1958 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
1960 if (!resize_table( table, count, sizeof(*rec) ))
1962 heap_free( buffer );
1963 return FILL_STATUS_FAILED;
1965 for (aa = buffer; aa; aa = aa->Next)
1967 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
1969 rec = (struct record_networkadapter *)(table->data + offset);
1970 sprintfW( device_id, fmtW, aa->u.s.IfIndex );
1971 rec->adaptertype = get_adaptertype( aa->IfType, &physical );
1972 rec->device_id = heap_strdupW( device_id );
1973 rec->index = aa->u.s.IfIndex;
1974 rec->interface_index = aa->u.s.IfIndex;
1975 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
1976 rec->manufacturer = compsys_manufacturerW;
1977 rec->name = heap_strdupW( aa->FriendlyName );
1978 rec->netconnection_status = get_connection_status( aa->OperStatus );
1979 rec->physicaladapter = physical;
1980 rec->pnpdevice_id = networkadapter_pnpdeviceidW;
1981 rec->speed = 1000000;
1982 if (!match_row( table, row, cond, &status ))
1984 free_row_values( table, row );
1985 continue;
1987 offset += sizeof(*rec);
1988 row++;
1990 TRACE("created %u rows\n", row);
1991 table->num_rows = row;
1993 heap_free( buffer );
1994 return status;
1997 static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr )
1999 const SOCKET_ADDRESS *sa = &addr->Address;
2000 WCHAR buf[NI_MAXHOST];
2002 if (!addr) return NULL;
2003 if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, sizeof(buf)/sizeof(buf[0]), NULL,
2004 0, NI_NAMEREQD )) return NULL;
2005 return heap_strdupW( buf );
2008 static enum fill_status fill_networkadapterconfig( struct table *table, const struct expr *cond )
2010 struct record_networkadapterconfig *rec;
2011 IP_ADAPTER_ADDRESSES *aa, *buffer;
2012 UINT row = 0, offset = 0, count = 0;
2013 DWORD size = 0, ret;
2014 enum fill_status status = FILL_STATUS_UNFILTERED;
2016 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
2017 if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
2019 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
2020 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
2022 heap_free( buffer );
2023 return FILL_STATUS_FAILED;
2025 for (aa = buffer; aa; aa = aa->Next)
2027 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
2029 if (!resize_table( table, count, sizeof(*rec) ))
2031 heap_free( buffer );
2032 return FILL_STATUS_FAILED;
2034 for (aa = buffer; aa; aa = aa->Next)
2036 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
2038 rec = (struct record_networkadapterconfig *)(table->data + offset);
2039 rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
2040 rec->index = aa->u.s.IfIndex;
2041 rec->ipconnectionmetric = 20;
2042 rec->ipenabled = -1;
2043 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
2044 if (!match_row( table, row, cond, &status ))
2046 free_row_values( table, row );
2047 continue;
2049 offset += sizeof(*rec);
2050 row++;
2052 TRACE("created %u rows\n", row);
2053 table->num_rows = row;
2055 heap_free( buffer );
2056 return status;
2059 static enum fill_status fill_physicalmemory( struct table *table, const struct expr *cond )
2061 struct record_physicalmemory *rec;
2062 enum fill_status status = FILL_STATUS_UNFILTERED;
2063 UINT row = 0;
2065 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2067 rec = (struct record_physicalmemory *)table->data;
2068 rec->capacity = get_total_physical_memory();
2069 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2070 else row++;
2072 TRACE("created %u rows\n", row);
2073 table->num_rows = row;
2074 return status;
2077 static enum fill_status fill_printer( struct table *table, const struct expr *cond )
2079 struct record_printer *rec;
2080 enum fill_status status = FILL_STATUS_UNFILTERED;
2081 PRINTER_INFO_2W *info;
2082 DWORD i, offset = 0, count = 0, size = 0;
2084 EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count );
2085 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FILL_STATUS_FAILED;
2087 if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
2088 if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count ))
2090 heap_free( info );
2091 return FILL_STATUS_FAILED;
2093 if (!resize_table( table, count, sizeof(*rec) ))
2095 heap_free( info );
2096 return FILL_STATUS_FAILED;
2099 for (i = 0; i < count; i++)
2101 rec = (struct record_printer *)(table->data + offset);
2102 rec->attributes = info[i].Attributes;
2103 rec->drivername = heap_strdupW( info[i].pDriverName );
2104 rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality;
2105 rec->local = -1;
2106 rec->name = heap_strdupW( info[i].pPrinterName );
2107 rec->network = 0;
2108 if (!match_row( table, i, cond, &status ))
2110 free_row_values( table, i );
2111 continue;
2113 offset += sizeof(*rec);
2115 TRACE("created %u rows\n", count);
2116 table->num_rows = count;
2118 heap_free( info );
2119 return status;
2122 static WCHAR *get_cmdline( DWORD process_id )
2124 if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
2125 return NULL; /* FIXME handle different process case */
2128 static enum fill_status fill_process( struct table *table, const struct expr *cond )
2130 static const WCHAR fmtW[] = {'%','u',0};
2131 WCHAR handle[11];
2132 struct record_process *rec;
2133 PROCESSENTRY32W entry;
2134 HANDLE snap;
2135 enum fill_status status = FILL_STATUS_FAILED;
2136 UINT row = 0, offset = 0;
2138 snap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
2139 if (snap == INVALID_HANDLE_VALUE) return FILL_STATUS_FAILED;
2141 entry.dwSize = sizeof(entry);
2142 if (!Process32FirstW( snap, &entry )) goto done;
2143 if (!resize_table( table, 8, sizeof(*rec) )) goto done;
2147 if (!resize_table( table, row + 1, sizeof(*rec) )) goto done;
2149 rec = (struct record_process *)(table->data + offset);
2150 rec->caption = heap_strdupW( entry.szExeFile );
2151 rec->commandline = get_cmdline( entry.th32ProcessID );
2152 rec->description = heap_strdupW( entry.szExeFile );
2153 sprintfW( handle, fmtW, entry.th32ProcessID );
2154 rec->handle = heap_strdupW( handle );
2155 rec->name = heap_strdupW( entry.szExeFile );
2156 rec->process_id = entry.th32ProcessID;
2157 rec->pprocess_id = entry.th32ParentProcessID;
2158 rec->thread_count = entry.cntThreads;
2159 rec->get_owner = process_get_owner;
2160 if (!match_row( table, row, cond, &status ))
2162 free_row_values( table, row );
2163 continue;
2165 offset += sizeof(*rec);
2166 row++;
2167 } while (Process32NextW( snap, &entry ));
2169 TRACE("created %u rows\n", row);
2170 table->num_rows = row;
2171 status = FILL_STATUS_UNFILTERED;
2173 done:
2174 CloseHandle( snap );
2175 return status;
2178 static inline void do_cpuid( unsigned int ax, unsigned int *p )
2180 #ifdef __i386__
2181 #ifdef _MSC_VER
2182 __cpuid(p, ax);
2183 #else
2184 __asm__("pushl %%ebx\n\t"
2185 "cpuid\n\t"
2186 "movl %%ebx, %%esi\n\t"
2187 "popl %%ebx"
2188 : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3])
2189 : "0" (ax));
2190 #endif
2191 #endif
2193 static const WCHAR *get_osarchitecture(void)
2195 SYSTEM_INFO info;
2196 GetNativeSystemInfo( &info );
2197 if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW;
2198 return os_32bitW;
2200 static void get_processor_caption( WCHAR *caption )
2202 static const WCHAR fmtW[] =
2203 {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ',
2204 'M','o','d','e','l',' ','%','u',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2205 static const WCHAR x86W[] = {'x','8','6',0};
2206 static const WCHAR intel64W[] = {'I','n','t','e','l','6','4',0};
2207 const WCHAR *arch = (get_osarchitecture() == os_32bitW) ? x86W : intel64W;
2208 unsigned int regs[4] = {0, 0, 0, 0};
2210 do_cpuid( 1, regs );
2211 sprintfW( caption, fmtW, arch, (regs[0] & (15 << 8)) >> 8, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 );
2213 static void get_processor_version( WCHAR *version )
2215 static const WCHAR fmtW[] =
2216 {'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2217 unsigned int regs[4] = {0, 0, 0, 0};
2219 do_cpuid( 1, regs );
2220 sprintfW( version, fmtW, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 );
2222 static void get_processor_id( WCHAR *processor_id )
2224 static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0};
2225 unsigned int regs[4] = {0, 0, 0, 0};
2227 do_cpuid( 1, regs );
2228 sprintfW( processor_id, fmtW, regs[3], regs[0] );
2230 static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer )
2232 unsigned int i;
2233 unsigned char *p = (unsigned char *)regs;
2235 for (i = 0; i < len; i++) { buffer[i] = *p++; }
2236 buffer[i] = 0;
2238 static void get_processor_manufacturer( WCHAR *manufacturer )
2240 unsigned int tmp, regs[4] = {0, 0, 0, 0};
2242 do_cpuid( 0, regs );
2243 tmp = regs[2]; /* swap edx and ecx */
2244 regs[2] = regs[3];
2245 regs[3] = tmp;
2247 regs_to_str( regs + 1, 12, manufacturer );
2249 static void get_processor_name( WCHAR *name )
2251 unsigned int regs[4] = {0, 0, 0, 0};
2253 do_cpuid( 0x80000000, regs );
2254 if (regs[0] >= 0x80000004)
2256 do_cpuid( 0x80000002, regs );
2257 regs_to_str( regs, 16, name );
2258 do_cpuid( 0x80000003, regs );
2259 regs_to_str( regs, 16, name + 16 );
2260 do_cpuid( 0x80000004, regs );
2261 regs_to_str( regs, 16, name + 32 );
2264 static UINT get_processor_currentclockspeed( UINT index )
2266 PROCESSOR_POWER_INFORMATION *info;
2267 UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
2268 NTSTATUS status;
2270 if ((info = heap_alloc( size )))
2272 status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
2273 if (!status) ret = info[index].CurrentMhz;
2274 heap_free( info );
2276 return ret;
2278 static UINT get_processor_maxclockspeed( UINT index )
2280 PROCESSOR_POWER_INFORMATION *info;
2281 UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
2282 NTSTATUS status;
2284 if ((info = heap_alloc( size )))
2286 status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
2287 if (!status) ret = info[index].MaxMhz;
2288 heap_free( info );
2290 return ret;
2293 static enum fill_status fill_processor( struct table *table, const struct expr *cond )
2295 static const WCHAR fmtW[] = {'C','P','U','%','u',0};
2296 WCHAR caption[100], device_id[14], processor_id[17], manufacturer[13], name[49] = {0}, version[50];
2297 struct record_processor *rec;
2298 UINT i, offset = 0, num_cores, num_logical_processors, count = get_processor_count();
2299 enum fill_status status = FILL_STATUS_UNFILTERED;
2301 if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED;
2303 get_processor_caption( caption );
2304 get_processor_id( processor_id );
2305 get_processor_manufacturer( manufacturer );
2306 get_processor_name( name );
2307 get_processor_version( version );
2309 num_logical_processors = get_logical_processor_count( &num_cores ) / count;
2310 num_cores /= count;
2312 for (i = 0; i < count; i++)
2314 rec = (struct record_processor *)(table->data + offset);
2315 rec->addresswidth = get_osarchitecture() == os_32bitW ? 32 : 64;
2316 rec->caption = heap_strdupW( caption );
2317 rec->cpu_status = 1; /* CPU Enabled */
2318 rec->currentclockspeed = get_processor_currentclockspeed( i );
2319 rec->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64;
2320 rec->description = heap_strdupW( caption );
2321 sprintfW( device_id, fmtW, i );
2322 rec->device_id = heap_strdupW( device_id );
2323 rec->family = 2; /* Unknown */
2324 rec->manufacturer = heap_strdupW( manufacturer );
2325 rec->maxclockspeed = get_processor_maxclockspeed( i );
2326 rec->name = heap_strdupW( name );
2327 rec->num_cores = num_cores;
2328 rec->num_logical_processors = num_logical_processors;
2329 rec->processor_id = heap_strdupW( processor_id );
2330 rec->processortype = 3; /* central processor */
2331 rec->unique_id = NULL;
2332 rec->version = heap_strdupW( version );
2333 if (!match_row( table, i, cond, &status ))
2335 free_row_values( table, i );
2336 continue;
2338 offset += sizeof(*rec);
2341 TRACE("created %u rows\n", count);
2342 table->num_rows = count;
2343 return status;
2346 static WCHAR *get_lastbootuptime(void)
2348 static const WCHAR fmtW[] =
2349 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2350 '.','%','0','6','u','+','0','0','0',0};
2351 SYSTEM_TIMEOFDAY_INFORMATION ti;
2352 TIME_FIELDS tf;
2353 WCHAR *ret;
2355 if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
2357 NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
2358 RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
2359 sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
2360 return ret;
2362 static WCHAR *get_localdatetime(void)
2364 static const WCHAR fmtW[] =
2365 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2366 '.','%','0','6','u','%','+','0','3','d',0};
2367 TIME_ZONE_INFORMATION tzi;
2368 SYSTEMTIME st;
2369 WCHAR *ret;
2370 DWORD Status;
2371 LONG Bias;
2373 Status = GetTimeZoneInformation(&tzi);
2375 if(Status == TIME_ZONE_ID_INVALID) return NULL;
2376 Bias = tzi.Bias;
2377 if(Status == TIME_ZONE_ID_DAYLIGHT)
2378 Bias+= tzi.DaylightBias;
2379 else
2380 Bias+= tzi.StandardBias;
2381 if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
2383 GetLocalTime(&st);
2384 sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias);
2385 return ret;
2387 static WCHAR *get_systemdirectory(void)
2389 void *redir;
2390 WCHAR *ret;
2392 if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
2393 Wow64DisableWow64FsRedirection( &redir );
2394 GetSystemDirectoryW( ret, MAX_PATH );
2395 Wow64RevertWow64FsRedirection( redir );
2396 return ret;
2398 static WCHAR *get_codeset(void)
2400 static const WCHAR fmtW[] = {'%','u',0};
2401 WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
2402 if (ret) sprintfW( ret, fmtW, GetACP() );
2403 return ret;
2405 static WCHAR *get_countrycode(void)
2407 WCHAR *ret = heap_alloc( 6 * sizeof(WCHAR) );
2408 if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, ret, 6 );
2409 return ret;
2411 static WCHAR *get_locale(void)
2413 WCHAR *ret = heap_alloc( 5 * sizeof(WCHAR) );
2414 if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, ret, 5 );
2415 return ret;
2418 static enum fill_status fill_os( struct table *table, const struct expr *cond )
2420 struct record_operatingsystem *rec;
2421 enum fill_status status = FILL_STATUS_UNFILTERED;
2422 UINT row = 0;
2424 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2426 rec = (struct record_operatingsystem *)table->data;
2427 rec->buildnumber = os_buildnumberW;
2428 rec->caption = os_captionW;
2429 rec->codeset = get_codeset();
2430 rec->countrycode = get_countrycode();
2431 rec->csdversion = os_csdversionW;
2432 rec->installdate = os_installdateW;
2433 rec->lastbootuptime = get_lastbootuptime();
2434 rec->localdatetime = get_localdatetime();
2435 rec->locale = get_locale();
2436 rec->name = os_nameW;
2437 rec->osarchitecture = get_osarchitecture();
2438 rec->oslanguage = GetSystemDefaultLangID();
2439 rec->osproductsuite = 2461140; /* Windows XP Professional */
2440 rec->ostype = 18; /* WINNT */
2441 rec->serialnumber = os_serialnumberW;
2442 rec->servicepackmajor = 3;
2443 rec->servicepackminor = 0;
2444 rec->suitemask = 272; /* Single User + Terminal */
2445 rec->systemdirectory = get_systemdirectory();
2446 rec->totalvisiblememorysize = get_total_physical_memory() / 1024;
2447 rec->version = os_versionW;
2448 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2449 else row++;
2451 TRACE("created %u rows\n", row);
2452 table->num_rows = row;
2453 return status;
2456 static const WCHAR *get_service_type( DWORD type )
2458 static const WCHAR filesystem_driverW[] =
2459 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
2460 static const WCHAR kernel_driverW[] =
2461 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
2462 static const WCHAR own_processW[] =
2463 {'O','w','n',' ','P','r','o','c','e','s','s',0};
2464 static const WCHAR share_processW[] =
2465 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
2467 if (type & SERVICE_KERNEL_DRIVER) return kernel_driverW;
2468 else if (type & SERVICE_FILE_SYSTEM_DRIVER) return filesystem_driverW;
2469 else if (type & SERVICE_WIN32_OWN_PROCESS) return own_processW;
2470 else if (type & SERVICE_WIN32_SHARE_PROCESS) return share_processW;
2471 else ERR("unhandled type 0x%08x\n", type);
2472 return NULL;
2474 static const WCHAR *get_service_state( DWORD state )
2476 static const WCHAR runningW[] =
2477 {'R','u','n','n','i','n','g',0};
2478 static const WCHAR start_pendingW[] =
2479 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
2480 static const WCHAR stop_pendingW[] =
2481 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
2482 static const WCHAR stoppedW[] =
2483 {'S','t','o','p','p','e','d',0};
2484 static const WCHAR unknownW[] =
2485 {'U','n','k','n','o','w','n',0};
2487 switch (state)
2489 case SERVICE_STOPPED: return stoppedW;
2490 case SERVICE_START_PENDING: return start_pendingW;
2491 case SERVICE_STOP_PENDING: return stop_pendingW;
2492 case SERVICE_RUNNING: return runningW;
2493 default:
2494 ERR("unknown state %u\n", state);
2495 return unknownW;
2498 static const WCHAR *get_service_startmode( DWORD mode )
2500 static const WCHAR bootW[] = {'B','o','o','t',0};
2501 static const WCHAR systemW[] = {'S','y','s','t','e','m',0};
2502 static const WCHAR autoW[] = {'A','u','t','o',0};
2503 static const WCHAR manualW[] = {'M','a','n','u','a','l',0};
2504 static const WCHAR disabledW[] = {'D','i','s','a','b','l','e','d',0};
2505 static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',0};
2507 switch (mode)
2509 case SERVICE_BOOT_START: return bootW;
2510 case SERVICE_SYSTEM_START: return systemW;
2511 case SERVICE_AUTO_START: return autoW;
2512 case SERVICE_DEMAND_START: return manualW;
2513 case SERVICE_DISABLED: return disabledW;
2514 default:
2515 ERR("unknown mode 0x%x\n", mode);
2516 return unknownW;
2519 static QUERY_SERVICE_CONFIGW *query_service_config( SC_HANDLE manager, const WCHAR *name )
2521 QUERY_SERVICE_CONFIGW *config = NULL;
2522 SC_HANDLE service;
2523 DWORD size;
2525 if (!(service = OpenServiceW( manager, name, SERVICE_QUERY_CONFIG ))) return NULL;
2526 QueryServiceConfigW( service, NULL, 0, &size );
2527 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
2528 if (!(config = heap_alloc( size ))) goto done;
2529 if (QueryServiceConfigW( service, config, size, &size )) goto done;
2530 heap_free( config );
2531 config = NULL;
2533 done:
2534 CloseServiceHandle( service );
2535 return config;
2538 static enum fill_status fill_service( struct table *table, const struct expr *cond )
2540 struct record_service *rec;
2541 SC_HANDLE manager;
2542 ENUM_SERVICE_STATUS_PROCESSW *tmp, *services = NULL;
2543 SERVICE_STATUS_PROCESS *status;
2544 WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1];
2545 DWORD len = sizeof(sysnameW) / sizeof(sysnameW[0]);
2546 UINT i, row = 0, offset = 0, size = 256, needed, count;
2547 enum fill_status fill_status = FILL_STATUS_FAILED;
2548 BOOL ret;
2550 if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) return FILL_STATUS_FAILED;
2551 if (!(services = heap_alloc( size ))) goto done;
2553 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
2554 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
2555 &count, NULL, NULL );
2556 if (!ret)
2558 if (GetLastError() != ERROR_MORE_DATA) goto done;
2559 size = needed;
2560 if (!(tmp = heap_realloc( services, size ))) goto done;
2561 services = tmp;
2562 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
2563 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
2564 &count, NULL, NULL );
2565 if (!ret) goto done;
2567 if (!resize_table( table, count, sizeof(*rec) )) goto done;
2569 GetComputerNameW( sysnameW, &len );
2570 fill_status = FILL_STATUS_UNFILTERED;
2572 for (i = 0; i < count; i++)
2574 QUERY_SERVICE_CONFIGW *config;
2576 if (!(config = query_service_config( manager, services[i].lpServiceName ))) continue;
2578 status = &services[i].ServiceStatusProcess;
2579 rec = (struct record_service *)(table->data + offset);
2580 rec->accept_pause = (status->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) ? -1 : 0;
2581 rec->accept_stop = (status->dwControlsAccepted & SERVICE_ACCEPT_STOP) ? -1 : 0;
2582 rec->displayname = heap_strdupW( services[i].lpDisplayName );
2583 rec->name = heap_strdupW( services[i].lpServiceName );
2584 rec->process_id = status->dwProcessId;
2585 rec->servicetype = get_service_type( status->dwServiceType );
2586 rec->startmode = get_service_startmode( config->dwStartType );
2587 rec->state = get_service_state( status->dwCurrentState );
2588 rec->systemname = heap_strdupW( sysnameW );
2589 rec->pause_service = service_pause_service;
2590 rec->resume_service = service_resume_service;
2591 rec->start_service = service_start_service;
2592 rec->stop_service = service_stop_service;
2593 heap_free( config );
2594 if (!match_row( table, row, cond, &fill_status ))
2596 free_row_values( table, row );
2597 continue;
2599 offset += sizeof(*rec);
2600 row++;
2603 TRACE("created %u rows\n", row);
2604 table->num_rows = row;
2606 done:
2607 CloseServiceHandle( manager );
2608 heap_free( services );
2609 return fill_status;
2612 static WCHAR *get_accountname( LSA_TRANSLATED_NAME *name )
2614 if (!name || !name->Name.Buffer) return NULL;
2615 return heap_strdupW( name->Name.Buffer );
2617 static UINT8 *get_binaryrepresentation( PSID sid, UINT len )
2619 UINT8 *ret = heap_alloc( len );
2620 if (!ret) return NULL;
2621 memcpy( ret, sid, len );
2622 return ret;
2624 static WCHAR *get_referenceddomainname( LSA_REFERENCED_DOMAIN_LIST *domain )
2626 if (!domain || !domain->Domains || !domain->Domains->Name.Buffer) return NULL;
2627 return heap_strdupW( domain->Domains->Name.Buffer );
2629 static const WCHAR *find_sid_str( const struct expr *cond )
2631 const struct expr *left, *right;
2632 const WCHAR *ret = NULL;
2634 if (!cond || cond->type != EXPR_COMPLEX || cond->u.expr.op != OP_EQ) return NULL;
2636 left = cond->u.expr.left;
2637 right = cond->u.expr.right;
2638 if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !strcmpiW( left->u.propval->name, prop_sidW ))
2640 ret = right->u.sval;
2642 else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !strcmpiW( right->u.propval->name, prop_sidW ))
2644 ret = left->u.sval;
2646 return ret;
2649 static enum fill_status fill_sid( struct table *table, const struct expr *cond )
2651 PSID sid;
2652 LSA_REFERENCED_DOMAIN_LIST *domain;
2653 LSA_TRANSLATED_NAME *name;
2654 LSA_HANDLE handle;
2655 LSA_OBJECT_ATTRIBUTES attrs;
2656 const WCHAR *str;
2657 struct record_sid *rec;
2658 UINT len;
2660 if (!(str = find_sid_str( cond ))) return FILL_STATUS_FAILED;
2661 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2663 if (!ConvertStringSidToSidW( str, &sid )) return FILL_STATUS_FAILED;
2664 len = GetLengthSid( sid );
2666 memset( &attrs, 0, sizeof(attrs) );
2667 attrs.Length = sizeof(attrs);
2668 if (LsaOpenPolicy( NULL, &attrs, POLICY_ALL_ACCESS, &handle ))
2670 LocalFree( sid );
2671 return FILL_STATUS_FAILED;
2673 if (LsaLookupSids( handle, 1, &sid, &domain, &name ))
2675 LocalFree( sid );
2676 LsaClose( handle );
2677 return FILL_STATUS_FAILED;
2680 rec = (struct record_sid *)table->data;
2681 rec->accountname = get_accountname( name );
2682 rec->binaryrepresentation = get_binaryrepresentation( sid, len );
2683 rec->referenceddomainname = get_referenceddomainname( domain );
2684 rec->sid = heap_strdupW( str );
2685 rec->sidlength = len;
2687 TRACE("created 1 row\n");
2688 table->num_rows = 1;
2690 LsaFreeMemory( domain );
2691 LsaFreeMemory( name );
2692 LocalFree( sid );
2693 LsaClose( handle );
2694 return FILL_STATUS_FILTERED;
2697 static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres )
2699 HDC hdc = GetDC( NULL );
2700 UINT32 ret;
2702 if (!hdc) return 32;
2703 ret = GetDeviceCaps( hdc, BITSPIXEL );
2704 *hres = GetDeviceCaps( hdc, HORZRES );
2705 *vres = GetDeviceCaps( hdc, VERTRES );
2706 ReleaseDC( NULL, hdc );
2707 return ret;
2709 static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
2711 static const WCHAR fmtW[] =
2712 {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
2713 '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
2714 '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
2715 WCHAR *ret;
2717 if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL;
2718 sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
2719 return ret;
2722 static enum fill_status fill_videocontroller( struct table *table, const struct expr *cond )
2725 struct record_videocontroller *rec;
2726 HRESULT hr;
2727 IDXGIFactory *factory = NULL;
2728 IDXGIAdapter *adapter = NULL;
2729 DXGI_ADAPTER_DESC desc;
2730 UINT hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
2731 const WCHAR *name = videocontroller_deviceidW;
2732 enum fill_status status = FILL_STATUS_UNFILTERED;
2733 UINT row = 0;
2735 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2737 memset (&desc, 0, sizeof(desc));
2738 hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
2739 if (FAILED(hr)) goto done;
2741 hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
2742 if (FAILED(hr)) goto done;
2744 hr = IDXGIAdapter_GetDesc( adapter, &desc );
2745 if (SUCCEEDED(hr))
2747 vidmem = desc.DedicatedVideoMemory;
2748 name = desc.Description;
2751 done:
2752 rec = (struct record_videocontroller *)table->data;
2753 rec->adapter_dactype = videocontroller_dactypeW;
2754 rec->adapter_ram = vidmem;
2755 rec->availability = 3; /* Running or Full Power */
2756 rec->caption = heap_strdupW( name );
2757 rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres );
2758 rec->current_horizontalres = hres;
2759 rec->current_refreshrate = 0; /* default refresh rate */
2760 rec->current_scanmode = 2; /* Unknown */
2761 rec->current_verticalres = vres;
2762 rec->description = heap_strdupW( name );
2763 rec->device_id = videocontroller_deviceidW;
2764 rec->driverversion = videocontroller_driverversionW;
2765 rec->name = heap_strdupW( name );
2766 rec->pnpdevice_id = get_pnpdeviceid( &desc );
2767 rec->videoarchitecture = 2; /* Unknown */
2768 rec->videomemorytype = 2; /* Unknown */
2769 rec->videoprocessor = heap_strdupW( name );
2770 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2771 else row++;
2773 TRACE("created %u rows\n", row);
2774 table->num_rows = row;
2776 if (adapter) IDXGIAdapter_Release( adapter );
2777 if (factory) IDXGIFactory_Release( factory );
2778 return status;
2781 static struct table builtin_classes[] =
2783 { class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), 0, (BYTE *)data_baseboard },
2784 { class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), 0, (BYTE *)data_bios },
2785 { class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive },
2786 { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
2787 { class_compsysproductW, SIZEOF(col_compsysproduct), col_compsysproduct, SIZEOF(data_compsysproduct), 0, (BYTE *)data_compsysproduct },
2788 { class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
2789 { class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory },
2790 { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive },
2791 { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },
2792 { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
2793 { class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
2794 { class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter },
2795 { class_networkadapterconfigW, SIZEOF(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig },
2796 { class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os },
2797 { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param },
2798 { class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia },
2799 { class_physicalmemoryW, SIZEOF(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory },
2800 { class_printerW, SIZEOF(col_printer), col_printer, 0, 0, NULL, fill_printer },
2801 { class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process },
2802 { class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
2803 { class_processor2W, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
2804 { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier },
2805 { class_serviceW, SIZEOF(col_service), col_service, 0, 0, NULL, fill_service },
2806 { class_sidW, SIZEOF(col_sid), col_sid, 0, 0, NULL, fill_sid },
2807 { class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), 0, (BYTE *)data_sounddevice },
2808 { class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), 0, (BYTE *)data_stdregprov },
2809 { class_systemsecurityW, SIZEOF(col_systemsecurity), col_systemsecurity, SIZEOF(data_systemsecurity), 0, (BYTE *)data_systemsecurity },
2810 { class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller }
2813 void init_table_list( void )
2815 static struct list tables = LIST_INIT( tables );
2816 UINT i;
2818 for (i = 0; i < SIZEOF(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry );
2819 table_list = &tables;