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_mediatypeW
, CIM_STRING
},
303 { prop_nameW
, CIM_STRING
},
304 { prop_pnpdeviceidW
, CIM_STRING
}
306 static const struct column col_compsys
[] =
308 { prop_descriptionW
, CIM_STRING
},
309 { prop_domainW
, CIM_STRING
},
310 { prop_domainroleW
, CIM_UINT16
},
311 { prop_manufacturerW
, CIM_STRING
},
312 { prop_modelW
, CIM_STRING
},
313 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
314 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
315 { prop_numprocessorsW
, CIM_UINT32
, VT_I4
},
316 { prop_totalphysicalmemoryW
, CIM_UINT64
}
318 static const struct column col_datafile
[] =
320 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
321 { prop_versionW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
323 static const struct column col_directory
[] =
325 { prop_accessmaskW
, CIM_UINT32
},
326 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
}
328 static const struct column col_diskdrive
[] =
330 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
331 { prop_indexW
, CIM_UINT32
, VT_I4
},
332 { prop_interfacetypeW
, CIM_STRING
},
333 { prop_manufacturerW
, CIM_STRING
},
334 { prop_mediatypeW
, CIM_STRING
},
335 { prop_modelW
, CIM_STRING
},
336 { prop_serialnumberW
, CIM_STRING
},
337 { prop_sizeW
, CIM_UINT64
}
339 static const struct column col_diskpartition
[] =
341 { prop_bootableW
, CIM_BOOLEAN
},
342 { prop_bootpartitionW
, CIM_BOOLEAN
},
343 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
344 { prop_diskindexW
, CIM_UINT32
, VT_I4
},
345 { prop_indexW
, CIM_UINT32
, VT_I4
},
346 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
347 { prop_sizeW
, CIM_UINT64
},
348 { prop_startingoffsetW
, CIM_UINT64
},
349 { prop_typeW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
351 static const struct column col_logicaldisk
[] =
353 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
354 { prop_drivetypeW
, CIM_UINT32
, VT_I4
},
355 { prop_filesystemW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
356 { prop_freespaceW
, CIM_UINT64
},
357 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
358 { prop_sizeW
, CIM_UINT64
},
359 { prop_volumeserialnumberW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
361 static const struct column col_networkadapter
[] =
363 { prop_adaptertypeW
, CIM_STRING
},
364 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
365 { prop_indexW
, CIM_UINT32
, VT_I4
},
366 { prop_interfaceindexW
, CIM_UINT32
, VT_I4
},
367 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
368 { prop_manufacturerW
, CIM_STRING
},
369 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
370 { prop_netconnectionstatusW
, CIM_UINT16
, VT_I4
},
371 { prop_physicaladapterW
, CIM_BOOLEAN
},
372 { prop_pnpdeviceidW
, CIM_STRING
},
373 { prop_speedW
, CIM_UINT64
}
375 static const struct column col_networkadapterconfig
[] =
377 { prop_indexW
, CIM_UINT32
|COL_FLAG_KEY
},
378 { prop_ipconnectionmetricW
, CIM_UINT32
},
379 { prop_ipenabledW
, CIM_BOOLEAN
},
380 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
382 static const struct column col_os
[] =
384 { prop_buildnumberW
, CIM_STRING
},
385 { prop_captionW
, CIM_STRING
},
386 { prop_codesetW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
387 { prop_countrycodeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
388 { prop_csdversionW
, CIM_STRING
},
389 { prop_installdateW
, CIM_DATETIME
},
390 { prop_lastbootuptimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
391 { prop_localdatetimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
392 { prop_localeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
393 { prop_nameW
, CIM_STRING
},
394 { prop_osarchitectureW
, CIM_STRING
},
395 { prop_oslanguageW
, CIM_UINT32
, VT_I4
},
396 { prop_osproductsuiteW
, CIM_UINT32
, VT_I4
},
397 { prop_ostypeW
, CIM_UINT16
, VT_I4
},
398 { prop_serialnumberW
, CIM_STRING
},
399 { prop_servicepackmajorW
, CIM_UINT16
, VT_I4
},
400 { prop_servicepackminorW
, CIM_UINT16
, VT_I4
},
401 { prop_suitemaskW
, CIM_UINT32
, VT_I4
},
402 { prop_systemdirectoryW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
403 { prop_versionW
, CIM_STRING
}
405 static const struct column col_param
[] =
407 { prop_classW
, CIM_STRING
},
408 { prop_methodW
, CIM_STRING
},
409 { prop_directionW
, CIM_SINT32
},
410 { prop_parameterW
, CIM_STRING
},
411 { prop_typeW
, CIM_UINT32
},
412 { prop_varianttypeW
, CIM_UINT32
},
413 { prop_defaultvalueW
, CIM_UINT32
}
415 static const struct column col_physicalmedia
[] =
417 { prop_serialnumberW
, CIM_STRING
},
418 { prop_tagW
, CIM_STRING
}
420 static const struct column col_physicalmemory
[] =
422 { prop_capacityW
, CIM_UINT64
}
424 static const struct column col_process
[] =
426 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
427 { prop_commandlineW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
428 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
429 { prop_handleW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
430 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
431 { prop_pprocessidW
, CIM_UINT32
, VT_I4
},
432 { prop_processidW
, CIM_UINT32
, VT_I4
},
433 { prop_threadcountW
, CIM_UINT32
, VT_I4
},
435 { method_getownerW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
437 static const struct column col_processor
[] =
439 { prop_addresswidthW
, CIM_UINT16
, VT_I4
},
440 { prop_cpustatusW
, CIM_UINT16
},
441 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
442 { prop_familyW
, CIM_UINT16
, VT_I4
},
443 { prop_manufacturerW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
444 { prop_maxclockspeedW
, CIM_UINT32
, VT_I4
},
445 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
446 { prop_numcoresW
, CIM_UINT32
, VT_I4
},
447 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
448 { prop_processoridW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
449 { prop_uniqueidW
, CIM_STRING
}
451 static const struct column col_qualifier
[] =
453 { prop_classW
, CIM_STRING
},
454 { prop_memberW
, CIM_STRING
},
455 { prop_typeW
, CIM_UINT32
},
456 { prop_flavorW
, CIM_SINT32
},
457 { prop_nameW
, CIM_STRING
},
458 { prop_intvalueW
, CIM_SINT32
},
459 { prop_strvalueW
, CIM_STRING
}
461 static const struct column col_service
[] =
463 { prop_acceptpauseW
, CIM_BOOLEAN
},
464 { prop_acceptstopW
, CIM_BOOLEAN
},
465 { prop_displaynameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
466 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
467 { prop_processidW
, CIM_UINT32
},
468 { prop_servicetypeW
, CIM_STRING
},
469 { prop_startmodeW
, CIM_STRING
},
470 { prop_stateW
, CIM_STRING
},
471 { prop_systemnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
473 { method_pauseserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
474 { method_resumeserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
475 { method_startserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
476 { method_stopserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
478 static const struct column col_sounddevice
[] =
480 { prop_nameW
, CIM_STRING
},
481 { prop_productnameW
, CIM_STRING
}
483 static const struct column col_stdregprov
[] =
485 { method_enumkeyW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
486 { method_enumvaluesW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
487 { method_getstringvalueW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
489 static const struct column col_videocontroller
[] =
491 { prop_adapterdactypeW
, CIM_STRING
},
492 { prop_adapterramW
, CIM_UINT32
, VT_I4
},
493 { prop_currentbitsperpixelW
, CIM_UINT32
},
494 { prop_currenthorizontalresW
, CIM_UINT32
},
495 { prop_currentverticalresW
, CIM_UINT32
},
496 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
497 { prop_deviceidW
, CIM_STRING
|COL_FLAG_KEY
},
498 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
499 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
502 static const WCHAR baseboard_manufacturerW
[] =
503 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
504 static const WCHAR baseboard_serialnumberW
[] =
506 static const WCHAR baseboard_tagW
[] =
507 {'B','a','s','e',' ','B','o','a','r','d',0};
508 static const WCHAR bios_descriptionW
[] =
509 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
510 static const WCHAR bios_manufacturerW
[] =
511 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
512 static const WCHAR bios_releasedateW
[] =
513 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
514 static const WCHAR bios_serialnumberW
[] =
516 static const WCHAR bios_smbiosbiosversionW
[] =
518 static const WCHAR bios_versionW
[] =
519 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
520 static const WCHAR cdromdrive_mediatypeW
[] =
521 {'C','D','-','R','O','M',0};
522 static const WCHAR cdromdrive_nameW
[] =
523 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
524 static const WCHAR cdromdrive_pnpdeviceidW
[]=
525 {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
526 '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
527 '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
528 'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
529 static const WCHAR compsys_descriptionW
[] =
530 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
531 static const WCHAR compsys_domainW
[] =
532 {'W','O','R','K','G','R','O','U','P',0};
533 static const WCHAR compsys_manufacturerW
[] =
534 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
535 static const WCHAR compsys_modelW
[] =
537 static const WCHAR diskdrive_interfacetypeW
[] =
539 static const WCHAR diskdrive_manufacturerW
[] =
540 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
541 static const WCHAR diskdrive_mediatype_fixedW
[] =
542 {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
543 static const WCHAR diskdrive_mediatype_removableW
[] =
544 {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
545 static const WCHAR diskdrive_modelW
[] =
546 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
547 static const WCHAR diskdrive_serialW
[] =
548 {'W','I','N','E','H','D','I','S','K',0};
549 static const WCHAR networkadapter_pnpdeviceidW
[]=
550 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
551 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
552 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
553 static const WCHAR os_32bitW
[] =
554 {'3','2','-','b','i','t',0};
555 static const WCHAR os_64bitW
[] =
556 {'6','4','-','b','i','t',0};
557 static const WCHAR os_buildnumberW
[] =
559 static const WCHAR os_captionW
[] =
560 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
561 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
562 static const WCHAR os_csdversionW
[] =
563 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
564 static const WCHAR os_installdateW
[] =
565 {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
566 static const WCHAR os_nameW
[] =
567 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
568 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
569 '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
570 '\\','P','a','r','t','i','t','i','o','n','1',0};
571 static const WCHAR os_serialnumberW
[] =
572 {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
573 static const WCHAR os_versionW
[] =
574 {'5','.','1','.','2','6','0','0',0};
575 static const WCHAR physicalmedia_tagW
[] =
576 {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
577 static const WCHAR sounddevice_productnameW
[] =
578 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
579 static const WCHAR videocontroller_dactypeW
[] =
580 {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
581 static const WCHAR videocontroller_deviceidW
[] =
582 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
584 #include "pshpack1.h"
585 struct record_baseboard
587 const WCHAR
*manufacturer
;
590 const WCHAR
*serialnumber
;
595 const WCHAR
*description
;
596 const WCHAR
*identificationcode
;
597 const WCHAR
*manufacturer
;
598 const WCHAR
*releasedate
;
599 const WCHAR
*serialnumber
;
600 const WCHAR
*smbiosbiosversion
;
601 const WCHAR
*version
;
603 struct record_cdromdrive
605 const WCHAR
*device_id
;
607 const WCHAR
*mediatype
;
609 const WCHAR
*pnpdevice_id
;
611 struct record_computersystem
613 const WCHAR
*description
;
616 const WCHAR
*manufacturer
;
619 UINT32 num_logical_processors
;
620 UINT32 num_processors
;
621 UINT64 total_physical_memory
;
623 struct record_datafile
626 const WCHAR
*version
;
628 struct record_directory
633 struct record_diskdrive
635 const WCHAR
*device_id
;
637 const WCHAR
*interfacetype
;
638 const WCHAR
*manufacturer
;
639 const WCHAR
*mediatype
;
641 const WCHAR
*serialnumber
;
644 struct record_diskpartition
648 const WCHAR
*device_id
;
651 const WCHAR
*pnpdevice_id
;
653 UINT64 startingoffset
;
656 struct record_logicaldisk
658 const WCHAR
*device_id
;
660 const WCHAR
*filesystem
;
664 const WCHAR
*volumeserialnumber
;
666 struct record_networkadapter
668 const WCHAR
*adaptertype
;
669 const WCHAR
*device_id
;
671 UINT32 interface_index
;
672 const WCHAR
*mac_address
;
673 const WCHAR
*manufacturer
;
675 UINT16 netconnection_status
;
677 const WCHAR
*pnpdevice_id
;
680 struct record_networkadapterconfig
683 UINT32 ipconnectionmetric
;
685 const WCHAR
*mac_address
;
687 struct record_operatingsystem
689 const WCHAR
*buildnumber
;
690 const WCHAR
*caption
;
691 const WCHAR
*codeset
;
692 const WCHAR
*countrycode
;
693 const WCHAR
*csdversion
;
694 const WCHAR
*installdate
;
695 const WCHAR
*lastbootuptime
;
696 const WCHAR
*localdatetime
;
699 const WCHAR
*osarchitecture
;
701 UINT32 osproductsuite
;
703 const WCHAR
*serialnumber
;
704 UINT16 servicepackmajor
;
705 UINT16 servicepackminor
;
707 const WCHAR
*systemdirectory
;
708 const WCHAR
*version
;
715 const WCHAR
*parameter
;
720 struct record_physicalmedia
722 const WCHAR
*serialnumber
;
725 struct record_physicalmemory
729 struct record_process
731 const WCHAR
*caption
;
732 const WCHAR
*commandline
;
733 const WCHAR
*description
;
740 class_method
*get_owner
;
742 struct record_processor
746 const WCHAR
*device_id
;
748 const WCHAR
*manufacturer
;
749 UINT32 maxclockspeed
;
752 UINT32 num_logical_processors
;
753 const WCHAR
*processor_id
;
754 const WCHAR
*unique_id
;
756 struct record_qualifier
764 const WCHAR
*strvalue
;
766 struct record_service
770 const WCHAR
*displayname
;
773 const WCHAR
*servicetype
;
774 const WCHAR
*startmode
;
776 const WCHAR
*systemname
;
778 class_method
*pause_service
;
779 class_method
*resume_service
;
780 class_method
*start_service
;
781 class_method
*stop_service
;
783 struct record_sounddevice
786 const WCHAR
*productname
;
788 struct record_stdregprov
790 class_method
*enumkey
;
791 class_method
*enumvalues
;
792 class_method
*getstringvalue
;
794 struct record_videocontroller
796 const WCHAR
*adapter_dactype
;
798 UINT32 current_bitsperpixel
;
799 UINT32 current_horizontalres
;
800 UINT32 current_verticalres
;
801 const WCHAR
*description
;
802 const WCHAR
*device_id
;
804 const WCHAR
*pnpdevice_id
;
808 static const struct record_baseboard data_baseboard
[] =
810 { baseboard_manufacturerW
, baseboard_tagW
, baseboard_tagW
, baseboard_serialnumberW
, baseboard_tagW
}
812 static const struct record_bios data_bios
[] =
814 { bios_descriptionW
, bios_descriptionW
, bios_manufacturerW
, bios_releasedateW
, bios_serialnumberW
,
815 bios_smbiosbiosversionW
, bios_versionW
}
817 static const struct record_param data_param
[] =
819 { class_processW
, method_getownerW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
820 { class_processW
, method_getownerW
, -1, param_userW
, CIM_STRING
},
821 { class_processW
, method_getownerW
, -1, param_domainW
, CIM_STRING
},
822 { class_serviceW
, method_pauseserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
823 { class_serviceW
, method_resumeserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
824 { class_serviceW
, method_startserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
825 { class_serviceW
, method_stopserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
826 { class_stdregprovW
, method_enumkeyW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
827 { class_stdregprovW
, method_enumkeyW
, 1, param_subkeynameW
, CIM_STRING
},
828 { class_stdregprovW
, method_enumkeyW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
829 { class_stdregprovW
, method_enumkeyW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
830 { class_stdregprovW
, method_enumvaluesW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
831 { class_stdregprovW
, method_enumvaluesW
, 1, param_subkeynameW
, CIM_STRING
},
832 { class_stdregprovW
, method_enumvaluesW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
833 { class_stdregprovW
, method_enumvaluesW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
834 { class_stdregprovW
, method_enumvaluesW
, -1, param_typesW
, CIM_SINT32
|CIM_FLAG_ARRAY
},
835 { class_stdregprovW
, method_getstringvalueW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
836 { class_stdregprovW
, method_getstringvalueW
, 1, param_subkeynameW
, CIM_STRING
},
837 { class_stdregprovW
, method_getstringvalueW
, 1, param_valuenameW
, CIM_STRING
},
838 { class_stdregprovW
, method_getstringvalueW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
839 { class_stdregprovW
, method_getstringvalueW
, -1, param_valueW
, CIM_STRING
}
842 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
843 WBEM_FLAVOR_ORIGIN_PROPAGATED)
845 static const struct record_physicalmedia data_physicalmedia
[] =
847 { diskdrive_serialW
, physicalmedia_tagW
}
849 static const struct record_qualifier data_qualifier
[] =
851 { class_process_getowner_outW
, param_userW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 0 },
852 { class_process_getowner_outW
, param_domainW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 1 }
854 static const struct record_sounddevice data_sounddevice
[] =
856 { sounddevice_productnameW
, sounddevice_productnameW
}
858 static const struct record_stdregprov data_stdregprov
[] =
860 { reg_enum_key
, reg_enum_values
, reg_get_stringvalue
}
863 /* check if row matches condition and update status */
864 static BOOL
match_row( const struct table
*table
, UINT row
, const struct expr
*cond
, enum fill_status
*status
)
871 *status
= FILL_STATUS_UNFILTERED
;
874 if (eval_cond( table
, row
, cond
, &val
, &type
) != S_OK
)
876 *status
= FILL_STATUS_FAILED
;
879 *status
= FILL_STATUS_FILTERED
;
883 static BOOL
resize_table( struct table
*table
, UINT row_count
, UINT row_size
)
885 if (!table
->num_rows_allocated
)
887 if (!(table
->data
= heap_alloc( row_count
* row_size
))) return FALSE
;
888 table
->num_rows_allocated
= row_count
;
891 if (row_count
>= table
->num_rows_allocated
)
894 UINT count
= table
->num_rows_allocated
* 2;
895 if (!(data
= heap_realloc( table
->data
, count
* row_size
))) return FALSE
;
897 table
->num_rows_allocated
= count
;
902 static enum fill_status
fill_cdromdrive( struct table
*table
, const struct expr
*cond
)
904 static const WCHAR fmtW
[] = {'%','c',':',0};
905 WCHAR drive
[3], root
[] = {'A',':','\\',0};
906 struct record_cdromdrive
*rec
;
907 UINT i
, row
= 0, offset
= 0;
908 DWORD drives
= GetLogicalDrives();
909 enum fill_status status
= FILL_STATUS_UNFILTERED
;
911 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
913 for (i
= 0; i
< sizeof(drives
); i
++)
915 if (drives
& (1 << i
))
918 if (GetDriveTypeW( root
) != DRIVE_CDROM
)
921 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
923 rec
= (struct record_cdromdrive
*)(table
->data
+ offset
);
924 rec
->device_id
= cdromdrive_pnpdeviceidW
;
925 sprintfW( drive
, fmtW
, 'A' + i
);
926 rec
->drive
= heap_strdupW( drive
);
927 rec
->mediatype
= cdromdrive_mediatypeW
;
928 rec
->name
= cdromdrive_nameW
;
929 rec
->pnpdevice_id
= cdromdrive_pnpdeviceidW
;
930 if (!match_row( table
, row
, cond
, &status
))
932 free_row_values( table
, row
);
935 offset
+= sizeof(*rec
);
939 TRACE("created %u rows\n", row
);
940 table
->num_rows
= row
;
944 static UINT
get_processor_count(void)
946 SYSTEM_BASIC_INFORMATION info
;
948 if (NtQuerySystemInformation( SystemBasicInformation
, &info
, sizeof(info
), NULL
)) return 1;
949 return info
.NumberOfProcessors
;
952 static UINT
get_logical_processor_count( UINT
*num_cores
)
954 SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*info
;
955 UINT i
, j
, count
= 0;
959 if (num_cores
) *num_cores
= get_processor_count();
960 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, NULL
, 0, &len
);
961 if (status
!= STATUS_INFO_LENGTH_MISMATCH
) return get_processor_count();
963 if (!(info
= heap_alloc( len
))) return get_processor_count();
964 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, info
, len
, &len
);
965 if (status
!= STATUS_SUCCESS
)
968 return get_processor_count();
970 if (num_cores
) *num_cores
= 0;
971 for (i
= 0; i
< len
/ sizeof(*info
); i
++)
973 if (info
[i
].Relationship
== RelationProcessorCore
)
975 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) count
++;
977 else if (info
[i
].Relationship
== RelationProcessorPackage
&& num_cores
)
979 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) (*num_cores
)++;
986 static UINT64
get_total_physical_memory(void)
988 MEMORYSTATUSEX status
;
990 status
.dwLength
= sizeof(status
);
991 if (!GlobalMemoryStatusEx( &status
)) return 1024 * 1024 * 1024;
992 return status
.ullTotalPhys
;
995 static WCHAR
*get_computername(void)
998 DWORD size
= MAX_COMPUTERNAME_LENGTH
;
1000 if (!(ret
= heap_alloc( size
* sizeof(WCHAR
) ))) return NULL
;
1001 GetComputerNameW( ret
, &size
);
1005 static enum fill_status
fill_compsys( struct table
*table
, const struct expr
*cond
)
1007 struct record_computersystem
*rec
;
1008 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1011 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1013 rec
= (struct record_computersystem
*)table
->data
;
1014 rec
->description
= compsys_descriptionW
;
1015 rec
->domain
= compsys_domainW
;
1016 rec
->domainrole
= 0; /* standalone workstation */
1017 rec
->manufacturer
= compsys_manufacturerW
;
1018 rec
->model
= compsys_modelW
;
1019 rec
->name
= get_computername();
1020 rec
->num_logical_processors
= get_logical_processor_count( NULL
);
1021 rec
->num_processors
= get_processor_count();
1022 rec
->total_physical_memory
= get_total_physical_memory();
1023 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
1026 TRACE("created %u rows\n", row
);
1027 table
->num_rows
= row
;
1039 static struct dirstack
*alloc_dirstack( UINT size
)
1041 struct dirstack
*dirstack
;
1043 if (!(dirstack
= heap_alloc( sizeof(*dirstack
) ))) return NULL
;
1044 if (!(dirstack
->dirs
= heap_alloc( sizeof(WCHAR
*) * size
)))
1046 heap_free( dirstack
);
1049 if (!(dirstack
->len_dirs
= heap_alloc( sizeof(UINT
) * size
)))
1051 heap_free( dirstack
->dirs
);
1052 heap_free( dirstack
);
1055 dirstack
->num_dirs
= 0;
1056 dirstack
->num_allocated
= size
;
1060 static void clear_dirstack( struct dirstack
*dirstack
)
1063 for (i
= 0; i
< dirstack
->num_dirs
; i
++) heap_free( dirstack
->dirs
[i
] );
1064 dirstack
->num_dirs
= 0;
1067 static void free_dirstack( struct dirstack
*dirstack
)
1069 clear_dirstack( dirstack
);
1070 heap_free( dirstack
->dirs
);
1071 heap_free( dirstack
->len_dirs
);
1072 heap_free( dirstack
);
1075 static BOOL
push_dir( struct dirstack
*dirstack
, WCHAR
*dir
, UINT len
)
1077 UINT size
, i
= dirstack
->num_dirs
;
1079 if (!dir
) return FALSE
;
1081 if (i
== dirstack
->num_allocated
)
1086 size
= dirstack
->num_allocated
* 2;
1087 if (!(tmp
= heap_realloc( dirstack
->dirs
, size
* sizeof(WCHAR
*) ))) return FALSE
;
1088 dirstack
->dirs
= tmp
;
1089 if (!(len_tmp
= heap_realloc( dirstack
->len_dirs
, size
* sizeof(UINT
) ))) return FALSE
;
1090 dirstack
->len_dirs
= len_tmp
;
1091 dirstack
->num_allocated
= size
;
1093 dirstack
->dirs
[i
] = dir
;
1094 dirstack
->len_dirs
[i
] = len
;
1095 dirstack
->num_dirs
++;
1099 static WCHAR
*pop_dir( struct dirstack
*dirstack
, UINT
*len
)
1101 if (!dirstack
->num_dirs
)
1106 dirstack
->num_dirs
--;
1107 *len
= dirstack
->len_dirs
[dirstack
->num_dirs
];
1108 return dirstack
->dirs
[dirstack
->num_dirs
];
1111 static const WCHAR
*peek_dir( struct dirstack
*dirstack
)
1113 if (!dirstack
->num_dirs
) return NULL
;
1114 return dirstack
->dirs
[dirstack
->num_dirs
- 1];
1117 static WCHAR
*build_glob( WCHAR drive
, const WCHAR
*path
, UINT len
)
1122 if (!(ret
= heap_alloc( (len
+ 6) * sizeof(WCHAR
) ))) return NULL
;
1128 memcpy( ret
+ i
, path
, len
* sizeof(WCHAR
) );
1137 static WCHAR
*build_name( WCHAR drive
, const WCHAR
*path
)
1139 UINT i
= 0, len
= 0;
1143 for (p
= path
; *p
; p
++)
1145 if (*p
== '\\') len
+= 2;
1148 if (!(ret
= heap_alloc( (len
+ 5) * sizeof(WCHAR
) ))) return NULL
;
1153 for (p
= path
; *p
; p
++)
1155 if (*p
!= '\\') ret
[i
++] = *p
;
1166 static WCHAR
*build_dirname( const WCHAR
*path
, UINT
*ret_len
)
1168 const WCHAR
*p
= path
, *start
;
1172 if (!isalphaW( p
[0] ) || p
[1] != ':' || p
[2] != '\\' || p
[3] != '\\' || !p
[4]) return NULL
;
1174 len
= strlenW( start
);
1175 p
= start
+ len
- 1;
1176 if (*p
== '\\') return NULL
;
1178 while (p
>= start
&& *p
!= '\\') { len
--; p
--; };
1179 while (p
>= start
&& *p
== '\\') { len
--; p
--; };
1181 if (!(ret
= heap_alloc( (len
+ 1) * sizeof(WCHAR
) ))) return NULL
;
1182 for (i
= 0, p
= start
; p
< start
+ len
; p
++)
1184 if (p
[0] == '\\' && p
[1] == '\\')
1196 static BOOL
seen_dir( struct dirstack
*dirstack
, const WCHAR
*path
)
1199 for (i
= 0; i
< dirstack
->num_dirs
; i
++) if (!strcmpW( dirstack
->dirs
[i
], path
)) return TRUE
;
1203 /* optimize queries of the form WHERE Name='...' [OR Name='...']* */
1204 static UINT
seed_dirs( struct dirstack
*dirstack
, const struct expr
*cond
, WCHAR root
, UINT
*count
)
1206 const struct expr
*left
, *right
;
1208 if (!cond
|| cond
->type
!= EXPR_COMPLEX
) return *count
= 0;
1210 left
= cond
->u
.expr
.left
;
1211 right
= cond
->u
.expr
.right
;
1212 if (cond
->u
.expr
.op
== OP_EQ
)
1216 const WCHAR
*str
= NULL
;
1218 if (left
->type
== EXPR_PROPVAL
&& right
->type
== EXPR_SVAL
&&
1219 !strcmpW( left
->u
.propval
->name
, prop_nameW
) &&
1220 toupperW( right
->u
.sval
[0] ) == toupperW( root
))
1222 str
= right
->u
.sval
;
1224 else if (left
->type
== EXPR_SVAL
&& right
->type
== EXPR_PROPVAL
&&
1225 !strcmpW( right
->u
.propval
->name
, prop_nameW
) &&
1226 toupperW( left
->u
.sval
[0] ) == toupperW( root
))
1230 if (str
&& (path
= build_dirname( str
, &len
)))
1232 if (seen_dir( dirstack
, path
))
1237 else if (push_dir( dirstack
, path
, len
)) return ++*count
;
1242 else if (cond
->u
.expr
.op
== OP_OR
)
1244 UINT left_count
= 0, right_count
= 0;
1246 if (!(seed_dirs( dirstack
, left
, root
, &left_count
))) return *count
= 0;
1247 if (!(seed_dirs( dirstack
, right
, root
, &right_count
))) return *count
= 0;
1248 return *count
+= left_count
+ right_count
;
1253 static WCHAR
*append_path( const WCHAR
*path
, const WCHAR
*segment
, UINT
*len
)
1255 UINT len_path
= 0, len_segment
= strlenW( segment
);
1259 if (path
) len_path
= strlenW( path
);
1260 if (!(ret
= heap_alloc( (len_path
+ len_segment
+ 2) * sizeof(WCHAR
) ))) return NULL
;
1261 if (path
&& len_path
)
1263 memcpy( ret
, path
, len_path
* sizeof(WCHAR
) );
1264 ret
[len_path
] = '\\';
1265 *len
+= len_path
+ 1;
1267 memcpy( ret
+ *len
, segment
, len_segment
* sizeof(WCHAR
) );
1268 *len
+= len_segment
;
1273 static WCHAR
*get_file_version( const WCHAR
*filename
)
1275 static const WCHAR slashW
[] = {'\\',0}, fmtW
[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
1276 VS_FIXEDFILEINFO
*info
;
1281 if (!(ret
= heap_alloc( (4 * 5 + sizeof(fmtW
) / sizeof(fmtW
[0])) * sizeof(WCHAR
) ))) return NULL
;
1282 if (!(size
= GetFileVersionInfoSizeW( filename
, NULL
)) || !(block
= heap_alloc( size
)))
1287 if (!GetFileVersionInfoW( filename
, 0, size
, block
) ||
1288 !VerQueryValueW( block
, slashW
, (void **)&info
, &size
))
1294 sprintfW( ret
, fmtW
, info
->dwFileVersionMS
>> 16, info
->dwFileVersionMS
& 0xffff,
1295 info
->dwFileVersionLS
>> 16, info
->dwFileVersionLS
& 0xffff );
1300 static enum fill_status
fill_datafile( struct table
*table
, const struct expr
*cond
)
1302 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1303 struct record_datafile
*rec
;
1304 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1305 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1306 DWORD drives
= GetLogicalDrives();
1307 WIN32_FIND_DATAW data
;
1309 struct dirstack
*dirstack
;
1310 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1312 if (!resize_table( table
, 8, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1314 dirstack
= alloc_dirstack(2);
1316 for (i
= 0; i
< sizeof(drives
); i
++)
1318 if (!(drives
& (1 << i
))) continue;
1321 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1323 num_expected_rows
= 0;
1324 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1328 path
= pop_dir( dirstack
, &len
);
1329 if (!(glob
= build_glob( root
[0], path
, len
)))
1331 status
= FILL_STATUS_FAILED
;
1334 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1338 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1340 status
= FILL_STATUS_FAILED
;
1341 FindClose( handle
);
1344 if (!strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
)) continue;
1345 new_path
= append_path( path
, data
.cFileName
, &len
);
1347 if (data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
1349 if (push_dir( dirstack
, new_path
, len
)) continue;
1350 heap_free( new_path
);
1351 FindClose( handle
);
1352 status
= FILL_STATUS_FAILED
;
1355 rec
= (struct record_datafile
*)(table
->data
+ offset
);
1356 rec
->name
= build_name( root
[0], new_path
);
1357 rec
->version
= get_file_version( rec
->name
);
1358 if (!match_row( table
, row
, cond
, &status
))
1360 free_row_values( table
, row
);
1363 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1366 FindClose( handle
);
1367 status
= FILL_STATUS_FILTERED
;
1370 offset
+= sizeof(*rec
);
1373 while (FindNextFileW( handle
, &data
));
1374 FindClose( handle
);
1376 if (!peek_dir( dirstack
)) break;
1383 free_dirstack( dirstack
);
1387 TRACE("created %u rows\n", row
);
1388 table
->num_rows
= row
;
1392 static enum fill_status
fill_directory( struct table
*table
, const struct expr
*cond
)
1394 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1395 struct record_directory
*rec
;
1396 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1397 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1398 DWORD drives
= GetLogicalDrives();
1399 WIN32_FIND_DATAW data
;
1401 struct dirstack
*dirstack
;
1402 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1404 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1406 dirstack
= alloc_dirstack(2);
1408 for (i
= 0; i
< sizeof(drives
); i
++)
1410 if (!(drives
& (1 << i
))) continue;
1413 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1415 num_expected_rows
= 0;
1416 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1420 path
= pop_dir( dirstack
, &len
);
1421 if (!(glob
= build_glob( root
[0], path
, len
)))
1423 status
= FILL_STATUS_FAILED
;
1426 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1430 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1432 FindClose( handle
);
1433 status
= FILL_STATUS_FAILED
;
1436 if (!(data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
) ||
1437 !strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
))
1440 new_path
= append_path( path
, data
.cFileName
, &len
);
1441 if (!(push_dir( dirstack
, new_path
, len
)))
1443 heap_free( new_path
);
1444 FindClose( handle
);
1445 status
= FILL_STATUS_FAILED
;
1448 rec
= (struct record_directory
*)(table
->data
+ offset
);
1449 rec
->accessmask
= FILE_ALL_ACCESS
;
1450 rec
->name
= build_name( root
[0], new_path
);
1451 if (!match_row( table
, row
, cond
, &status
))
1453 free_row_values( table
, row
);
1456 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1459 FindClose( handle
);
1460 status
= FILL_STATUS_FILTERED
;
1463 offset
+= sizeof(*rec
);
1466 while (FindNextFileW( handle
, &data
));
1467 FindClose( handle
);
1469 if (!peek_dir( dirstack
)) break;
1476 free_dirstack( dirstack
);
1480 TRACE("created %u rows\n", row
);
1481 table
->num_rows
= row
;
1485 static UINT64
get_freespace( const WCHAR
*dir
, UINT64
*disksize
)
1487 WCHAR root
[] = {'\\','\\','.','\\','A',':',0};
1488 ULARGE_INTEGER free
;
1489 DISK_GEOMETRY_EX info
;
1492 free
.QuadPart
= 512 * 1024 * 1024;
1493 GetDiskFreeSpaceExW( dir
, NULL
, NULL
, &free
);
1496 handle
= CreateFileW( root
, GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
, OPEN_EXISTING
, 0, 0 );
1497 if (handle
!= INVALID_HANDLE_VALUE
)
1499 if (DeviceIoControl( handle
, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
, NULL
, 0, &info
, sizeof(info
), NULL
, NULL
))
1500 *disksize
= info
.DiskSize
.QuadPart
;
1501 CloseHandle( handle
);
1503 return free
.QuadPart
;
1506 static enum fill_status
fill_diskdrive( struct table
*table
, const struct expr
*cond
)
1508 static const WCHAR fmtW
[] =
1509 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
1510 WCHAR device_id
[sizeof(fmtW
)/sizeof(fmtW
[0]) + 10], root
[] = {'A',':','\\',0};
1511 struct record_diskdrive
*rec
;
1512 UINT i
, row
= 0, offset
= 0, index
= 0, type
;
1513 UINT64 size
= 1024 * 1024 * 1024;
1514 DWORD drives
= GetLogicalDrives();
1515 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1517 if (!resize_table( table
, 2, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1519 for (i
= 0; i
< sizeof(drives
); i
++)
1521 if (drives
& (1 << i
))
1524 type
= GetDriveTypeW( root
);
1525 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1528 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1530 rec
= (struct record_diskdrive
*)(table
->data
+ offset
);
1531 sprintfW( device_id
, fmtW
, index
);
1532 rec
->device_id
= heap_strdupW( device_id
);
1534 rec
->interfacetype
= diskdrive_interfacetypeW
;
1535 rec
->manufacturer
= diskdrive_manufacturerW
;
1536 if (type
== DRIVE_FIXED
)
1537 rec
->mediatype
= diskdrive_mediatype_fixedW
;
1539 rec
->mediatype
= diskdrive_mediatype_removableW
;
1540 rec
->model
= diskdrive_modelW
;
1541 rec
->serialnumber
= diskdrive_serialW
;
1542 get_freespace( root
, &size
);
1544 if (!match_row( table
, row
, cond
, &status
))
1546 free_row_values( table
, row
);
1549 offset
+= sizeof(*rec
);
1554 TRACE("created %u rows\n", row
);
1555 table
->num_rows
= row
;
1559 static WCHAR
*get_filesystem( const WCHAR
*root
)
1561 static const WCHAR ntfsW
[] = {'N','T','F','S',0};
1562 WCHAR buffer
[MAX_PATH
+ 1];
1564 if (GetVolumeInformationW( root
, NULL
, 0, NULL
, NULL
, NULL
, buffer
, MAX_PATH
+ 1 ))
1565 return heap_strdupW( buffer
);
1566 return heap_strdupW( ntfsW
);
1569 static enum fill_status
fill_diskpartition( struct table
*table
, const struct expr
*cond
)
1571 static const WCHAR fmtW
[] =
1572 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
1573 WCHAR device_id
[32], root
[] = {'A',':','\\',0};
1574 struct record_diskpartition
*rec
;
1575 UINT i
, row
= 0, offset
= 0, type
, index
= 0;
1576 UINT64 size
= 1024 * 1024 * 1024;
1577 DWORD drives
= GetLogicalDrives();
1578 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1580 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1582 for (i
= 0; i
< sizeof(drives
); i
++)
1584 if (drives
& (1 << i
))
1587 type
= GetDriveTypeW( root
);
1588 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1591 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1593 rec
= (struct record_diskpartition
*)(table
->data
+ offset
);
1594 rec
->bootable
= (i
== 2) ? -1 : 0;
1595 rec
->bootpartition
= (i
== 2) ? -1 : 0;
1596 sprintfW( device_id
, fmtW
, index
);
1597 rec
->device_id
= heap_strdupW( device_id
);
1598 rec
->diskindex
= index
;
1600 rec
->pnpdevice_id
= heap_strdupW( device_id
);
1601 get_freespace( root
, &size
);
1603 rec
->startingoffset
= 0;
1604 rec
->type
= get_filesystem( root
);
1605 if (!match_row( table
, row
, cond
, &status
))
1607 free_row_values( table
, row
);
1610 offset
+= sizeof(*rec
);
1615 TRACE("created %u rows\n", row
);
1616 table
->num_rows
= row
;
1620 static WCHAR
*get_volumeserialnumber( const WCHAR
*root
)
1622 static const WCHAR fmtW
[] = {'%','0','8','X',0};
1626 GetVolumeInformationW( root
, NULL
, 0, &serial
, NULL
, NULL
, NULL
, 0 );
1627 sprintfW( buffer
, fmtW
, serial
);
1628 return heap_strdupW( buffer
);
1631 static enum fill_status
fill_logicaldisk( struct table
*table
, const struct expr
*cond
)
1633 static const WCHAR fmtW
[] = {'%','c',':',0};
1634 WCHAR device_id
[3], root
[] = {'A',':','\\',0};
1635 struct record_logicaldisk
*rec
;
1636 UINT i
, row
= 0, offset
= 0, type
;
1637 UINT64 size
= 1024 * 1024 * 1024;
1638 DWORD drives
= GetLogicalDrives();
1639 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1641 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1643 for (i
= 0; i
< sizeof(drives
); i
++)
1645 if (drives
& (1 << i
))
1648 type
= GetDriveTypeW( root
);
1649 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_CDROM
&& type
!= DRIVE_REMOVABLE
)
1652 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1654 rec
= (struct record_logicaldisk
*)(table
->data
+ offset
);
1655 sprintfW( device_id
, fmtW
, 'A' + i
);
1656 rec
->device_id
= heap_strdupW( device_id
);
1657 rec
->drivetype
= type
;
1658 rec
->filesystem
= get_filesystem( root
);
1659 rec
->freespace
= get_freespace( root
, &size
);
1660 rec
->name
= heap_strdupW( device_id
);
1662 rec
->volumeserialnumber
= get_volumeserialnumber( root
);
1663 if (!match_row( table
, row
, cond
, &status
))
1665 free_row_values( table
, row
);
1668 offset
+= sizeof(*rec
);
1672 TRACE("created %u rows\n", row
);
1673 table
->num_rows
= row
;
1677 static UINT16
get_connection_status( IF_OPER_STATUS status
)
1681 case IfOperStatusDown
:
1682 return 0; /* Disconnected */
1683 case IfOperStatusUp
:
1684 return 2; /* Connected */
1686 ERR("unhandled status %u\n", status
);
1691 static WCHAR
*get_mac_address( const BYTE
*addr
, DWORD len
)
1693 static const WCHAR fmtW
[] =
1694 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
1695 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
1698 if (len
!= 6 || !(ret
= heap_alloc( 18 * sizeof(WCHAR
) ))) return NULL
;
1699 sprintfW( ret
, fmtW
, addr
[0], addr
[1], addr
[2], addr
[3], addr
[4], addr
[5] );
1702 static const WCHAR
*get_adaptertype( DWORD type
, int *physical
)
1704 static const WCHAR ethernetW
[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
1705 static const WCHAR wirelessW
[] = {'W','i','r','e','l','e','s','s',0};
1706 static const WCHAR firewireW
[] = {'1','3','9','4',0};
1707 static const WCHAR tunnelW
[] = {'T','u','n','n','e','l',0};
1711 case IF_TYPE_ETHERNET_CSMACD
: *physical
= -1; return ethernetW
;
1712 case IF_TYPE_IEEE80211
: *physical
= -1; return wirelessW
;
1713 case IF_TYPE_IEEE1394
: *physical
= -1; return firewireW
;
1714 case IF_TYPE_TUNNEL
: *physical
= 0; return tunnelW
;
1715 default: *physical
= 0; return NULL
;
1719 static enum fill_status
fill_networkadapter( struct table
*table
, const struct expr
*cond
)
1721 static const WCHAR fmtW
[] = {'%','u',0};
1722 WCHAR device_id
[11];
1723 struct record_networkadapter
*rec
;
1724 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
1725 UINT row
= 0, offset
= 0, count
= 0;
1726 DWORD size
= 0, ret
;
1728 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1730 ret
= GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, NULL
, &size
);
1731 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
1733 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
1734 if (GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, buffer
, &size
))
1736 heap_free( buffer
);
1737 return FILL_STATUS_FAILED
;
1739 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1741 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
1743 if (!resize_table( table
, count
, sizeof(*rec
) ))
1745 heap_free( buffer
);
1746 return FILL_STATUS_FAILED
;
1748 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1750 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
1752 rec
= (struct record_networkadapter
*)(table
->data
+ offset
);
1753 sprintfW( device_id
, fmtW
, aa
->u
.s
.IfIndex
);
1754 rec
->adaptertype
= get_adaptertype( aa
->IfType
, &physical
);
1755 rec
->device_id
= heap_strdupW( device_id
);
1756 rec
->index
= aa
->u
.s
.IfIndex
;
1757 rec
->interface_index
= aa
->u
.s
.IfIndex
;
1758 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
1759 rec
->manufacturer
= compsys_manufacturerW
;
1760 rec
->name
= heap_strdupW( aa
->FriendlyName
);
1761 rec
->netconnection_status
= get_connection_status( aa
->OperStatus
);
1762 rec
->physicaladapter
= physical
;
1763 rec
->pnpdevice_id
= networkadapter_pnpdeviceidW
;
1764 rec
->speed
= 1000000;
1765 if (!match_row( table
, row
, cond
, &status
))
1767 free_row_values( table
, row
);
1770 offset
+= sizeof(*rec
);
1773 TRACE("created %u rows\n", row
);
1774 table
->num_rows
= row
;
1776 heap_free( buffer
);
1780 static enum fill_status
fill_networkadapterconfig( struct table
*table
, const struct expr
*cond
)
1782 struct record_networkadapterconfig
*rec
;
1783 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
1784 UINT row
= 0, offset
= 0, count
= 0;
1785 DWORD size
= 0, ret
;
1786 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1788 ret
= GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, NULL
, &size
);
1789 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
1791 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
1792 if (GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, buffer
, &size
))
1794 heap_free( buffer
);
1795 return FILL_STATUS_FAILED
;
1797 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1799 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
1801 if (!resize_table( table
, count
, sizeof(*rec
) ))
1803 heap_free( buffer
);
1804 return FILL_STATUS_FAILED
;
1806 for (aa
= buffer
; aa
; aa
= aa
->Next
)
1808 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
1810 rec
= (struct record_networkadapterconfig
*)(table
->data
+ offset
);
1811 rec
->index
= aa
->u
.s
.IfIndex
;
1812 rec
->ipconnectionmetric
= 20;
1813 rec
->ipenabled
= -1;
1814 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
1815 if (!match_row( table
, row
, cond
, &status
))
1817 free_row_values( table
, row
);
1820 offset
+= sizeof(*rec
);
1823 TRACE("created %u rows\n", row
);
1824 table
->num_rows
= row
;
1826 heap_free( buffer
);
1830 static enum fill_status
fill_physicalmemory( struct table
*table
, const struct expr
*cond
)
1832 struct record_physicalmemory
*rec
;
1833 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1836 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1838 rec
= (struct record_physicalmemory
*)table
->data
;
1839 rec
->capacity
= get_total_physical_memory();
1840 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
1843 TRACE("created %u rows\n", row
);
1844 table
->num_rows
= row
;
1848 static WCHAR
*get_cmdline( DWORD process_id
)
1850 if (process_id
== GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
1851 return NULL
; /* FIXME handle different process case */
1854 static enum fill_status
fill_process( struct table
*table
, const struct expr
*cond
)
1856 static const WCHAR fmtW
[] = {'%','u',0};
1858 struct record_process
*rec
;
1859 PROCESSENTRY32W entry
;
1861 enum fill_status status
= FILL_STATUS_FAILED
;
1862 UINT row
= 0, offset
= 0;
1864 snap
= CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS
, 0 );
1865 if (snap
== INVALID_HANDLE_VALUE
) return FILL_STATUS_FAILED
;
1867 entry
.dwSize
= sizeof(entry
);
1868 if (!Process32FirstW( snap
, &entry
)) goto done
;
1869 if (!resize_table( table
, 8, sizeof(*rec
) )) goto done
;
1873 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) goto done
;
1875 rec
= (struct record_process
*)(table
->data
+ offset
);
1876 rec
->caption
= heap_strdupW( entry
.szExeFile
);
1877 rec
->commandline
= get_cmdline( entry
.th32ProcessID
);
1878 rec
->description
= heap_strdupW( entry
.szExeFile
);
1879 sprintfW( handle
, fmtW
, entry
.th32ProcessID
);
1880 rec
->handle
= heap_strdupW( handle
);
1881 rec
->name
= heap_strdupW( entry
.szExeFile
);
1882 rec
->process_id
= entry
.th32ProcessID
;
1883 rec
->pprocess_id
= entry
.th32ParentProcessID
;
1884 rec
->thread_count
= entry
.cntThreads
;
1885 rec
->get_owner
= process_get_owner
;
1886 if (!match_row( table
, row
, cond
, &status
))
1888 free_row_values( table
, row
);
1891 offset
+= sizeof(*rec
);
1893 } while (Process32NextW( snap
, &entry
));
1895 TRACE("created %u rows\n", row
);
1896 table
->num_rows
= row
;
1897 status
= FILL_STATUS_UNFILTERED
;
1900 CloseHandle( snap
);
1904 static inline void do_cpuid( unsigned int ax
, unsigned int *p
)
1907 __asm__("pushl %%ebx\n\t"
1909 "movl %%ebx, %%esi\n\t"
1911 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
1916 static void get_processor_id( WCHAR
*processor_id
)
1918 static const WCHAR fmtW
[] = {'%','0','8','X','%','0','8','X',0};
1919 unsigned int regs
[4] = {0, 0, 0, 0};
1921 do_cpuid( 1, regs
);
1922 sprintfW( processor_id
, fmtW
, regs
[3], regs
[0] );
1924 static void regs_to_str( unsigned int *regs
, unsigned int len
, WCHAR
*buffer
)
1927 unsigned char *p
= (unsigned char *)regs
;
1929 for (i
= 0; i
< len
; i
++) { buffer
[i
] = *p
++; }
1932 static void get_processor_manufacturer( WCHAR
*manufacturer
)
1934 unsigned int tmp
, regs
[4] = {0, 0, 0, 0};
1936 do_cpuid( 0, regs
);
1937 tmp
= regs
[2]; /* swap edx and ecx */
1941 regs_to_str( regs
+ 1, 12, manufacturer
);
1943 static void get_processor_name( WCHAR
*name
)
1945 unsigned int regs
[4] = {0, 0, 0, 0};
1947 do_cpuid( 0x80000000, regs
);
1948 if (regs
[0] >= 0x80000004)
1950 do_cpuid( 0x80000002, regs
);
1951 regs_to_str( regs
, 16, name
);
1952 do_cpuid( 0x80000003, regs
);
1953 regs_to_str( regs
, 16, name
+ 16 );
1954 do_cpuid( 0x80000004, regs
);
1955 regs_to_str( regs
, 16, name
+ 32 );
1958 static UINT
get_processor_maxclockspeed( void )
1960 PROCESSOR_POWER_INFORMATION
*info
;
1961 UINT ret
= 1000, size
= get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION
);
1964 if ((info
= heap_alloc( size
)))
1966 status
= NtPowerInformation( ProcessorInformation
, NULL
, 0, info
, size
);
1967 if (!status
) ret
= info
[0].MaxMhz
;
1972 static const WCHAR
*get_osarchitecture(void)
1975 GetNativeSystemInfo( &info
);
1976 if (info
.u
.s
.wProcessorArchitecture
== PROCESSOR_ARCHITECTURE_AMD64
) return os_64bitW
;
1980 static enum fill_status
fill_processor( struct table
*table
, const struct expr
*cond
)
1982 static const WCHAR fmtW
[] = {'C','P','U','%','u',0};
1983 WCHAR device_id
[14], processor_id
[17], manufacturer
[13], name
[49] = {0};
1984 struct record_processor
*rec
;
1985 UINT i
, offset
= 0, maxclockspeed
, num_cores
, num_logical_processors
, count
= get_processor_count();
1986 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1988 if (!resize_table( table
, count
, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1990 get_processor_id( processor_id
);
1991 get_processor_manufacturer( manufacturer
);
1992 get_processor_name( name
);
1994 maxclockspeed
= get_processor_maxclockspeed();
1995 num_logical_processors
= get_logical_processor_count( &num_cores
) / count
;
1998 for (i
= 0; i
< count
; i
++)
2000 rec
= (struct record_processor
*)(table
->data
+ offset
);
2001 rec
->addresswidth
= get_osarchitecture() == os_32bitW
? 32 : 64;
2002 rec
->cpu_status
= 1; /* CPU Enabled */
2003 sprintfW( device_id
, fmtW
, i
);
2004 rec
->device_id
= heap_strdupW( device_id
);
2005 rec
->family
= 2; /* Unknown */
2006 rec
->manufacturer
= heap_strdupW( manufacturer
);
2007 rec
->maxclockspeed
= maxclockspeed
;
2008 rec
->name
= heap_strdupW( name
);
2009 rec
->num_cores
= num_cores
;
2010 rec
->num_logical_processors
= num_logical_processors
;
2011 rec
->processor_id
= heap_strdupW( processor_id
);
2012 rec
->unique_id
= NULL
;
2013 if (!match_row( table
, i
, cond
, &status
))
2015 free_row_values( table
, i
);
2018 offset
+= sizeof(*rec
);
2021 TRACE("created %u rows\n", count
);
2022 table
->num_rows
= count
;
2026 static WCHAR
*get_lastbootuptime(void)
2028 static const WCHAR fmtW
[] =
2029 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2030 '.','%','0','6','u','+','0','0','0',0};
2031 SYSTEM_TIMEOFDAY_INFORMATION ti
;
2035 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2037 NtQuerySystemInformation( SystemTimeOfDayInformation
, &ti
, sizeof(ti
), NULL
);
2038 RtlTimeToTimeFields( &ti
.liKeBootTime
, &tf
);
2039 sprintfW( ret
, fmtW
, tf
.Year
, tf
.Month
, tf
.Day
, tf
.Hour
, tf
.Minute
, tf
.Second
, tf
.Milliseconds
* 1000 );
2042 static WCHAR
*get_localdatetime(void)
2044 static const WCHAR fmtW
[] =
2045 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2046 '.','%','0','6','u','%','+','0','3','d',0};
2047 TIME_ZONE_INFORMATION tzi
;
2053 Status
= GetTimeZoneInformation(&tzi
);
2055 if(Status
== TIME_ZONE_ID_INVALID
) return NULL
;
2057 if(Status
== TIME_ZONE_ID_DAYLIGHT
)
2058 Bias
+= tzi
.DaylightBias
;
2060 Bias
+= tzi
.StandardBias
;
2061 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2064 sprintfW( ret
, fmtW
, st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
, st
.wMilliseconds
* 1000, -Bias
);
2067 static WCHAR
*get_systemdirectory(void)
2072 if (!(ret
= heap_alloc( MAX_PATH
* sizeof(WCHAR
) ))) return NULL
;
2073 Wow64DisableWow64FsRedirection( &redir
);
2074 GetSystemDirectoryW( ret
, MAX_PATH
);
2075 Wow64RevertWow64FsRedirection( redir
);
2078 static WCHAR
*get_codeset(void)
2080 static const WCHAR fmtW
[] = {'%','u',0};
2081 WCHAR
*ret
= heap_alloc( 11 * sizeof(WCHAR
) );
2082 if (ret
) sprintfW( ret
, fmtW
, GetACP() );
2085 static WCHAR
*get_countrycode(void)
2087 WCHAR
*ret
= heap_alloc( 6 * sizeof(WCHAR
) );
2088 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ICOUNTRY
, ret
, 6 );
2091 static WCHAR
*get_locale(void)
2093 WCHAR
*ret
= heap_alloc( 5 * sizeof(WCHAR
) );
2094 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ILANGUAGE
, ret
, 5 );
2098 static enum fill_status
fill_os( struct table
*table
, const struct expr
*cond
)
2100 struct record_operatingsystem
*rec
;
2101 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2104 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2106 rec
= (struct record_operatingsystem
*)table
->data
;
2107 rec
->buildnumber
= os_buildnumberW
;
2108 rec
->caption
= os_captionW
;
2109 rec
->codeset
= get_codeset();
2110 rec
->countrycode
= get_countrycode();
2111 rec
->csdversion
= os_csdversionW
;
2112 rec
->installdate
= os_installdateW
;
2113 rec
->lastbootuptime
= get_lastbootuptime();
2114 rec
->localdatetime
= get_localdatetime();
2115 rec
->locale
= get_locale();
2116 rec
->name
= os_nameW
;
2117 rec
->osarchitecture
= get_osarchitecture();
2118 rec
->oslanguage
= GetSystemDefaultLangID();
2119 rec
->osproductsuite
= 2461140; /* Windows XP Professional */
2120 rec
->ostype
= 18; /* WINNT */
2121 rec
->serialnumber
= os_serialnumberW
;
2122 rec
->servicepackmajor
= 3;
2123 rec
->servicepackminor
= 0;
2124 rec
->suitemask
= 272; /* Single User + Terminal */
2125 rec
->systemdirectory
= get_systemdirectory();
2126 rec
->version
= os_versionW
;
2127 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2130 TRACE("created %u rows\n", row
);
2131 table
->num_rows
= row
;
2135 static const WCHAR
*get_service_type( DWORD type
)
2137 static const WCHAR filesystem_driverW
[] =
2138 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
2139 static const WCHAR kernel_driverW
[] =
2140 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
2141 static const WCHAR own_processW
[] =
2142 {'O','w','n',' ','P','r','o','c','e','s','s',0};
2143 static const WCHAR share_processW
[] =
2144 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
2146 if (type
& SERVICE_KERNEL_DRIVER
) return kernel_driverW
;
2147 else if (type
& SERVICE_FILE_SYSTEM_DRIVER
) return filesystem_driverW
;
2148 else if (type
& SERVICE_WIN32_OWN_PROCESS
) return own_processW
;
2149 else if (type
& SERVICE_WIN32_SHARE_PROCESS
) return share_processW
;
2150 else ERR("unhandled type 0x%08x\n", type
);
2153 static const WCHAR
*get_service_state( DWORD state
)
2155 static const WCHAR runningW
[] =
2156 {'R','u','n','n','i','n','g',0};
2157 static const WCHAR start_pendingW
[] =
2158 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
2159 static const WCHAR stop_pendingW
[] =
2160 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
2161 static const WCHAR stoppedW
[] =
2162 {'S','t','o','p','p','e','d',0};
2163 static const WCHAR unknownW
[] =
2164 {'U','n','k','n','o','w','n',0};
2168 case SERVICE_STOPPED
: return stoppedW
;
2169 case SERVICE_START_PENDING
: return start_pendingW
;
2170 case SERVICE_STOP_PENDING
: return stop_pendingW
;
2171 case SERVICE_RUNNING
: return runningW
;
2173 ERR("unknown state %u\n", state
);
2177 static const WCHAR
*get_service_startmode( DWORD mode
)
2179 static const WCHAR bootW
[] = {'B','o','o','t',0};
2180 static const WCHAR systemW
[] = {'S','y','s','t','e','m',0};
2181 static const WCHAR autoW
[] = {'A','u','t','o',0};
2182 static const WCHAR manualW
[] = {'M','a','n','u','a','l',0};
2183 static const WCHAR disabledW
[] = {'D','i','s','a','b','l','e','d',0};
2184 static const WCHAR unknownW
[] = {'U','n','k','n','o','w','n',0};
2188 case SERVICE_BOOT_START
: return bootW
;
2189 case SERVICE_SYSTEM_START
: return systemW
;
2190 case SERVICE_AUTO_START
: return autoW
;
2191 case SERVICE_DEMAND_START
: return manualW
;
2192 case SERVICE_DISABLED
: return disabledW
;
2194 ERR("unknown mode 0x%x\n", mode
);
2198 static QUERY_SERVICE_CONFIGW
*query_service_config( SC_HANDLE manager
, const WCHAR
*name
)
2200 QUERY_SERVICE_CONFIGW
*config
= NULL
;
2204 if (!(service
= OpenServiceW( manager
, name
, SERVICE_QUERY_CONFIG
))) return NULL
;
2205 QueryServiceConfigW( service
, NULL
, 0, &size
);
2206 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
) goto done
;
2207 if (!(config
= heap_alloc( size
))) goto done
;
2208 if (QueryServiceConfigW( service
, config
, size
, &size
)) goto done
;
2209 heap_free( config
);
2213 CloseServiceHandle( service
);
2217 static enum fill_status
fill_service( struct table
*table
, const struct expr
*cond
)
2219 struct record_service
*rec
;
2221 ENUM_SERVICE_STATUS_PROCESSW
*tmp
, *services
= NULL
;
2222 SERVICE_STATUS_PROCESS
*status
;
2223 WCHAR sysnameW
[MAX_COMPUTERNAME_LENGTH
+ 1];
2224 DWORD len
= sizeof(sysnameW
) / sizeof(sysnameW
[0]);
2225 UINT i
, row
= 0, offset
= 0, size
= 256, needed
, count
;
2226 enum fill_status fill_status
= FILL_STATUS_FAILED
;
2229 if (!(manager
= OpenSCManagerW( NULL
, NULL
, SC_MANAGER_ENUMERATE_SERVICE
))) return FILL_STATUS_FAILED
;
2230 if (!(services
= heap_alloc( size
))) goto done
;
2232 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2233 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2234 &count
, NULL
, NULL
);
2237 if (GetLastError() != ERROR_MORE_DATA
) goto done
;
2239 if (!(tmp
= heap_realloc( services
, size
))) goto done
;
2241 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2242 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2243 &count
, NULL
, NULL
);
2244 if (!ret
) goto done
;
2246 if (!resize_table( table
, count
, sizeof(*rec
) )) goto done
;
2248 GetComputerNameW( sysnameW
, &len
);
2249 fill_status
= FILL_STATUS_UNFILTERED
;
2251 for (i
= 0; i
< count
; i
++)
2253 QUERY_SERVICE_CONFIGW
*config
;
2255 if (!(config
= query_service_config( manager
, services
[i
].lpServiceName
))) continue;
2257 status
= &services
[i
].ServiceStatusProcess
;
2258 rec
= (struct record_service
*)(table
->data
+ offset
);
2259 rec
->accept_pause
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_PAUSE_CONTINUE
) ? -1 : 0;
2260 rec
->accept_stop
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_STOP
) ? -1 : 0;
2261 rec
->displayname
= heap_strdupW( services
[i
].lpDisplayName
);
2262 rec
->name
= heap_strdupW( services
[i
].lpServiceName
);
2263 rec
->process_id
= status
->dwProcessId
;
2264 rec
->servicetype
= get_service_type( status
->dwServiceType
);
2265 rec
->startmode
= get_service_startmode( config
->dwStartType
);
2266 rec
->state
= get_service_state( status
->dwCurrentState
);
2267 rec
->systemname
= heap_strdupW( sysnameW
);
2268 rec
->pause_service
= service_pause_service
;
2269 rec
->resume_service
= service_resume_service
;
2270 rec
->start_service
= service_start_service
;
2271 rec
->stop_service
= service_stop_service
;
2272 heap_free( config
);
2273 if (!match_row( table
, row
, cond
, &fill_status
))
2275 free_row_values( table
, row
);
2278 offset
+= sizeof(*rec
);
2282 TRACE("created %u rows\n", row
);
2283 table
->num_rows
= row
;
2286 CloseServiceHandle( manager
);
2287 heap_free( services
);
2291 static UINT32
get_bits_per_pixel( UINT
*hres
, UINT
*vres
)
2293 HDC hdc
= GetDC( NULL
);
2296 if (!hdc
) return 32;
2297 ret
= GetDeviceCaps( hdc
, BITSPIXEL
);
2298 *hres
= GetDeviceCaps( hdc
, HORZRES
);
2299 *vres
= GetDeviceCaps( hdc
, VERTRES
);
2300 ReleaseDC( NULL
, hdc
);
2303 static WCHAR
*get_pnpdeviceid( DXGI_ADAPTER_DESC
*desc
)
2305 static const WCHAR fmtW
[] =
2306 {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
2307 '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
2308 '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
2311 if (!(ret
= heap_alloc( sizeof(fmtW
) + 2 * sizeof(WCHAR
) ))) return NULL
;
2312 sprintfW( ret
, fmtW
, desc
->VendorId
, desc
->DeviceId
, desc
->SubSysId
, desc
->Revision
);
2316 static enum fill_status
fill_videocontroller( struct table
*table
, const struct expr
*cond
)
2319 struct record_videocontroller
*rec
;
2321 IDXGIFactory
*factory
= NULL
;
2322 IDXGIAdapter
*adapter
= NULL
;
2323 DXGI_ADAPTER_DESC desc
;
2324 UINT hres
= 1024, vres
= 768, vidmem
= 512 * 1024 * 1024;
2325 const WCHAR
*name
= videocontroller_deviceidW
;
2326 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2329 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2331 memset (&desc
, 0, sizeof(desc
));
2332 hr
= CreateDXGIFactory( &IID_IDXGIFactory
, (void **)&factory
);
2333 if (FAILED(hr
)) goto done
;
2335 hr
= IDXGIFactory_EnumAdapters( factory
, 0, &adapter
);
2336 if (FAILED(hr
)) goto done
;
2338 hr
= IDXGIAdapter_GetDesc( adapter
, &desc
);
2341 vidmem
= desc
.DedicatedVideoMemory
;
2342 name
= desc
.Description
;
2346 rec
= (struct record_videocontroller
*)table
->data
;
2347 rec
->adapter_dactype
= videocontroller_dactypeW
;
2348 rec
->adapter_ram
= vidmem
;
2349 rec
->current_bitsperpixel
= get_bits_per_pixel( &hres
, &vres
);
2350 rec
->current_horizontalres
= hres
;
2351 rec
->current_verticalres
= vres
;
2352 rec
->description
= heap_strdupW( name
);
2353 rec
->device_id
= videocontroller_deviceidW
;
2354 rec
->name
= heap_strdupW( name
);
2355 rec
->pnpdevice_id
= get_pnpdeviceid( &desc
);
2356 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2359 TRACE("created %u rows\n", row
);
2360 table
->num_rows
= row
;
2362 if (adapter
) IDXGIAdapter_Release( adapter
);
2363 if (factory
) IDXGIFactory_Release( factory
);
2367 static struct table builtin_classes
[] =
2369 { class_baseboardW
, SIZEOF(col_baseboard
), col_baseboard
, SIZEOF(data_baseboard
), 0, (BYTE
*)data_baseboard
},
2370 { class_biosW
, SIZEOF(col_bios
), col_bios
, SIZEOF(data_bios
), 0, (BYTE
*)data_bios
},
2371 { class_cdromdriveW
, SIZEOF(col_cdromdrive
), col_cdromdrive
, 0, 0, NULL
, fill_cdromdrive
},
2372 { class_compsysW
, SIZEOF(col_compsys
), col_compsys
, 0, 0, NULL
, fill_compsys
},
2373 { class_datafileW
, SIZEOF(col_datafile
), col_datafile
, 0, 0, NULL
, fill_datafile
},
2374 { class_directoryW
, SIZEOF(col_directory
), col_directory
, 0, 0, NULL
, fill_directory
},
2375 { class_diskdriveW
, SIZEOF(col_diskdrive
), col_diskdrive
, 0, 0, NULL
, fill_diskdrive
},
2376 { class_diskpartitionW
, SIZEOF(col_diskpartition
), col_diskpartition
, 0, 0, NULL
, fill_diskpartition
},
2377 { class_logicaldiskW
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
2378 { class_logicaldisk2W
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
2379 { class_networkadapterW
, SIZEOF(col_networkadapter
), col_networkadapter
, 0, 0, NULL
, fill_networkadapter
},
2380 { class_networkadapterconfigW
, SIZEOF(col_networkadapterconfig
), col_networkadapterconfig
, 0, 0, NULL
,
2381 fill_networkadapterconfig
},
2382 { class_osW
, SIZEOF(col_os
), col_os
, 0, 0, NULL
, fill_os
},
2383 { class_paramsW
, SIZEOF(col_param
), col_param
, SIZEOF(data_param
), 0, (BYTE
*)data_param
},
2384 { class_physicalmediaW
, SIZEOF(col_physicalmedia
), col_physicalmedia
, SIZEOF(data_physicalmedia
), 0, (BYTE
*)data_physicalmedia
},
2385 { class_physicalmemoryW
, SIZEOF(col_physicalmemory
), col_physicalmemory
, 0, 0, NULL
, fill_physicalmemory
},
2386 { class_processW
, SIZEOF(col_process
), col_process
, 0, 0, NULL
, fill_process
},
2387 { class_processorW
, SIZEOF(col_processor
), col_processor
, 0, 0, NULL
, fill_processor
},
2388 { class_qualifiersW
, SIZEOF(col_qualifier
), col_qualifier
, SIZEOF(data_qualifier
), 0, (BYTE
*)data_qualifier
},
2389 { class_serviceW
, SIZEOF(col_service
), col_service
, 0, 0, NULL
, fill_service
},
2390 { class_sounddeviceW
, SIZEOF(col_sounddevice
), col_sounddevice
, SIZEOF(data_sounddevice
), 0, (BYTE
*)data_sounddevice
},
2391 { class_stdregprovW
, SIZEOF(col_stdregprov
), col_stdregprov
, SIZEOF(data_stdregprov
), 0, (BYTE
*)data_stdregprov
},
2392 { class_videocontrollerW
, SIZEOF(col_videocontroller
), col_videocontroller
, 0, 0, NULL
, fill_videocontroller
}
2395 void init_table_list( void )
2397 static struct list tables
= LIST_INIT( tables
);
2400 for (i
= 0; i
< SIZEOF(builtin_classes
); i
++) list_add_tail( &tables
, &builtin_classes
[i
].entry
);
2401 table_list
= &tables
;