2 * Copyright 2012 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define NONAMELESSUNION
21 #define NONAMELESSSTRUCT
27 #define WIN32_NO_STATUS
42 #include "wine/debug.h"
43 #include "wbemprox_private.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox
);
47 static const WCHAR class_baseboardW
[] =
48 {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0};
49 static const WCHAR class_biosW
[] =
50 {'W','i','n','3','2','_','B','I','O','S',0};
51 static const WCHAR class_cdromdriveW
[] =
52 {'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0};
53 static const WCHAR class_compsysW
[] =
54 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
55 static const WCHAR class_datafileW
[] =
56 {'C','I','M','_','D','a','t','a','F','i','l','e',0};
57 static const WCHAR class_directoryW
[] =
58 {'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0};
59 static const WCHAR class_diskdriveW
[] =
60 {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0};
61 static const WCHAR class_diskpartitionW
[] =
62 {'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
63 static const WCHAR class_logicaldiskW
[] =
64 {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
65 static const WCHAR class_logicaldisk2W
[] =
66 {'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0};
67 static const WCHAR class_networkadapterW
[] =
68 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
69 static const WCHAR class_networkadapterconfigW
[] =
70 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',
71 'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
72 static const WCHAR class_osW
[] =
73 {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
74 static const WCHAR class_paramsW
[] =
75 {'_','_','P','A','R','A','M','E','T','E','R','S',0};
76 static const WCHAR class_physicalmediaW
[] =
77 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0};
78 static const WCHAR class_physicalmemoryW
[] =
79 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
80 static const WCHAR class_qualifiersW
[] =
81 {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
82 static const WCHAR class_process_getowner_outW
[] =
83 {'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W',
84 'N','E','R','_','O','U','T',0};
85 static const WCHAR class_processorW
[] =
86 {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
87 static const WCHAR class_sounddeviceW
[] =
88 {'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0};
89 static const WCHAR class_videocontrollerW
[] =
90 {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
92 static const WCHAR prop_acceptpauseW
[] =
93 {'A','c','c','e','p','t','P','a','u','s','e',0};
94 static const WCHAR prop_acceptstopW
[] =
95 {'A','c','c','e','p','t','S','t','o','p',0};
96 static const WCHAR prop_accessmaskW
[] =
97 {'A','c','c','e','s','s','M','a','s','k',0};
98 static const WCHAR prop_adapterdactypeW
[] =
99 {'A','d','a','p','t','e','r','D','A','C','T','y','p','e',0};
100 static const WCHAR prop_adapterramW
[] =
101 {'A','d','a','p','t','e','r','R','A','M',0};
102 static const WCHAR prop_adaptertypeW
[] =
103 {'A','d','a','p','t','e','r','T','y','p','e',0};
104 static const WCHAR prop_addresswidthW
[] =
105 {'A','d','d','r','e','s','s','W','i','d','t','h',0};
106 static const WCHAR prop_bootableW
[] =
107 {'B','o','o','t','a','b','l','e',0};
108 static const WCHAR prop_bootpartitionW
[] =
109 {'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
110 static const WCHAR prop_buildnumberW
[] =
111 {'B','u','i','l','d','N','u','m','b','e','r',0};
112 static const WCHAR prop_capacityW
[] =
113 {'C','a','p','a','c','i','t','y',0};
114 static const WCHAR prop_captionW
[] =
115 {'C','a','p','t','i','o','n',0};
116 static const WCHAR prop_classW
[] =
117 {'C','l','a','s','s',0};
118 static const WCHAR prop_codesetW
[] =
119 {'C','o','d','e','S','e','t',0};
120 static const WCHAR prop_commandlineW
[] =
121 {'C','o','m','m','a','n','d','L','i','n','e',0};
122 static const WCHAR prop_countrycodeW
[] =
123 {'C','o','u','n','t','r','y','C','o','d','e',0};
124 static const WCHAR prop_cpustatusW
[] =
125 {'C','p','u','S','t','a','t','u','s',0};
126 static const WCHAR prop_csdversionW
[] =
127 {'C','S','D','V','e','r','s','i','o','n',0};
128 static const WCHAR prop_currentbitsperpixelW
[] =
129 {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
130 static const WCHAR prop_currenthorizontalresW
[] =
131 {'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};
132 static const WCHAR prop_currentverticalresW
[] =
133 {'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};
134 static const WCHAR prop_defaultvalueW
[] =
135 {'D','e','f','a','u','l','t','V','a','l','u','e',0};
136 static const WCHAR prop_descriptionW
[] =
137 {'D','e','s','c','r','i','p','t','i','o','n',0};
138 static const WCHAR prop_deviceidW
[] =
139 {'D','e','v','i','c','e','I','d',0};
140 static const WCHAR prop_directionW
[] =
141 {'D','i','r','e','c','t','i','o','n',0};
142 static const WCHAR prop_displaynameW
[] =
143 {'D','i','s','p','l','a','y','N','a','m','e',0};
144 static const WCHAR prop_diskindexW
[] =
145 {'D','i','s','k','I','n','d','e','x',0};
146 static const WCHAR prop_domainW
[] =
147 {'D','o','m','a','i','n',0};
148 static const WCHAR prop_domainroleW
[] =
149 {'D','o','m','a','i','n','R','o','l','e',0};
150 static const WCHAR prop_driveW
[] =
151 {'D','r','i','v','e',0};
152 static const WCHAR prop_drivetypeW
[] =
153 {'D','r','i','v','e','T','y','p','e',0};
154 static const WCHAR prop_familyW
[] =
155 {'F','a','m','i','l','y',0};
156 static const WCHAR prop_filesystemW
[] =
157 {'F','i','l','e','S','y','s','t','e','m',0};
158 static const WCHAR prop_flavorW
[] =
159 {'F','l','a','v','o','r',0};
160 static const WCHAR prop_freespaceW
[] =
161 {'F','r','e','e','S','p','a','c','e',0};
162 static const WCHAR prop_handleW
[] =
163 {'H','a','n','d','l','e',0};
164 static const WCHAR prop_idW
[] =
166 static const WCHAR prop_identificationcodeW
[] =
167 {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
168 static const WCHAR prop_indexW
[] =
169 {'I','n','d','e','x',0};
170 static const WCHAR prop_installdateW
[] =
171 {'I','n','s','t','a','l','l','D','a','t','e',0};
172 static const WCHAR prop_interfaceindexW
[] =
173 {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
174 static const WCHAR prop_interfacetypeW
[] =
175 {'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
176 static const WCHAR prop_intvalueW
[] =
177 {'I','n','t','e','g','e','r','V','a','l','u','e',0};
178 static const WCHAR prop_ipconnectionmetricW
[] =
179 {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
180 static const WCHAR prop_ipenabledW
[] =
181 {'I','P','E','n','a','b','l','e','d',0};
182 static const WCHAR prop_lastbootuptimeW
[] =
183 {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
184 static const WCHAR prop_localdatetimeW
[] =
185 {'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
186 static const WCHAR prop_localeW
[] =
187 {'L','o','c','a','l','e',0};
188 static const WCHAR prop_macaddressW
[] =
189 {'M','A','C','A','d','d','r','e','s','s',0};
190 static const WCHAR prop_manufacturerW
[] =
191 {'M','a','n','u','f','a','c','t','u','r','e','r',0};
192 static const WCHAR prop_maxclockspeedW
[] =
193 {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
194 static const WCHAR prop_mediatypeW
[] =
195 {'M','e','d','i','a','T','y','p','e',0};
196 static const WCHAR prop_memberW
[] =
197 {'M','e','m','b','e','r',0};
198 static const WCHAR prop_methodW
[] =
199 {'M','e','t','h','o','d',0};
200 static const WCHAR prop_modelW
[] =
201 {'M','o','d','e','l',0};
202 static const WCHAR prop_netconnectionstatusW
[] =
203 {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
204 static const WCHAR prop_numcoresW
[] =
205 {'N','u','m','b','e','r','O','f','C','o','r','e','s',0};
206 static const WCHAR prop_numlogicalprocessorsW
[] =
207 {'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};
208 static const WCHAR prop_numprocessorsW
[] =
209 {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
210 static const WCHAR prop_osarchitectureW
[] =
211 {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
212 static const WCHAR prop_oslanguageW
[] =
213 {'O','S','L','a','n','g','u','a','g','e',0};
214 static const WCHAR prop_osproductsuiteW
[] =
215 {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
216 static const WCHAR prop_ostypeW
[] =
217 {'O','S','T','y','p','e',0};
218 static const WCHAR prop_parameterW
[] =
219 {'P','a','r','a','m','e','t','e','r',0};
220 static const WCHAR prop_physicaladapterW
[] =
221 {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
222 static const WCHAR prop_pnpdeviceidW
[] =
223 {'P','N','P','D','e','v','i','c','e','I','D',0};
224 static const WCHAR prop_pprocessidW
[] =
225 {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
226 static const WCHAR prop_processidW
[] =
227 {'P','r','o','c','e','s','s','I','D',0};
228 static const WCHAR prop_processoridW
[] =
229 {'P','r','o','c','e','s','s','o','r','I','d',0};
230 static const WCHAR prop_productnameW
[] =
231 {'P','r','o','d','u','c','t','N','a','m','e',0};
232 static const WCHAR prop_releasedateW
[] =
233 {'R','e','l','e','a','s','e','D','a','t','e',0};
234 static const WCHAR prop_serialnumberW
[] =
235 {'S','e','r','i','a','l','N','u','m','b','e','r',0};
236 static const WCHAR prop_servicepackmajorW
[] =
237 {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
238 static const WCHAR prop_servicepackminorW
[] =
239 {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
240 static const WCHAR prop_servicetypeW
[] =
241 {'S','e','r','v','i','c','e','T','y','p','e',0};
242 static const WCHAR prop_smbiosbiosversionW
[] =
243 {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
244 static const WCHAR prop_startmodeW
[] =
245 {'S','t','a','r','t','M','o','d','e',0};
246 static const WCHAR prop_sizeW
[] =
248 static const WCHAR prop_speedW
[] =
249 {'S','p','e','e','d',0};
250 static const WCHAR prop_startingoffsetW
[] =
251 {'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0};
252 static const WCHAR prop_stateW
[] =
253 {'S','t','a','t','e',0};
254 static const WCHAR prop_strvalueW
[] =
255 {'S','t','r','i','n','g','V','a','l','u','e',0};
256 static const WCHAR prop_suitemaskW
[] =
257 {'S','u','i','t','e','M','a','s','k',0};
258 static const WCHAR prop_systemdirectoryW
[] =
259 {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
260 static const WCHAR prop_systemnameW
[] =
261 {'S','y','s','t','e','m','N','a','m','e',0};
262 static const WCHAR prop_tagW
[] =
264 static const WCHAR prop_threadcountW
[] =
265 {'T','h','r','e','a','d','C','o','u','n','t',0};
266 static const WCHAR prop_totalphysicalmemoryW
[] =
267 {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
268 static const WCHAR prop_typeW
[] =
270 static const WCHAR prop_uniqueidW
[] =
271 {'U','n','i','q','u','e','I','d',0};
272 static const WCHAR prop_varianttypeW
[] =
273 {'V','a','r','i','a','n','t','T','y','p','e',0};
274 static const WCHAR prop_versionW
[] =
275 {'V','e','r','s','i','o','n',0};
276 static const WCHAR prop_volumeserialnumberW
[] =
277 {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
279 /* column definitions must be kept in sync with record structures below */
280 static const struct column col_baseboard
[] =
282 { prop_manufacturerW
, CIM_STRING
},
283 { prop_modelW
, CIM_STRING
},
284 { prop_nameW
, CIM_STRING
},
285 { prop_serialnumberW
, CIM_STRING
},
286 { prop_tagW
, CIM_STRING
|COL_FLAG_KEY
}
288 static const struct column col_bios
[] =
290 { prop_descriptionW
, CIM_STRING
},
291 { prop_identificationcodeW
, CIM_STRING
},
292 { prop_manufacturerW
, CIM_STRING
},
293 { prop_releasedateW
, CIM_DATETIME
},
294 { prop_serialnumberW
, CIM_STRING
},
295 { prop_smbiosbiosversionW
, CIM_STRING
},
296 { prop_versionW
, CIM_STRING
|COL_FLAG_KEY
}
298 static const struct column col_cdromdrive
[] =
300 { prop_deviceidW
, CIM_STRING
|COL_FLAG_KEY
},
301 { prop_driveW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
302 { prop_nameW
, CIM_STRING
},
303 { prop_pnpdeviceidW
, CIM_STRING
}
305 static const struct column col_compsys
[] =
307 { prop_descriptionW
, CIM_STRING
},
308 { prop_domainW
, CIM_STRING
},
309 { prop_domainroleW
, CIM_UINT16
},
310 { prop_manufacturerW
, CIM_STRING
},
311 { prop_modelW
, CIM_STRING
},
312 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
313 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
314 { prop_numprocessorsW
, CIM_UINT32
, VT_I4
},
315 { prop_totalphysicalmemoryW
, CIM_UINT64
}
317 static const struct column col_datafile
[] =
319 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
320 { prop_versionW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
322 static const struct column col_directory
[] =
324 { prop_accessmaskW
, CIM_UINT32
},
325 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
}
327 static const struct column col_diskdrive
[] =
329 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
330 { prop_indexW
, CIM_UINT32
, VT_I4
},
331 { prop_interfacetypeW
, CIM_STRING
},
332 { prop_manufacturerW
, CIM_STRING
},
333 { prop_mediatypeW
, CIM_STRING
},
334 { prop_modelW
, CIM_STRING
},
335 { prop_serialnumberW
, CIM_STRING
},
336 { prop_sizeW
, CIM_UINT64
}
338 static const struct column col_diskpartition
[] =
340 { prop_bootableW
, CIM_BOOLEAN
},
341 { prop_bootpartitionW
, CIM_BOOLEAN
},
342 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
343 { prop_diskindexW
, CIM_UINT32
, VT_I4
},
344 { prop_indexW
, CIM_UINT32
, VT_I4
},
345 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
346 { prop_sizeW
, CIM_UINT64
},
347 { prop_startingoffsetW
, CIM_UINT64
},
348 { prop_typeW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
350 static const struct column col_logicaldisk
[] =
352 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
353 { prop_drivetypeW
, CIM_UINT32
, VT_I4
},
354 { prop_filesystemW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
355 { prop_freespaceW
, CIM_UINT64
},
356 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
357 { prop_sizeW
, CIM_UINT64
},
358 { prop_volumeserialnumberW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
360 static const struct column col_networkadapter
[] =
362 { prop_adaptertypeW
, CIM_STRING
},
363 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
364 { prop_indexW
, CIM_UINT32
, VT_I4
},
365 { prop_interfaceindexW
, CIM_UINT32
, VT_I4
},
366 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
367 { prop_manufacturerW
, CIM_STRING
},
368 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
369 { prop_netconnectionstatusW
, CIM_UINT16
, VT_I4
},
370 { prop_physicaladapterW
, CIM_BOOLEAN
},
371 { prop_pnpdeviceidW
, CIM_STRING
},
372 { prop_speedW
, CIM_UINT64
}
374 static const struct column col_networkadapterconfig
[] =
376 { prop_indexW
, CIM_UINT32
|COL_FLAG_KEY
},
377 { prop_ipconnectionmetricW
, CIM_UINT32
},
378 { prop_ipenabledW
, CIM_BOOLEAN
},
379 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
381 static const struct column col_os
[] =
383 { prop_buildnumberW
, CIM_STRING
},
384 { prop_captionW
, CIM_STRING
},
385 { prop_codesetW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
386 { prop_countrycodeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
387 { prop_csdversionW
, CIM_STRING
},
388 { prop_installdateW
, CIM_DATETIME
},
389 { prop_lastbootuptimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
390 { prop_localdatetimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
391 { prop_localeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
392 { prop_nameW
, CIM_STRING
},
393 { prop_osarchitectureW
, CIM_STRING
},
394 { prop_oslanguageW
, CIM_UINT32
, VT_I4
},
395 { prop_osproductsuiteW
, CIM_UINT32
, VT_I4
},
396 { prop_ostypeW
, CIM_UINT16
, VT_I4
},
397 { prop_serialnumberW
, CIM_STRING
},
398 { prop_servicepackmajorW
, CIM_UINT16
, VT_I4
},
399 { prop_servicepackminorW
, CIM_UINT16
, VT_I4
},
400 { prop_suitemaskW
, CIM_UINT32
, VT_I4
},
401 { prop_systemdirectoryW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
402 { prop_versionW
, CIM_STRING
}
404 static const struct column col_param
[] =
406 { prop_classW
, CIM_STRING
},
407 { prop_methodW
, CIM_STRING
},
408 { prop_directionW
, CIM_SINT32
},
409 { prop_parameterW
, CIM_STRING
},
410 { prop_typeW
, CIM_UINT32
},
411 { prop_varianttypeW
, CIM_UINT32
},
412 { prop_defaultvalueW
, CIM_UINT32
}
414 static const struct column col_physicalmedia
[] =
416 { prop_serialnumberW
, CIM_STRING
},
417 { prop_tagW
, CIM_STRING
}
419 static const struct column col_physicalmemory
[] =
421 { prop_capacityW
, CIM_UINT64
}
423 static const struct column col_process
[] =
425 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
426 { prop_commandlineW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
427 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
428 { prop_handleW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
429 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
430 { prop_pprocessidW
, CIM_UINT32
, VT_I4
},
431 { prop_processidW
, CIM_UINT32
, VT_I4
},
432 { prop_threadcountW
, CIM_UINT32
, VT_I4
},
434 { method_getownerW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
436 static const struct column col_processor
[] =
438 { prop_addresswidthW
, CIM_UINT16
, VT_I4
},
439 { prop_cpustatusW
, CIM_UINT16
},
440 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
441 { prop_familyW
, CIM_UINT16
, VT_I4
},
442 { prop_manufacturerW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
443 { prop_maxclockspeedW
, CIM_UINT32
, VT_I4
},
444 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
445 { prop_numcoresW
, CIM_UINT32
, VT_I4
},
446 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
447 { prop_processoridW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
448 { prop_uniqueidW
, CIM_STRING
}
450 static const struct column col_qualifier
[] =
452 { prop_classW
, CIM_STRING
},
453 { prop_memberW
, CIM_STRING
},
454 { prop_typeW
, CIM_UINT32
},
455 { prop_flavorW
, CIM_SINT32
},
456 { prop_nameW
, CIM_STRING
},
457 { prop_intvalueW
, CIM_SINT32
},
458 { prop_strvalueW
, CIM_STRING
}
460 static const struct column col_service
[] =
462 { prop_acceptpauseW
, CIM_BOOLEAN
},
463 { prop_acceptstopW
, CIM_BOOLEAN
},
464 { prop_displaynameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
465 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
466 { prop_processidW
, CIM_UINT32
},
467 { prop_servicetypeW
, CIM_STRING
},
468 { prop_startmodeW
, CIM_STRING
},
469 { prop_stateW
, CIM_STRING
},
470 { prop_systemnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
472 { method_pauseserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
473 { method_resumeserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
474 { method_startserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
475 { method_stopserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
477 static const struct column col_sounddevice
[] =
479 { prop_nameW
, CIM_STRING
},
480 { prop_productnameW
, CIM_STRING
}
482 static const struct column col_stdregprov
[] =
484 { method_enumkeyW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
485 { method_enumvaluesW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
486 { method_getstringvalueW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
488 static const struct column col_videocontroller
[] =
490 { prop_adapterdactypeW
, CIM_STRING
},
491 { prop_adapterramW
, CIM_UINT32
, VT_I4
},
492 { prop_currentbitsperpixelW
, CIM_UINT32
},
493 { prop_currenthorizontalresW
, CIM_UINT32
},
494 { prop_currentverticalresW
, CIM_UINT32
},
495 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
496 { prop_deviceidW
, CIM_STRING
|COL_FLAG_KEY
},
497 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
498 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
501 static const WCHAR baseboard_manufacturerW
[] =
502 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
503 static const WCHAR baseboard_serialnumberW
[] =
505 static const WCHAR baseboard_tagW
[] =
506 {'B','a','s','e',' ','B','o','a','r','d',0};
507 static const WCHAR bios_descriptionW
[] =
508 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
509 static const WCHAR bios_manufacturerW
[] =
510 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
511 static const WCHAR bios_releasedateW
[] =
512 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
513 static const WCHAR bios_serialnumberW
[] =
515 static const WCHAR bios_smbiosbiosversionW
[] =
517 static const WCHAR bios_versionW
[] =
518 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
519 static const WCHAR cdromdrive_nameW
[] =
520 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
521 static const WCHAR cdromdrive_pnpdeviceidW
[]=
522 {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
523 '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
524 '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
525 'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
526 static const WCHAR compsys_descriptionW
[] =
527 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
528 static const WCHAR compsys_domainW
[] =
529 {'W','O','R','K','G','R','O','U','P',0};
530 static const WCHAR compsys_manufacturerW
[] =
531 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
532 static const WCHAR compsys_modelW
[] =
534 static const WCHAR diskdrive_interfacetypeW
[] =
536 static const WCHAR diskdrive_manufacturerW
[] =
537 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
538 static const WCHAR diskdrive_mediatype_fixedW
[] =
539 {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
540 static const WCHAR diskdrive_mediatype_removableW
[] =
541 {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
542 static const WCHAR diskdrive_modelW
[] =
543 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
544 static const WCHAR diskdrive_serialW
[] =
545 {'W','I','N','E','H','D','I','S','K',0};
546 static const WCHAR networkadapter_pnpdeviceidW
[]=
547 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
548 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
549 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
550 static const WCHAR os_32bitW
[] =
551 {'3','2','-','b','i','t',0};
552 static const WCHAR os_64bitW
[] =
553 {'6','4','-','b','i','t',0};
554 static const WCHAR os_buildnumberW
[] =
556 static const WCHAR os_captionW
[] =
557 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
558 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
559 static const WCHAR os_csdversionW
[] =
560 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
561 static const WCHAR os_installdateW
[] =
562 {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
563 static const WCHAR os_nameW
[] =
564 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
565 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
566 '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
567 '\\','P','a','r','t','i','t','i','o','n','1',0};
568 static const WCHAR os_serialnumberW
[] =
569 {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
570 static const WCHAR os_versionW
[] =
571 {'5','.','1','.','2','6','0','0',0};
572 static const WCHAR physicalmedia_tagW
[] =
573 {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
574 static const WCHAR sounddevice_productnameW
[] =
575 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
576 static const WCHAR videocontroller_dactypeW
[] =
577 {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
578 static const WCHAR videocontroller_deviceidW
[] =
579 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
581 #include "pshpack1.h"
582 struct record_baseboard
584 const WCHAR
*manufacturer
;
587 const WCHAR
*serialnumber
;
592 const WCHAR
*description
;
593 const WCHAR
*identificationcode
;
594 const WCHAR
*manufacturer
;
595 const WCHAR
*releasedate
;
596 const WCHAR
*serialnumber
;
597 const WCHAR
*smbiosbiosversion
;
598 const WCHAR
*version
;
600 struct record_cdromdrive
602 const WCHAR
*device_id
;
605 const WCHAR
*pnpdevice_id
;
607 struct record_computersystem
609 const WCHAR
*description
;
612 const WCHAR
*manufacturer
;
615 UINT32 num_logical_processors
;
616 UINT32 num_processors
;
617 UINT64 total_physical_memory
;
619 struct record_datafile
622 const WCHAR
*version
;
624 struct record_directory
629 struct record_diskdrive
631 const WCHAR
*device_id
;
633 const WCHAR
*interfacetype
;
634 const WCHAR
*manufacturer
;
635 const WCHAR
*mediatype
;
637 const WCHAR
*serialnumber
;
640 struct record_diskpartition
644 const WCHAR
*device_id
;
647 const WCHAR
*pnpdevice_id
;
649 UINT64 startingoffset
;
652 struct record_logicaldisk
654 const WCHAR
*device_id
;
656 const WCHAR
*filesystem
;
660 const WCHAR
*volumeserialnumber
;
662 struct record_networkadapter
664 const WCHAR
*adaptertype
;
665 const WCHAR
*device_id
;
667 UINT32 interface_index
;
668 const WCHAR
*mac_address
;
669 const WCHAR
*manufacturer
;
671 UINT16 netconnection_status
;
673 const WCHAR
*pnpdevice_id
;
676 struct record_networkadapterconfig
679 UINT32 ipconnectionmetric
;
681 const WCHAR
*mac_address
;
683 struct record_operatingsystem
685 const WCHAR
*buildnumber
;
686 const WCHAR
*caption
;
687 const WCHAR
*codeset
;
688 const WCHAR
*countrycode
;
689 const WCHAR
*csdversion
;
690 const WCHAR
*installdate
;
691 const WCHAR
*lastbootuptime
;
692 const WCHAR
*localdatetime
;
695 const WCHAR
*osarchitecture
;
697 UINT32 osproductsuite
;
699 const WCHAR
*serialnumber
;
700 UINT16 servicepackmajor
;
701 UINT16 servicepackminor
;
703 const WCHAR
*systemdirectory
;
704 const WCHAR
*version
;
711 const WCHAR
*parameter
;
716 struct record_physicalmedia
718 const WCHAR
*serialnumber
;
721 struct record_physicalmemory
725 struct record_process
727 const WCHAR
*caption
;
728 const WCHAR
*commandline
;
729 const WCHAR
*description
;
736 class_method
*get_owner
;
738 struct record_processor
742 const WCHAR
*device_id
;
744 const WCHAR
*manufacturer
;
745 UINT32 maxclockspeed
;
748 UINT32 num_logical_processors
;
749 const WCHAR
*processor_id
;
750 const WCHAR
*unique_id
;
752 struct record_qualifier
760 const WCHAR
*strvalue
;
762 struct record_service
766 const WCHAR
*displayname
;
769 const WCHAR
*servicetype
;
770 const WCHAR
*startmode
;
772 const WCHAR
*systemname
;
774 class_method
*pause_service
;
775 class_method
*resume_service
;
776 class_method
*start_service
;
777 class_method
*stop_service
;
779 struct record_sounddevice
782 const WCHAR
*productname
;
784 struct record_stdregprov
786 class_method
*enumkey
;
787 class_method
*enumvalues
;
788 class_method
*getstringvalue
;
790 struct record_videocontroller
792 const WCHAR
*adapter_dactype
;
794 UINT32 current_bitsperpixel
;
795 UINT32 current_horizontalres
;
796 UINT32 current_verticalres
;
797 const WCHAR
*description
;
798 const WCHAR
*device_id
;
800 const WCHAR
*pnpdevice_id
;
804 static const struct record_baseboard data_baseboard
[] =
806 { baseboard_manufacturerW
, baseboard_tagW
, baseboard_tagW
, baseboard_serialnumberW
, baseboard_tagW
}
808 static const struct record_bios data_bios
[] =
810 { bios_descriptionW
, bios_descriptionW
, bios_manufacturerW
, bios_releasedateW
, bios_serialnumberW
,
811 bios_smbiosbiosversionW
, bios_versionW
}
813 static const struct record_param data_param
[] =
815 { class_processW
, method_getownerW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
816 { class_processW
, method_getownerW
, -1, param_userW
, CIM_STRING
},
817 { class_processW
, method_getownerW
, -1, param_domainW
, CIM_STRING
},
818 { class_serviceW
, method_pauseserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
819 { class_serviceW
, method_resumeserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
820 { class_serviceW
, method_startserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
821 { class_serviceW
, method_stopserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
822 { class_stdregprovW
, method_enumkeyW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
823 { class_stdregprovW
, method_enumkeyW
, 1, param_subkeynameW
, CIM_STRING
},
824 { class_stdregprovW
, method_enumkeyW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
825 { class_stdregprovW
, method_enumkeyW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
826 { class_stdregprovW
, method_enumvaluesW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
827 { class_stdregprovW
, method_enumvaluesW
, 1, param_subkeynameW
, CIM_STRING
},
828 { class_stdregprovW
, method_enumvaluesW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
829 { class_stdregprovW
, method_enumvaluesW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
830 { class_stdregprovW
, method_enumvaluesW
, -1, param_typesW
, CIM_SINT32
|CIM_FLAG_ARRAY
},
831 { class_stdregprovW
, method_getstringvalueW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
832 { class_stdregprovW
, method_getstringvalueW
, 1, param_subkeynameW
, CIM_STRING
},
833 { class_stdregprovW
, method_getstringvalueW
, 1, param_valuenameW
, CIM_STRING
},
834 { class_stdregprovW
, method_getstringvalueW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
835 { class_stdregprovW
, method_getstringvalueW
, -1, param_valueW
, CIM_STRING
}
838 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
839 WBEM_FLAVOR_ORIGIN_PROPAGATED)
841 static const struct record_physicalmedia data_physicalmedia
[] =
843 { diskdrive_serialW
, physicalmedia_tagW
}
845 static const struct record_qualifier data_qualifier
[] =
847 { class_process_getowner_outW
, param_userW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 0 },
848 { class_process_getowner_outW
, param_domainW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 1 }
850 static const struct record_sounddevice data_sounddevice
[] =
852 { sounddevice_productnameW
, sounddevice_productnameW
}
854 static const struct record_stdregprov data_stdregprov
[] =
856 { reg_enum_key
, reg_enum_values
, reg_get_stringvalue
}
859 /* check if row matches condition and update status */
860 static BOOL
match_row( const struct table
*table
, UINT row
, const struct expr
*cond
, enum fill_status
*status
)
867 *status
= FILL_STATUS_UNFILTERED
;
870 if (eval_cond( table
, row
, cond
, &val
, &type
) != S_OK
)
872 *status
= FILL_STATUS_FAILED
;
875 *status
= FILL_STATUS_FILTERED
;
879 static BOOL
resize_table( struct table
*table
, UINT row_count
, UINT row_size
)
881 if (!table
->num_rows_allocated
)
883 if (!(table
->data
= heap_alloc( row_count
* row_size
))) return FALSE
;
884 table
->num_rows_allocated
= row_count
;
887 if (row_count
>= table
->num_rows_allocated
)
890 UINT count
= table
->num_rows_allocated
* 2;
891 if (!(data
= heap_realloc( table
->data
, count
* row_size
))) return FALSE
;
893 table
->num_rows_allocated
= count
;
898 static enum fill_status
fill_cdromdrive( struct table
*table
, const struct expr
*cond
)
900 static const WCHAR fmtW
[] = {'%','c',':',0};
901 WCHAR drive
[3], root
[] = {'A',':','\\',0};
902 struct record_cdromdrive
*rec
;
903 UINT i
, row
= 0, offset
= 0;
904 DWORD drives
= GetLogicalDrives();
905 enum fill_status status
= FILL_STATUS_UNFILTERED
;
907 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
909 for (i
= 0; i
< sizeof(drives
); i
++)
911 if (drives
& (1 << i
))
914 if (GetDriveTypeW( root
) != DRIVE_CDROM
)
917 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
919 rec
= (struct record_cdromdrive
*)(table
->data
+ offset
);
920 rec
->device_id
= cdromdrive_pnpdeviceidW
;
921 sprintfW( drive
, fmtW
, 'A' + i
);
922 rec
->drive
= heap_strdupW( drive
);
923 rec
->name
= cdromdrive_nameW
;
924 rec
->pnpdevice_id
= cdromdrive_pnpdeviceidW
;
925 if (!match_row( table
, row
, cond
, &status
))
927 free_row_values( table
, row
);
930 offset
+= sizeof(*rec
);
934 TRACE("created %u rows\n", row
);
935 table
->num_rows
= row
;
939 static UINT
get_processor_count(void)
941 SYSTEM_BASIC_INFORMATION info
;
943 if (NtQuerySystemInformation( SystemBasicInformation
, &info
, sizeof(info
), NULL
)) return 1;
944 return info
.NumberOfProcessors
;
947 static UINT
get_logical_processor_count( UINT
*num_cores
)
949 SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*info
;
950 UINT i
, j
, count
= 0;
954 if (num_cores
) *num_cores
= get_processor_count();
955 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, NULL
, 0, &len
);
956 if (status
!= STATUS_INFO_LENGTH_MISMATCH
) return get_processor_count();
958 if (!(info
= heap_alloc( len
))) return get_processor_count();
959 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, info
, len
, &len
);
960 if (status
!= STATUS_SUCCESS
)
963 return get_processor_count();
965 if (num_cores
) *num_cores
= 0;
966 for (i
= 0; i
< len
/ sizeof(*info
); i
++)
968 if (info
[i
].Relationship
== RelationProcessorCore
)
970 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) count
++;
972 else if (info
[i
].Relationship
== RelationProcessorPackage
&& num_cores
)
974 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) (*num_cores
)++;
981 static UINT64
get_total_physical_memory(void)
983 MEMORYSTATUSEX status
;
985 status
.dwLength
= sizeof(status
);
986 if (!GlobalMemoryStatusEx( &status
)) return 1024 * 1024 * 1024;
987 return status
.ullTotalPhys
;
990 static WCHAR
*get_computername(void)
993 DWORD size
= MAX_COMPUTERNAME_LENGTH
;
995 if (!(ret
= heap_alloc( size
* sizeof(WCHAR
) ))) return NULL
;
996 GetComputerNameW( ret
, &size
);
1000 static enum fill_status
fill_compsys( struct table
*table
, const struct expr
*cond
)
1002 struct record_computersystem
*rec
;
1003 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1006 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1008 rec
= (struct record_computersystem
*)table
->data
;
1009 rec
->description
= compsys_descriptionW
;
1010 rec
->domain
= compsys_domainW
;
1011 rec
->domainrole
= 0; /* standalone workstation */
1012 rec
->manufacturer
= compsys_manufacturerW
;
1013 rec
->model
= compsys_modelW
;
1014 rec
->name
= get_computername();
1015 rec
->num_logical_processors
= get_logical_processor_count( NULL
);
1016 rec
->num_processors
= get_processor_count();
1017 rec
->total_physical_memory
= get_total_physical_memory();
1018 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
1021 TRACE("created %u rows\n", row
);
1022 table
->num_rows
= row
;
1034 static struct dirstack
*alloc_dirstack( UINT size
)
1036 struct dirstack
*dirstack
;
1038 if (!(dirstack
= heap_alloc( sizeof(*dirstack
) ))) return NULL
;
1039 if (!(dirstack
->dirs
= heap_alloc( sizeof(WCHAR
*) * size
)))
1041 heap_free( dirstack
);
1044 if (!(dirstack
->len_dirs
= heap_alloc( sizeof(UINT
) * size
)))
1046 heap_free( dirstack
->dirs
);
1047 heap_free( dirstack
);
1050 dirstack
->num_dirs
= 0;
1051 dirstack
->num_allocated
= size
;
1055 static void clear_dirstack( struct dirstack
*dirstack
)
1058 for (i
= 0; i
< dirstack
->num_dirs
; i
++) heap_free( dirstack
->dirs
[i
] );
1059 dirstack
->num_dirs
= 0;
1062 static void free_dirstack( struct dirstack
*dirstack
)
1064 clear_dirstack( dirstack
);
1065 heap_free( dirstack
->dirs
);
1066 heap_free( dirstack
->len_dirs
);
1067 heap_free( dirstack
);
1070 static BOOL
push_dir( struct dirstack
*dirstack
, WCHAR
*dir
, UINT len
)
1072 UINT size
, i
= dirstack
->num_dirs
;
1074 if (!dir
) return FALSE
;
1076 if (i
== dirstack
->num_allocated
)
1081 size
= dirstack
->num_allocated
* 2;
1082 if (!(tmp
= heap_realloc( dirstack
->dirs
, size
* sizeof(WCHAR
*) ))) return FALSE
;
1083 dirstack
->dirs
= tmp
;
1084 if (!(len_tmp
= heap_realloc( dirstack
->len_dirs
, size
* sizeof(UINT
) ))) return FALSE
;
1085 dirstack
->len_dirs
= len_tmp
;
1086 dirstack
->num_allocated
= size
;
1088 dirstack
->dirs
[i
] = dir
;
1089 dirstack
->len_dirs
[i
] = len
;
1090 dirstack
->num_dirs
++;
1094 static WCHAR
*pop_dir( struct dirstack
*dirstack
, UINT
*len
)
1096 if (!dirstack
->num_dirs
)
1101 dirstack
->num_dirs
--;
1102 *len
= dirstack
->len_dirs
[dirstack
->num_dirs
];
1103 return dirstack
->dirs
[dirstack
->num_dirs
];
1106 static const WCHAR
*peek_dir( struct dirstack
*dirstack
)
1108 if (!dirstack
->num_dirs
) return NULL
;
1109 return dirstack
->dirs
[dirstack
->num_dirs
- 1];
1112 static WCHAR
*build_glob( WCHAR drive
, const WCHAR
*path
, UINT len
)
1117 if (!(ret
= heap_alloc( (len
+ 6) * sizeof(WCHAR
) ))) return NULL
;
1123 memcpy( ret
+ i
, path
, len
* sizeof(WCHAR
) );
1132 static WCHAR
*build_name( WCHAR drive
, const WCHAR
*path
)
1134 UINT i
= 0, len
= 0;
1138 for (p
= path
; *p
; p
++)
1140 if (*p
== '\\') len
+= 2;
1143 if (!(ret
= heap_alloc( (len
+ 5) * sizeof(WCHAR
) ))) return NULL
;
1148 for (p
= path
; *p
; p
++)
1150 if (*p
!= '\\') ret
[i
++] = *p
;
1161 static WCHAR
*build_dirname( const WCHAR
*path
, UINT
*ret_len
)
1163 const WCHAR
*p
= path
, *start
;
1167 if (!isalphaW( p
[0] ) || p
[1] != ':' || p
[2] != '\\' || p
[3] != '\\' || !p
[4]) return NULL
;
1169 len
= strlenW( start
);
1170 p
= start
+ len
- 1;
1171 if (*p
== '\\') return NULL
;
1173 while (p
>= start
&& *p
!= '\\') { len
--; p
--; };
1174 while (p
>= start
&& *p
== '\\') { len
--; p
--; };
1176 if (!(ret
= heap_alloc( (len
+ 1) * sizeof(WCHAR
) ))) return NULL
;
1177 for (i
= 0, p
= start
; p
< start
+ len
; p
++)
1179 if (p
[0] == '\\' && p
[1] == '\\')
1191 static BOOL
seen_dir( struct dirstack
*dirstack
, const WCHAR
*path
)
1194 for (i
= 0; i
< dirstack
->num_dirs
; i
++) if (!strcmpW( dirstack
->dirs
[i
], path
)) return TRUE
;
1198 /* optimize queries of the form WHERE Name='...' [OR Name='...']* */
1199 static UINT
seed_dirs( struct dirstack
*dirstack
, const struct expr
*cond
, WCHAR root
, UINT
*count
)
1201 const struct expr
*left
, *right
;
1203 if (!cond
|| cond
->type
!= EXPR_COMPLEX
) return *count
= 0;
1205 left
= cond
->u
.expr
.left
;
1206 right
= cond
->u
.expr
.right
;
1207 if (cond
->u
.expr
.op
== OP_EQ
)
1211 const WCHAR
*str
= NULL
;
1213 if (left
->type
== EXPR_PROPVAL
&& right
->type
== EXPR_SVAL
&&
1214 !strcmpW( left
->u
.propval
->name
, prop_nameW
) &&
1215 toupperW( right
->u
.sval
[0] ) == toupperW( root
))
1217 str
= right
->u
.sval
;
1219 else if (left
->type
== EXPR_SVAL
&& right
->type
== EXPR_PROPVAL
&&
1220 !strcmpW( right
->u
.propval
->name
, prop_nameW
) &&
1221 toupperW( left
->u
.sval
[0] ) == toupperW( root
))
1225 if (str
&& (path
= build_dirname( str
, &len
)))
1227 if (seen_dir( dirstack
, path
))
1232 else if (push_dir( dirstack
, path
, len
)) return ++*count
;
1237 else if (cond
->u
.expr
.op
== OP_OR
)
1239 UINT left_count
= 0, right_count
= 0;
1241 if (!(seed_dirs( dirstack
, left
, root
, &left_count
))) return *count
= 0;
1242 if (!(seed_dirs( dirstack
, right
, root
, &right_count
))) return *count
= 0;
1243 return *count
+= left_count
+ right_count
;
1248 static WCHAR
*append_path( const WCHAR
*path
, const WCHAR
*segment
, UINT
*len
)
1250 UINT len_path
= 0, len_segment
= strlenW( segment
);
1254 if (path
) len_path
= strlenW( path
);
1255 if (!(ret
= heap_alloc( (len_path
+ len_segment
+ 2) * sizeof(WCHAR
) ))) return NULL
;
1256 if (path
&& len_path
)
1258 memcpy( ret
, path
, len_path
* sizeof(WCHAR
) );
1259 ret
[len_path
] = '\\';
1260 *len
+= len_path
+ 1;
1262 memcpy( ret
+ *len
, segment
, len_segment
* sizeof(WCHAR
) );
1263 *len
+= len_segment
;
1268 static WCHAR
*get_file_version( const WCHAR
*filename
)
1270 static const WCHAR slashW
[] = {'\\',0}, fmtW
[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
1271 VS_FIXEDFILEINFO
*info
;
1276 if (!(ret
= heap_alloc( (4 * 5 + sizeof(fmtW
) / sizeof(fmtW
[0])) * sizeof(WCHAR
) ))) return NULL
;
1277 if (!(size
= GetFileVersionInfoSizeW( filename
, NULL
)) || !(block
= heap_alloc( size
)))
1282 if (!GetFileVersionInfoW( filename
, 0, size
, block
) ||
1283 !VerQueryValueW( block
, slashW
, (void **)&info
, &size
))
1289 sprintfW( ret
, fmtW
, info
->dwFileVersionMS
>> 16, info
->dwFileVersionMS
& 0xffff,
1290 info
->dwFileVersionLS
>> 16, info
->dwFileVersionLS
& 0xffff );
1295 static enum fill_status
fill_datafile( struct table
*table
, const struct expr
*cond
)
1297 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1298 struct record_datafile
*rec
;
1299 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1300 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1301 DWORD drives
= GetLogicalDrives();
1302 WIN32_FIND_DATAW data
;
1304 struct dirstack
*dirstack
;
1305 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1307 if (!resize_table( table
, 8, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1309 dirstack
= alloc_dirstack(2);
1311 for (i
= 0; i
< sizeof(drives
); i
++)
1313 if (!(drives
& (1 << i
))) continue;
1316 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1318 num_expected_rows
= 0;
1319 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1323 path
= pop_dir( dirstack
, &len
);
1324 if (!(glob
= build_glob( root
[0], path
, len
)))
1326 status
= FILL_STATUS_FAILED
;
1329 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1333 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1335 status
= FILL_STATUS_FAILED
;
1336 FindClose( handle
);
1339 if (!strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
)) continue;
1340 new_path
= append_path( path
, data
.cFileName
, &len
);
1342 if (data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
1344 if (push_dir( dirstack
, new_path
, len
)) continue;
1345 heap_free( new_path
);
1346 FindClose( handle
);
1347 status
= FILL_STATUS_FAILED
;
1350 rec
= (struct record_datafile
*)(table
->data
+ offset
);
1351 rec
->name
= build_name( root
[0], new_path
);
1352 rec
->version
= get_file_version( rec
->name
);
1353 if (!match_row( table
, row
, cond
, &status
))
1355 free_row_values( table
, row
);
1358 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1361 FindClose( handle
);
1362 status
= FILL_STATUS_FILTERED
;
1365 offset
+= sizeof(*rec
);
1368 while (FindNextFileW( handle
, &data
));
1369 FindClose( handle
);
1371 if (!peek_dir( dirstack
)) break;
1378 free_dirstack( dirstack
);
1382 TRACE("created %u rows\n", row
);
1383 table
->num_rows
= row
;
1387 static enum fill_status
fill_directory( struct table
*table
, const struct expr
*cond
)
1389 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1390 struct record_directory
*rec
;
1391 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1392 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1393 DWORD drives
= GetLogicalDrives();
1394 WIN32_FIND_DATAW data
;
1396 struct dirstack
*dirstack
;
1397 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1399 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1401 dirstack
= alloc_dirstack(2);
1403 for (i
= 0; i
< sizeof(drives
); i
++)
1405 if (!(drives
& (1 << i
))) continue;
1408 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1410 num_expected_rows
= 0;
1411 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1415 path
= pop_dir( dirstack
, &len
);
1416 if (!(glob
= build_glob( root
[0], path
, len
)))
1418 status
= FILL_STATUS_FAILED
;
1421 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1425 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1427 FindClose( handle
);
1428 status
= FILL_STATUS_FAILED
;
1431 if (!(data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
) ||
1432 !strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
))
1435 new_path
= append_path( path
, data
.cFileName
, &len
);
1436 if (!(push_dir( dirstack
, new_path
, len
)))
1438 heap_free( new_path
);
1439 FindClose( handle
);
1440 status
= FILL_STATUS_FAILED
;
1443 rec
= (struct record_directory
*)(table
->data
+ offset
);
1444 rec
->accessmask
= FILE_ALL_ACCESS
;
1445 rec
->name
= build_name( root
[0], new_path
);
1446 if (!match_row( table
, row
, cond
, &status
))
1448 free_row_values( table
, row
);
1451 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1454 FindClose( handle
);
1455 status
= FILL_STATUS_FILTERED
;
1458 offset
+= sizeof(*rec
);
1461 while (FindNextFileW( handle
, &data
));
1462 FindClose( handle
);
1464 if (!peek_dir( dirstack
)) break;
1471 free_dirstack( dirstack
);
1475 TRACE("created %u rows\n", row
);
1476 table
->num_rows
= row
;
1480 static UINT64
get_freespace( const WCHAR
*dir
, UINT64
*disksize
)
1482 WCHAR root
[] = {'\\','\\','.','\\','A',':',0};
1483 ULARGE_INTEGER free
;
1484 DISK_GEOMETRY_EX info
;
1487 free
.QuadPart
= 512 * 1024 * 1024;
1488 GetDiskFreeSpaceExW( dir
, NULL
, NULL
, &free
);
1491 handle
= CreateFileW( root
, GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
, OPEN_EXISTING
, 0, 0 );
1492 if (handle
!= INVALID_HANDLE_VALUE
)
1494 if (DeviceIoControl( handle
, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
, NULL
, 0, &info
, sizeof(info
), NULL
, NULL
))
1495 *disksize
= info
.DiskSize
.QuadPart
;
1496 CloseHandle( handle
);
1498 return free
.QuadPart
;
1501 static enum fill_status
fill_diskdrive( struct table
*table
, const struct expr
*cond
)
1503 static const WCHAR fmtW
[] =
1504 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
1505 WCHAR device_id
[sizeof(fmtW
)/sizeof(fmtW
[0]) + 10], root
[] = {'A',':','\\',0};
1506 struct record_diskdrive
*rec
;
1507 UINT i
, row
= 0, offset
= 0, index
= 0, type
;
1508 UINT64 size
= 1024 * 1024 * 1024;
1509 DWORD drives
= GetLogicalDrives();
1510 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1512 if (!resize_table( table
, 2, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1514 for (i
= 0; i
< sizeof(drives
); i
++)
1516 if (drives
& (1 << i
))
1519 type
= GetDriveTypeW( root
);
1520 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1523 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1525 rec
= (struct record_diskdrive
*)(table
->data
+ offset
);
1526 sprintfW( device_id
, fmtW
, index
);
1527 rec
->device_id
= heap_strdupW( device_id
);
1529 rec
->interfacetype
= diskdrive_interfacetypeW
;
1530 rec
->manufacturer
= diskdrive_manufacturerW
;
1531 if (type
== DRIVE_FIXED
)
1532 rec
->mediatype
= diskdrive_mediatype_fixedW
;
1534 rec
->mediatype
= diskdrive_mediatype_removableW
;
1535 rec
->model
= diskdrive_modelW
;
1536 rec
->serialnumber
= diskdrive_serialW
;
1537 get_freespace( root
, &size
);
1539 if (!match_row( table
, row
, cond
, &status
))
1541 free_row_values( table
, row
);
1544 offset
+= sizeof(*rec
);
1549 TRACE("created %u rows\n", row
);
1550 table
->num_rows
= row
;
1554 static WCHAR
*get_filesystem( const WCHAR
*root
)
1556 static const WCHAR ntfsW
[] = {'N','T','F','S',0};
1557 WCHAR buffer
[MAX_PATH
+ 1];
1559 if (GetVolumeInformationW( root
, NULL
, 0, NULL
, NULL
, NULL
, buffer
, MAX_PATH
+ 1 ))
1560 return heap_strdupW( buffer
);
1561 return heap_strdupW( ntfsW
);
1564 static enum fill_status
fill_diskpartition( struct table
*table
, const struct expr
*cond
)
1566 static const WCHAR fmtW
[] =
1567 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
1568 WCHAR device_id
[32], root
[] = {'A',':','\\',0};
1569 struct record_diskpartition
*rec
;
1570 UINT i
, row
= 0, offset
= 0, type
, index
= 0;
1571 UINT64 size
= 1024 * 1024 * 1024;
1572 DWORD drives
= GetLogicalDrives();
1573 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1575 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1577 for (i
= 0; i
< sizeof(drives
); i
++)
1579 if (drives
& (1 << i
))
1582 type
= GetDriveTypeW( root
);
1583 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1586 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1588 rec
= (struct record_diskpartition
*)(table
->data
+ offset
);
1589 rec
->bootable
= (i
== 2) ? -1 : 0;
1590 rec
->bootpartition
= (i
== 2) ? -1 : 0;
1591 sprintfW( device_id
, fmtW
, index
);
1592 rec
->device_id
= heap_strdupW( device_id
);
1593 rec
->diskindex
= index
;
1595 rec
->pnpdevice_id
= heap_strdupW( device_id
);
1596 get_freespace( root
, &size
);
1598 rec
->startingoffset
= 0;
1599 rec
->type
= get_filesystem( root
);
1600 if (!match_row( table
, row
, cond
, &status
))
1602 free_row_values( table
, row
);
1605 offset
+= sizeof(*rec
);
1610 TRACE("created %u rows\n", row
);
1611 table
->num_rows
= row
;
1615 static WCHAR
*get_volumeserialnumber( const WCHAR
*root
)
1617 static const WCHAR fmtW
[] = {'%','0','8','X',0};
1621 GetVolumeInformationW( root
, NULL
, 0, &serial
, NULL
, NULL
, NULL
, 0 );
1622 sprintfW( buffer
, fmtW
, serial
);
1623 return heap_strdupW( buffer
);
1626 static enum fill_status
fill_logicaldisk( struct table
*table
, const struct expr
*cond
)
1628 static const WCHAR fmtW
[] = {'%','c',':',0};
1629 WCHAR device_id
[3], root
[] = {'A',':','\\',0};
1630 struct record_logicaldisk
*rec
;
1631 UINT i
, row
= 0, offset
= 0, type
;
1632 UINT64 size
= 1024 * 1024 * 1024;
1633 DWORD drives
= GetLogicalDrives();
1634 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1636 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1638 for (i
= 0; i
< sizeof(drives
); i
++)
1640 if (drives
& (1 << i
))
1643 type
= GetDriveTypeW( root
);
1644 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_CDROM
&& type
!= DRIVE_REMOVABLE
)
1647 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1649 rec
= (struct record_logicaldisk
*)(table
->data
+ offset
);
1650 sprintfW( device_id
, fmtW
, 'A' + i
);
1651 rec
->device_id
= heap_strdupW( device_id
);
1652 rec
->drivetype
= type
;
1653 rec
->filesystem
= get_filesystem( root
);
1654 rec
->freespace
= get_freespace( root
, &size
);
1655 rec
->name
= heap_strdupW( device_id
);
1657 rec
->volumeserialnumber
= get_volumeserialnumber( root
);
1658 if (!match_row( table
, row
, cond
, &status
))
1660 free_row_values( table
, row
);
1663 offset
+= sizeof(*rec
);
1667 TRACE("created %u rows\n", row
);
1668 table
->num_rows
= row
;
1672 static UINT16
get_connection_status( IF_OPER_STATUS status
)
1676 case IfOperStatusDown
:
1677 return 0; /* Disconnected */
1678 case IfOperStatusUp
:
1679 return 2; /* Connected */
1681 ERR("unhandled status %u\n", status
);
1686 static WCHAR
*get_mac_address( const BYTE
*addr
, DWORD len
)
1688 static const WCHAR fmtW
[] =
1689 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
1690 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
1693 if (len
!= 6 || !(ret
= heap_alloc( 18 * sizeof(WCHAR
) ))) return NULL
;
1694 sprintfW( ret
, fmtW
, addr
[0], addr
[1], addr
[2], addr
[3], addr
[4], addr
[5] );
1697 static const WCHAR
*get_adaptertype( DWORD type
, int *physical
)
1699 static const WCHAR ethernetW
[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
1700 static const WCHAR wirelessW
[] = {'W','i','r','e','l','e','s','s',0};
1701 static const WCHAR firewireW
[] = {'1','3','9','4',0};
1702 static const WCHAR tunnelW
[] = {'T','u','n','n','e','l',0};
1706 case IF_TYPE_ETHERNET_CSMACD
: *physical
= -1; return ethernetW
;
1707 case IF_TYPE_IEEE80211
: *physical
= -1; return wirelessW
;
1708 case IF_TYPE_IEEE1394
: *physical
= -1; return firewireW
;
1709 case IF_TYPE_TUNNEL
: *physical
= 0; return tunnelW
;
1710 default: *physical
= 0; return NULL
;
1714 static enum fill_status
fill_networkadapter( struct table
*table
, const struct expr
*cond
)
1716 static const WCHAR fmtW
[] = {'%','u',0};
1717 WCHAR device_id
[11];
1718 struct record_networkadapter
*rec
;
1719 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
1720 UINT row
= 0, offset
= 0, count
= 0;
1721 DWORD size
= 0, ret
;
1723 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1725 ret
= GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, NULL
, &size
);
1726 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
1728 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
1729 if (GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, buffer
, &size
))
1731 heap_free( buffer
);
1732 return FILL_STATUS_FAILED
;
1734 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1736 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
1738 if (!resize_table( table
, count
, sizeof(*rec
) ))
1740 heap_free( buffer
);
1741 return FILL_STATUS_FAILED
;
1743 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1745 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
1747 rec
= (struct record_networkadapter
*)(table
->data
+ offset
);
1748 sprintfW( device_id
, fmtW
, aa
->u
.s
.IfIndex
);
1749 rec
->adaptertype
= get_adaptertype( aa
->IfType
, &physical
);
1750 rec
->device_id
= heap_strdupW( device_id
);
1751 rec
->index
= aa
->u
.s
.IfIndex
;
1752 rec
->interface_index
= aa
->u
.s
.IfIndex
;
1753 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
1754 rec
->manufacturer
= compsys_manufacturerW
;
1755 rec
->name
= heap_strdupW( aa
->FriendlyName
);
1756 rec
->netconnection_status
= get_connection_status( aa
->OperStatus
);
1757 rec
->physicaladapter
= physical
;
1758 rec
->pnpdevice_id
= networkadapter_pnpdeviceidW
;
1759 rec
->speed
= 1000000;
1760 if (!match_row( table
, row
, cond
, &status
))
1762 free_row_values( table
, row
);
1765 offset
+= sizeof(*rec
);
1768 TRACE("created %u rows\n", row
);
1769 table
->num_rows
= row
;
1771 heap_free( buffer
);
1775 static enum fill_status
fill_networkadapterconfig( struct table
*table
, const struct expr
*cond
)
1777 struct record_networkadapterconfig
*rec
;
1778 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
1779 UINT row
= 0, offset
= 0, count
= 0;
1780 DWORD size
= 0, ret
;
1781 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1783 ret
= GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, NULL
, &size
);
1784 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
1786 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
1787 if (GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, buffer
, &size
))
1789 heap_free( buffer
);
1790 return FILL_STATUS_FAILED
;
1792 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1794 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
1796 if (!resize_table( table
, count
, sizeof(*rec
) ))
1798 heap_free( buffer
);
1799 return FILL_STATUS_FAILED
;
1801 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1803 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
1805 rec
= (struct record_networkadapterconfig
*)(table
->data
+ offset
);
1806 rec
->index
= aa
->u
.s
.IfIndex
;
1807 rec
->ipconnectionmetric
= 20;
1808 rec
->ipenabled
= -1;
1809 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
1810 if (!match_row( table
, row
, cond
, &status
))
1812 free_row_values( table
, row
);
1815 offset
+= sizeof(*rec
);
1818 TRACE("created %u rows\n", row
);
1819 table
->num_rows
= row
;
1821 heap_free( buffer
);
1825 static enum fill_status
fill_physicalmemory( struct table
*table
, const struct expr
*cond
)
1827 struct record_physicalmemory
*rec
;
1828 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1831 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1833 rec
= (struct record_physicalmemory
*)table
->data
;
1834 rec
->capacity
= get_total_physical_memory();
1835 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
1838 TRACE("created %u rows\n", row
);
1839 table
->num_rows
= row
;
1843 static WCHAR
*get_cmdline( DWORD process_id
)
1845 if (process_id
== GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
1846 return NULL
; /* FIXME handle different process case */
1849 static enum fill_status
fill_process( struct table
*table
, const struct expr
*cond
)
1851 static const WCHAR fmtW
[] = {'%','u',0};
1853 struct record_process
*rec
;
1854 PROCESSENTRY32W entry
;
1856 enum fill_status status
= FILL_STATUS_FAILED
;
1857 UINT row
= 0, offset
= 0;
1859 snap
= CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS
, 0 );
1860 if (snap
== INVALID_HANDLE_VALUE
) return FILL_STATUS_FAILED
;
1862 entry
.dwSize
= sizeof(entry
);
1863 if (!Process32FirstW( snap
, &entry
)) goto done
;
1864 if (!resize_table( table
, 8, sizeof(*rec
) )) goto done
;
1868 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) goto done
;
1870 rec
= (struct record_process
*)(table
->data
+ offset
);
1871 rec
->caption
= heap_strdupW( entry
.szExeFile
);
1872 rec
->commandline
= get_cmdline( entry
.th32ProcessID
);
1873 rec
->description
= heap_strdupW( entry
.szExeFile
);
1874 sprintfW( handle
, fmtW
, entry
.th32ProcessID
);
1875 rec
->handle
= heap_strdupW( handle
);
1876 rec
->name
= heap_strdupW( entry
.szExeFile
);
1877 rec
->process_id
= entry
.th32ProcessID
;
1878 rec
->pprocess_id
= entry
.th32ParentProcessID
;
1879 rec
->thread_count
= entry
.cntThreads
;
1880 rec
->get_owner
= process_get_owner
;
1881 if (!match_row( table
, row
, cond
, &status
))
1883 free_row_values( table
, row
);
1886 offset
+= sizeof(*rec
);
1888 } while (Process32NextW( snap
, &entry
));
1890 TRACE("created %u rows\n", row
);
1891 table
->num_rows
= row
;
1892 status
= FILL_STATUS_UNFILTERED
;
1895 CloseHandle( snap
);
1899 static inline void do_cpuid( unsigned int ax
, unsigned int *p
)
1902 __asm__("pushl %%ebx\n\t"
1904 "movl %%ebx, %%esi\n\t"
1906 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
1911 static void get_processor_id( WCHAR
*processor_id
)
1913 static const WCHAR fmtW
[] = {'%','0','8','X','%','0','8','X',0};
1914 unsigned int regs
[4] = {0, 0, 0, 0};
1916 do_cpuid( 1, regs
);
1917 sprintfW( processor_id
, fmtW
, regs
[3], regs
[0] );
1919 static void regs_to_str( unsigned int *regs
, unsigned int len
, WCHAR
*buffer
)
1922 unsigned char *p
= (unsigned char *)regs
;
1924 for (i
= 0; i
< len
; i
++) { buffer
[i
] = *p
++; }
1927 static void get_processor_manufacturer( WCHAR
*manufacturer
)
1929 unsigned int tmp
, regs
[4] = {0, 0, 0, 0};
1931 do_cpuid( 0, regs
);
1932 tmp
= regs
[2]; /* swap edx and ecx */
1936 regs_to_str( regs
+ 1, 12, manufacturer
);
1938 static void get_processor_name( WCHAR
*name
)
1940 unsigned int regs
[4] = {0, 0, 0, 0};
1942 do_cpuid( 0x80000000, regs
);
1943 if (regs
[0] >= 0x80000004)
1945 do_cpuid( 0x80000002, regs
);
1946 regs_to_str( regs
, 16, name
);
1947 do_cpuid( 0x80000003, regs
);
1948 regs_to_str( regs
, 16, name
+ 16 );
1949 do_cpuid( 0x80000004, regs
);
1950 regs_to_str( regs
, 16, name
+ 32 );
1953 static UINT
get_processor_maxclockspeed( void )
1955 PROCESSOR_POWER_INFORMATION
*info
;
1956 UINT ret
= 1000, size
= get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION
);
1959 if ((info
= heap_alloc( size
)))
1961 status
= NtPowerInformation( ProcessorInformation
, NULL
, 0, info
, size
);
1962 if (!status
) ret
= info
[0].MaxMhz
;
1967 static const WCHAR
*get_osarchitecture(void)
1970 GetNativeSystemInfo( &info
);
1971 if (info
.u
.s
.wProcessorArchitecture
== PROCESSOR_ARCHITECTURE_AMD64
) return os_64bitW
;
1975 static enum fill_status
fill_processor( struct table
*table
, const struct expr
*cond
)
1977 static const WCHAR fmtW
[] = {'C','P','U','%','u',0};
1978 WCHAR device_id
[14], processor_id
[17], manufacturer
[13], name
[49] = {0};
1979 struct record_processor
*rec
;
1980 UINT i
, offset
= 0, maxclockspeed
, num_cores
, num_logical_processors
, count
= get_processor_count();
1981 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1983 if (!resize_table( table
, count
, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1985 get_processor_id( processor_id
);
1986 get_processor_manufacturer( manufacturer
);
1987 get_processor_name( name
);
1989 maxclockspeed
= get_processor_maxclockspeed();
1990 num_logical_processors
= get_logical_processor_count( &num_cores
) / count
;
1993 for (i
= 0; i
< count
; i
++)
1995 rec
= (struct record_processor
*)(table
->data
+ offset
);
1996 rec
->addresswidth
= get_osarchitecture() == os_32bitW
? 32 : 64;
1997 rec
->cpu_status
= 1; /* CPU Enabled */
1998 sprintfW( device_id
, fmtW
, i
);
1999 rec
->device_id
= heap_strdupW( device_id
);
2000 rec
->family
= 2; /* Unknown */
2001 rec
->manufacturer
= heap_strdupW( manufacturer
);
2002 rec
->maxclockspeed
= maxclockspeed
;
2003 rec
->name
= heap_strdupW( name
);
2004 rec
->num_cores
= num_cores
;
2005 rec
->num_logical_processors
= num_logical_processors
;
2006 rec
->processor_id
= heap_strdupW( processor_id
);
2007 rec
->unique_id
= NULL
;
2008 if (!match_row( table
, i
, cond
, &status
))
2010 free_row_values( table
, i
);
2013 offset
+= sizeof(*rec
);
2016 TRACE("created %u rows\n", count
);
2017 table
->num_rows
= count
;
2021 static WCHAR
*get_lastbootuptime(void)
2023 static const WCHAR fmtW
[] =
2024 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2025 '.','%','0','6','u','+','0','0','0',0};
2026 SYSTEM_TIMEOFDAY_INFORMATION ti
;
2030 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2032 NtQuerySystemInformation( SystemTimeOfDayInformation
, &ti
, sizeof(ti
), NULL
);
2033 RtlTimeToTimeFields( &ti
.liKeBootTime
, &tf
);
2034 sprintfW( ret
, fmtW
, tf
.Year
, tf
.Month
, tf
.Day
, tf
.Hour
, tf
.Minute
, tf
.Second
, tf
.Milliseconds
* 1000 );
2037 static WCHAR
*get_localdatetime(void)
2039 static const WCHAR fmtW
[] =
2040 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2041 '.','%','0','6','u','%','+','0','3','d',0};
2042 TIME_ZONE_INFORMATION tzi
;
2048 Status
= GetTimeZoneInformation(&tzi
);
2050 if(Status
== TIME_ZONE_ID_INVALID
) return NULL
;
2052 if(Status
== TIME_ZONE_ID_DAYLIGHT
)
2053 Bias
+= tzi
.DaylightBias
;
2055 Bias
+= tzi
.StandardBias
;
2056 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2059 sprintfW( ret
, fmtW
, st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
, st
.wMilliseconds
* 1000, -Bias
);
2062 static WCHAR
*get_systemdirectory(void)
2067 if (!(ret
= heap_alloc( MAX_PATH
* sizeof(WCHAR
) ))) return NULL
;
2068 Wow64DisableWow64FsRedirection( &redir
);
2069 GetSystemDirectoryW( ret
, MAX_PATH
);
2070 Wow64RevertWow64FsRedirection( redir
);
2073 static WCHAR
*get_codeset(void)
2075 static const WCHAR fmtW
[] = {'%','u',0};
2076 WCHAR
*ret
= heap_alloc( 11 * sizeof(WCHAR
) );
2077 if (ret
) sprintfW( ret
, fmtW
, GetACP() );
2080 static WCHAR
*get_countrycode(void)
2082 WCHAR
*ret
= heap_alloc( 6 * sizeof(WCHAR
) );
2083 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ICOUNTRY
, ret
, 6 );
2086 static WCHAR
*get_locale(void)
2088 WCHAR
*ret
= heap_alloc( 5 * sizeof(WCHAR
) );
2089 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ILANGUAGE
, ret
, 5 );
2093 static enum fill_status
fill_os( struct table
*table
, const struct expr
*cond
)
2095 struct record_operatingsystem
*rec
;
2096 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2099 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2101 rec
= (struct record_operatingsystem
*)table
->data
;
2102 rec
->buildnumber
= os_buildnumberW
;
2103 rec
->caption
= os_captionW
;
2104 rec
->codeset
= get_codeset();
2105 rec
->countrycode
= get_countrycode();
2106 rec
->csdversion
= os_csdversionW
;
2107 rec
->installdate
= os_installdateW
;
2108 rec
->lastbootuptime
= get_lastbootuptime();
2109 rec
->localdatetime
= get_localdatetime();
2110 rec
->locale
= get_locale();
2111 rec
->name
= os_nameW
;
2112 rec
->osarchitecture
= get_osarchitecture();
2113 rec
->oslanguage
= GetSystemDefaultLangID();
2114 rec
->osproductsuite
= 2461140; /* Windows XP Professional */
2115 rec
->ostype
= 18; /* WINNT */
2116 rec
->serialnumber
= os_serialnumberW
;
2117 rec
->servicepackmajor
= 3;
2118 rec
->servicepackminor
= 0;
2119 rec
->suitemask
= 272; /* Single User + Terminal */
2120 rec
->systemdirectory
= get_systemdirectory();
2121 rec
->version
= os_versionW
;
2122 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2125 TRACE("created %u rows\n", row
);
2126 table
->num_rows
= row
;
2130 static const WCHAR
*get_service_type( DWORD type
)
2132 static const WCHAR filesystem_driverW
[] =
2133 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
2134 static const WCHAR kernel_driverW
[] =
2135 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
2136 static const WCHAR own_processW
[] =
2137 {'O','w','n',' ','P','r','o','c','e','s','s',0};
2138 static const WCHAR share_processW
[] =
2139 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
2141 if (type
& SERVICE_KERNEL_DRIVER
) return kernel_driverW
;
2142 else if (type
& SERVICE_FILE_SYSTEM_DRIVER
) return filesystem_driverW
;
2143 else if (type
& SERVICE_WIN32_OWN_PROCESS
) return own_processW
;
2144 else if (type
& SERVICE_WIN32_SHARE_PROCESS
) return share_processW
;
2145 else ERR("unhandled type 0x%08x\n", type
);
2148 static const WCHAR
*get_service_state( DWORD state
)
2150 static const WCHAR runningW
[] =
2151 {'R','u','n','n','i','n','g',0};
2152 static const WCHAR start_pendingW
[] =
2153 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
2154 static const WCHAR stop_pendingW
[] =
2155 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
2156 static const WCHAR stoppedW
[] =
2157 {'S','t','o','p','p','e','d',0};
2158 static const WCHAR unknownW
[] =
2159 {'U','n','k','n','o','w','n',0};
2163 case SERVICE_STOPPED
: return stoppedW
;
2164 case SERVICE_START_PENDING
: return start_pendingW
;
2165 case SERVICE_STOP_PENDING
: return stop_pendingW
;
2166 case SERVICE_RUNNING
: return runningW
;
2168 ERR("unknown state %u\n", state
);
2172 static const WCHAR
*get_service_startmode( DWORD mode
)
2174 static const WCHAR bootW
[] = {'B','o','o','t',0};
2175 static const WCHAR systemW
[] = {'S','y','s','t','e','m',0};
2176 static const WCHAR autoW
[] = {'A','u','t','o',0};
2177 static const WCHAR manualW
[] = {'M','a','n','u','a','l',0};
2178 static const WCHAR disabledW
[] = {'D','i','s','a','b','l','e','d',0};
2179 static const WCHAR unknownW
[] = {'U','n','k','n','o','w','n',0};
2183 case SERVICE_BOOT_START
: return bootW
;
2184 case SERVICE_SYSTEM_START
: return systemW
;
2185 case SERVICE_AUTO_START
: return autoW
;
2186 case SERVICE_DEMAND_START
: return manualW
;
2187 case SERVICE_DISABLED
: return disabledW
;
2189 ERR("unknown mode 0x%x\n", mode
);
2193 static QUERY_SERVICE_CONFIGW
*query_service_config( SC_HANDLE manager
, const WCHAR
*name
)
2195 QUERY_SERVICE_CONFIGW
*config
= NULL
;
2199 if (!(service
= OpenServiceW( manager
, name
, SERVICE_QUERY_CONFIG
))) return NULL
;
2200 QueryServiceConfigW( service
, NULL
, 0, &size
);
2201 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
) goto done
;
2202 if (!(config
= heap_alloc( size
))) goto done
;
2203 if (QueryServiceConfigW( service
, config
, size
, &size
)) goto done
;
2204 heap_free( config
);
2208 CloseServiceHandle( service
);
2212 static enum fill_status
fill_service( struct table
*table
, const struct expr
*cond
)
2214 struct record_service
*rec
;
2216 ENUM_SERVICE_STATUS_PROCESSW
*tmp
, *services
= NULL
;
2217 SERVICE_STATUS_PROCESS
*status
;
2218 WCHAR sysnameW
[MAX_COMPUTERNAME_LENGTH
+ 1];
2219 DWORD len
= sizeof(sysnameW
) / sizeof(sysnameW
[0]);
2220 UINT i
, row
= 0, offset
= 0, size
= 256, needed
, count
;
2221 enum fill_status fill_status
= FILL_STATUS_FAILED
;
2224 if (!(manager
= OpenSCManagerW( NULL
, NULL
, SC_MANAGER_ENUMERATE_SERVICE
))) return FILL_STATUS_FAILED
;
2225 if (!(services
= heap_alloc( size
))) goto done
;
2227 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2228 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2229 &count
, NULL
, NULL
);
2232 if (GetLastError() != ERROR_MORE_DATA
) goto done
;
2234 if (!(tmp
= heap_realloc( services
, size
))) goto done
;
2236 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2237 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2238 &count
, NULL
, NULL
);
2239 if (!ret
) goto done
;
2241 if (!resize_table( table
, count
, sizeof(*rec
) )) goto done
;
2243 GetComputerNameW( sysnameW
, &len
);
2244 fill_status
= FILL_STATUS_UNFILTERED
;
2246 for (i
= 0; i
< count
; i
++)
2248 QUERY_SERVICE_CONFIGW
*config
;
2250 if (!(config
= query_service_config( manager
, services
[i
].lpServiceName
))) continue;
2252 status
= &services
[i
].ServiceStatusProcess
;
2253 rec
= (struct record_service
*)(table
->data
+ offset
);
2254 rec
->accept_pause
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_PAUSE_CONTINUE
) ? -1 : 0;
2255 rec
->accept_stop
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_STOP
) ? -1 : 0;
2256 rec
->displayname
= heap_strdupW( services
[i
].lpDisplayName
);
2257 rec
->name
= heap_strdupW( services
[i
].lpServiceName
);
2258 rec
->process_id
= status
->dwProcessId
;
2259 rec
->servicetype
= get_service_type( status
->dwServiceType
);
2260 rec
->startmode
= get_service_startmode( config
->dwStartType
);
2261 rec
->state
= get_service_state( status
->dwCurrentState
);
2262 rec
->systemname
= heap_strdupW( sysnameW
);
2263 rec
->pause_service
= service_pause_service
;
2264 rec
->resume_service
= service_resume_service
;
2265 rec
->start_service
= service_start_service
;
2266 rec
->stop_service
= service_stop_service
;
2267 heap_free( config
);
2268 if (!match_row( table
, row
, cond
, &fill_status
))
2270 free_row_values( table
, row
);
2273 offset
+= sizeof(*rec
);
2277 TRACE("created %u rows\n", row
);
2278 table
->num_rows
= row
;
2281 CloseServiceHandle( manager
);
2282 heap_free( services
);
2286 static UINT32
get_bits_per_pixel( UINT
*hres
, UINT
*vres
)
2288 HDC hdc
= GetDC( NULL
);
2291 if (!hdc
) return 32;
2292 ret
= GetDeviceCaps( hdc
, BITSPIXEL
);
2293 *hres
= GetDeviceCaps( hdc
, HORZRES
);
2294 *vres
= GetDeviceCaps( hdc
, VERTRES
);
2295 ReleaseDC( NULL
, hdc
);
2298 static WCHAR
*get_pnpdeviceid( DXGI_ADAPTER_DESC
*desc
)
2300 static const WCHAR fmtW
[] =
2301 {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
2302 '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
2303 '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
2306 if (!(ret
= heap_alloc( sizeof(fmtW
) + 2 * sizeof(WCHAR
) ))) return NULL
;
2307 sprintfW( ret
, fmtW
, desc
->VendorId
, desc
->DeviceId
, desc
->SubSysId
, desc
->Revision
);
2311 static enum fill_status
fill_videocontroller( struct table
*table
, const struct expr
*cond
)
2314 struct record_videocontroller
*rec
;
2316 IDXGIFactory
*factory
= NULL
;
2317 IDXGIAdapter
*adapter
= NULL
;
2318 DXGI_ADAPTER_DESC desc
;
2319 UINT hres
= 1024, vres
= 768, vidmem
= 512 * 1024 * 1024;
2320 const WCHAR
*name
= videocontroller_deviceidW
;
2321 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2324 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2326 memset (&desc
, 0, sizeof(desc
));
2327 hr
= CreateDXGIFactory( &IID_IDXGIFactory
, (void **)&factory
);
2328 if (FAILED(hr
)) goto done
;
2330 hr
= IDXGIFactory_EnumAdapters( factory
, 0, &adapter
);
2331 if (FAILED(hr
)) goto done
;
2333 hr
= IDXGIAdapter_GetDesc( adapter
, &desc
);
2336 vidmem
= desc
.DedicatedVideoMemory
;
2337 name
= desc
.Description
;
2341 rec
= (struct record_videocontroller
*)table
->data
;
2342 rec
->adapter_dactype
= videocontroller_dactypeW
;
2343 rec
->adapter_ram
= vidmem
;
2344 rec
->current_bitsperpixel
= get_bits_per_pixel( &hres
, &vres
);
2345 rec
->current_horizontalres
= hres
;
2346 rec
->current_verticalres
= vres
;
2347 rec
->description
= heap_strdupW( name
);
2348 rec
->device_id
= videocontroller_deviceidW
;
2349 rec
->name
= heap_strdupW( name
);
2350 rec
->pnpdevice_id
= get_pnpdeviceid( &desc
);
2351 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2354 TRACE("created %u rows\n", row
);
2355 table
->num_rows
= row
;
2357 if (adapter
) IDXGIAdapter_Release( adapter
);
2358 if (factory
) IDXGIFactory_Release( factory
);
2362 static struct table builtin_classes
[] =
2364 { class_baseboardW
, SIZEOF(col_baseboard
), col_baseboard
, SIZEOF(data_baseboard
), 0, (BYTE
*)data_baseboard
},
2365 { class_biosW
, SIZEOF(col_bios
), col_bios
, SIZEOF(data_bios
), 0, (BYTE
*)data_bios
},
2366 { class_cdromdriveW
, SIZEOF(col_cdromdrive
), col_cdromdrive
, 0, 0, NULL
, fill_cdromdrive
},
2367 { class_compsysW
, SIZEOF(col_compsys
), col_compsys
, 0, 0, NULL
, fill_compsys
},
2368 { class_datafileW
, SIZEOF(col_datafile
), col_datafile
, 0, 0, NULL
, fill_datafile
},
2369 { class_directoryW
, SIZEOF(col_directory
), col_directory
, 0, 0, NULL
, fill_directory
},
2370 { class_diskdriveW
, SIZEOF(col_diskdrive
), col_diskdrive
, 0, 0, NULL
, fill_diskdrive
},
2371 { class_diskpartitionW
, SIZEOF(col_diskpartition
), col_diskpartition
, 0, 0, NULL
, fill_diskpartition
},
2372 { class_logicaldiskW
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
2373 { class_logicaldisk2W
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
2374 { class_networkadapterW
, SIZEOF(col_networkadapter
), col_networkadapter
, 0, 0, NULL
, fill_networkadapter
},
2375 { class_networkadapterconfigW
, SIZEOF(col_networkadapterconfig
), col_networkadapterconfig
, 0, 0, NULL
,
2376 fill_networkadapterconfig
},
2377 { class_osW
, SIZEOF(col_os
), col_os
, 0, 0, NULL
, fill_os
},
2378 { class_paramsW
, SIZEOF(col_param
), col_param
, SIZEOF(data_param
), 0, (BYTE
*)data_param
},
2379 { class_physicalmediaW
, SIZEOF(col_physicalmedia
), col_physicalmedia
, SIZEOF(data_physicalmedia
), 0, (BYTE
*)data_physicalmedia
},
2380 { class_physicalmemoryW
, SIZEOF(col_physicalmemory
), col_physicalmemory
, 0, 0, NULL
, fill_physicalmemory
},
2381 { class_processW
, SIZEOF(col_process
), col_process
, 0, 0, NULL
, fill_process
},
2382 { class_processorW
, SIZEOF(col_processor
), col_processor
, 0, 0, NULL
, fill_processor
},
2383 { class_qualifiersW
, SIZEOF(col_qualifier
), col_qualifier
, SIZEOF(data_qualifier
), 0, (BYTE
*)data_qualifier
},
2384 { class_serviceW
, SIZEOF(col_service
), col_service
, 0, 0, NULL
, fill_service
},
2385 { class_sounddeviceW
, SIZEOF(col_sounddevice
), col_sounddevice
, SIZEOF(data_sounddevice
), 0, (BYTE
*)data_sounddevice
},
2386 { class_stdregprovW
, SIZEOF(col_stdregprov
), col_stdregprov
, SIZEOF(data_stdregprov
), 0, (BYTE
*)data_stdregprov
},
2387 { class_videocontrollerW
, SIZEOF(col_videocontroller
), col_videocontroller
, 0, 0, NULL
, fill_videocontroller
}
2390 void init_table_list( void )
2392 static struct list tables
= LIST_INIT( tables
);
2395 for (i
= 0; i
< SIZEOF(builtin_classes
); i
++) list_add_tail( &tables
, &builtin_classes
[i
].entry
);
2396 table_list
= &tables
;