msvcirt: Add implementation of streambuf::sputbackc.
[wine.git] / dlls / wbemprox / builtin.c
blobf1e5c4a60a78c63913b3b01bc6b4113abdced507
1 /*
2 * Copyright 2012 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
20 #define NONAMELESSUNION
21 #define NONAMELESSSTRUCT
23 #include "config.h"
24 #include <stdarg.h>
26 #include "ntstatus.h"
27 #define WIN32_NO_STATUS
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winsock2.h"
31 #include "ws2tcpip.h"
32 #include "initguid.h"
33 #include "wbemcli.h"
34 #include "wbemprov.h"
35 #include "iphlpapi.h"
36 #include "tlhelp32.h"
37 #include "d3d10.h"
38 #include "winternl.h"
39 #include "winioctl.h"
40 #include "winsvc.h"
41 #include "winver.h"
42 #include "sddl.h"
43 #include "ntsecapi.h"
44 #include "winspool.h"
46 #include "wine/debug.h"
47 #include "wbemprox_private.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox);
51 static const WCHAR class_baseboardW[] =
52 {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0};
53 static const WCHAR class_biosW[] =
54 {'W','i','n','3','2','_','B','I','O','S',0};
55 static const WCHAR class_cdromdriveW[] =
56 {'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0};
57 static const WCHAR class_compsysW[] =
58 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
59 static const WCHAR class_compsysproductW[] =
60 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m','P','r','o','d','u','c','t',0};
61 static const WCHAR class_datafileW[] =
62 {'C','I','M','_','D','a','t','a','F','i','l','e',0};
63 static const WCHAR class_directoryW[] =
64 {'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0};
65 static const WCHAR class_diskdriveW[] =
66 {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0};
67 static const WCHAR class_diskpartitionW[] =
68 {'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
69 static const WCHAR class_logicaldiskW[] =
70 {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
71 static const WCHAR class_logicaldisk2W[] =
72 {'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0};
73 static const WCHAR class_networkadapterW[] =
74 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
75 static const WCHAR class_networkadapterconfigW[] =
76 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',
77 'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
78 static const WCHAR class_osW[] =
79 {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
80 static const WCHAR class_paramsW[] =
81 {'_','_','P','A','R','A','M','E','T','E','R','S',0};
82 static const WCHAR class_physicalmediaW[] =
83 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0};
84 static const WCHAR class_physicalmemoryW[] =
85 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
86 static const WCHAR class_qualifiersW[] =
87 {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
88 static const WCHAR class_printerW[] =
89 {'W','i','n','3','2','_','P','r','i','n','t','e','r',0};
90 static const WCHAR class_process_getowner_outW[] =
91 {'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W',
92 'N','E','R','_','O','U','T',0};
93 static const WCHAR class_processorW[] =
94 {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
95 static const WCHAR class_processor2W[] =
96 {'C','I','M','_','P','r','o','c','e','s','s','o','r',0};
97 static const WCHAR class_sidW[] =
98 {'W','i','n','3','2','_','S','I','D',0};
99 static const WCHAR class_sounddeviceW[] =
100 {'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0};
101 static const WCHAR class_systemenclosureW[] =
102 {'W','i','n','3','2','_','S','y','s','t','e','m','E','n','c','l','o','s','u','r','e',0};
103 static const WCHAR class_videocontrollerW[] =
104 {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
106 static const WCHAR prop_accountnameW[] =
107 {'A','c','c','o','u','n','t','N','a','m','e',0};
108 static const WCHAR prop_acceptpauseW[] =
109 {'A','c','c','e','p','t','P','a','u','s','e',0};
110 static const WCHAR prop_acceptstopW[] =
111 {'A','c','c','e','p','t','S','t','o','p',0};
112 static const WCHAR prop_accessmaskW[] =
113 {'A','c','c','e','s','s','M','a','s','k',0};
114 static const WCHAR prop_adapterdactypeW[] =
115 {'A','d','a','p','t','e','r','D','A','C','T','y','p','e',0};
116 static const WCHAR prop_adapterramW[] =
117 {'A','d','a','p','t','e','r','R','A','M',0};
118 static const WCHAR prop_adaptertypeW[] =
119 {'A','d','a','p','t','e','r','T','y','p','e',0};
120 static const WCHAR prop_addresswidthW[] =
121 {'A','d','d','r','e','s','s','W','i','d','t','h',0};
122 static const WCHAR prop_attributesW[] =
123 {'A','t','t','r','i','b','u','t','e','s',0};
124 static const WCHAR prop_availabilityW[] =
125 {'A','v','a','i','l','a','b','i','l','i','t','y',0};
126 static const WCHAR prop_binaryrepresentationW[] =
127 {'B','i','n','a','r','y','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0};
128 static const WCHAR prop_bootableW[] =
129 {'B','o','o','t','a','b','l','e',0};
130 static const WCHAR prop_bootpartitionW[] =
131 {'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
132 static const WCHAR prop_buildnumberW[] =
133 {'B','u','i','l','d','N','u','m','b','e','r',0};
134 static const WCHAR prop_capacityW[] =
135 {'C','a','p','a','c','i','t','y',0};
136 static const WCHAR prop_captionW[] =
137 {'C','a','p','t','i','o','n',0};
138 static const WCHAR prop_chassistypesW[] =
139 {'C','h','a','s','s','i','s','T','y','p','e','s',0};
140 static const WCHAR prop_classW[] =
141 {'C','l','a','s','s',0};
142 static const WCHAR prop_codesetW[] =
143 {'C','o','d','e','S','e','t',0};
144 static const WCHAR prop_commandlineW[] =
145 {'C','o','m','m','a','n','d','L','i','n','e',0};
146 static const WCHAR prop_countrycodeW[] =
147 {'C','o','u','n','t','r','y','C','o','d','e',0};
148 static const WCHAR prop_cpustatusW[] =
149 {'C','p','u','S','t','a','t','u','s',0};
150 static const WCHAR prop_csdversionW[] =
151 {'C','S','D','V','e','r','s','i','o','n',0};
152 static const WCHAR prop_currentbitsperpixelW[] =
153 {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
154 static const WCHAR prop_currentclockspeedW[] =
155 {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0};
156 static const WCHAR prop_currenthorizontalresW[] =
157 {'C','u','r','r','e','n','t','H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
158 static const WCHAR prop_currentrefreshrateW[] =
159 {'C','u','r','r','e','n','t','R','e','f','r','e','s','h','R','a','t','e',0};
160 static const WCHAR prop_currentscanmodeW[] =
161 {'C','u','r','r','e','n','t','S','c','a','n','M','o','d','e',0};
162 static const WCHAR prop_currentverticalresW[] =
163 {'C','u','r','r','e','n','t','V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0};
164 static const WCHAR prop_datawidthW[] =
165 {'D','a','t','a','W','i','d','t','h',0};
166 static const WCHAR prop_defaultvalueW[] =
167 {'D','e','f','a','u','l','t','V','a','l','u','e',0};
168 static const WCHAR prop_descriptionW[] =
169 {'D','e','s','c','r','i','p','t','i','o','n',0};
170 static const WCHAR prop_deviceidW[] =
171 {'D','e','v','i','c','e','I','d',0};
172 static const WCHAR prop_directionW[] =
173 {'D','i','r','e','c','t','i','o','n',0};
174 static const WCHAR prop_displaynameW[] =
175 {'D','i','s','p','l','a','y','N','a','m','e',0};
176 static const WCHAR prop_diskindexW[] =
177 {'D','i','s','k','I','n','d','e','x',0};
178 static const WCHAR prop_dnshostnameW[] =
179 {'D','N','S','H','o','s','t','N','a','m','e',0};
180 static const WCHAR prop_domainW[] =
181 {'D','o','m','a','i','n',0};
182 static const WCHAR prop_domainroleW[] =
183 {'D','o','m','a','i','n','R','o','l','e',0};
184 static const WCHAR prop_driveW[] =
185 {'D','r','i','v','e',0};
186 static const WCHAR prop_drivernameW[] =
187 {'D','r','i','v','e','r','N','a','m','e',0};
188 static const WCHAR prop_driverversionW[] =
189 {'D','r','i','v','e','r','V','e','r','s','i','o','n',0};
190 static const WCHAR prop_drivetypeW[] =
191 {'D','r','i','v','e','T','y','p','e',0};
192 static const WCHAR prop_familyW[] =
193 {'F','a','m','i','l','y',0};
194 static const WCHAR prop_filesystemW[] =
195 {'F','i','l','e','S','y','s','t','e','m',0};
196 static const WCHAR prop_flavorW[] =
197 {'F','l','a','v','o','r',0};
198 static const WCHAR prop_freespaceW[] =
199 {'F','r','e','e','S','p','a','c','e',0};
200 static const WCHAR prop_handleW[] =
201 {'H','a','n','d','l','e',0};
202 static const WCHAR prop_horizontalresolutionW[] =
203 {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
204 static const WCHAR prop_idW[] =
205 {'I','D',0};
206 static const WCHAR prop_identificationcodeW[] =
207 {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
208 static const WCHAR prop_identifyingnumberW[] =
209 {'I','d','e','n','t','i','f','y','i','n','g','N','u','m','b','e','r',0};
210 static const WCHAR prop_indexW[] =
211 {'I','n','d','e','x',0};
212 static const WCHAR prop_installdateW[] =
213 {'I','n','s','t','a','l','l','D','a','t','e',0};
214 static const WCHAR prop_interfaceindexW[] =
215 {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
216 static const WCHAR prop_interfacetypeW[] =
217 {'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
218 static const WCHAR prop_intvalueW[] =
219 {'I','n','t','e','g','e','r','V','a','l','u','e',0};
220 static const WCHAR prop_ipconnectionmetricW[] =
221 {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
222 static const WCHAR prop_ipenabledW[] =
223 {'I','P','E','n','a','b','l','e','d',0};
224 static const WCHAR prop_lastbootuptimeW[] =
225 {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
226 static const WCHAR prop_localW[] =
227 {'L','o','c','a','l',0};
228 static const WCHAR prop_localdatetimeW[] =
229 {'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
230 static const WCHAR prop_localeW[] =
231 {'L','o','c','a','l','e',0};
232 static const WCHAR prop_lockpresentW[] =
233 {'L','o','c','k','P','r','e','s','e','n','t',0};
234 static const WCHAR prop_macaddressW[] =
235 {'M','A','C','A','d','d','r','e','s','s',0};
236 static const WCHAR prop_manufacturerW[] =
237 {'M','a','n','u','f','a','c','t','u','r','e','r',0};
238 static const WCHAR prop_maxclockspeedW[] =
239 {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
240 static const WCHAR prop_mediatypeW[] =
241 {'M','e','d','i','a','T','y','p','e',0};
242 static const WCHAR prop_memberW[] =
243 {'M','e','m','b','e','r',0};
244 static const WCHAR prop_methodW[] =
245 {'M','e','t','h','o','d',0};
246 static const WCHAR prop_modelW[] =
247 {'M','o','d','e','l',0};
248 static const WCHAR prop_netconnectionstatusW[] =
249 {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
250 static const WCHAR prop_networkW[] =
251 {'N','e','t','w','o','r','k',0};
252 static const WCHAR prop_numcoresW[] =
253 {'N','u','m','b','e','r','O','f','C','o','r','e','s',0};
254 static const WCHAR prop_numlogicalprocessorsW[] =
255 {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0};
256 static const WCHAR prop_numprocessorsW[] =
257 {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
258 static const WCHAR prop_osarchitectureW[] =
259 {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
260 static const WCHAR prop_oslanguageW[] =
261 {'O','S','L','a','n','g','u','a','g','e',0};
262 static const WCHAR prop_osproductsuiteW[] =
263 {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
264 static const WCHAR prop_ostypeW[] =
265 {'O','S','T','y','p','e',0};
266 static const WCHAR prop_parameterW[] =
267 {'P','a','r','a','m','e','t','e','r',0};
268 static const WCHAR prop_physicaladapterW[] =
269 {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
270 static const WCHAR prop_pnpdeviceidW[] =
271 {'P','N','P','D','e','v','i','c','e','I','D',0};
272 static const WCHAR prop_pprocessidW[] =
273 {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
274 static const WCHAR prop_primaryW[] =
275 {'P','r','i','m','a','r','y',0};
276 static const WCHAR prop_processidW[] =
277 {'P','r','o','c','e','s','s','I','D',0};
278 static const WCHAR prop_processoridW[] =
279 {'P','r','o','c','e','s','s','o','r','I','d',0};
280 static const WCHAR prop_processortypeW[] =
281 {'P','r','o','c','e','s','s','o','r','T','y','p','e',0};
282 static const WCHAR prop_productW[] =
283 {'P','r','o','d','u','c','t',0};
284 static const WCHAR prop_productnameW[] =
285 {'P','r','o','d','u','c','t','N','a','m','e',0};
286 static const WCHAR prop_referenceddomainnameW[] =
287 {'R','e','f','e','r','e','n','c','e','d','D','o','m','a','i','n','N','a','m','e',0};
288 static const WCHAR prop_releasedateW[] =
289 {'R','e','l','e','a','s','e','D','a','t','e',0};
290 static const WCHAR prop_serialnumberW[] =
291 {'S','e','r','i','a','l','N','u','m','b','e','r',0};
292 static const WCHAR prop_servicepackmajorW[] =
293 {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
294 static const WCHAR prop_servicepackminorW[] =
295 {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
296 static const WCHAR prop_servicetypeW[] =
297 {'S','e','r','v','i','c','e','T','y','p','e',0};
298 static const WCHAR prop_smbiosbiosversionW[] =
299 {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
300 static const WCHAR prop_startmodeW[] =
301 {'S','t','a','r','t','M','o','d','e',0};
302 static const WCHAR prop_sidW[] =
303 {'S','I','D',0};
304 static const WCHAR prop_sidlengthW[] =
305 {'S','i','d','L','e','n','g','t','h',0};
306 static const WCHAR prop_sizeW[] =
307 {'S','i','z','e',0};
308 static const WCHAR prop_speedW[] =
309 {'S','p','e','e','d',0};
310 static const WCHAR prop_startingoffsetW[] =
311 {'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0};
312 static const WCHAR prop_stateW[] =
313 {'S','t','a','t','e',0};
314 static const WCHAR prop_statusinfoW[] =
315 {'S','t','a','t','u','s','I','n','f','o',0};
316 static const WCHAR prop_strvalueW[] =
317 {'S','t','r','i','n','g','V','a','l','u','e',0};
318 static const WCHAR prop_suitemaskW[] =
319 {'S','u','i','t','e','M','a','s','k',0};
320 static const WCHAR prop_systemdirectoryW[] =
321 {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
322 static const WCHAR prop_systemnameW[] =
323 {'S','y','s','t','e','m','N','a','m','e',0};
324 static const WCHAR prop_tagW[] =
325 {'T','a','g',0};
326 static const WCHAR prop_threadcountW[] =
327 {'T','h','r','e','a','d','C','o','u','n','t',0};
328 static const WCHAR prop_totalphysicalmemoryW[] =
329 {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
330 static const WCHAR prop_totalvisiblememorysizeW[] =
331 {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0};
332 static const WCHAR prop_typeW[] =
333 {'T','y','p','e',0};
334 static const WCHAR prop_uniqueidW[] =
335 {'U','n','i','q','u','e','I','d',0};
336 static const WCHAR prop_usernameW[] =
337 {'U','s','e','r','N','a','m','e',0};
338 static const WCHAR prop_uuidW[] =
339 {'U','U','I','D',0};
340 static const WCHAR prop_varianttypeW[] =
341 {'V','a','r','i','a','n','t','T','y','p','e',0};
342 static const WCHAR prop_versionW[] =
343 {'V','e','r','s','i','o','n',0};
344 static const WCHAR prop_videoarchitectureW[] =
345 {'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0};
346 static const WCHAR prop_videomemorytypeW[] =
347 {'V','i','d','e','o','M','e','m','o','r','y','T','y','p','e',0};
348 static const WCHAR prop_videoprocessorW[] =
349 {'V','i','d','e','o','P','r','o','c','e','s','s','o','r',0};
350 static const WCHAR prop_volumenameW[] =
351 {'V','o','l','u','m','e','N','a','m','e',0};
352 static const WCHAR prop_volumeserialnumberW[] =
353 {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
354 static const WCHAR prop_workingsetsizeW[] =
355 {'W','o','r','k','i','n','g','S','e','t','S','i','z','e',0};
357 /* column definitions must be kept in sync with record structures below */
358 static const struct column col_baseboard[] =
360 { prop_manufacturerW, CIM_STRING },
361 { prop_modelW, CIM_STRING },
362 { prop_nameW, CIM_STRING },
363 { prop_productW, CIM_STRING },
364 { prop_serialnumberW, CIM_STRING },
365 { prop_tagW, CIM_STRING|COL_FLAG_KEY },
366 { prop_versionW, CIM_STRING }
368 static const struct column col_bios[] =
370 { prop_descriptionW, CIM_STRING },
371 { prop_identificationcodeW, CIM_STRING },
372 { prop_manufacturerW, CIM_STRING },
373 { prop_releasedateW, CIM_DATETIME },
374 { prop_serialnumberW, CIM_STRING },
375 { prop_smbiosbiosversionW, CIM_STRING },
376 { prop_versionW, CIM_STRING|COL_FLAG_KEY }
378 static const struct column col_cdromdrive[] =
380 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
381 { prop_driveW, CIM_STRING|COL_FLAG_DYNAMIC },
382 { prop_mediatypeW, CIM_STRING },
383 { prop_nameW, CIM_STRING },
384 { prop_pnpdeviceidW, CIM_STRING }
386 static const struct column col_compsys[] =
388 { prop_descriptionW, CIM_STRING },
389 { prop_domainW, CIM_STRING },
390 { prop_domainroleW, CIM_UINT16, VT_I4 },
391 { prop_manufacturerW, CIM_STRING },
392 { prop_modelW, CIM_STRING },
393 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
394 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
395 { prop_numprocessorsW, CIM_UINT32, VT_I4 },
396 { prop_totalphysicalmemoryW, CIM_UINT64 },
397 { prop_usernameW, CIM_STRING|COL_FLAG_DYNAMIC }
399 static const struct column col_compsysproduct[] =
401 { prop_identifyingnumberW, CIM_STRING|COL_FLAG_KEY },
402 { prop_uuidW, CIM_STRING }
404 static const struct column col_datafile[] =
406 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
407 { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
409 static const struct column col_directory[] =
411 { prop_accessmaskW, CIM_UINT32 },
412 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }
414 static const struct column col_diskdrive[] =
416 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
417 { prop_indexW, CIM_UINT32, VT_I4 },
418 { prop_interfacetypeW, CIM_STRING },
419 { prop_manufacturerW, CIM_STRING },
420 { prop_mediatypeW, CIM_STRING },
421 { prop_modelW, CIM_STRING },
422 { prop_pnpdeviceidW, CIM_STRING },
423 { prop_serialnumberW, CIM_STRING },
424 { prop_sizeW, CIM_UINT64 }
426 static const struct column col_diskpartition[] =
428 { prop_bootableW, CIM_BOOLEAN },
429 { prop_bootpartitionW, CIM_BOOLEAN },
430 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
431 { prop_diskindexW, CIM_UINT32, VT_I4 },
432 { prop_indexW, CIM_UINT32, VT_I4 },
433 { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
434 { prop_sizeW, CIM_UINT64 },
435 { prop_startingoffsetW, CIM_UINT64 },
436 { prop_typeW, CIM_STRING|COL_FLAG_DYNAMIC }
438 static const struct column col_logicaldisk[] =
440 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
441 { prop_drivetypeW, CIM_UINT32, VT_I4 },
442 { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC },
443 { prop_freespaceW, CIM_UINT64 },
444 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
445 { prop_sizeW, CIM_UINT64 },
446 { prop_volumenameW, CIM_STRING|COL_FLAG_DYNAMIC },
447 { prop_volumeserialnumberW, CIM_STRING|COL_FLAG_DYNAMIC }
449 static const struct column col_networkadapter[] =
451 { prop_adaptertypeW, CIM_STRING },
452 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
453 { prop_indexW, CIM_UINT32, VT_I4 },
454 { prop_interfaceindexW, CIM_UINT32, VT_I4 },
455 { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
456 { prop_manufacturerW, CIM_STRING },
457 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
458 { prop_netconnectionstatusW, CIM_UINT16, VT_I4 },
459 { prop_physicaladapterW, CIM_BOOLEAN },
460 { prop_pnpdeviceidW, CIM_STRING },
461 { prop_speedW, CIM_UINT64 }
463 static const struct column col_networkadapterconfig[] =
465 { prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC },
466 { prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 },
467 { prop_ipconnectionmetricW, CIM_UINT32, VT_I4 },
468 { prop_ipenabledW, CIM_BOOLEAN },
469 { prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC }
471 static const struct column col_os[] =
473 { prop_buildnumberW, CIM_STRING },
474 { prop_captionW, CIM_STRING },
475 { prop_codesetW, CIM_STRING|COL_FLAG_DYNAMIC },
476 { prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC },
477 { prop_csdversionW, CIM_STRING },
478 { prop_installdateW, CIM_DATETIME },
479 { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
480 { prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC },
481 { prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC },
482 { prop_nameW, CIM_STRING },
483 { prop_osarchitectureW, CIM_STRING },
484 { prop_oslanguageW, CIM_UINT32, VT_I4 },
485 { prop_osproductsuiteW, CIM_UINT32, VT_I4 },
486 { prop_ostypeW, CIM_UINT16, VT_I4 },
487 { prop_primaryW, CIM_BOOLEAN },
488 { prop_serialnumberW, CIM_STRING },
489 { prop_servicepackmajorW, CIM_UINT16, VT_I4 },
490 { prop_servicepackminorW, CIM_UINT16, VT_I4 },
491 { prop_suitemaskW, CIM_UINT32, VT_I4 },
492 { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC },
493 { prop_totalvisiblememorysizeW, CIM_UINT64 },
494 { prop_versionW, CIM_STRING }
496 static const struct column col_param[] =
498 { prop_classW, CIM_STRING },
499 { prop_methodW, CIM_STRING },
500 { prop_directionW, CIM_SINT32 },
501 { prop_parameterW, CIM_STRING },
502 { prop_typeW, CIM_UINT32 },
503 { prop_varianttypeW, CIM_UINT32 },
504 { prop_defaultvalueW, CIM_UINT32 }
506 static const struct column col_physicalmedia[] =
508 { prop_serialnumberW, CIM_STRING },
509 { prop_tagW, CIM_STRING }
511 static const struct column col_physicalmemory[] =
513 { prop_capacityW, CIM_UINT64 }
515 static const struct column col_printer[] =
517 { prop_attributesW, CIM_UINT32 },
518 { prop_drivernameW, CIM_STRING|COL_FLAG_DYNAMIC },
519 { prop_horizontalresolutionW, CIM_UINT32 },
520 { prop_localW, CIM_BOOLEAN },
521 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
522 { prop_networkW, CIM_BOOLEAN }
524 static const struct column col_process[] =
526 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
527 { prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC },
528 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
529 { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
530 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
531 { prop_pprocessidW, CIM_UINT32, VT_I4 },
532 { prop_processidW, CIM_UINT32, VT_I4 },
533 { prop_threadcountW, CIM_UINT32, VT_I4 },
534 { prop_workingsetsizeW, CIM_UINT64 },
535 /* methods */
536 { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
538 static const struct column col_processor[] =
540 { prop_addresswidthW, CIM_UINT16, VT_I4 },
541 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
542 { prop_cpustatusW, CIM_UINT16 },
543 { prop_currentclockspeedW, CIM_UINT32, VT_I4 },
544 { prop_datawidthW, CIM_UINT16, VT_I4 },
545 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
546 { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
547 { prop_familyW, CIM_UINT16, VT_I4 },
548 { prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
549 { prop_maxclockspeedW, CIM_UINT32, VT_I4 },
550 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
551 { prop_numcoresW, CIM_UINT32, VT_I4 },
552 { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
553 { prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC },
554 { prop_processortypeW, CIM_UINT16, VT_I4 },
555 { prop_uniqueidW, CIM_STRING },
556 { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
558 static const struct column col_qualifier[] =
560 { prop_classW, CIM_STRING },
561 { prop_memberW, CIM_STRING },
562 { prop_typeW, CIM_UINT32 },
563 { prop_flavorW, CIM_SINT32 },
564 { prop_nameW, CIM_STRING },
565 { prop_intvalueW, CIM_SINT32 },
566 { prop_strvalueW, CIM_STRING }
568 static const struct column col_service[] =
570 { prop_acceptpauseW, CIM_BOOLEAN },
571 { prop_acceptstopW, CIM_BOOLEAN },
572 { prop_displaynameW, CIM_STRING|COL_FLAG_DYNAMIC },
573 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
574 { prop_processidW, CIM_UINT32 },
575 { prop_servicetypeW, CIM_STRING },
576 { prop_startmodeW, CIM_STRING },
577 { prop_stateW, CIM_STRING },
578 { prop_systemnameW, CIM_STRING|COL_FLAG_DYNAMIC },
579 /* methods */
580 { method_pauseserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
581 { method_resumeserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
582 { method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
583 { method_stopserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
585 static const struct column col_sid[] =
587 { prop_accountnameW, CIM_STRING|COL_FLAG_DYNAMIC },
588 { prop_binaryrepresentationW, CIM_UINT8|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
589 { prop_referenceddomainnameW, CIM_STRING|COL_FLAG_DYNAMIC },
590 { prop_sidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
591 { prop_sidlengthW, CIM_UINT32 }
593 static const struct column col_sounddevice[] =
595 { prop_nameW, CIM_STRING },
596 { prop_productnameW, CIM_STRING },
597 { prop_statusinfoW, CIM_UINT16, VT_I4 }
599 static const struct column col_stdregprov[] =
601 { method_enumkeyW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
602 { method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
603 { method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
605 static const struct column col_systemenclosure[] =
607 { prop_captionW, CIM_STRING },
608 { prop_chassistypesW, CIM_UINT16|CIM_FLAG_ARRAY },
609 { prop_descriptionW, CIM_STRING },
610 { prop_lockpresentW, CIM_BOOLEAN },
611 { prop_manufacturerW, CIM_STRING },
612 { prop_nameW, CIM_STRING },
613 { prop_tagW, CIM_STRING },
615 static const struct column col_systemsecurity[] =
617 { method_getsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
618 { method_setsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD },
620 static const struct column col_videocontroller[] =
622 { prop_adapterdactypeW, CIM_STRING },
623 { prop_adapterramW, CIM_UINT32, VT_I4 },
624 { prop_availabilityW, CIM_UINT16 },
625 { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
626 { prop_currentbitsperpixelW, CIM_UINT32, VT_I4 },
627 { prop_currenthorizontalresW, CIM_UINT32, VT_I4 },
628 { prop_currentrefreshrateW, CIM_UINT32, VT_I4 },
629 { prop_currentscanmodeW, CIM_UINT16, VT_I4 },
630 { prop_currentverticalresW, CIM_UINT32, VT_I4 },
631 { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
632 { prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
633 { prop_driverversionW, CIM_STRING },
634 { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
635 { prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
636 { prop_videoarchitectureW, CIM_UINT16, VT_I4 },
637 { prop_videomemorytypeW, CIM_UINT16, VT_I4 },
638 { prop_videoprocessorW, CIM_STRING|COL_FLAG_DYNAMIC }
641 static const WCHAR baseboard_manufacturerW[] =
642 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
643 static const WCHAR baseboard_serialnumberW[] =
644 {'N','o','n','e',0};
645 static const WCHAR baseboard_tagW[] =
646 {'B','a','s','e',' ','B','o','a','r','d',0};
647 static const WCHAR baseboard_versionW[] =
648 {'1','.','0',0};
649 static const WCHAR bios_descriptionW[] =
650 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
651 static const WCHAR bios_manufacturerW[] =
652 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
653 static const WCHAR bios_releasedateW[] =
654 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
655 static const WCHAR bios_serialnumberW[] =
656 {'0',0};
657 static const WCHAR bios_smbiosbiosversionW[] =
658 {'W','i','n','e',0};
659 static const WCHAR bios_versionW[] =
660 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
661 static const WCHAR cdromdrive_mediatypeW[] =
662 {'C','D','-','R','O','M',0};
663 static const WCHAR cdromdrive_nameW[] =
664 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
665 static const WCHAR cdromdrive_pnpdeviceidW[]=
666 {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
667 '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
668 '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
669 'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
670 static const WCHAR compsys_descriptionW[] =
671 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
672 static const WCHAR compsys_domainW[] =
673 {'W','O','R','K','G','R','O','U','P',0};
674 static const WCHAR compsys_manufacturerW[] =
675 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
676 static const WCHAR compsys_modelW[] =
677 {'W','i','n','e',0};
678 static const WCHAR compsysproduct_identifyingnumberW[] =
679 {'0',0};
680 static const WCHAR compsysproduct_uuidW[] =
681 {'0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-',
682 '0','0','0','0','0','0','0','0','0','0','0','0',0};
683 static const WCHAR diskdrive_interfacetypeW[] =
684 {'I','D','E',0};
685 static const WCHAR diskdrive_manufacturerW[] =
686 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
687 static const WCHAR diskdrive_mediatype_fixedW[] =
688 {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
689 static const WCHAR diskdrive_mediatype_removableW[] =
690 {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
691 static const WCHAR diskdrive_modelW[] =
692 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
693 static const WCHAR diskdrive_pnpdeviceidW[] =
694 {'I','D','E','\\','D','i','s','k','\\','V','E','N','_','W','I','N','E',0};
695 static const WCHAR diskdrive_serialW[] =
696 {'W','I','N','E','H','D','I','S','K',0};
697 static const WCHAR networkadapter_pnpdeviceidW[]=
698 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
699 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
700 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
701 static const WCHAR os_32bitW[] =
702 {'3','2','-','b','i','t',0};
703 static const WCHAR os_64bitW[] =
704 {'6','4','-','b','i','t',0};
705 static const WCHAR os_buildnumberW[] =
706 {'2','6','0','0',0};
707 static const WCHAR os_captionW[] =
708 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
709 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
710 static const WCHAR os_csdversionW[] =
711 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
712 static const WCHAR os_installdateW[] =
713 {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
714 static const WCHAR os_nameW[] =
715 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
716 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
717 '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
718 '\\','P','a','r','t','i','t','i','o','n','1',0};
719 static const WCHAR os_serialnumberW[] =
720 {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
721 static const WCHAR os_versionW[] =
722 {'5','.','1','.','2','6','0','0',0};
723 static const WCHAR physicalmedia_tagW[] =
724 {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
725 static const WCHAR sounddevice_productnameW[] =
726 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
727 static const WCHAR systemenclosure_systemenclosureW[] =
728 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',0};
729 static const WCHAR systemenclosure_tagW[] =
730 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',' ','0',0};
731 static const WCHAR systemenclosure_manufacturerW[] =
732 {'W','i','n','e',0};
733 static const WCHAR videocontroller_dactypeW[] =
734 {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
735 static const WCHAR videocontroller_deviceidW[] =
736 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
737 static const WCHAR videocontroller_driverversionW[] =
738 {'1','.','0',0};
740 #include "pshpack1.h"
741 struct record_baseboard
743 const WCHAR *manufacturer;
744 const WCHAR *model;
745 const WCHAR *name;
746 const WCHAR *product;
747 const WCHAR *serialnumber;
748 const WCHAR *tag;
749 const WCHAR *version;
751 struct record_bios
753 const WCHAR *description;
754 const WCHAR *identificationcode;
755 const WCHAR *manufacturer;
756 const WCHAR *releasedate;
757 const WCHAR *serialnumber;
758 const WCHAR *smbiosbiosversion;
759 const WCHAR *version;
761 struct record_cdromdrive
763 const WCHAR *device_id;
764 const WCHAR *drive;
765 const WCHAR *mediatype;
766 const WCHAR *name;
767 const WCHAR *pnpdevice_id;
769 struct record_computersystem
771 const WCHAR *description;
772 const WCHAR *domain;
773 UINT16 domainrole;
774 const WCHAR *manufacturer;
775 const WCHAR *model;
776 const WCHAR *name;
777 UINT32 num_logical_processors;
778 UINT32 num_processors;
779 UINT64 total_physical_memory;
780 const WCHAR *username;
782 struct record_computersystemproduct
784 const WCHAR *identifyingnumber;
785 const WCHAR *uuid;
787 struct record_datafile
789 const WCHAR *name;
790 const WCHAR *version;
792 struct record_directory
794 UINT32 accessmask;
795 const WCHAR *name;
797 struct record_diskdrive
799 const WCHAR *device_id;
800 UINT32 index;
801 const WCHAR *interfacetype;
802 const WCHAR *manufacturer;
803 const WCHAR *mediatype;
804 const WCHAR *model;
805 const WCHAR *pnpdevice_id;
806 const WCHAR *serialnumber;
807 UINT64 size;
809 struct record_diskpartition
811 int bootable;
812 int bootpartition;
813 const WCHAR *device_id;
814 UINT32 diskindex;
815 UINT32 index;
816 const WCHAR *pnpdevice_id;
817 UINT64 size;
818 UINT64 startingoffset;
819 const WCHAR *type;
821 struct record_logicaldisk
823 const WCHAR *device_id;
824 UINT32 drivetype;
825 const WCHAR *filesystem;
826 UINT64 freespace;
827 const WCHAR *name;
828 UINT64 size;
829 const WCHAR *volumename;
830 const WCHAR *volumeserialnumber;
832 struct record_networkadapter
834 const WCHAR *adaptertype;
835 const WCHAR *device_id;
836 UINT32 index;
837 UINT32 interface_index;
838 const WCHAR *mac_address;
839 const WCHAR *manufacturer;
840 const WCHAR *name;
841 UINT16 netconnection_status;
842 int physicaladapter;
843 const WCHAR *pnpdevice_id;
844 UINT64 speed;
846 struct record_networkadapterconfig
848 const WCHAR *dnshostname;
849 UINT32 index;
850 UINT32 ipconnectionmetric;
851 int ipenabled;
852 const WCHAR *mac_address;
854 struct record_operatingsystem
856 const WCHAR *buildnumber;
857 const WCHAR *caption;
858 const WCHAR *codeset;
859 const WCHAR *countrycode;
860 const WCHAR *csdversion;
861 const WCHAR *installdate;
862 const WCHAR *lastbootuptime;
863 const WCHAR *localdatetime;
864 const WCHAR *locale;
865 const WCHAR *name;
866 const WCHAR *osarchitecture;
867 UINT32 oslanguage;
868 UINT32 osproductsuite;
869 UINT16 ostype;
870 int primary;
871 const WCHAR *serialnumber;
872 UINT16 servicepackmajor;
873 UINT16 servicepackminor;
874 UINT32 suitemask;
875 const WCHAR *systemdirectory;
876 UINT64 totalvisiblememorysize;
877 const WCHAR *version;
879 struct record_param
881 const WCHAR *class;
882 const WCHAR *method;
883 INT32 direction;
884 const WCHAR *parameter;
885 UINT32 type;
886 UINT32 varianttype;
887 UINT32 defaultvalue;
889 struct record_physicalmedia
891 const WCHAR *serialnumber;
892 const WCHAR *tag;
894 struct record_physicalmemory
896 UINT64 capacity;
898 struct record_printer
900 UINT32 attributes;
901 const WCHAR *drivername;
902 UINT32 horizontalresolution;
903 int local;
904 const WCHAR *name;
905 int network;
907 struct record_process
909 const WCHAR *caption;
910 const WCHAR *commandline;
911 const WCHAR *description;
912 const WCHAR *handle;
913 const WCHAR *name;
914 UINT32 pprocess_id;
915 UINT32 process_id;
916 UINT32 thread_count;
917 UINT64 workingsetsize;
918 /* methods */
919 class_method *get_owner;
921 struct record_processor
923 UINT16 addresswidth;
924 const WCHAR *caption;
925 UINT16 cpu_status;
926 UINT32 currentclockspeed;
927 UINT16 datawidth;
928 const WCHAR *description;
929 const WCHAR *device_id;
930 UINT16 family;
931 const WCHAR *manufacturer;
932 UINT32 maxclockspeed;
933 const WCHAR *name;
934 UINT32 num_cores;
935 UINT32 num_logical_processors;
936 const WCHAR *processor_id;
937 UINT16 processortype;
938 const WCHAR *unique_id;
939 const WCHAR *version;
941 struct record_qualifier
943 const WCHAR *class;
944 const WCHAR *member;
945 UINT32 type;
946 INT32 flavor;
947 const WCHAR *name;
948 INT32 intvalue;
949 const WCHAR *strvalue;
951 struct record_service
953 int accept_pause;
954 int accept_stop;
955 const WCHAR *displayname;
956 const WCHAR *name;
957 UINT32 process_id;
958 const WCHAR *servicetype;
959 const WCHAR *startmode;
960 const WCHAR *state;
961 const WCHAR *systemname;
962 /* methods */
963 class_method *pause_service;
964 class_method *resume_service;
965 class_method *start_service;
966 class_method *stop_service;
968 struct record_sid
970 const WCHAR *accountname;
971 const struct array *binaryrepresentation;
972 const WCHAR *referenceddomainname;
973 const WCHAR *sid;
974 UINT32 sidlength;
976 struct record_sounddevice
978 const WCHAR *name;
979 const WCHAR *productname;
980 UINT16 statusinfo;
982 struct record_stdregprov
984 class_method *enumkey;
985 class_method *enumvalues;
986 class_method *getstringvalue;
988 struct record_systemsecurity
990 class_method *getsd;
991 class_method *setsd;
993 struct record_systemenclosure
995 const WCHAR *caption;
996 const struct array *chassistypes;
997 const WCHAR *description;
998 int lockpresent;
999 const WCHAR *manufacturer;
1000 const WCHAR *name;
1001 const WCHAR *tag;
1003 struct record_videocontroller
1005 const WCHAR *adapter_dactype;
1006 UINT32 adapter_ram;
1007 UINT16 availability;
1008 const WCHAR *caption;
1009 UINT32 current_bitsperpixel;
1010 UINT32 current_horizontalres;
1011 UINT32 current_refreshrate;
1012 UINT16 current_scanmode;
1013 UINT32 current_verticalres;
1014 const WCHAR *description;
1015 const WCHAR *device_id;
1016 const WCHAR *driverversion;
1017 const WCHAR *name;
1018 const WCHAR *pnpdevice_id;
1019 UINT16 videoarchitecture;
1020 UINT16 videomemorytype;
1021 const WCHAR *videoprocessor;
1023 #include "poppack.h"
1025 static const struct record_baseboard data_baseboard[] =
1027 { baseboard_manufacturerW, baseboard_tagW, baseboard_tagW, baseboard_tagW, baseboard_serialnumberW, baseboard_versionW }
1029 static const struct record_bios data_bios[] =
1031 { bios_descriptionW, bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW,
1032 bios_smbiosbiosversionW, bios_versionW }
1034 static const struct record_computersystemproduct data_compsysproduct[] =
1036 { compsysproduct_identifyingnumberW, compsysproduct_uuidW }
1038 static const struct record_param data_param[] =
1040 { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1041 { class_processW, method_getownerW, -1, param_userW, CIM_STRING },
1042 { class_processW, method_getownerW, -1, param_domainW, CIM_STRING },
1043 { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1044 { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1045 { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1046 { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1047 { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1048 { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING },
1049 { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1050 { class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
1051 { class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1052 { class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING },
1053 { class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1054 { class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
1055 { class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY },
1056 { class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
1057 { class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING },
1058 { class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING },
1059 { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1060 { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING },
1061 { class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1062 { class_systemsecurityW, method_getsdW, -1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
1063 { class_systemsecurityW, method_setsdW, 1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
1064 { class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
1067 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
1068 WBEM_FLAVOR_ORIGIN_PROPAGATED)
1070 static const struct record_physicalmedia data_physicalmedia[] =
1072 { diskdrive_serialW, physicalmedia_tagW }
1074 static const struct record_qualifier data_qualifier[] =
1076 { class_process_getowner_outW, param_userW, CIM_SINT32, FLAVOR_ID, prop_idW, 0 },
1077 { class_process_getowner_outW, param_domainW, CIM_SINT32, FLAVOR_ID, prop_idW, 1 }
1079 static const struct record_sounddevice data_sounddevice[] =
1081 { sounddevice_productnameW, sounddevice_productnameW, 3 /* enabled */ }
1083 static const struct record_stdregprov data_stdregprov[] =
1085 { reg_enum_key, reg_enum_values, reg_get_stringvalue }
1087 static UINT16 systemenclosure_chassistypes[] =
1091 static const struct array systemenclosure_chassistypes_array =
1093 SIZEOF(systemenclosure_chassistypes),
1094 &systemenclosure_chassistypes
1096 static const struct record_systemenclosure data_systemenclosure[] =
1099 systemenclosure_systemenclosureW,
1100 &systemenclosure_chassistypes_array,
1101 systemenclosure_systemenclosureW,
1102 FALSE,
1103 systemenclosure_manufacturerW,
1104 systemenclosure_systemenclosureW,
1105 systemenclosure_tagW,
1108 static const struct record_systemsecurity data_systemsecurity[] =
1110 { security_get_sd, security_set_sd }
1113 /* check if row matches condition and update status */
1114 static BOOL match_row( const struct table *table, UINT row, const struct expr *cond, enum fill_status *status )
1116 LONGLONG val;
1117 UINT type;
1119 if (!cond)
1121 *status = FILL_STATUS_UNFILTERED;
1122 return TRUE;
1124 if (eval_cond( table, row, cond, &val, &type ) != S_OK)
1126 *status = FILL_STATUS_FAILED;
1127 return FALSE;
1129 *status = FILL_STATUS_FILTERED;
1130 return val != 0;
1133 static BOOL resize_table( struct table *table, UINT row_count, UINT row_size )
1135 if (!table->num_rows_allocated)
1137 if (!(table->data = heap_alloc( row_count * row_size ))) return FALSE;
1138 table->num_rows_allocated = row_count;
1139 return TRUE;
1141 if (row_count > table->num_rows_allocated)
1143 BYTE *data;
1144 UINT count = max( row_count, table->num_rows_allocated * 2 );
1145 if (!(data = heap_realloc( table->data, count * row_size ))) return FALSE;
1146 table->data = data;
1147 table->num_rows_allocated = count;
1149 return TRUE;
1152 static enum fill_status fill_cdromdrive( struct table *table, const struct expr *cond )
1154 static const WCHAR fmtW[] = {'%','c',':',0};
1155 WCHAR drive[3], root[] = {'A',':','\\',0};
1156 struct record_cdromdrive *rec;
1157 UINT i, row = 0, offset = 0;
1158 DWORD drives = GetLogicalDrives();
1159 enum fill_status status = FILL_STATUS_UNFILTERED;
1161 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1163 for (i = 0; i < sizeof(drives); i++)
1165 if (drives & (1 << i))
1167 root[0] = 'A' + i;
1168 if (GetDriveTypeW( root ) != DRIVE_CDROM)
1169 continue;
1171 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1173 rec = (struct record_cdromdrive *)(table->data + offset);
1174 rec->device_id = cdromdrive_pnpdeviceidW;
1175 sprintfW( drive, fmtW, 'A' + i );
1176 rec->drive = heap_strdupW( drive );
1177 rec->mediatype = cdromdrive_mediatypeW;
1178 rec->name = cdromdrive_nameW;
1179 rec->pnpdevice_id = cdromdrive_pnpdeviceidW;
1180 if (!match_row( table, row, cond, &status ))
1182 free_row_values( table, row );
1183 continue;
1185 offset += sizeof(*rec);
1186 row++;
1189 TRACE("created %u rows\n", row);
1190 table->num_rows = row;
1191 return status;
1194 static UINT get_processor_count(void)
1196 SYSTEM_BASIC_INFORMATION info;
1198 if (NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )) return 1;
1199 return info.NumberOfProcessors;
1202 static UINT get_logical_processor_count( UINT *num_cores )
1204 SYSTEM_LOGICAL_PROCESSOR_INFORMATION *info;
1205 UINT i, j, count = 0;
1206 NTSTATUS status;
1207 ULONG len;
1209 if (num_cores) *num_cores = get_processor_count();
1210 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, NULL, 0, &len );
1211 if (status != STATUS_INFO_LENGTH_MISMATCH) return get_processor_count();
1213 if (!(info = heap_alloc( len ))) return get_processor_count();
1214 status = NtQuerySystemInformation( SystemLogicalProcessorInformation, info, len, &len );
1215 if (status != STATUS_SUCCESS)
1217 heap_free( info );
1218 return get_processor_count();
1220 if (num_cores) *num_cores = 0;
1221 for (i = 0; i < len / sizeof(*info); i++)
1223 if (info[i].Relationship == RelationProcessorCore)
1225 for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) count++;
1227 else if (info[i].Relationship == RelationProcessorPackage && num_cores)
1229 for (j = 0; j < sizeof(ULONG_PTR); j++) if (info[i].ProcessorMask & (1 << j)) (*num_cores)++;
1232 heap_free( info );
1233 return count;
1236 static UINT64 get_total_physical_memory(void)
1238 MEMORYSTATUSEX status;
1240 status.dwLength = sizeof(status);
1241 if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
1242 return status.ullTotalPhys;
1245 static WCHAR *get_computername(void)
1247 WCHAR *ret;
1248 DWORD size = MAX_COMPUTERNAME_LENGTH + 1;
1250 if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
1251 GetComputerNameW( ret, &size );
1252 return ret;
1255 static WCHAR *get_username(void)
1257 WCHAR *ret;
1258 DWORD compsize, usersize;
1259 DWORD size;
1261 compsize = 0;
1262 GetComputerNameW( NULL, &compsize );
1263 usersize = 0;
1264 GetUserNameW( NULL, &usersize );
1265 size = compsize + usersize; /* two null terminators account for the \ */
1266 if (!(ret = heap_alloc( size * sizeof(WCHAR) ))) return NULL;
1267 GetComputerNameW( ret, &compsize );
1268 ret[compsize] = '\\';
1269 GetUserNameW( ret + compsize + 1, &usersize );
1270 return ret;
1273 static enum fill_status fill_compsys( struct table *table, const struct expr *cond )
1275 struct record_computersystem *rec;
1276 enum fill_status status = FILL_STATUS_UNFILTERED;
1277 UINT row = 0;
1279 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1281 rec = (struct record_computersystem *)table->data;
1282 rec->description = compsys_descriptionW;
1283 rec->domain = compsys_domainW;
1284 rec->domainrole = 0; /* standalone workstation */
1285 rec->manufacturer = compsys_manufacturerW;
1286 rec->model = compsys_modelW;
1287 rec->name = get_computername();
1288 rec->num_logical_processors = get_logical_processor_count( NULL );
1289 rec->num_processors = get_processor_count();
1290 rec->total_physical_memory = get_total_physical_memory();
1291 rec->username = get_username();
1292 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
1293 else row++;
1295 TRACE("created %u rows\n", row);
1296 table->num_rows = row;
1297 return status;
1300 struct dirstack
1302 WCHAR **dirs;
1303 UINT *len_dirs;
1304 UINT num_dirs;
1305 UINT num_allocated;
1308 static struct dirstack *alloc_dirstack( UINT size )
1310 struct dirstack *dirstack;
1312 if (!(dirstack = heap_alloc( sizeof(*dirstack) ))) return NULL;
1313 if (!(dirstack->dirs = heap_alloc( sizeof(WCHAR *) * size )))
1315 heap_free( dirstack );
1316 return NULL;
1318 if (!(dirstack->len_dirs = heap_alloc( sizeof(UINT) * size )))
1320 heap_free( dirstack->dirs );
1321 heap_free( dirstack );
1322 return NULL;
1324 dirstack->num_dirs = 0;
1325 dirstack->num_allocated = size;
1326 return dirstack;
1329 static void clear_dirstack( struct dirstack *dirstack )
1331 UINT i;
1332 for (i = 0; i < dirstack->num_dirs; i++) heap_free( dirstack->dirs[i] );
1333 dirstack->num_dirs = 0;
1336 static void free_dirstack( struct dirstack *dirstack )
1338 clear_dirstack( dirstack );
1339 heap_free( dirstack->dirs );
1340 heap_free( dirstack->len_dirs );
1341 heap_free( dirstack );
1344 static BOOL push_dir( struct dirstack *dirstack, WCHAR *dir, UINT len )
1346 UINT size, i = dirstack->num_dirs;
1348 if (!dir) return FALSE;
1350 if (i == dirstack->num_allocated)
1352 WCHAR **tmp;
1353 UINT *len_tmp;
1355 size = dirstack->num_allocated * 2;
1356 if (!(tmp = heap_realloc( dirstack->dirs, size * sizeof(WCHAR *) ))) return FALSE;
1357 dirstack->dirs = tmp;
1358 if (!(len_tmp = heap_realloc( dirstack->len_dirs, size * sizeof(UINT) ))) return FALSE;
1359 dirstack->len_dirs = len_tmp;
1360 dirstack->num_allocated = size;
1362 dirstack->dirs[i] = dir;
1363 dirstack->len_dirs[i] = len;
1364 dirstack->num_dirs++;
1365 return TRUE;
1368 static WCHAR *pop_dir( struct dirstack *dirstack, UINT *len )
1370 if (!dirstack->num_dirs)
1372 *len = 0;
1373 return NULL;
1375 dirstack->num_dirs--;
1376 *len = dirstack->len_dirs[dirstack->num_dirs];
1377 return dirstack->dirs[dirstack->num_dirs];
1380 static const WCHAR *peek_dir( struct dirstack *dirstack )
1382 if (!dirstack->num_dirs) return NULL;
1383 return dirstack->dirs[dirstack->num_dirs - 1];
1386 static WCHAR *build_glob( WCHAR drive, const WCHAR *path, UINT len )
1388 UINT i = 0;
1389 WCHAR *ret;
1391 if (!(ret = heap_alloc( (len + 6) * sizeof(WCHAR) ))) return NULL;
1392 ret[i++] = drive;
1393 ret[i++] = ':';
1394 ret[i++] = '\\';
1395 if (path && len)
1397 memcpy( ret + i, path, len * sizeof(WCHAR) );
1398 i += len;
1399 ret[i++] = '\\';
1401 ret[i++] = '*';
1402 ret[i] = 0;
1403 return ret;
1406 static WCHAR *build_name( WCHAR drive, const WCHAR *path )
1408 UINT i = 0, len = 0;
1409 const WCHAR *p;
1410 WCHAR *ret;
1412 for (p = path; *p; p++)
1414 if (*p == '\\') len += 2;
1415 else len++;
1417 if (!(ret = heap_alloc( (len + 5) * sizeof(WCHAR) ))) return NULL;
1418 ret[i++] = drive;
1419 ret[i++] = ':';
1420 ret[i++] = '\\';
1421 ret[i++] = '\\';
1422 for (p = path; *p; p++)
1424 if (*p != '\\') ret[i++] = *p;
1425 else
1427 ret[i++] = '\\';
1428 ret[i++] = '\\';
1431 ret[i] = 0;
1432 return ret;
1435 static WCHAR *build_dirname( const WCHAR *path, UINT *ret_len )
1437 const WCHAR *p = path, *start;
1438 UINT len, i;
1439 WCHAR *ret;
1441 if (!isalphaW( p[0] ) || p[1] != ':' || p[2] != '\\' || p[3] != '\\' || !p[4]) return NULL;
1442 start = path + 4;
1443 len = strlenW( start );
1444 p = start + len - 1;
1445 if (*p == '\\') return NULL;
1447 while (p >= start && *p != '\\') { len--; p--; };
1448 while (p >= start && *p == '\\') { len--; p--; };
1450 if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
1451 for (i = 0, p = start; p < start + len; p++)
1453 if (p[0] == '\\' && p[1] == '\\')
1455 ret[i++] = '\\';
1456 p++;
1458 else ret[i++] = *p;
1460 ret[i] = 0;
1461 *ret_len = i;
1462 return ret;
1465 static BOOL seen_dir( struct dirstack *dirstack, const WCHAR *path )
1467 UINT i;
1468 for (i = 0; i < dirstack->num_dirs; i++) if (!strcmpW( dirstack->dirs[i], path )) return TRUE;
1469 return FALSE;
1472 /* optimize queries of the form WHERE Name='...' [OR Name='...']* */
1473 static UINT seed_dirs( struct dirstack *dirstack, const struct expr *cond, WCHAR root, UINT *count )
1475 const struct expr *left, *right;
1477 if (!cond || cond->type != EXPR_COMPLEX) return *count = 0;
1479 left = cond->u.expr.left;
1480 right = cond->u.expr.right;
1481 if (cond->u.expr.op == OP_EQ)
1483 UINT len;
1484 WCHAR *path;
1485 const WCHAR *str = NULL;
1487 if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL &&
1488 !strcmpW( left->u.propval->name, prop_nameW ) &&
1489 toupperW( right->u.sval[0] ) == toupperW( root ))
1491 str = right->u.sval;
1493 else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL &&
1494 !strcmpW( right->u.propval->name, prop_nameW ) &&
1495 toupperW( left->u.sval[0] ) == toupperW( root ))
1497 str = left->u.sval;
1499 if (str && (path = build_dirname( str, &len )))
1501 if (seen_dir( dirstack, path ))
1503 heap_free( path );
1504 return ++*count;
1506 else if (push_dir( dirstack, path, len )) return ++*count;
1507 heap_free( path );
1508 return *count = 0;
1511 else if (cond->u.expr.op == OP_OR)
1513 UINT left_count = 0, right_count = 0;
1515 if (!(seed_dirs( dirstack, left, root, &left_count ))) return *count = 0;
1516 if (!(seed_dirs( dirstack, right, root, &right_count ))) return *count = 0;
1517 return *count += left_count + right_count;
1519 return *count = 0;
1522 static WCHAR *append_path( const WCHAR *path, const WCHAR *segment, UINT *len )
1524 UINT len_path = 0, len_segment = strlenW( segment );
1525 WCHAR *ret;
1527 *len = 0;
1528 if (path) len_path = strlenW( path );
1529 if (!(ret = heap_alloc( (len_path + len_segment + 2) * sizeof(WCHAR) ))) return NULL;
1530 if (path && len_path)
1532 memcpy( ret, path, len_path * sizeof(WCHAR) );
1533 ret[len_path] = '\\';
1534 *len += len_path + 1;
1536 memcpy( ret + *len, segment, len_segment * sizeof(WCHAR) );
1537 *len += len_segment;
1538 ret[*len] = 0;
1539 return ret;
1542 static WCHAR *get_file_version( const WCHAR *filename )
1544 static const WCHAR slashW[] = {'\\',0}, fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
1545 VS_FIXEDFILEINFO *info;
1546 DWORD size;
1547 void *block;
1548 WCHAR *ret;
1550 if (!(ret = heap_alloc( (4 * 5 + sizeof(fmtW) / sizeof(fmtW[0])) * sizeof(WCHAR) ))) return NULL;
1551 if (!(size = GetFileVersionInfoSizeW( filename, NULL )) || !(block = heap_alloc( size )))
1553 heap_free( ret );
1554 return NULL;
1556 if (!GetFileVersionInfoW( filename, 0, size, block ) ||
1557 !VerQueryValueW( block, slashW, (void **)&info, &size ))
1559 heap_free( block );
1560 heap_free( ret );
1561 return NULL;
1563 sprintfW( ret, fmtW, info->dwFileVersionMS >> 16, info->dwFileVersionMS & 0xffff,
1564 info->dwFileVersionLS >> 16, info->dwFileVersionLS & 0xffff );
1565 heap_free( block );
1566 return ret;
1569 static enum fill_status fill_datafile( struct table *table, const struct expr *cond )
1571 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
1572 struct record_datafile *rec;
1573 UINT i, len, row = 0, offset = 0, num_expected_rows;
1574 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
1575 DWORD drives = GetLogicalDrives();
1576 WIN32_FIND_DATAW data;
1577 HANDLE handle;
1578 struct dirstack *dirstack;
1579 enum fill_status status = FILL_STATUS_UNFILTERED;
1581 if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED;
1583 dirstack = alloc_dirstack(2);
1585 for (i = 0; i < sizeof(drives); i++)
1587 if (!(drives & (1 << i))) continue;
1589 root[0] = 'A' + i;
1590 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
1592 num_expected_rows = 0;
1593 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
1595 for (;;)
1597 heap_free( glob );
1598 heap_free( path );
1599 path = pop_dir( dirstack, &len );
1600 if (!(glob = build_glob( root[0], path, len )))
1602 status = FILL_STATUS_FAILED;
1603 goto done;
1605 if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
1609 if (!resize_table( table, row + 1, sizeof(*rec) ))
1611 status = FILL_STATUS_FAILED;
1612 FindClose( handle );
1613 goto done;
1615 if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue;
1616 new_path = append_path( path, data.cFileName, &len );
1618 if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
1620 if (push_dir( dirstack, new_path, len )) continue;
1621 heap_free( new_path );
1622 FindClose( handle );
1623 status = FILL_STATUS_FAILED;
1624 goto done;
1626 rec = (struct record_datafile *)(table->data + offset);
1627 rec->name = build_name( root[0], new_path );
1628 rec->version = get_file_version( rec->name );
1629 if (!match_row( table, row, cond, &status ))
1631 free_row_values( table, row );
1632 continue;
1634 else if (num_expected_rows && row == num_expected_rows - 1)
1636 row++;
1637 FindClose( handle );
1638 status = FILL_STATUS_FILTERED;
1639 goto done;
1641 offset += sizeof(*rec);
1642 row++;
1644 while (FindNextFileW( handle, &data ));
1645 FindClose( handle );
1647 if (!peek_dir( dirstack )) break;
1651 done:
1652 free_dirstack( dirstack );
1653 heap_free( glob );
1654 heap_free( path );
1656 TRACE("created %u rows\n", row);
1657 table->num_rows = row;
1658 return status;
1661 static enum fill_status fill_directory( struct table *table, const struct expr *cond )
1663 static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
1664 struct record_directory *rec;
1665 UINT i, len, row = 0, offset = 0, num_expected_rows;
1666 WCHAR *glob = NULL, *path = NULL, *new_path, root[] = {'A',':','\\',0};
1667 DWORD drives = GetLogicalDrives();
1668 WIN32_FIND_DATAW data;
1669 HANDLE handle;
1670 struct dirstack *dirstack;
1671 enum fill_status status = FILL_STATUS_UNFILTERED;
1673 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1675 dirstack = alloc_dirstack(2);
1677 for (i = 0; i < sizeof(drives); i++)
1679 if (!(drives & (1 << i))) continue;
1681 root[0] = 'A' + i;
1682 if (GetDriveTypeW( root ) != DRIVE_FIXED) continue;
1684 num_expected_rows = 0;
1685 if (!seed_dirs( dirstack, cond, root[0], &num_expected_rows )) clear_dirstack( dirstack );
1687 for (;;)
1689 heap_free( glob );
1690 heap_free( path );
1691 path = pop_dir( dirstack, &len );
1692 if (!(glob = build_glob( root[0], path, len )))
1694 status = FILL_STATUS_FAILED;
1695 goto done;
1697 if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
1701 if (!resize_table( table, row + 1, sizeof(*rec) ))
1703 FindClose( handle );
1704 status = FILL_STATUS_FAILED;
1705 goto done;
1707 if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
1708 !strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW ))
1709 continue;
1711 new_path = append_path( path, data.cFileName, &len );
1712 if (!(push_dir( dirstack, new_path, len )))
1714 heap_free( new_path );
1715 FindClose( handle );
1716 status = FILL_STATUS_FAILED;
1717 goto done;
1719 rec = (struct record_directory *)(table->data + offset);
1720 rec->accessmask = FILE_ALL_ACCESS;
1721 rec->name = build_name( root[0], new_path );
1722 if (!match_row( table, row, cond, &status ))
1724 free_row_values( table, row );
1725 continue;
1727 else if (num_expected_rows && row == num_expected_rows - 1)
1729 row++;
1730 FindClose( handle );
1731 status = FILL_STATUS_FILTERED;
1732 goto done;
1734 offset += sizeof(*rec);
1735 row++;
1737 while (FindNextFileW( handle, &data ));
1738 FindClose( handle );
1740 if (!peek_dir( dirstack )) break;
1744 done:
1745 free_dirstack( dirstack );
1746 heap_free( glob );
1747 heap_free( path );
1749 TRACE("created %u rows\n", row);
1750 table->num_rows = row;
1751 return status;
1754 static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize )
1756 WCHAR root[] = {'\\','\\','.','\\','A',':',0};
1757 ULARGE_INTEGER free;
1758 DISK_GEOMETRY_EX info;
1759 HANDLE handle;
1760 DWORD bytes_returned;
1762 free.QuadPart = 512 * 1024 * 1024;
1763 GetDiskFreeSpaceExW( dir, NULL, NULL, &free );
1765 root[4] = dir[0];
1766 handle = CreateFileW( root, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0 );
1767 if (handle != INVALID_HANDLE_VALUE)
1769 if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &info, sizeof(info), &bytes_returned, NULL ))
1770 *disksize = info.DiskSize.QuadPart;
1771 CloseHandle( handle );
1773 return free.QuadPart;
1776 static enum fill_status fill_diskdrive( struct table *table, const struct expr *cond )
1778 static const WCHAR fmtW[] =
1779 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
1780 WCHAR device_id[sizeof(fmtW)/sizeof(fmtW[0]) + 10], root[] = {'A',':','\\',0};
1781 struct record_diskdrive *rec;
1782 UINT i, row = 0, offset = 0, index = 0, type;
1783 UINT64 size = 1024 * 1024 * 1024;
1784 DWORD drives = GetLogicalDrives();
1785 enum fill_status status = FILL_STATUS_UNFILTERED;
1787 if (!resize_table( table, 2, sizeof(*rec) )) return FILL_STATUS_FAILED;
1789 for (i = 0; i < sizeof(drives); i++)
1791 if (drives & (1 << i))
1793 root[0] = 'A' + i;
1794 type = GetDriveTypeW( root );
1795 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
1796 continue;
1798 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1800 rec = (struct record_diskdrive *)(table->data + offset);
1801 sprintfW( device_id, fmtW, index );
1802 rec->device_id = heap_strdupW( device_id );
1803 rec->index = index;
1804 rec->interfacetype = diskdrive_interfacetypeW;
1805 rec->manufacturer = diskdrive_manufacturerW;
1806 if (type == DRIVE_FIXED)
1807 rec->mediatype = diskdrive_mediatype_fixedW;
1808 else
1809 rec->mediatype = diskdrive_mediatype_removableW;
1810 rec->model = diskdrive_modelW;
1811 rec->pnpdevice_id = diskdrive_pnpdeviceidW;
1812 rec->serialnumber = diskdrive_serialW;
1813 get_freespace( root, &size );
1814 rec->size = size;
1815 if (!match_row( table, row, cond, &status ))
1817 free_row_values( table, row );
1818 continue;
1820 offset += sizeof(*rec);
1821 index++;
1822 row++;
1825 TRACE("created %u rows\n", row);
1826 table->num_rows = row;
1827 return status;
1830 static WCHAR *get_filesystem( const WCHAR *root )
1832 static const WCHAR ntfsW[] = {'N','T','F','S',0};
1833 WCHAR buffer[MAX_PATH + 1];
1835 if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 ))
1836 return heap_strdupW( buffer );
1837 return heap_strdupW( ntfsW );
1840 static enum fill_status fill_diskpartition( struct table *table, const struct expr *cond )
1842 static const WCHAR fmtW[] =
1843 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
1844 WCHAR device_id[32], root[] = {'A',':','\\',0};
1845 struct record_diskpartition *rec;
1846 UINT i, row = 0, offset = 0, type, index = 0;
1847 UINT64 size = 1024 * 1024 * 1024;
1848 DWORD drives = GetLogicalDrives();
1849 enum fill_status status = FILL_STATUS_UNFILTERED;
1851 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1853 for (i = 0; i < sizeof(drives); i++)
1855 if (drives & (1 << i))
1857 root[0] = 'A' + i;
1858 type = GetDriveTypeW( root );
1859 if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE)
1860 continue;
1862 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1864 rec = (struct record_diskpartition *)(table->data + offset);
1865 rec->bootable = (i == 2) ? -1 : 0;
1866 rec->bootpartition = (i == 2) ? -1 : 0;
1867 sprintfW( device_id, fmtW, index );
1868 rec->device_id = heap_strdupW( device_id );
1869 rec->diskindex = index;
1870 rec->index = 0;
1871 rec->pnpdevice_id = heap_strdupW( device_id );
1872 get_freespace( root, &size );
1873 rec->size = size;
1874 rec->startingoffset = 0;
1875 rec->type = get_filesystem( root );
1876 if (!match_row( table, row, cond, &status ))
1878 free_row_values( table, row );
1879 continue;
1881 offset += sizeof(*rec);
1882 row++;
1883 index++;
1886 TRACE("created %u rows\n", row);
1887 table->num_rows = row;
1888 return status;
1891 static WCHAR *get_volumename( const WCHAR *root )
1893 WCHAR buf[MAX_PATH + 1] = {0};
1894 GetVolumeInformationW( root, buf, sizeof(buf)/sizeof(buf[0]), NULL, NULL, NULL, NULL, 0 );
1895 return heap_strdupW( buf );
1897 static WCHAR *get_volumeserialnumber( const WCHAR *root )
1899 static const WCHAR fmtW[] = {'%','0','8','X',0};
1900 DWORD serial = 0;
1901 WCHAR buffer[9];
1903 GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 );
1904 sprintfW( buffer, fmtW, serial );
1905 return heap_strdupW( buffer );
1908 static enum fill_status fill_logicaldisk( struct table *table, const struct expr *cond )
1910 static const WCHAR fmtW[] = {'%','c',':',0};
1911 WCHAR device_id[3], root[] = {'A',':','\\',0};
1912 struct record_logicaldisk *rec;
1913 UINT i, row = 0, offset = 0, type;
1914 UINT64 size = 1024 * 1024 * 1024;
1915 DWORD drives = GetLogicalDrives();
1916 enum fill_status status = FILL_STATUS_UNFILTERED;
1918 if (!resize_table( table, 4, sizeof(*rec) )) return FILL_STATUS_FAILED;
1920 for (i = 0; i < sizeof(drives); i++)
1922 if (drives & (1 << i))
1924 root[0] = 'A' + i;
1925 type = GetDriveTypeW( root );
1926 if (type != DRIVE_FIXED && type != DRIVE_CDROM && type != DRIVE_REMOVABLE)
1927 continue;
1929 if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
1931 rec = (struct record_logicaldisk *)(table->data + offset);
1932 sprintfW( device_id, fmtW, 'A' + i );
1933 rec->device_id = heap_strdupW( device_id );
1934 rec->drivetype = type;
1935 rec->filesystem = get_filesystem( root );
1936 rec->freespace = get_freespace( root, &size );
1937 rec->name = heap_strdupW( device_id );
1938 rec->size = size;
1939 rec->volumename = get_volumename( root );
1940 rec->volumeserialnumber = get_volumeserialnumber( root );
1941 if (!match_row( table, row, cond, &status ))
1943 free_row_values( table, row );
1944 continue;
1946 offset += sizeof(*rec);
1947 row++;
1950 TRACE("created %u rows\n", row);
1951 table->num_rows = row;
1952 return status;
1955 static UINT16 get_connection_status( IF_OPER_STATUS status )
1957 switch (status)
1959 case IfOperStatusDown:
1960 return 0; /* Disconnected */
1961 case IfOperStatusUp:
1962 return 2; /* Connected */
1963 default:
1964 ERR("unhandled status %u\n", status);
1965 break;
1967 return 0;
1969 static WCHAR *get_mac_address( const BYTE *addr, DWORD len )
1971 static const WCHAR fmtW[] =
1972 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
1973 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
1974 WCHAR *ret;
1976 if (len != 6 || !(ret = heap_alloc( 18 * sizeof(WCHAR) ))) return NULL;
1977 sprintfW( ret, fmtW, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] );
1978 return ret;
1980 static const WCHAR *get_adaptertype( DWORD type, int *physical )
1982 static const WCHAR ethernetW[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
1983 static const WCHAR wirelessW[] = {'W','i','r','e','l','e','s','s',0};
1984 static const WCHAR firewireW[] = {'1','3','9','4',0};
1985 static const WCHAR tunnelW[] = {'T','u','n','n','e','l',0};
1987 switch (type)
1989 case IF_TYPE_ETHERNET_CSMACD: *physical = -1; return ethernetW;
1990 case IF_TYPE_IEEE80211: *physical = -1; return wirelessW;
1991 case IF_TYPE_IEEE1394: *physical = -1; return firewireW;
1992 case IF_TYPE_TUNNEL: *physical = 0; return tunnelW;
1993 default: *physical = 0; return NULL;
1997 static enum fill_status fill_networkadapter( struct table *table, const struct expr *cond )
1999 static const WCHAR fmtW[] = {'%','u',0};
2000 WCHAR device_id[11];
2001 struct record_networkadapter *rec;
2002 IP_ADAPTER_ADDRESSES *aa, *buffer;
2003 UINT row = 0, offset = 0, count = 0;
2004 DWORD size = 0, ret;
2005 int physical;
2006 enum fill_status status = FILL_STATUS_UNFILTERED;
2008 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
2009 if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
2011 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
2012 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
2014 heap_free( buffer );
2015 return FILL_STATUS_FAILED;
2017 for (aa = buffer; aa; aa = aa->Next)
2019 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
2021 if (!resize_table( table, count, sizeof(*rec) ))
2023 heap_free( buffer );
2024 return FILL_STATUS_FAILED;
2026 for (aa = buffer; aa; aa = aa->Next)
2028 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
2030 rec = (struct record_networkadapter *)(table->data + offset);
2031 sprintfW( device_id, fmtW, aa->u.s.IfIndex );
2032 rec->adaptertype = get_adaptertype( aa->IfType, &physical );
2033 rec->device_id = heap_strdupW( device_id );
2034 rec->index = aa->u.s.IfIndex;
2035 rec->interface_index = aa->u.s.IfIndex;
2036 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
2037 rec->manufacturer = compsys_manufacturerW;
2038 rec->name = heap_strdupW( aa->FriendlyName );
2039 rec->netconnection_status = get_connection_status( aa->OperStatus );
2040 rec->physicaladapter = physical;
2041 rec->pnpdevice_id = networkadapter_pnpdeviceidW;
2042 rec->speed = 1000000;
2043 if (!match_row( table, row, cond, &status ))
2045 free_row_values( table, row );
2046 continue;
2048 offset += sizeof(*rec);
2049 row++;
2051 TRACE("created %u rows\n", row);
2052 table->num_rows = row;
2054 heap_free( buffer );
2055 return status;
2058 static WCHAR *get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS *addr )
2060 const SOCKET_ADDRESS *sa = &addr->Address;
2061 WCHAR buf[NI_MAXHOST];
2063 if (!addr) return NULL;
2064 if (GetNameInfoW( sa->lpSockaddr, sa->iSockaddrLength, buf, sizeof(buf)/sizeof(buf[0]), NULL,
2065 0, NI_NAMEREQD )) return NULL;
2066 return heap_strdupW( buf );
2069 static enum fill_status fill_networkadapterconfig( struct table *table, const struct expr *cond )
2071 struct record_networkadapterconfig *rec;
2072 IP_ADAPTER_ADDRESSES *aa, *buffer;
2073 UINT row = 0, offset = 0, count = 0;
2074 DWORD size = 0, ret;
2075 enum fill_status status = FILL_STATUS_UNFILTERED;
2077 ret = GetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size );
2078 if (ret != ERROR_BUFFER_OVERFLOW) return FILL_STATUS_FAILED;
2080 if (!(buffer = heap_alloc( size ))) return FILL_STATUS_FAILED;
2081 if (GetAdaptersAddresses( AF_UNSPEC, 0, NULL, buffer, &size ))
2083 heap_free( buffer );
2084 return FILL_STATUS_FAILED;
2086 for (aa = buffer; aa; aa = aa->Next)
2088 if (aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) count++;
2090 if (!resize_table( table, count, sizeof(*rec) ))
2092 heap_free( buffer );
2093 return FILL_STATUS_FAILED;
2095 for (aa = buffer; aa; aa = aa->Next)
2097 if (aa->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
2099 rec = (struct record_networkadapterconfig *)(table->data + offset);
2100 rec->dnshostname = get_dnshostname( aa->FirstUnicastAddress );
2101 rec->index = aa->u.s.IfIndex;
2102 rec->ipconnectionmetric = 20;
2103 rec->ipenabled = -1;
2104 rec->mac_address = get_mac_address( aa->PhysicalAddress, aa->PhysicalAddressLength );
2105 if (!match_row( table, row, cond, &status ))
2107 free_row_values( table, row );
2108 continue;
2110 offset += sizeof(*rec);
2111 row++;
2113 TRACE("created %u rows\n", row);
2114 table->num_rows = row;
2116 heap_free( buffer );
2117 return status;
2120 static enum fill_status fill_physicalmemory( struct table *table, const struct expr *cond )
2122 struct record_physicalmemory *rec;
2123 enum fill_status status = FILL_STATUS_UNFILTERED;
2124 UINT row = 0;
2126 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2128 rec = (struct record_physicalmemory *)table->data;
2129 rec->capacity = get_total_physical_memory();
2130 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2131 else row++;
2133 TRACE("created %u rows\n", row);
2134 table->num_rows = row;
2135 return status;
2138 static enum fill_status fill_printer( struct table *table, const struct expr *cond )
2140 struct record_printer *rec;
2141 enum fill_status status = FILL_STATUS_UNFILTERED;
2142 PRINTER_INFO_2W *info;
2143 DWORD i, offset = 0, count = 0, size = 0;
2145 EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &size, &count );
2146 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FILL_STATUS_FAILED;
2148 if (!(info = heap_alloc( size ))) return FILL_STATUS_FAILED;
2149 if (!EnumPrintersW( PRINTER_ENUM_LOCAL, NULL, 2, (BYTE *)info, size, &size, &count ))
2151 heap_free( info );
2152 return FILL_STATUS_FAILED;
2154 if (!resize_table( table, count, sizeof(*rec) ))
2156 heap_free( info );
2157 return FILL_STATUS_FAILED;
2160 for (i = 0; i < count; i++)
2162 rec = (struct record_printer *)(table->data + offset);
2163 rec->attributes = info[i].Attributes;
2164 rec->drivername = heap_strdupW( info[i].pDriverName );
2165 rec->horizontalresolution = info[i].pDevMode->u1.s1.dmPrintQuality;
2166 rec->local = -1;
2167 rec->name = heap_strdupW( info[i].pPrinterName );
2168 rec->network = 0;
2169 if (!match_row( table, i, cond, &status ))
2171 free_row_values( table, i );
2172 continue;
2174 offset += sizeof(*rec);
2176 TRACE("created %u rows\n", count);
2177 table->num_rows = count;
2179 heap_free( info );
2180 return status;
2183 static WCHAR *get_cmdline( DWORD process_id )
2185 if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
2186 return NULL; /* FIXME handle different process case */
2189 static enum fill_status fill_process( struct table *table, const struct expr *cond )
2191 static const WCHAR fmtW[] = {'%','u',0};
2192 WCHAR handle[11];
2193 struct record_process *rec;
2194 PROCESSENTRY32W entry;
2195 HANDLE snap;
2196 enum fill_status status = FILL_STATUS_FAILED;
2197 UINT row = 0, offset = 0;
2199 snap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
2200 if (snap == INVALID_HANDLE_VALUE) return FILL_STATUS_FAILED;
2202 entry.dwSize = sizeof(entry);
2203 if (!Process32FirstW( snap, &entry )) goto done;
2204 if (!resize_table( table, 8, sizeof(*rec) )) goto done;
2208 if (!resize_table( table, row + 1, sizeof(*rec) )) goto done;
2210 rec = (struct record_process *)(table->data + offset);
2211 rec->caption = heap_strdupW( entry.szExeFile );
2212 rec->commandline = get_cmdline( entry.th32ProcessID );
2213 rec->description = heap_strdupW( entry.szExeFile );
2214 sprintfW( handle, fmtW, entry.th32ProcessID );
2215 rec->handle = heap_strdupW( handle );
2216 rec->name = heap_strdupW( entry.szExeFile );
2217 rec->process_id = entry.th32ProcessID;
2218 rec->pprocess_id = entry.th32ParentProcessID;
2219 rec->thread_count = entry.cntThreads;
2220 rec->workingsetsize = 0;
2221 rec->get_owner = process_get_owner;
2222 if (!match_row( table, row, cond, &status ))
2224 free_row_values( table, row );
2225 continue;
2227 offset += sizeof(*rec);
2228 row++;
2229 } while (Process32NextW( snap, &entry ));
2231 TRACE("created %u rows\n", row);
2232 table->num_rows = row;
2233 status = FILL_STATUS_UNFILTERED;
2235 done:
2236 CloseHandle( snap );
2237 return status;
2240 static inline void do_cpuid( unsigned int ax, unsigned int *p )
2242 #ifdef __i386__
2243 #ifdef _MSC_VER
2244 __cpuid(p, ax);
2245 #else
2246 __asm__("pushl %%ebx\n\t"
2247 "cpuid\n\t"
2248 "movl %%ebx, %%esi\n\t"
2249 "popl %%ebx"
2250 : "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3])
2251 : "0" (ax));
2252 #endif
2253 #endif
2255 static const WCHAR *get_osarchitecture(void)
2257 SYSTEM_INFO info;
2258 GetNativeSystemInfo( &info );
2259 if (info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) return os_64bitW;
2260 return os_32bitW;
2262 static void get_processor_caption( WCHAR *caption )
2264 static const WCHAR fmtW[] =
2265 {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ',
2266 'M','o','d','e','l',' ','%','u',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2267 static const WCHAR x86W[] = {'x','8','6',0};
2268 static const WCHAR intel64W[] = {'I','n','t','e','l','6','4',0};
2269 const WCHAR *arch = (get_osarchitecture() == os_32bitW) ? x86W : intel64W;
2270 unsigned int regs[4] = {0, 0, 0, 0};
2272 do_cpuid( 1, regs );
2273 sprintfW( caption, fmtW, arch, (regs[0] & (15 << 8)) >> 8, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 );
2275 static void get_processor_version( WCHAR *version )
2277 static const WCHAR fmtW[] =
2278 {'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2279 unsigned int regs[4] = {0, 0, 0, 0};
2281 do_cpuid( 1, regs );
2282 sprintfW( version, fmtW, (regs[0] & (15 << 4)) >> 4, regs[0] & 15 );
2284 static void get_processor_id( WCHAR *processor_id )
2286 static const WCHAR fmtW[] = {'%','0','8','X','%','0','8','X',0};
2287 unsigned int regs[4] = {0, 0, 0, 0};
2289 do_cpuid( 1, regs );
2290 sprintfW( processor_id, fmtW, regs[3], regs[0] );
2292 static void regs_to_str( unsigned int *regs, unsigned int len, WCHAR *buffer )
2294 unsigned int i;
2295 unsigned char *p = (unsigned char *)regs;
2297 for (i = 0; i < len; i++) { buffer[i] = *p++; }
2298 buffer[i] = 0;
2300 static void get_processor_manufacturer( WCHAR *manufacturer )
2302 unsigned int tmp, regs[4] = {0, 0, 0, 0};
2304 do_cpuid( 0, regs );
2305 tmp = regs[2]; /* swap edx and ecx */
2306 regs[2] = regs[3];
2307 regs[3] = tmp;
2309 regs_to_str( regs + 1, 12, manufacturer );
2311 static void get_processor_name( WCHAR *name )
2313 unsigned int regs[4] = {0, 0, 0, 0};
2315 do_cpuid( 0x80000000, regs );
2316 if (regs[0] >= 0x80000004)
2318 do_cpuid( 0x80000002, regs );
2319 regs_to_str( regs, 16, name );
2320 do_cpuid( 0x80000003, regs );
2321 regs_to_str( regs, 16, name + 16 );
2322 do_cpuid( 0x80000004, regs );
2323 regs_to_str( regs, 16, name + 32 );
2326 static UINT get_processor_currentclockspeed( UINT index )
2328 PROCESSOR_POWER_INFORMATION *info;
2329 UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
2330 NTSTATUS status;
2332 if ((info = heap_alloc( size )))
2334 status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
2335 if (!status) ret = info[index].CurrentMhz;
2336 heap_free( info );
2338 return ret;
2340 static UINT get_processor_maxclockspeed( UINT index )
2342 PROCESSOR_POWER_INFORMATION *info;
2343 UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
2344 NTSTATUS status;
2346 if ((info = heap_alloc( size )))
2348 status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
2349 if (!status) ret = info[index].MaxMhz;
2350 heap_free( info );
2352 return ret;
2355 static enum fill_status fill_processor( struct table *table, const struct expr *cond )
2357 static const WCHAR fmtW[] = {'C','P','U','%','u',0};
2358 WCHAR caption[100], device_id[14], processor_id[17], manufacturer[13], name[49] = {0}, version[50];
2359 struct record_processor *rec;
2360 UINT i, offset = 0, num_cores, num_logical_processors, count = get_processor_count();
2361 enum fill_status status = FILL_STATUS_UNFILTERED;
2363 if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED;
2365 get_processor_caption( caption );
2366 get_processor_id( processor_id );
2367 get_processor_manufacturer( manufacturer );
2368 get_processor_name( name );
2369 get_processor_version( version );
2371 num_logical_processors = get_logical_processor_count( &num_cores ) / count;
2372 num_cores /= count;
2374 for (i = 0; i < count; i++)
2376 rec = (struct record_processor *)(table->data + offset);
2377 rec->addresswidth = get_osarchitecture() == os_32bitW ? 32 : 64;
2378 rec->caption = heap_strdupW( caption );
2379 rec->cpu_status = 1; /* CPU Enabled */
2380 rec->currentclockspeed = get_processor_currentclockspeed( i );
2381 rec->datawidth = get_osarchitecture() == os_32bitW ? 32 : 64;
2382 rec->description = heap_strdupW( caption );
2383 sprintfW( device_id, fmtW, i );
2384 rec->device_id = heap_strdupW( device_id );
2385 rec->family = 2; /* Unknown */
2386 rec->manufacturer = heap_strdupW( manufacturer );
2387 rec->maxclockspeed = get_processor_maxclockspeed( i );
2388 rec->name = heap_strdupW( name );
2389 rec->num_cores = num_cores;
2390 rec->num_logical_processors = num_logical_processors;
2391 rec->processor_id = heap_strdupW( processor_id );
2392 rec->processortype = 3; /* central processor */
2393 rec->unique_id = NULL;
2394 rec->version = heap_strdupW( version );
2395 if (!match_row( table, i, cond, &status ))
2397 free_row_values( table, i );
2398 continue;
2400 offset += sizeof(*rec);
2403 TRACE("created %u rows\n", count);
2404 table->num_rows = count;
2405 return status;
2408 static WCHAR *get_lastbootuptime(void)
2410 static const WCHAR fmtW[] =
2411 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2412 '.','%','0','6','u','+','0','0','0',0};
2413 SYSTEM_TIMEOFDAY_INFORMATION ti;
2414 TIME_FIELDS tf;
2415 WCHAR *ret;
2417 if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
2419 NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
2420 RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
2421 sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
2422 return ret;
2424 static WCHAR *get_localdatetime(void)
2426 static const WCHAR fmtW[] =
2427 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2428 '.','%','0','6','u','%','+','0','3','d',0};
2429 TIME_ZONE_INFORMATION tzi;
2430 SYSTEMTIME st;
2431 WCHAR *ret;
2432 DWORD Status;
2433 LONG Bias;
2435 Status = GetTimeZoneInformation(&tzi);
2437 if(Status == TIME_ZONE_ID_INVALID) return NULL;
2438 Bias = tzi.Bias;
2439 if(Status == TIME_ZONE_ID_DAYLIGHT)
2440 Bias+= tzi.DaylightBias;
2441 else
2442 Bias+= tzi.StandardBias;
2443 if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
2445 GetLocalTime(&st);
2446 sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias);
2447 return ret;
2449 static WCHAR *get_systemdirectory(void)
2451 void *redir;
2452 WCHAR *ret;
2454 if (!(ret = heap_alloc( MAX_PATH * sizeof(WCHAR) ))) return NULL;
2455 Wow64DisableWow64FsRedirection( &redir );
2456 GetSystemDirectoryW( ret, MAX_PATH );
2457 Wow64RevertWow64FsRedirection( redir );
2458 return ret;
2460 static WCHAR *get_codeset(void)
2462 static const WCHAR fmtW[] = {'%','u',0};
2463 WCHAR *ret = heap_alloc( 11 * sizeof(WCHAR) );
2464 if (ret) sprintfW( ret, fmtW, GetACP() );
2465 return ret;
2467 static WCHAR *get_countrycode(void)
2469 WCHAR *ret = heap_alloc( 6 * sizeof(WCHAR) );
2470 if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, ret, 6 );
2471 return ret;
2473 static WCHAR *get_locale(void)
2475 WCHAR *ret = heap_alloc( 5 * sizeof(WCHAR) );
2476 if (ret) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, ret, 5 );
2477 return ret;
2480 static enum fill_status fill_os( struct table *table, const struct expr *cond )
2482 struct record_operatingsystem *rec;
2483 enum fill_status status = FILL_STATUS_UNFILTERED;
2484 UINT row = 0;
2486 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2488 rec = (struct record_operatingsystem *)table->data;
2489 rec->buildnumber = os_buildnumberW;
2490 rec->caption = os_captionW;
2491 rec->codeset = get_codeset();
2492 rec->countrycode = get_countrycode();
2493 rec->csdversion = os_csdversionW;
2494 rec->installdate = os_installdateW;
2495 rec->lastbootuptime = get_lastbootuptime();
2496 rec->localdatetime = get_localdatetime();
2497 rec->locale = get_locale();
2498 rec->name = os_nameW;
2499 rec->osarchitecture = get_osarchitecture();
2500 rec->oslanguage = GetSystemDefaultLangID();
2501 rec->osproductsuite = 2461140; /* Windows XP Professional */
2502 rec->ostype = 18; /* WINNT */
2503 rec->primary = -1;
2504 rec->serialnumber = os_serialnumberW;
2505 rec->servicepackmajor = 3;
2506 rec->servicepackminor = 0;
2507 rec->suitemask = 272; /* Single User + Terminal */
2508 rec->systemdirectory = get_systemdirectory();
2509 rec->totalvisiblememorysize = get_total_physical_memory() / 1024;
2510 rec->version = os_versionW;
2511 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2512 else row++;
2514 TRACE("created %u rows\n", row);
2515 table->num_rows = row;
2516 return status;
2519 static const WCHAR *get_service_type( DWORD type )
2521 static const WCHAR filesystem_driverW[] =
2522 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
2523 static const WCHAR kernel_driverW[] =
2524 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
2525 static const WCHAR own_processW[] =
2526 {'O','w','n',' ','P','r','o','c','e','s','s',0};
2527 static const WCHAR share_processW[] =
2528 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
2530 if (type & SERVICE_KERNEL_DRIVER) return kernel_driverW;
2531 else if (type & SERVICE_FILE_SYSTEM_DRIVER) return filesystem_driverW;
2532 else if (type & SERVICE_WIN32_OWN_PROCESS) return own_processW;
2533 else if (type & SERVICE_WIN32_SHARE_PROCESS) return share_processW;
2534 else ERR("unhandled type 0x%08x\n", type);
2535 return NULL;
2537 static const WCHAR *get_service_state( DWORD state )
2539 static const WCHAR runningW[] =
2540 {'R','u','n','n','i','n','g',0};
2541 static const WCHAR start_pendingW[] =
2542 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
2543 static const WCHAR stop_pendingW[] =
2544 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
2545 static const WCHAR stoppedW[] =
2546 {'S','t','o','p','p','e','d',0};
2547 static const WCHAR unknownW[] =
2548 {'U','n','k','n','o','w','n',0};
2550 switch (state)
2552 case SERVICE_STOPPED: return stoppedW;
2553 case SERVICE_START_PENDING: return start_pendingW;
2554 case SERVICE_STOP_PENDING: return stop_pendingW;
2555 case SERVICE_RUNNING: return runningW;
2556 default:
2557 ERR("unknown state %u\n", state);
2558 return unknownW;
2561 static const WCHAR *get_service_startmode( DWORD mode )
2563 static const WCHAR bootW[] = {'B','o','o','t',0};
2564 static const WCHAR systemW[] = {'S','y','s','t','e','m',0};
2565 static const WCHAR autoW[] = {'A','u','t','o',0};
2566 static const WCHAR manualW[] = {'M','a','n','u','a','l',0};
2567 static const WCHAR disabledW[] = {'D','i','s','a','b','l','e','d',0};
2568 static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',0};
2570 switch (mode)
2572 case SERVICE_BOOT_START: return bootW;
2573 case SERVICE_SYSTEM_START: return systemW;
2574 case SERVICE_AUTO_START: return autoW;
2575 case SERVICE_DEMAND_START: return manualW;
2576 case SERVICE_DISABLED: return disabledW;
2577 default:
2578 ERR("unknown mode 0x%x\n", mode);
2579 return unknownW;
2582 static QUERY_SERVICE_CONFIGW *query_service_config( SC_HANDLE manager, const WCHAR *name )
2584 QUERY_SERVICE_CONFIGW *config = NULL;
2585 SC_HANDLE service;
2586 DWORD size;
2588 if (!(service = OpenServiceW( manager, name, SERVICE_QUERY_CONFIG ))) return NULL;
2589 QueryServiceConfigW( service, NULL, 0, &size );
2590 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
2591 if (!(config = heap_alloc( size ))) goto done;
2592 if (QueryServiceConfigW( service, config, size, &size )) goto done;
2593 heap_free( config );
2594 config = NULL;
2596 done:
2597 CloseServiceHandle( service );
2598 return config;
2601 static enum fill_status fill_service( struct table *table, const struct expr *cond )
2603 struct record_service *rec;
2604 SC_HANDLE manager;
2605 ENUM_SERVICE_STATUS_PROCESSW *tmp, *services = NULL;
2606 SERVICE_STATUS_PROCESS *status;
2607 WCHAR sysnameW[MAX_COMPUTERNAME_LENGTH + 1];
2608 DWORD len = sizeof(sysnameW) / sizeof(sysnameW[0]);
2609 UINT i, row = 0, offset = 0, size = 256, needed, count;
2610 enum fill_status fill_status = FILL_STATUS_FAILED;
2611 BOOL ret;
2613 if (!(manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ))) return FILL_STATUS_FAILED;
2614 if (!(services = heap_alloc( size ))) goto done;
2616 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
2617 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
2618 &count, NULL, NULL );
2619 if (!ret)
2621 if (GetLastError() != ERROR_MORE_DATA) goto done;
2622 size = needed;
2623 if (!(tmp = heap_realloc( services, size ))) goto done;
2624 services = tmp;
2625 ret = EnumServicesStatusExW( manager, SC_ENUM_PROCESS_INFO, SERVICE_TYPE_ALL,
2626 SERVICE_STATE_ALL, (BYTE *)services, size, &needed,
2627 &count, NULL, NULL );
2628 if (!ret) goto done;
2630 if (!resize_table( table, count, sizeof(*rec) )) goto done;
2632 GetComputerNameW( sysnameW, &len );
2633 fill_status = FILL_STATUS_UNFILTERED;
2635 for (i = 0; i < count; i++)
2637 QUERY_SERVICE_CONFIGW *config;
2639 if (!(config = query_service_config( manager, services[i].lpServiceName ))) continue;
2641 status = &services[i].ServiceStatusProcess;
2642 rec = (struct record_service *)(table->data + offset);
2643 rec->accept_pause = (status->dwControlsAccepted & SERVICE_ACCEPT_PAUSE_CONTINUE) ? -1 : 0;
2644 rec->accept_stop = (status->dwControlsAccepted & SERVICE_ACCEPT_STOP) ? -1 : 0;
2645 rec->displayname = heap_strdupW( services[i].lpDisplayName );
2646 rec->name = heap_strdupW( services[i].lpServiceName );
2647 rec->process_id = status->dwProcessId;
2648 rec->servicetype = get_service_type( status->dwServiceType );
2649 rec->startmode = get_service_startmode( config->dwStartType );
2650 rec->state = get_service_state( status->dwCurrentState );
2651 rec->systemname = heap_strdupW( sysnameW );
2652 rec->pause_service = service_pause_service;
2653 rec->resume_service = service_resume_service;
2654 rec->start_service = service_start_service;
2655 rec->stop_service = service_stop_service;
2656 heap_free( config );
2657 if (!match_row( table, row, cond, &fill_status ))
2659 free_row_values( table, row );
2660 continue;
2662 offset += sizeof(*rec);
2663 row++;
2666 TRACE("created %u rows\n", row);
2667 table->num_rows = row;
2669 done:
2670 CloseServiceHandle( manager );
2671 heap_free( services );
2672 return fill_status;
2675 static WCHAR *get_accountname( LSA_TRANSLATED_NAME *name )
2677 if (!name || !name->Name.Buffer) return NULL;
2678 return heap_strdupW( name->Name.Buffer );
2680 static struct array *get_binaryrepresentation( PSID sid, UINT len )
2682 struct array *array = heap_alloc( sizeof(struct array) );
2683 if (array)
2685 UINT8 *ret = heap_alloc( len );
2686 if (ret)
2688 memcpy( ret, sid, len );
2689 array->count = len;
2690 array->ptr = ret;
2691 return array;
2693 heap_free( array );
2695 return NULL;
2697 static WCHAR *get_referenceddomainname( LSA_REFERENCED_DOMAIN_LIST *domain )
2699 if (!domain || !domain->Domains || !domain->Domains->Name.Buffer) return NULL;
2700 return heap_strdupW( domain->Domains->Name.Buffer );
2702 static const WCHAR *find_sid_str( const struct expr *cond )
2704 const struct expr *left, *right;
2705 const WCHAR *ret = NULL;
2707 if (!cond || cond->type != EXPR_COMPLEX || cond->u.expr.op != OP_EQ) return NULL;
2709 left = cond->u.expr.left;
2710 right = cond->u.expr.right;
2711 if (left->type == EXPR_PROPVAL && right->type == EXPR_SVAL && !strcmpiW( left->u.propval->name, prop_sidW ))
2713 ret = right->u.sval;
2715 else if (left->type == EXPR_SVAL && right->type == EXPR_PROPVAL && !strcmpiW( right->u.propval->name, prop_sidW ))
2717 ret = left->u.sval;
2719 return ret;
2722 static enum fill_status fill_sid( struct table *table, const struct expr *cond )
2724 PSID sid;
2725 LSA_REFERENCED_DOMAIN_LIST *domain;
2726 LSA_TRANSLATED_NAME *name;
2727 LSA_HANDLE handle;
2728 LSA_OBJECT_ATTRIBUTES attrs;
2729 const WCHAR *str;
2730 struct record_sid *rec;
2731 UINT len;
2733 if (!(str = find_sid_str( cond ))) return FILL_STATUS_FAILED;
2734 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2736 if (!ConvertStringSidToSidW( str, &sid )) return FILL_STATUS_FAILED;
2737 len = GetLengthSid( sid );
2739 memset( &attrs, 0, sizeof(attrs) );
2740 attrs.Length = sizeof(attrs);
2741 if (LsaOpenPolicy( NULL, &attrs, POLICY_ALL_ACCESS, &handle ))
2743 LocalFree( sid );
2744 return FILL_STATUS_FAILED;
2746 if (LsaLookupSids( handle, 1, &sid, &domain, &name ))
2748 LocalFree( sid );
2749 LsaClose( handle );
2750 return FILL_STATUS_FAILED;
2753 rec = (struct record_sid *)table->data;
2754 rec->accountname = get_accountname( name );
2755 rec->binaryrepresentation = get_binaryrepresentation( sid, len );
2756 rec->referenceddomainname = get_referenceddomainname( domain );
2757 rec->sid = heap_strdupW( str );
2758 rec->sidlength = len;
2760 TRACE("created 1 row\n");
2761 table->num_rows = 1;
2763 LsaFreeMemory( domain );
2764 LsaFreeMemory( name );
2765 LocalFree( sid );
2766 LsaClose( handle );
2767 return FILL_STATUS_FILTERED;
2770 static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres )
2772 HDC hdc = GetDC( NULL );
2773 UINT32 ret;
2775 if (!hdc) return 32;
2776 ret = GetDeviceCaps( hdc, BITSPIXEL );
2777 *hres = GetDeviceCaps( hdc, HORZRES );
2778 *vres = GetDeviceCaps( hdc, VERTRES );
2779 ReleaseDC( NULL, hdc );
2780 return ret;
2782 static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
2784 static const WCHAR fmtW[] =
2785 {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
2786 '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
2787 '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
2788 WCHAR *ret;
2790 if (!(ret = heap_alloc( sizeof(fmtW) + 2 * sizeof(WCHAR) ))) return NULL;
2791 sprintfW( ret, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
2792 return ret;
2795 static enum fill_status fill_videocontroller( struct table *table, const struct expr *cond )
2798 struct record_videocontroller *rec;
2799 HRESULT hr;
2800 IDXGIFactory *factory = NULL;
2801 IDXGIAdapter *adapter = NULL;
2802 DXGI_ADAPTER_DESC desc;
2803 UINT hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
2804 const WCHAR *name = videocontroller_deviceidW;
2805 enum fill_status status = FILL_STATUS_UNFILTERED;
2806 UINT row = 0;
2808 if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
2810 memset (&desc, 0, sizeof(desc));
2811 hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
2812 if (FAILED(hr)) goto done;
2814 hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
2815 if (FAILED(hr)) goto done;
2817 hr = IDXGIAdapter_GetDesc( adapter, &desc );
2818 if (SUCCEEDED(hr))
2820 vidmem = desc.DedicatedVideoMemory;
2821 name = desc.Description;
2824 done:
2825 rec = (struct record_videocontroller *)table->data;
2826 rec->adapter_dactype = videocontroller_dactypeW;
2827 rec->adapter_ram = vidmem;
2828 rec->availability = 3; /* Running or Full Power */
2829 rec->caption = heap_strdupW( name );
2830 rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres );
2831 rec->current_horizontalres = hres;
2832 rec->current_refreshrate = 0; /* default refresh rate */
2833 rec->current_scanmode = 2; /* Unknown */
2834 rec->current_verticalres = vres;
2835 rec->description = heap_strdupW( name );
2836 rec->device_id = videocontroller_deviceidW;
2837 rec->driverversion = videocontroller_driverversionW;
2838 rec->name = heap_strdupW( name );
2839 rec->pnpdevice_id = get_pnpdeviceid( &desc );
2840 rec->videoarchitecture = 2; /* Unknown */
2841 rec->videomemorytype = 2; /* Unknown */
2842 rec->videoprocessor = heap_strdupW( name );
2843 if (!match_row( table, row, cond, &status )) free_row_values( table, row );
2844 else row++;
2846 TRACE("created %u rows\n", row);
2847 table->num_rows = row;
2849 if (adapter) IDXGIAdapter_Release( adapter );
2850 if (factory) IDXGIFactory_Release( factory );
2851 return status;
2854 static struct table builtin_classes[] =
2856 { class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), 0, (BYTE *)data_baseboard },
2857 { class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), 0, (BYTE *)data_bios },
2858 { class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive },
2859 { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
2860 { class_compsysproductW, SIZEOF(col_compsysproduct), col_compsysproduct, SIZEOF(data_compsysproduct), 0, (BYTE *)data_compsysproduct },
2861 { class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
2862 { class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory },
2863 { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive },
2864 { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },
2865 { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
2866 { class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
2867 { class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter },
2868 { class_networkadapterconfigW, SIZEOF(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig },
2869 { class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os },
2870 { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param },
2871 { class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia },
2872 { class_physicalmemoryW, SIZEOF(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory },
2873 { class_printerW, SIZEOF(col_printer), col_printer, 0, 0, NULL, fill_printer },
2874 { class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process },
2875 { class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
2876 { class_processor2W, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
2877 { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier },
2878 { class_serviceW, SIZEOF(col_service), col_service, 0, 0, NULL, fill_service },
2879 { class_sidW, SIZEOF(col_sid), col_sid, 0, 0, NULL, fill_sid },
2880 { class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), 0, (BYTE *)data_sounddevice },
2881 { class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), 0, (BYTE *)data_stdregprov },
2882 { class_systemsecurityW, SIZEOF(col_systemsecurity), col_systemsecurity, SIZEOF(data_systemsecurity), 0, (BYTE *)data_systemsecurity },
2883 { class_systemenclosureW, SIZEOF(col_systemenclosure), col_systemenclosure, SIZEOF(data_systemenclosure), 0, (BYTE *)data_systemenclosure },
2884 { class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller }
2887 void init_table_list( void )
2889 static struct list tables = LIST_INIT( tables );
2890 UINT i;
2892 for (i = 0; i < SIZEOF(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry );
2893 table_list = &tables;