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
46 #include "wine/debug.h"
47 #include "wbemprox_private.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox
);
51 static const WCHAR class_baseboardW
[] =
52 {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0};
53 static const WCHAR class_biosW
[] =
54 {'W','i','n','3','2','_','B','I','O','S',0};
55 static const WCHAR class_cdromdriveW
[] =
56 {'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0};
57 static const WCHAR class_compsysW
[] =
58 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
59 static const WCHAR class_compsysproductW
[] =
60 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m','P','r','o','d','u','c','t',0};
61 static const WCHAR class_datafileW
[] =
62 {'C','I','M','_','D','a','t','a','F','i','l','e',0};
63 static const WCHAR class_desktopmonitorW
[] =
64 {'W','i','n','3','2','_','D','e','s','k','t','o','p','M','o','n','i','t','o','r',0};
65 static const WCHAR class_directoryW
[] =
66 {'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0};
67 static const WCHAR class_diskdriveW
[] =
68 {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0};
69 static const WCHAR class_diskpartitionW
[] =
70 {'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
71 static const WCHAR class_logicaldiskW
[] =
72 {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
73 static const WCHAR class_logicaldisk2W
[] =
74 {'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0};
75 static const WCHAR class_networkadapterW
[] =
76 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
77 static const WCHAR class_networkadapterconfigW
[] =
78 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',
79 'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
80 static const WCHAR class_osW
[] =
81 {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
82 static const WCHAR class_paramsW
[] =
83 {'_','_','P','A','R','A','M','E','T','E','R','S',0};
84 static const WCHAR class_physicalmediaW
[] =
85 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0};
86 static const WCHAR class_physicalmemoryW
[] =
87 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
88 static const WCHAR class_qualifiersW
[] =
89 {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
90 static const WCHAR class_printerW
[] =
91 {'W','i','n','3','2','_','P','r','i','n','t','e','r',0};
92 static const WCHAR class_process_getowner_outW
[] =
93 {'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W',
94 'N','E','R','_','O','U','T',0};
95 static const WCHAR class_processorW
[] =
96 {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
97 static const WCHAR class_processor2W
[] =
98 {'C','I','M','_','P','r','o','c','e','s','s','o','r',0};
99 static const WCHAR class_sidW
[] =
100 {'W','i','n','3','2','_','S','I','D',0};
101 static const WCHAR class_sounddeviceW
[] =
102 {'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0};
103 static const WCHAR class_systemenclosureW
[] =
104 {'W','i','n','3','2','_','S','y','s','t','e','m','E','n','c','l','o','s','u','r','e',0};
105 static const WCHAR class_videocontrollerW
[] =
106 {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
108 static const WCHAR prop_accountnameW
[] =
109 {'A','c','c','o','u','n','t','N','a','m','e',0};
110 static const WCHAR prop_acceptpauseW
[] =
111 {'A','c','c','e','p','t','P','a','u','s','e',0};
112 static const WCHAR prop_acceptstopW
[] =
113 {'A','c','c','e','p','t','S','t','o','p',0};
114 static const WCHAR prop_accessmaskW
[] =
115 {'A','c','c','e','s','s','M','a','s','k',0};
116 static const WCHAR prop_adapterdactypeW
[] =
117 {'A','d','a','p','t','e','r','D','A','C','T','y','p','e',0};
118 static const WCHAR prop_adapterramW
[] =
119 {'A','d','a','p','t','e','r','R','A','M',0};
120 static const WCHAR prop_adaptertypeW
[] =
121 {'A','d','a','p','t','e','r','T','y','p','e',0};
122 static const WCHAR prop_addresswidthW
[] =
123 {'A','d','d','r','e','s','s','W','i','d','t','h',0};
124 static const WCHAR prop_attributesW
[] =
125 {'A','t','t','r','i','b','u','t','e','s',0};
126 static const WCHAR prop_availabilityW
[] =
127 {'A','v','a','i','l','a','b','i','l','i','t','y',0};
128 static const WCHAR prop_binaryrepresentationW
[] =
129 {'B','i','n','a','r','y','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0};
130 static const WCHAR prop_bootableW
[] =
131 {'B','o','o','t','a','b','l','e',0};
132 static const WCHAR prop_bootpartitionW
[] =
133 {'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
134 static const WCHAR prop_buildnumberW
[] =
135 {'B','u','i','l','d','N','u','m','b','e','r',0};
136 static const WCHAR prop_capacityW
[] =
137 {'C','a','p','a','c','i','t','y',0};
138 static const WCHAR prop_captionW
[] =
139 {'C','a','p','t','i','o','n',0};
140 static const WCHAR prop_chassistypesW
[] =
141 {'C','h','a','s','s','i','s','T','y','p','e','s',0};
142 static const WCHAR prop_classW
[] =
143 {'C','l','a','s','s',0};
144 static const WCHAR prop_codesetW
[] =
145 {'C','o','d','e','S','e','t',0};
146 static const WCHAR prop_commandlineW
[] =
147 {'C','o','m','m','a','n','d','L','i','n','e',0};
148 static const WCHAR prop_countrycodeW
[] =
149 {'C','o','u','n','t','r','y','C','o','d','e',0};
150 static const WCHAR prop_cpustatusW
[] =
151 {'C','p','u','S','t','a','t','u','s',0};
152 static const WCHAR prop_csdversionW
[] =
153 {'C','S','D','V','e','r','s','i','o','n',0};
154 static const WCHAR prop_currentbitsperpixelW
[] =
155 {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
156 static const WCHAR prop_currentclockspeedW
[] =
157 {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0};
158 static const WCHAR prop_currenthorizontalresW
[] =
159 {'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};
160 static const WCHAR prop_currentrefreshrateW
[] =
161 {'C','u','r','r','e','n','t','R','e','f','r','e','s','h','R','a','t','e',0};
162 static const WCHAR prop_currentscanmodeW
[] =
163 {'C','u','r','r','e','n','t','S','c','a','n','M','o','d','e',0};
164 static const WCHAR prop_currentverticalresW
[] =
165 {'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};
166 static const WCHAR prop_datawidthW
[] =
167 {'D','a','t','a','W','i','d','t','h',0};
168 static const WCHAR prop_defaultipgatewayW
[] =
169 {'D','e','f','a','u','l','t','I','P','G','a','t','e','w','a','y',0};
170 static const WCHAR prop_defaultvalueW
[] =
171 {'D','e','f','a','u','l','t','V','a','l','u','e',0};
172 static const WCHAR prop_descriptionW
[] =
173 {'D','e','s','c','r','i','p','t','i','o','n',0};
174 static const WCHAR prop_deviceidW
[] =
175 {'D','e','v','i','c','e','I','d',0};
176 static const WCHAR prop_dhcpenabledW
[] =
177 {'D','H','C','P','E','n','a','b','l','e','d',0};
178 static const WCHAR prop_directionW
[] =
179 {'D','i','r','e','c','t','i','o','n',0};
180 static const WCHAR prop_displaynameW
[] =
181 {'D','i','s','p','l','a','y','N','a','m','e',0};
182 static const WCHAR prop_diskindexW
[] =
183 {'D','i','s','k','I','n','d','e','x',0};
184 static const WCHAR prop_dnshostnameW
[] =
185 {'D','N','S','H','o','s','t','N','a','m','e',0};
186 static const WCHAR prop_dnsserversearchorderW
[] =
187 {'D','N','S','S','e','r','v','e','r','S','e','a','r','c','h','O','r','d','e','r',0};
188 static const WCHAR prop_domainW
[] =
189 {'D','o','m','a','i','n',0};
190 static const WCHAR prop_domainroleW
[] =
191 {'D','o','m','a','i','n','R','o','l','e',0};
192 static const WCHAR prop_driveW
[] =
193 {'D','r','i','v','e',0};
194 static const WCHAR prop_drivernameW
[] =
195 {'D','r','i','v','e','r','N','a','m','e',0};
196 static const WCHAR prop_driverversionW
[] =
197 {'D','r','i','v','e','r','V','e','r','s','i','o','n',0};
198 static const WCHAR prop_drivetypeW
[] =
199 {'D','r','i','v','e','T','y','p','e',0};
200 static const WCHAR prop_familyW
[] =
201 {'F','a','m','i','l','y',0};
202 static const WCHAR prop_filesystemW
[] =
203 {'F','i','l','e','S','y','s','t','e','m',0};
204 static const WCHAR prop_flavorW
[] =
205 {'F','l','a','v','o','r',0};
206 static const WCHAR prop_freespaceW
[] =
207 {'F','r','e','e','S','p','a','c','e',0};
208 static const WCHAR prop_handleW
[] =
209 {'H','a','n','d','l','e',0};
210 static const WCHAR prop_horizontalresolutionW
[] =
211 {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
212 static const WCHAR prop_idW
[] =
214 static const WCHAR prop_identificationcodeW
[] =
215 {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
216 static const WCHAR prop_identifyingnumberW
[] =
217 {'I','d','e','n','t','i','f','y','i','n','g','N','u','m','b','e','r',0};
218 static const WCHAR prop_indexW
[] =
219 {'I','n','d','e','x',0};
220 static const WCHAR prop_installdateW
[] =
221 {'I','n','s','t','a','l','l','D','a','t','e',0};
222 static const WCHAR prop_interfaceindexW
[] =
223 {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
224 static const WCHAR prop_interfacetypeW
[] =
225 {'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
226 static const WCHAR prop_intvalueW
[] =
227 {'I','n','t','e','g','e','r','V','a','l','u','e',0};
228 static const WCHAR prop_ipconnectionmetricW
[] =
229 {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
230 static const WCHAR prop_ipenabledW
[] =
231 {'I','P','E','n','a','b','l','e','d',0};
232 static const WCHAR prop_lastbootuptimeW
[] =
233 {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
234 static const WCHAR prop_localW
[] =
235 {'L','o','c','a','l',0};
236 static const WCHAR prop_localdatetimeW
[] =
237 {'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
238 static const WCHAR prop_localeW
[] =
239 {'L','o','c','a','l','e',0};
240 static const WCHAR prop_lockpresentW
[] =
241 {'L','o','c','k','P','r','e','s','e','n','t',0};
242 static const WCHAR prop_macaddressW
[] =
243 {'M','A','C','A','d','d','r','e','s','s',0};
244 static const WCHAR prop_manufacturerW
[] =
245 {'M','a','n','u','f','a','c','t','u','r','e','r',0};
246 static const WCHAR prop_maxclockspeedW
[] =
247 {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
248 static const WCHAR prop_mediatypeW
[] =
249 {'M','e','d','i','a','T','y','p','e',0};
250 static const WCHAR prop_memberW
[] =
251 {'M','e','m','b','e','r',0};
252 static const WCHAR prop_methodW
[] =
253 {'M','e','t','h','o','d',0};
254 static const WCHAR prop_modelW
[] =
255 {'M','o','d','e','l',0};
256 static const WCHAR prop_netconnectionstatusW
[] =
257 {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
258 static const WCHAR prop_networkW
[] =
259 {'N','e','t','w','o','r','k',0};
260 static const WCHAR prop_numcoresW
[] =
261 {'N','u','m','b','e','r','O','f','C','o','r','e','s',0};
262 static const WCHAR prop_numlogicalprocessorsW
[] =
263 {'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};
264 static const WCHAR prop_numprocessorsW
[] =
265 {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
266 static const WCHAR prop_osarchitectureW
[] =
267 {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
268 static const WCHAR prop_oslanguageW
[] =
269 {'O','S','L','a','n','g','u','a','g','e',0};
270 static const WCHAR prop_osproductsuiteW
[] =
271 {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
272 static const WCHAR prop_ostypeW
[] =
273 {'O','S','T','y','p','e',0};
274 static const WCHAR prop_parameterW
[] =
275 {'P','a','r','a','m','e','t','e','r',0};
276 static const WCHAR prop_physicaladapterW
[] =
277 {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
278 static const WCHAR prop_pixelsperxlogicalinchW
[] =
279 {'P','i','x','e','l','s','P','e','r','X','L','o','g','i','c','a','l','I','n','c','h',0};
280 static const WCHAR prop_pnpdeviceidW
[] =
281 {'P','N','P','D','e','v','i','c','e','I','D',0};
282 static const WCHAR prop_pprocessidW
[] =
283 {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
284 static const WCHAR prop_primaryW
[] =
285 {'P','r','i','m','a','r','y',0};
286 static const WCHAR prop_processidW
[] =
287 {'P','r','o','c','e','s','s','I','D',0};
288 static const WCHAR prop_processoridW
[] =
289 {'P','r','o','c','e','s','s','o','r','I','d',0};
290 static const WCHAR prop_processortypeW
[] =
291 {'P','r','o','c','e','s','s','o','r','T','y','p','e',0};
292 static const WCHAR prop_productW
[] =
293 {'P','r','o','d','u','c','t',0};
294 static const WCHAR prop_productnameW
[] =
295 {'P','r','o','d','u','c','t','N','a','m','e',0};
296 static const WCHAR prop_referenceddomainnameW
[] =
297 {'R','e','f','e','r','e','n','c','e','d','D','o','m','a','i','n','N','a','m','e',0};
298 static const WCHAR prop_releasedateW
[] =
299 {'R','e','l','e','a','s','e','D','a','t','e',0};
300 static const WCHAR prop_serialnumberW
[] =
301 {'S','e','r','i','a','l','N','u','m','b','e','r',0};
302 static const WCHAR prop_servicepackmajorW
[] =
303 {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
304 static const WCHAR prop_servicepackminorW
[] =
305 {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
306 static const WCHAR prop_servicetypeW
[] =
307 {'S','e','r','v','i','c','e','T','y','p','e',0};
308 static const WCHAR prop_settingidW
[] =
309 {'S','e','t','t','i','n','g','I','D',0};
310 static const WCHAR prop_smbiosbiosversionW
[] =
311 {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
312 static const WCHAR prop_startmodeW
[] =
313 {'S','t','a','r','t','M','o','d','e',0};
314 static const WCHAR prop_sidW
[] =
316 static const WCHAR prop_sidlengthW
[] =
317 {'S','i','d','L','e','n','g','t','h',0};
318 static const WCHAR prop_sizeW
[] =
320 static const WCHAR prop_speedW
[] =
321 {'S','p','e','e','d',0};
322 static const WCHAR prop_startingoffsetW
[] =
323 {'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0};
324 static const WCHAR prop_stateW
[] =
325 {'S','t','a','t','e',0};
326 static const WCHAR prop_statusinfoW
[] =
327 {'S','t','a','t','u','s','I','n','f','o',0};
328 static const WCHAR prop_strvalueW
[] =
329 {'S','t','r','i','n','g','V','a','l','u','e',0};
330 static const WCHAR prop_suitemaskW
[] =
331 {'S','u','i','t','e','M','a','s','k',0};
332 static const WCHAR prop_systemdirectoryW
[] =
333 {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
334 static const WCHAR prop_systemnameW
[] =
335 {'S','y','s','t','e','m','N','a','m','e',0};
336 static const WCHAR prop_tagW
[] =
338 static const WCHAR prop_threadcountW
[] =
339 {'T','h','r','e','a','d','C','o','u','n','t',0};
340 static const WCHAR prop_totalphysicalmemoryW
[] =
341 {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
342 static const WCHAR prop_totalvisiblememorysizeW
[] =
343 {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0};
344 static const WCHAR prop_typeW
[] =
346 static const WCHAR prop_uniqueidW
[] =
347 {'U','n','i','q','u','e','I','d',0};
348 static const WCHAR prop_usernameW
[] =
349 {'U','s','e','r','N','a','m','e',0};
350 static const WCHAR prop_uuidW
[] =
352 static const WCHAR prop_varianttypeW
[] =
353 {'V','a','r','i','a','n','t','T','y','p','e',0};
354 static const WCHAR prop_versionW
[] =
355 {'V','e','r','s','i','o','n',0};
356 static const WCHAR prop_videoarchitectureW
[] =
357 {'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0};
358 static const WCHAR prop_videomemorytypeW
[] =
359 {'V','i','d','e','o','M','e','m','o','r','y','T','y','p','e',0};
360 static const WCHAR prop_videoprocessorW
[] =
361 {'V','i','d','e','o','P','r','o','c','e','s','s','o','r',0};
362 static const WCHAR prop_volumenameW
[] =
363 {'V','o','l','u','m','e','N','a','m','e',0};
364 static const WCHAR prop_volumeserialnumberW
[] =
365 {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
366 static const WCHAR prop_workingsetsizeW
[] =
367 {'W','o','r','k','i','n','g','S','e','t','S','i','z','e',0};
369 /* column definitions must be kept in sync with record structures below */
370 static const struct column col_baseboard
[] =
372 { prop_manufacturerW
, CIM_STRING
},
373 { prop_modelW
, CIM_STRING
},
374 { prop_nameW
, CIM_STRING
},
375 { prop_productW
, CIM_STRING
},
376 { prop_serialnumberW
, CIM_STRING
},
377 { prop_tagW
, CIM_STRING
|COL_FLAG_KEY
},
378 { prop_versionW
, CIM_STRING
}
380 static const struct column col_bios
[] =
382 { prop_descriptionW
, CIM_STRING
},
383 { prop_identificationcodeW
, CIM_STRING
},
384 { prop_manufacturerW
, CIM_STRING
},
385 { prop_nameW
, CIM_STRING
},
386 { prop_releasedateW
, CIM_DATETIME
},
387 { prop_serialnumberW
, CIM_STRING
},
388 { prop_smbiosbiosversionW
, CIM_STRING
},
389 { prop_versionW
, CIM_STRING
|COL_FLAG_KEY
}
391 static const struct column col_cdromdrive
[] =
393 { prop_deviceidW
, CIM_STRING
|COL_FLAG_KEY
},
394 { prop_driveW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
395 { prop_mediatypeW
, CIM_STRING
},
396 { prop_nameW
, CIM_STRING
},
397 { prop_pnpdeviceidW
, CIM_STRING
}
399 static const struct column col_compsys
[] =
401 { prop_descriptionW
, CIM_STRING
},
402 { prop_domainW
, CIM_STRING
},
403 { prop_domainroleW
, CIM_UINT16
, VT_I4
},
404 { prop_manufacturerW
, CIM_STRING
},
405 { prop_modelW
, CIM_STRING
},
406 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
407 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
408 { prop_numprocessorsW
, CIM_UINT32
, VT_I4
},
409 { prop_totalphysicalmemoryW
, CIM_UINT64
},
410 { prop_usernameW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
412 static const struct column col_compsysproduct
[] =
414 { prop_identifyingnumberW
, CIM_STRING
|COL_FLAG_KEY
},
415 { prop_uuidW
, CIM_STRING
}
417 static const struct column col_datafile
[] =
419 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
420 { prop_versionW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
422 static const struct column col_desktopmonitor
[] =
424 { prop_pixelsperxlogicalinchW
, CIM_UINT32
}
426 static const struct column col_directory
[] =
428 { prop_accessmaskW
, CIM_UINT32
},
429 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
}
431 static const struct column col_diskdrive
[] =
433 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
434 { prop_indexW
, CIM_UINT32
, VT_I4
},
435 { prop_interfacetypeW
, CIM_STRING
},
436 { prop_manufacturerW
, CIM_STRING
},
437 { prop_mediatypeW
, CIM_STRING
},
438 { prop_modelW
, CIM_STRING
},
439 { prop_pnpdeviceidW
, CIM_STRING
},
440 { prop_serialnumberW
, CIM_STRING
},
441 { prop_sizeW
, CIM_UINT64
}
443 static const struct column col_diskpartition
[] =
445 { prop_bootableW
, CIM_BOOLEAN
},
446 { prop_bootpartitionW
, CIM_BOOLEAN
},
447 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
448 { prop_diskindexW
, CIM_UINT32
, VT_I4
},
449 { prop_indexW
, CIM_UINT32
, VT_I4
},
450 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
451 { prop_sizeW
, CIM_UINT64
},
452 { prop_startingoffsetW
, CIM_UINT64
},
453 { prop_typeW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
455 static const struct column col_logicaldisk
[] =
457 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
458 { prop_drivetypeW
, CIM_UINT32
, VT_I4
},
459 { prop_filesystemW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
460 { prop_freespaceW
, CIM_UINT64
},
461 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
462 { prop_sizeW
, CIM_UINT64
},
463 { prop_volumenameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
464 { prop_volumeserialnumberW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
466 static const struct column col_networkadapter
[] =
468 { prop_adaptertypeW
, CIM_STRING
},
469 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
470 { prop_indexW
, CIM_UINT32
, VT_I4
},
471 { prop_interfaceindexW
, CIM_UINT32
, VT_I4
},
472 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
473 { prop_manufacturerW
, CIM_STRING
},
474 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
475 { prop_netconnectionstatusW
, CIM_UINT16
, VT_I4
},
476 { prop_physicaladapterW
, CIM_BOOLEAN
},
477 { prop_pnpdeviceidW
, CIM_STRING
},
478 { prop_speedW
, CIM_UINT64
}
480 static const struct column col_networkadapterconfig
[] =
482 { prop_defaultipgatewayW
, CIM_STRING
|CIM_FLAG_ARRAY
|COL_FLAG_DYNAMIC
},
483 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
484 { prop_dhcpenabledW
, CIM_BOOLEAN
},
485 { prop_dnshostnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
486 { prop_dnsserversearchorderW
, CIM_STRING
|CIM_FLAG_ARRAY
|COL_FLAG_DYNAMIC
},
487 { prop_indexW
, CIM_UINT32
|COL_FLAG_KEY
, VT_I4
},
488 { prop_ipconnectionmetricW
, CIM_UINT32
, VT_I4
},
489 { prop_ipenabledW
, CIM_BOOLEAN
},
490 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
491 { prop_settingidW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
493 static const struct column col_os
[] =
495 { prop_buildnumberW
, CIM_STRING
},
496 { prop_captionW
, CIM_STRING
},
497 { prop_codesetW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
498 { prop_countrycodeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
499 { prop_csdversionW
, CIM_STRING
},
500 { prop_installdateW
, CIM_DATETIME
},
501 { prop_lastbootuptimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
502 { prop_localdatetimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
503 { prop_localeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
504 { prop_nameW
, CIM_STRING
},
505 { prop_osarchitectureW
, CIM_STRING
},
506 { prop_oslanguageW
, CIM_UINT32
, VT_I4
},
507 { prop_osproductsuiteW
, CIM_UINT32
, VT_I4
},
508 { prop_ostypeW
, CIM_UINT16
, VT_I4
},
509 { prop_primaryW
, CIM_BOOLEAN
},
510 { prop_serialnumberW
, CIM_STRING
},
511 { prop_servicepackmajorW
, CIM_UINT16
, VT_I4
},
512 { prop_servicepackminorW
, CIM_UINT16
, VT_I4
},
513 { prop_suitemaskW
, CIM_UINT32
, VT_I4
},
514 { prop_systemdirectoryW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
515 { prop_totalvisiblememorysizeW
, CIM_UINT64
},
516 { prop_versionW
, CIM_STRING
}
518 static const struct column col_param
[] =
520 { prop_classW
, CIM_STRING
},
521 { prop_methodW
, CIM_STRING
},
522 { prop_directionW
, CIM_SINT32
},
523 { prop_parameterW
, CIM_STRING
},
524 { prop_typeW
, CIM_UINT32
},
525 { prop_varianttypeW
, CIM_UINT32
},
526 { prop_defaultvalueW
, CIM_UINT32
}
528 static const struct column col_physicalmedia
[] =
530 { prop_serialnumberW
, CIM_STRING
},
531 { prop_tagW
, CIM_STRING
}
533 static const struct column col_physicalmemory
[] =
535 { prop_capacityW
, CIM_UINT64
}
537 static const struct column col_printer
[] =
539 { prop_attributesW
, CIM_UINT32
},
540 { prop_drivernameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
541 { prop_horizontalresolutionW
, CIM_UINT32
},
542 { prop_localW
, CIM_BOOLEAN
},
543 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
544 { prop_networkW
, CIM_BOOLEAN
}
546 static const struct column col_process
[] =
548 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
549 { prop_commandlineW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
550 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
551 { prop_handleW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
552 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
553 { prop_pprocessidW
, CIM_UINT32
, VT_I4
},
554 { prop_processidW
, CIM_UINT32
, VT_I4
},
555 { prop_threadcountW
, CIM_UINT32
, VT_I4
},
556 { prop_workingsetsizeW
, CIM_UINT64
},
558 { method_getownerW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
560 static const struct column col_processor
[] =
562 { prop_addresswidthW
, CIM_UINT16
, VT_I4
},
563 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
564 { prop_cpustatusW
, CIM_UINT16
},
565 { prop_currentclockspeedW
, CIM_UINT32
, VT_I4
},
566 { prop_datawidthW
, CIM_UINT16
, VT_I4
},
567 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
568 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
569 { prop_familyW
, CIM_UINT16
, VT_I4
},
570 { prop_manufacturerW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
571 { prop_maxclockspeedW
, CIM_UINT32
, VT_I4
},
572 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
573 { prop_numcoresW
, CIM_UINT32
, VT_I4
},
574 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
575 { prop_processoridW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
576 { prop_processortypeW
, CIM_UINT16
, VT_I4
},
577 { prop_uniqueidW
, CIM_STRING
},
578 { prop_versionW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
580 static const struct column col_qualifier
[] =
582 { prop_classW
, CIM_STRING
},
583 { prop_memberW
, CIM_STRING
},
584 { prop_typeW
, CIM_UINT32
},
585 { prop_flavorW
, CIM_SINT32
},
586 { prop_nameW
, CIM_STRING
},
587 { prop_intvalueW
, CIM_SINT32
},
588 { prop_strvalueW
, CIM_STRING
}
590 static const struct column col_service
[] =
592 { prop_acceptpauseW
, CIM_BOOLEAN
},
593 { prop_acceptstopW
, CIM_BOOLEAN
},
594 { prop_displaynameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
595 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
596 { prop_processidW
, CIM_UINT32
},
597 { prop_servicetypeW
, CIM_STRING
},
598 { prop_startmodeW
, CIM_STRING
},
599 { prop_stateW
, CIM_STRING
},
600 { prop_systemnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
602 { method_pauseserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
603 { method_resumeserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
604 { method_startserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
605 { method_stopserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
607 static const struct column col_sid
[] =
609 { prop_accountnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
610 { prop_binaryrepresentationW
, CIM_UINT8
|CIM_FLAG_ARRAY
|COL_FLAG_DYNAMIC
},
611 { prop_referenceddomainnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
612 { prop_sidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
613 { prop_sidlengthW
, CIM_UINT32
}
615 static const struct column col_sounddevice
[] =
617 { prop_nameW
, CIM_STRING
},
618 { prop_productnameW
, CIM_STRING
},
619 { prop_statusinfoW
, CIM_UINT16
, VT_I4
}
621 static const struct column col_stdregprov
[] =
623 { method_enumkeyW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
624 { method_enumvaluesW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
625 { method_getstringvalueW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
627 static const struct column col_systemenclosure
[] =
629 { prop_captionW
, CIM_STRING
},
630 { prop_chassistypesW
, CIM_UINT16
|CIM_FLAG_ARRAY
},
631 { prop_descriptionW
, CIM_STRING
},
632 { prop_lockpresentW
, CIM_BOOLEAN
},
633 { prop_manufacturerW
, CIM_STRING
},
634 { prop_nameW
, CIM_STRING
},
635 { prop_tagW
, CIM_STRING
},
637 static const struct column col_systemsecurity
[] =
639 { method_getsdW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
640 { method_setsdW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
642 static const struct column col_videocontroller
[] =
644 { prop_adapterdactypeW
, CIM_STRING
},
645 { prop_adapterramW
, CIM_UINT32
, VT_I4
},
646 { prop_availabilityW
, CIM_UINT16
},
647 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
648 { prop_currentbitsperpixelW
, CIM_UINT32
, VT_I4
},
649 { prop_currenthorizontalresW
, CIM_UINT32
, VT_I4
},
650 { prop_currentrefreshrateW
, CIM_UINT32
, VT_I4
},
651 { prop_currentscanmodeW
, CIM_UINT16
, VT_I4
},
652 { prop_currentverticalresW
, CIM_UINT32
, VT_I4
},
653 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
654 { prop_deviceidW
, CIM_STRING
|COL_FLAG_KEY
},
655 { prop_driverversionW
, CIM_STRING
},
656 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
657 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
658 { prop_videoarchitectureW
, CIM_UINT16
, VT_I4
},
659 { prop_videomemorytypeW
, CIM_UINT16
, VT_I4
},
660 { prop_videoprocessorW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
663 static const WCHAR baseboard_manufacturerW
[] =
664 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
665 static const WCHAR baseboard_serialnumberW
[] =
667 static const WCHAR baseboard_tagW
[] =
668 {'B','a','s','e',' ','B','o','a','r','d',0};
669 static const WCHAR baseboard_versionW
[] =
671 static const WCHAR bios_descriptionW
[] =
672 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
673 static const WCHAR bios_manufacturerW
[] =
674 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
675 static const WCHAR bios_nameW
[] =
676 {'W','I','N','E',' ','B','I','O','S',0};
677 static const WCHAR bios_releasedateW
[] =
678 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
679 static const WCHAR bios_serialnumberW
[] =
681 static const WCHAR bios_smbiosbiosversionW
[] =
683 static const WCHAR bios_versionW
[] =
684 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
685 static const WCHAR cdromdrive_mediatypeW
[] =
686 {'C','D','-','R','O','M',0};
687 static const WCHAR cdromdrive_nameW
[] =
688 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
689 static const WCHAR cdromdrive_pnpdeviceidW
[]=
690 {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
691 '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
692 '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
693 'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
694 static const WCHAR compsys_descriptionW
[] =
695 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
696 static const WCHAR compsys_domainW
[] =
697 {'W','O','R','K','G','R','O','U','P',0};
698 static const WCHAR compsys_manufacturerW
[] =
699 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
700 static const WCHAR compsys_modelW
[] =
702 static const WCHAR compsysproduct_identifyingnumberW
[] =
704 static const WCHAR compsysproduct_uuidW
[] =
705 {'0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-',
706 '0','0','0','0','0','0','0','0','0','0','0','0',0};
707 static const WCHAR diskdrive_interfacetypeW
[] =
709 static const WCHAR diskdrive_manufacturerW
[] =
710 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
711 static const WCHAR diskdrive_mediatype_fixedW
[] =
712 {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
713 static const WCHAR diskdrive_mediatype_removableW
[] =
714 {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
715 static const WCHAR diskdrive_modelW
[] =
716 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
717 static const WCHAR diskdrive_pnpdeviceidW
[] =
718 {'I','D','E','\\','D','i','s','k','\\','V','E','N','_','W','I','N','E',0};
719 static const WCHAR diskdrive_serialW
[] =
720 {'W','I','N','E','H','D','I','S','K',0};
721 static const WCHAR networkadapter_pnpdeviceidW
[]=
722 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
723 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
724 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
725 static const WCHAR os_32bitW
[] =
726 {'3','2','-','b','i','t',0};
727 static const WCHAR os_64bitW
[] =
728 {'6','4','-','b','i','t',0};
729 static const WCHAR os_buildnumberW
[] =
731 static const WCHAR os_captionW
[] =
732 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
733 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
734 static const WCHAR os_csdversionW
[] =
735 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
736 static const WCHAR os_installdateW
[] =
737 {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
738 static const WCHAR os_nameW
[] =
739 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
740 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
741 '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
742 '\\','P','a','r','t','i','t','i','o','n','1',0};
743 static const WCHAR os_serialnumberW
[] =
744 {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
745 static const WCHAR os_versionW
[] =
746 {'5','.','1','.','2','6','0','0',0};
747 static const WCHAR physicalmedia_tagW
[] =
748 {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
749 static const WCHAR sounddevice_productnameW
[] =
750 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
751 static const WCHAR systemenclosure_systemenclosureW
[] =
752 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',0};
753 static const WCHAR systemenclosure_tagW
[] =
754 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',' ','0',0};
755 static const WCHAR systemenclosure_manufacturerW
[] =
757 static const WCHAR videocontroller_dactypeW
[] =
758 {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
759 static const WCHAR videocontroller_deviceidW
[] =
760 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
761 static const WCHAR videocontroller_driverversionW
[] =
764 #include "pshpack1.h"
765 struct record_baseboard
767 const WCHAR
*manufacturer
;
770 const WCHAR
*product
;
771 const WCHAR
*serialnumber
;
773 const WCHAR
*version
;
777 const WCHAR
*description
;
778 const WCHAR
*identificationcode
;
779 const WCHAR
*manufacturer
;
781 const WCHAR
*releasedate
;
782 const WCHAR
*serialnumber
;
783 const WCHAR
*smbiosbiosversion
;
784 const WCHAR
*version
;
786 struct record_cdromdrive
788 const WCHAR
*device_id
;
790 const WCHAR
*mediatype
;
792 const WCHAR
*pnpdevice_id
;
794 struct record_computersystem
796 const WCHAR
*description
;
799 const WCHAR
*manufacturer
;
802 UINT32 num_logical_processors
;
803 UINT32 num_processors
;
804 UINT64 total_physical_memory
;
805 const WCHAR
*username
;
807 struct record_computersystemproduct
809 const WCHAR
*identifyingnumber
;
812 struct record_datafile
815 const WCHAR
*version
;
817 struct record_desktopmonitor
819 UINT32 pixelsperxlogicalinch
;
821 struct record_directory
826 struct record_diskdrive
828 const WCHAR
*device_id
;
830 const WCHAR
*interfacetype
;
831 const WCHAR
*manufacturer
;
832 const WCHAR
*mediatype
;
834 const WCHAR
*pnpdevice_id
;
835 const WCHAR
*serialnumber
;
838 struct record_diskpartition
842 const WCHAR
*device_id
;
845 const WCHAR
*pnpdevice_id
;
847 UINT64 startingoffset
;
850 struct record_logicaldisk
852 const WCHAR
*device_id
;
854 const WCHAR
*filesystem
;
858 const WCHAR
*volumename
;
859 const WCHAR
*volumeserialnumber
;
861 struct record_networkadapter
863 const WCHAR
*adaptertype
;
864 const WCHAR
*device_id
;
866 UINT32 interface_index
;
867 const WCHAR
*mac_address
;
868 const WCHAR
*manufacturer
;
870 UINT16 netconnection_status
;
872 const WCHAR
*pnpdevice_id
;
875 struct record_networkadapterconfig
877 const struct array
*defaultipgateway
;
878 const WCHAR
*description
;
880 const WCHAR
*dnshostname
;
881 const struct array
*dnsserversearchorder
;
883 UINT32 ipconnectionmetric
;
885 const WCHAR
*mac_address
;
886 const WCHAR
*settingid
;
888 struct record_operatingsystem
890 const WCHAR
*buildnumber
;
891 const WCHAR
*caption
;
892 const WCHAR
*codeset
;
893 const WCHAR
*countrycode
;
894 const WCHAR
*csdversion
;
895 const WCHAR
*installdate
;
896 const WCHAR
*lastbootuptime
;
897 const WCHAR
*localdatetime
;
900 const WCHAR
*osarchitecture
;
902 UINT32 osproductsuite
;
905 const WCHAR
*serialnumber
;
906 UINT16 servicepackmajor
;
907 UINT16 servicepackminor
;
909 const WCHAR
*systemdirectory
;
910 UINT64 totalvisiblememorysize
;
911 const WCHAR
*version
;
918 const WCHAR
*parameter
;
923 struct record_physicalmedia
925 const WCHAR
*serialnumber
;
928 struct record_physicalmemory
932 struct record_printer
935 const WCHAR
*drivername
;
936 UINT32 horizontalresolution
;
941 struct record_process
943 const WCHAR
*caption
;
944 const WCHAR
*commandline
;
945 const WCHAR
*description
;
951 UINT64 workingsetsize
;
953 class_method
*get_owner
;
955 struct record_processor
958 const WCHAR
*caption
;
960 UINT32 currentclockspeed
;
962 const WCHAR
*description
;
963 const WCHAR
*device_id
;
965 const WCHAR
*manufacturer
;
966 UINT32 maxclockspeed
;
969 UINT32 num_logical_processors
;
970 const WCHAR
*processor_id
;
971 UINT16 processortype
;
972 const WCHAR
*unique_id
;
973 const WCHAR
*version
;
975 struct record_qualifier
983 const WCHAR
*strvalue
;
985 struct record_service
989 const WCHAR
*displayname
;
992 const WCHAR
*servicetype
;
993 const WCHAR
*startmode
;
995 const WCHAR
*systemname
;
997 class_method
*pause_service
;
998 class_method
*resume_service
;
999 class_method
*start_service
;
1000 class_method
*stop_service
;
1004 const WCHAR
*accountname
;
1005 const struct array
*binaryrepresentation
;
1006 const WCHAR
*referenceddomainname
;
1010 struct record_sounddevice
1013 const WCHAR
*productname
;
1016 struct record_stdregprov
1018 class_method
*enumkey
;
1019 class_method
*enumvalues
;
1020 class_method
*getstringvalue
;
1022 struct record_systemsecurity
1024 class_method
*getsd
;
1025 class_method
*setsd
;
1027 struct record_systemenclosure
1029 const WCHAR
*caption
;
1030 const struct array
*chassistypes
;
1031 const WCHAR
*description
;
1033 const WCHAR
*manufacturer
;
1037 struct record_videocontroller
1039 const WCHAR
*adapter_dactype
;
1041 UINT16 availability
;
1042 const WCHAR
*caption
;
1043 UINT32 current_bitsperpixel
;
1044 UINT32 current_horizontalres
;
1045 UINT32 current_refreshrate
;
1046 UINT16 current_scanmode
;
1047 UINT32 current_verticalres
;
1048 const WCHAR
*description
;
1049 const WCHAR
*device_id
;
1050 const WCHAR
*driverversion
;
1052 const WCHAR
*pnpdevice_id
;
1053 UINT16 videoarchitecture
;
1054 UINT16 videomemorytype
;
1055 const WCHAR
*videoprocessor
;
1057 #include "poppack.h"
1059 static const struct record_baseboard data_baseboard
[] =
1061 { baseboard_manufacturerW
, baseboard_tagW
, baseboard_tagW
, baseboard_tagW
, baseboard_serialnumberW
, baseboard_versionW
}
1063 static const struct record_bios data_bios
[] =
1065 { bios_descriptionW
, bios_descriptionW
, bios_manufacturerW
, bios_nameW
, bios_releasedateW
, bios_serialnumberW
,
1066 bios_smbiosbiosversionW
, bios_versionW
}
1068 static const struct record_computersystemproduct data_compsysproduct
[] =
1070 { compsysproduct_identifyingnumberW
, compsysproduct_uuidW
}
1072 static const struct record_param data_param
[] =
1074 { class_processW
, method_getownerW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1075 { class_processW
, method_getownerW
, -1, param_userW
, CIM_STRING
},
1076 { class_processW
, method_getownerW
, -1, param_domainW
, CIM_STRING
},
1077 { class_serviceW
, method_pauseserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1078 { class_serviceW
, method_resumeserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1079 { class_serviceW
, method_startserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1080 { class_serviceW
, method_stopserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1081 { class_stdregprovW
, method_enumkeyW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
1082 { class_stdregprovW
, method_enumkeyW
, 1, param_subkeynameW
, CIM_STRING
},
1083 { class_stdregprovW
, method_enumkeyW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1084 { class_stdregprovW
, method_enumkeyW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
1085 { class_stdregprovW
, method_enumvaluesW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
1086 { class_stdregprovW
, method_enumvaluesW
, 1, param_subkeynameW
, CIM_STRING
},
1087 { class_stdregprovW
, method_enumvaluesW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1088 { class_stdregprovW
, method_enumvaluesW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
1089 { class_stdregprovW
, method_enumvaluesW
, -1, param_typesW
, CIM_SINT32
|CIM_FLAG_ARRAY
},
1090 { class_stdregprovW
, method_getstringvalueW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
1091 { class_stdregprovW
, method_getstringvalueW
, 1, param_subkeynameW
, CIM_STRING
},
1092 { class_stdregprovW
, method_getstringvalueW
, 1, param_valuenameW
, CIM_STRING
},
1093 { class_stdregprovW
, method_getstringvalueW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1094 { class_stdregprovW
, method_getstringvalueW
, -1, param_valueW
, CIM_STRING
},
1095 { class_systemsecurityW
, method_getsdW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1096 { class_systemsecurityW
, method_getsdW
, -1, param_sdW
, CIM_UINT8
|CIM_FLAG_ARRAY
},
1097 { class_systemsecurityW
, method_setsdW
, 1, param_sdW
, CIM_UINT8
|CIM_FLAG_ARRAY
},
1098 { class_systemsecurityW
, method_setsdW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1101 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
1102 WBEM_FLAVOR_ORIGIN_PROPAGATED)
1104 static const struct record_physicalmedia data_physicalmedia
[] =
1106 { diskdrive_serialW
, physicalmedia_tagW
}
1108 static const struct record_qualifier data_qualifier
[] =
1110 { class_process_getowner_outW
, param_userW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 0 },
1111 { class_process_getowner_outW
, param_domainW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 1 }
1113 static const struct record_sounddevice data_sounddevice
[] =
1115 { sounddevice_productnameW
, sounddevice_productnameW
, 3 /* enabled */ }
1117 static const struct record_stdregprov data_stdregprov
[] =
1119 { reg_enum_key
, reg_enum_values
, reg_get_stringvalue
}
1121 static UINT16 systemenclosure_chassistypes
[] =
1125 static const struct array systemenclosure_chassistypes_array
=
1127 SIZEOF(systemenclosure_chassistypes
),
1128 &systemenclosure_chassistypes
1130 static const struct record_systemenclosure data_systemenclosure
[] =
1133 systemenclosure_systemenclosureW
,
1134 &systemenclosure_chassistypes_array
,
1135 systemenclosure_systemenclosureW
,
1137 systemenclosure_manufacturerW
,
1138 systemenclosure_systemenclosureW
,
1139 systemenclosure_tagW
,
1142 static const struct record_systemsecurity data_systemsecurity
[] =
1144 { security_get_sd
, security_set_sd
}
1147 /* check if row matches condition and update status */
1148 static BOOL
match_row( const struct table
*table
, UINT row
, const struct expr
*cond
, enum fill_status
*status
)
1155 *status
= FILL_STATUS_UNFILTERED
;
1158 if (eval_cond( table
, row
, cond
, &val
, &type
) != S_OK
)
1160 *status
= FILL_STATUS_FAILED
;
1163 *status
= FILL_STATUS_FILTERED
;
1167 static BOOL
resize_table( struct table
*table
, UINT row_count
, UINT row_size
)
1169 if (!table
->num_rows_allocated
)
1171 if (!(table
->data
= heap_alloc( row_count
* row_size
))) return FALSE
;
1172 table
->num_rows_allocated
= row_count
;
1175 if (row_count
> table
->num_rows_allocated
)
1178 UINT count
= max( row_count
, table
->num_rows_allocated
* 2 );
1179 if (!(data
= heap_realloc( table
->data
, count
* row_size
))) return FALSE
;
1181 table
->num_rows_allocated
= count
;
1186 static enum fill_status
fill_cdromdrive( struct table
*table
, const struct expr
*cond
)
1188 static const WCHAR fmtW
[] = {'%','c',':',0};
1189 WCHAR drive
[3], root
[] = {'A',':','\\',0};
1190 struct record_cdromdrive
*rec
;
1191 UINT i
, row
= 0, offset
= 0;
1192 DWORD drives
= GetLogicalDrives();
1193 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1195 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1197 for (i
= 0; i
< 26; i
++)
1199 if (drives
& (1 << i
))
1202 if (GetDriveTypeW( root
) != DRIVE_CDROM
)
1205 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1207 rec
= (struct record_cdromdrive
*)(table
->data
+ offset
);
1208 rec
->device_id
= cdromdrive_pnpdeviceidW
;
1209 sprintfW( drive
, fmtW
, 'A' + i
);
1210 rec
->drive
= heap_strdupW( drive
);
1211 rec
->mediatype
= cdromdrive_mediatypeW
;
1212 rec
->name
= cdromdrive_nameW
;
1213 rec
->pnpdevice_id
= cdromdrive_pnpdeviceidW
;
1214 if (!match_row( table
, row
, cond
, &status
))
1216 free_row_values( table
, row
);
1219 offset
+= sizeof(*rec
);
1223 TRACE("created %u rows\n", row
);
1224 table
->num_rows
= row
;
1228 static UINT
get_processor_count(void)
1230 SYSTEM_BASIC_INFORMATION info
;
1232 if (NtQuerySystemInformation( SystemBasicInformation
, &info
, sizeof(info
), NULL
)) return 1;
1233 return info
.NumberOfProcessors
;
1236 static UINT
get_logical_processor_count( UINT
*num_cores
)
1238 SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*info
;
1239 UINT i
, j
, count
= 0;
1243 if (num_cores
) *num_cores
= get_processor_count();
1244 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, NULL
, 0, &len
);
1245 if (status
!= STATUS_INFO_LENGTH_MISMATCH
) return get_processor_count();
1247 if (!(info
= heap_alloc( len
))) return get_processor_count();
1248 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, info
, len
, &len
);
1249 if (status
!= STATUS_SUCCESS
)
1252 return get_processor_count();
1254 if (num_cores
) *num_cores
= 0;
1255 for (i
= 0; i
< len
/ sizeof(*info
); i
++)
1257 if (info
[i
].Relationship
== RelationProcessorCore
)
1259 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) count
++;
1261 else if (info
[i
].Relationship
== RelationProcessorPackage
&& num_cores
)
1263 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) (*num_cores
)++;
1270 static UINT64
get_total_physical_memory(void)
1272 MEMORYSTATUSEX status
;
1274 status
.dwLength
= sizeof(status
);
1275 if (!GlobalMemoryStatusEx( &status
)) return 1024 * 1024 * 1024;
1276 return status
.ullTotalPhys
;
1279 static WCHAR
*get_computername(void)
1282 DWORD size
= MAX_COMPUTERNAME_LENGTH
+ 1;
1284 if (!(ret
= heap_alloc( size
* sizeof(WCHAR
) ))) return NULL
;
1285 GetComputerNameW( ret
, &size
);
1289 static WCHAR
*get_username(void)
1292 DWORD compsize
, usersize
;
1296 GetComputerNameW( NULL
, &compsize
);
1298 GetUserNameW( NULL
, &usersize
);
1299 size
= compsize
+ usersize
; /* two null terminators account for the \ */
1300 if (!(ret
= heap_alloc( size
* sizeof(WCHAR
) ))) return NULL
;
1301 GetComputerNameW( ret
, &compsize
);
1302 ret
[compsize
] = '\\';
1303 GetUserNameW( ret
+ compsize
+ 1, &usersize
);
1307 static enum fill_status
fill_compsys( struct table
*table
, const struct expr
*cond
)
1309 struct record_computersystem
*rec
;
1310 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1313 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1315 rec
= (struct record_computersystem
*)table
->data
;
1316 rec
->description
= compsys_descriptionW
;
1317 rec
->domain
= compsys_domainW
;
1318 rec
->domainrole
= 0; /* standalone workstation */
1319 rec
->manufacturer
= compsys_manufacturerW
;
1320 rec
->model
= compsys_modelW
;
1321 rec
->name
= get_computername();
1322 rec
->num_logical_processors
= get_logical_processor_count( NULL
);
1323 rec
->num_processors
= get_processor_count();
1324 rec
->total_physical_memory
= get_total_physical_memory();
1325 rec
->username
= get_username();
1326 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
1329 TRACE("created %u rows\n", row
);
1330 table
->num_rows
= row
;
1342 static struct dirstack
*alloc_dirstack( UINT size
)
1344 struct dirstack
*dirstack
;
1346 if (!(dirstack
= heap_alloc( sizeof(*dirstack
) ))) return NULL
;
1347 if (!(dirstack
->dirs
= heap_alloc( sizeof(WCHAR
*) * size
)))
1349 heap_free( dirstack
);
1352 if (!(dirstack
->len_dirs
= heap_alloc( sizeof(UINT
) * size
)))
1354 heap_free( dirstack
->dirs
);
1355 heap_free( dirstack
);
1358 dirstack
->num_dirs
= 0;
1359 dirstack
->num_allocated
= size
;
1363 static void clear_dirstack( struct dirstack
*dirstack
)
1366 for (i
= 0; i
< dirstack
->num_dirs
; i
++) heap_free( dirstack
->dirs
[i
] );
1367 dirstack
->num_dirs
= 0;
1370 static void free_dirstack( struct dirstack
*dirstack
)
1372 clear_dirstack( dirstack
);
1373 heap_free( dirstack
->dirs
);
1374 heap_free( dirstack
->len_dirs
);
1375 heap_free( dirstack
);
1378 static BOOL
push_dir( struct dirstack
*dirstack
, WCHAR
*dir
, UINT len
)
1380 UINT size
, i
= dirstack
->num_dirs
;
1382 if (!dir
) return FALSE
;
1384 if (i
== dirstack
->num_allocated
)
1389 size
= dirstack
->num_allocated
* 2;
1390 if (!(tmp
= heap_realloc( dirstack
->dirs
, size
* sizeof(WCHAR
*) ))) return FALSE
;
1391 dirstack
->dirs
= tmp
;
1392 if (!(len_tmp
= heap_realloc( dirstack
->len_dirs
, size
* sizeof(UINT
) ))) return FALSE
;
1393 dirstack
->len_dirs
= len_tmp
;
1394 dirstack
->num_allocated
= size
;
1396 dirstack
->dirs
[i
] = dir
;
1397 dirstack
->len_dirs
[i
] = len
;
1398 dirstack
->num_dirs
++;
1402 static WCHAR
*pop_dir( struct dirstack
*dirstack
, UINT
*len
)
1404 if (!dirstack
->num_dirs
)
1409 dirstack
->num_dirs
--;
1410 *len
= dirstack
->len_dirs
[dirstack
->num_dirs
];
1411 return dirstack
->dirs
[dirstack
->num_dirs
];
1414 static const WCHAR
*peek_dir( struct dirstack
*dirstack
)
1416 if (!dirstack
->num_dirs
) return NULL
;
1417 return dirstack
->dirs
[dirstack
->num_dirs
- 1];
1420 static WCHAR
*build_glob( WCHAR drive
, const WCHAR
*path
, UINT len
)
1425 if (!(ret
= heap_alloc( (len
+ 6) * sizeof(WCHAR
) ))) return NULL
;
1431 memcpy( ret
+ i
, path
, len
* sizeof(WCHAR
) );
1440 static WCHAR
*build_name( WCHAR drive
, const WCHAR
*path
)
1442 UINT i
= 0, len
= 0;
1446 for (p
= path
; *p
; p
++)
1448 if (*p
== '\\') len
+= 2;
1451 if (!(ret
= heap_alloc( (len
+ 5) * sizeof(WCHAR
) ))) return NULL
;
1456 for (p
= path
; *p
; p
++)
1458 if (*p
!= '\\') ret
[i
++] = *p
;
1469 static WCHAR
*build_dirname( const WCHAR
*path
, UINT
*ret_len
)
1471 const WCHAR
*p
= path
, *start
;
1475 if (!isalphaW( p
[0] ) || p
[1] != ':' || p
[2] != '\\' || p
[3] != '\\' || !p
[4]) return NULL
;
1477 len
= strlenW( start
);
1478 p
= start
+ len
- 1;
1479 if (*p
== '\\') return NULL
;
1481 while (p
>= start
&& *p
!= '\\') { len
--; p
--; };
1482 while (p
>= start
&& *p
== '\\') { len
--; p
--; };
1484 if (!(ret
= heap_alloc( (len
+ 1) * sizeof(WCHAR
) ))) return NULL
;
1485 for (i
= 0, p
= start
; p
< start
+ len
; p
++)
1487 if (p
[0] == '\\' && p
[1] == '\\')
1499 static BOOL
seen_dir( struct dirstack
*dirstack
, const WCHAR
*path
)
1502 for (i
= 0; i
< dirstack
->num_dirs
; i
++) if (!strcmpW( dirstack
->dirs
[i
], path
)) return TRUE
;
1506 /* optimize queries of the form WHERE Name='...' [OR Name='...']* */
1507 static UINT
seed_dirs( struct dirstack
*dirstack
, const struct expr
*cond
, WCHAR root
, UINT
*count
)
1509 const struct expr
*left
, *right
;
1511 if (!cond
|| cond
->type
!= EXPR_COMPLEX
) return *count
= 0;
1513 left
= cond
->u
.expr
.left
;
1514 right
= cond
->u
.expr
.right
;
1515 if (cond
->u
.expr
.op
== OP_EQ
)
1519 const WCHAR
*str
= NULL
;
1521 if (left
->type
== EXPR_PROPVAL
&& right
->type
== EXPR_SVAL
&&
1522 !strcmpW( left
->u
.propval
->name
, prop_nameW
) &&
1523 toupperW( right
->u
.sval
[0] ) == toupperW( root
))
1525 str
= right
->u
.sval
;
1527 else if (left
->type
== EXPR_SVAL
&& right
->type
== EXPR_PROPVAL
&&
1528 !strcmpW( right
->u
.propval
->name
, prop_nameW
) &&
1529 toupperW( left
->u
.sval
[0] ) == toupperW( root
))
1533 if (str
&& (path
= build_dirname( str
, &len
)))
1535 if (seen_dir( dirstack
, path
))
1540 else if (push_dir( dirstack
, path
, len
)) return ++*count
;
1545 else if (cond
->u
.expr
.op
== OP_OR
)
1547 UINT left_count
= 0, right_count
= 0;
1549 if (!(seed_dirs( dirstack
, left
, root
, &left_count
))) return *count
= 0;
1550 if (!(seed_dirs( dirstack
, right
, root
, &right_count
))) return *count
= 0;
1551 return *count
+= left_count
+ right_count
;
1556 static WCHAR
*append_path( const WCHAR
*path
, const WCHAR
*segment
, UINT
*len
)
1558 UINT len_path
= 0, len_segment
= strlenW( segment
);
1562 if (path
) len_path
= strlenW( path
);
1563 if (!(ret
= heap_alloc( (len_path
+ len_segment
+ 2) * sizeof(WCHAR
) ))) return NULL
;
1564 if (path
&& len_path
)
1566 memcpy( ret
, path
, len_path
* sizeof(WCHAR
) );
1567 ret
[len_path
] = '\\';
1568 *len
+= len_path
+ 1;
1570 memcpy( ret
+ *len
, segment
, len_segment
* sizeof(WCHAR
) );
1571 *len
+= len_segment
;
1576 static WCHAR
*get_file_version( const WCHAR
*filename
)
1578 static const WCHAR slashW
[] = {'\\',0}, fmtW
[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
1579 VS_FIXEDFILEINFO
*info
;
1584 if (!(ret
= heap_alloc( (4 * 5 + sizeof(fmtW
) / sizeof(fmtW
[0])) * sizeof(WCHAR
) ))) return NULL
;
1585 if (!(size
= GetFileVersionInfoSizeW( filename
, NULL
)) || !(block
= heap_alloc( size
)))
1590 if (!GetFileVersionInfoW( filename
, 0, size
, block
) ||
1591 !VerQueryValueW( block
, slashW
, (void **)&info
, &size
))
1597 sprintfW( ret
, fmtW
, info
->dwFileVersionMS
>> 16, info
->dwFileVersionMS
& 0xffff,
1598 info
->dwFileVersionLS
>> 16, info
->dwFileVersionLS
& 0xffff );
1603 static enum fill_status
fill_datafile( struct table
*table
, const struct expr
*cond
)
1605 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1606 struct record_datafile
*rec
;
1607 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1608 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1609 DWORD drives
= GetLogicalDrives();
1610 WIN32_FIND_DATAW data
;
1612 struct dirstack
*dirstack
;
1613 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1615 if (!resize_table( table
, 8, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1617 dirstack
= alloc_dirstack(2);
1619 for (i
= 0; i
< 26; i
++)
1621 if (!(drives
& (1 << i
))) continue;
1624 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1626 num_expected_rows
= 0;
1627 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1633 path
= pop_dir( dirstack
, &len
);
1634 if (!(glob
= build_glob( root
[0], path
, len
)))
1636 status
= FILL_STATUS_FAILED
;
1639 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1643 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1645 status
= FILL_STATUS_FAILED
;
1646 FindClose( handle
);
1649 if (!strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
)) continue;
1650 new_path
= append_path( path
, data
.cFileName
, &len
);
1652 if (data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
1654 if (push_dir( dirstack
, new_path
, len
)) continue;
1655 heap_free( new_path
);
1656 FindClose( handle
);
1657 status
= FILL_STATUS_FAILED
;
1660 rec
= (struct record_datafile
*)(table
->data
+ offset
);
1661 rec
->name
= build_name( root
[0], new_path
);
1662 rec
->version
= get_file_version( rec
->name
);
1663 if (!match_row( table
, row
, cond
, &status
))
1665 free_row_values( table
, row
);
1668 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1671 FindClose( handle
);
1672 status
= FILL_STATUS_FILTERED
;
1675 offset
+= sizeof(*rec
);
1678 while (FindNextFileW( handle
, &data
));
1679 FindClose( handle
);
1681 if (!peek_dir( dirstack
)) break;
1686 free_dirstack( dirstack
);
1690 TRACE("created %u rows\n", row
);
1691 table
->num_rows
= row
;
1695 static UINT32
get_pixelsperxlogicalinch(void)
1697 HDC hdc
= GetDC( NULL
);
1700 if (!hdc
) return 96;
1701 ret
= GetDeviceCaps( hdc
, LOGPIXELSX
);
1702 ReleaseDC( NULL
, hdc
);
1706 static enum fill_status
fill_desktopmonitor( struct table
*table
, const struct expr
*cond
)
1708 struct record_desktopmonitor
*rec
;
1709 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1712 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1714 rec
= (struct record_desktopmonitor
*)table
->data
;
1715 rec
->pixelsperxlogicalinch
= get_pixelsperxlogicalinch();
1717 if (match_row( table
, row
, cond
, &status
)) row
++;
1719 TRACE("created %u rows\n", row
);
1720 table
->num_rows
= row
;
1724 static enum fill_status
fill_directory( struct table
*table
, const struct expr
*cond
)
1726 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1727 struct record_directory
*rec
;
1728 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1729 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1730 DWORD drives
= GetLogicalDrives();
1731 WIN32_FIND_DATAW data
;
1733 struct dirstack
*dirstack
;
1734 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1736 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1738 dirstack
= alloc_dirstack(2);
1740 for (i
= 0; i
< 26; i
++)
1742 if (!(drives
& (1 << i
))) continue;
1745 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1747 num_expected_rows
= 0;
1748 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1754 path
= pop_dir( dirstack
, &len
);
1755 if (!(glob
= build_glob( root
[0], path
, len
)))
1757 status
= FILL_STATUS_FAILED
;
1760 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1764 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1766 FindClose( handle
);
1767 status
= FILL_STATUS_FAILED
;
1770 if (!(data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
) ||
1771 !strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
))
1774 new_path
= append_path( path
, data
.cFileName
, &len
);
1775 if (!(push_dir( dirstack
, new_path
, len
)))
1777 heap_free( new_path
);
1778 FindClose( handle
);
1779 status
= FILL_STATUS_FAILED
;
1782 rec
= (struct record_directory
*)(table
->data
+ offset
);
1783 rec
->accessmask
= FILE_ALL_ACCESS
;
1784 rec
->name
= build_name( root
[0], new_path
);
1785 if (!match_row( table
, row
, cond
, &status
))
1787 free_row_values( table
, row
);
1790 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1793 FindClose( handle
);
1794 status
= FILL_STATUS_FILTERED
;
1797 offset
+= sizeof(*rec
);
1800 while (FindNextFileW( handle
, &data
));
1801 FindClose( handle
);
1803 if (!peek_dir( dirstack
)) break;
1808 free_dirstack( dirstack
);
1812 TRACE("created %u rows\n", row
);
1813 table
->num_rows
= row
;
1817 static UINT64
get_freespace( const WCHAR
*dir
, UINT64
*disksize
)
1819 WCHAR root
[] = {'\\','\\','.','\\','A',':',0};
1820 ULARGE_INTEGER free
;
1821 DISK_GEOMETRY_EX info
;
1823 DWORD bytes_returned
;
1825 free
.QuadPart
= 512 * 1024 * 1024;
1826 GetDiskFreeSpaceExW( dir
, NULL
, NULL
, &free
);
1829 handle
= CreateFileW( root
, GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
, OPEN_EXISTING
, 0, 0 );
1830 if (handle
!= INVALID_HANDLE_VALUE
)
1832 if (DeviceIoControl( handle
, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
, NULL
, 0, &info
, sizeof(info
), &bytes_returned
, NULL
))
1833 *disksize
= info
.DiskSize
.QuadPart
;
1834 CloseHandle( handle
);
1836 return free
.QuadPart
;
1839 static enum fill_status
fill_diskdrive( struct table
*table
, const struct expr
*cond
)
1841 static const WCHAR fmtW
[] =
1842 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
1843 WCHAR device_id
[sizeof(fmtW
)/sizeof(fmtW
[0]) + 10], root
[] = {'A',':','\\',0};
1844 struct record_diskdrive
*rec
;
1845 UINT i
, row
= 0, offset
= 0, index
= 0, type
;
1846 UINT64 size
= 1024 * 1024 * 1024;
1847 DWORD drives
= GetLogicalDrives();
1848 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1850 if (!resize_table( table
, 2, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1852 for (i
= 0; i
< 26; i
++)
1854 if (drives
& (1 << i
))
1857 type
= GetDriveTypeW( root
);
1858 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1861 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1863 rec
= (struct record_diskdrive
*)(table
->data
+ offset
);
1864 sprintfW( device_id
, fmtW
, index
);
1865 rec
->device_id
= heap_strdupW( device_id
);
1867 rec
->interfacetype
= diskdrive_interfacetypeW
;
1868 rec
->manufacturer
= diskdrive_manufacturerW
;
1869 if (type
== DRIVE_FIXED
)
1870 rec
->mediatype
= diskdrive_mediatype_fixedW
;
1872 rec
->mediatype
= diskdrive_mediatype_removableW
;
1873 rec
->model
= diskdrive_modelW
;
1874 rec
->pnpdevice_id
= diskdrive_pnpdeviceidW
;
1875 rec
->serialnumber
= diskdrive_serialW
;
1876 get_freespace( root
, &size
);
1878 if (!match_row( table
, row
, cond
, &status
))
1880 free_row_values( table
, row
);
1883 offset
+= sizeof(*rec
);
1888 TRACE("created %u rows\n", row
);
1889 table
->num_rows
= row
;
1893 static WCHAR
*get_filesystem( const WCHAR
*root
)
1895 static const WCHAR ntfsW
[] = {'N','T','F','S',0};
1896 WCHAR buffer
[MAX_PATH
+ 1];
1898 if (GetVolumeInformationW( root
, NULL
, 0, NULL
, NULL
, NULL
, buffer
, MAX_PATH
+ 1 ))
1899 return heap_strdupW( buffer
);
1900 return heap_strdupW( ntfsW
);
1903 static enum fill_status
fill_diskpartition( struct table
*table
, const struct expr
*cond
)
1905 static const WCHAR fmtW
[] =
1906 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
1907 WCHAR device_id
[32], root
[] = {'A',':','\\',0};
1908 struct record_diskpartition
*rec
;
1909 UINT i
, row
= 0, offset
= 0, type
, index
= 0;
1910 UINT64 size
= 1024 * 1024 * 1024;
1911 DWORD drives
= GetLogicalDrives();
1912 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1914 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1916 for (i
= 0; i
< 26; i
++)
1918 if (drives
& (1 << i
))
1921 type
= GetDriveTypeW( root
);
1922 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1925 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1927 rec
= (struct record_diskpartition
*)(table
->data
+ offset
);
1928 rec
->bootable
= (i
== 2) ? -1 : 0;
1929 rec
->bootpartition
= (i
== 2) ? -1 : 0;
1930 sprintfW( device_id
, fmtW
, index
);
1931 rec
->device_id
= heap_strdupW( device_id
);
1932 rec
->diskindex
= index
;
1934 rec
->pnpdevice_id
= heap_strdupW( device_id
);
1935 get_freespace( root
, &size
);
1937 rec
->startingoffset
= 0;
1938 rec
->type
= get_filesystem( root
);
1939 if (!match_row( table
, row
, cond
, &status
))
1941 free_row_values( table
, row
);
1944 offset
+= sizeof(*rec
);
1949 TRACE("created %u rows\n", row
);
1950 table
->num_rows
= row
;
1954 static WCHAR
*get_volumename( const WCHAR
*root
)
1956 WCHAR buf
[MAX_PATH
+ 1] = {0};
1957 GetVolumeInformationW( root
, buf
, sizeof(buf
)/sizeof(buf
[0]), NULL
, NULL
, NULL
, NULL
, 0 );
1958 return heap_strdupW( buf
);
1960 static WCHAR
*get_volumeserialnumber( const WCHAR
*root
)
1962 static const WCHAR fmtW
[] = {'%','0','8','X',0};
1966 GetVolumeInformationW( root
, NULL
, 0, &serial
, NULL
, NULL
, NULL
, 0 );
1967 sprintfW( buffer
, fmtW
, serial
);
1968 return heap_strdupW( buffer
);
1971 static enum fill_status
fill_logicaldisk( struct table
*table
, const struct expr
*cond
)
1973 static const WCHAR fmtW
[] = {'%','c',':',0};
1974 WCHAR device_id
[3], root
[] = {'A',':','\\',0};
1975 struct record_logicaldisk
*rec
;
1976 UINT i
, row
= 0, offset
= 0, type
;
1977 UINT64 size
= 1024 * 1024 * 1024;
1978 DWORD drives
= GetLogicalDrives();
1979 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1981 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1983 for (i
= 0; i
< 26; i
++)
1985 if (drives
& (1 << i
))
1988 type
= GetDriveTypeW( root
);
1989 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_CDROM
&& type
!= DRIVE_REMOVABLE
)
1992 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1994 rec
= (struct record_logicaldisk
*)(table
->data
+ offset
);
1995 sprintfW( device_id
, fmtW
, 'A' + i
);
1996 rec
->device_id
= heap_strdupW( device_id
);
1997 rec
->drivetype
= type
;
1998 rec
->filesystem
= get_filesystem( root
);
1999 rec
->freespace
= get_freespace( root
, &size
);
2000 rec
->name
= heap_strdupW( device_id
);
2002 rec
->volumename
= get_volumename( root
);
2003 rec
->volumeserialnumber
= get_volumeserialnumber( root
);
2004 if (!match_row( table
, row
, cond
, &status
))
2006 free_row_values( table
, row
);
2009 offset
+= sizeof(*rec
);
2013 TRACE("created %u rows\n", row
);
2014 table
->num_rows
= row
;
2018 static UINT16
get_connection_status( IF_OPER_STATUS status
)
2022 case IfOperStatusDown
:
2023 return 0; /* Disconnected */
2024 case IfOperStatusUp
:
2025 return 2; /* Connected */
2027 ERR("unhandled status %u\n", status
);
2032 static WCHAR
*get_mac_address( const BYTE
*addr
, DWORD len
)
2034 static const WCHAR fmtW
[] =
2035 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
2036 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
2039 if (len
!= 6 || !(ret
= heap_alloc( 18 * sizeof(WCHAR
) ))) return NULL
;
2040 sprintfW( ret
, fmtW
, addr
[0], addr
[1], addr
[2], addr
[3], addr
[4], addr
[5] );
2043 static const WCHAR
*get_adaptertype( DWORD type
, int *physical
)
2045 static const WCHAR ethernetW
[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
2046 static const WCHAR wirelessW
[] = {'W','i','r','e','l','e','s','s',0};
2047 static const WCHAR firewireW
[] = {'1','3','9','4',0};
2048 static const WCHAR tunnelW
[] = {'T','u','n','n','e','l',0};
2052 case IF_TYPE_ETHERNET_CSMACD
: *physical
= -1; return ethernetW
;
2053 case IF_TYPE_IEEE80211
: *physical
= -1; return wirelessW
;
2054 case IF_TYPE_IEEE1394
: *physical
= -1; return firewireW
;
2055 case IF_TYPE_TUNNEL
: *physical
= 0; return tunnelW
;
2056 default: *physical
= 0; return NULL
;
2060 static enum fill_status
fill_networkadapter( struct table
*table
, const struct expr
*cond
)
2062 static const WCHAR fmtW
[] = {'%','u',0};
2063 WCHAR device_id
[11];
2064 struct record_networkadapter
*rec
;
2065 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
2066 UINT row
= 0, offset
= 0, count
= 0;
2067 DWORD size
= 0, ret
;
2069 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2071 ret
= GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, NULL
, &size
);
2072 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
2074 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
2075 if (GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, buffer
, &size
))
2077 heap_free( buffer
);
2078 return FILL_STATUS_FAILED
;
2080 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2082 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
2084 if (!resize_table( table
, count
, sizeof(*rec
) ))
2086 heap_free( buffer
);
2087 return FILL_STATUS_FAILED
;
2089 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2091 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
2093 rec
= (struct record_networkadapter
*)(table
->data
+ offset
);
2094 sprintfW( device_id
, fmtW
, aa
->u
.s
.IfIndex
);
2095 rec
->adaptertype
= get_adaptertype( aa
->IfType
, &physical
);
2096 rec
->device_id
= heap_strdupW( device_id
);
2097 rec
->index
= aa
->u
.s
.IfIndex
;
2098 rec
->interface_index
= aa
->u
.s
.IfIndex
;
2099 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
2100 rec
->manufacturer
= compsys_manufacturerW
;
2101 rec
->name
= heap_strdupW( aa
->FriendlyName
);
2102 rec
->netconnection_status
= get_connection_status( aa
->OperStatus
);
2103 rec
->physicaladapter
= physical
;
2104 rec
->pnpdevice_id
= networkadapter_pnpdeviceidW
;
2105 rec
->speed
= 1000000;
2106 if (!match_row( table
, row
, cond
, &status
))
2108 free_row_values( table
, row
);
2111 offset
+= sizeof(*rec
);
2114 TRACE("created %u rows\n", row
);
2115 table
->num_rows
= row
;
2117 heap_free( buffer
);
2121 static WCHAR
*get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS
*addr
)
2123 const SOCKET_ADDRESS
*sa
= &addr
->Address
;
2124 WCHAR buf
[NI_MAXHOST
];
2126 if (!addr
) return NULL
;
2127 if (GetNameInfoW( sa
->lpSockaddr
, sa
->iSockaddrLength
, buf
, sizeof(buf
)/sizeof(buf
[0]), NULL
,
2128 0, NI_NAMEREQD
)) return NULL
;
2129 return heap_strdupW( buf
);
2131 static struct array
*get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS
*list
)
2133 IP_ADAPTER_GATEWAY_ADDRESS
*gateway
;
2135 ULONG buflen
, i
= 0, count
= 0;
2136 WCHAR
**ptr
, buf
[54]; /* max IPv6 address length */
2138 if (!list
) return NULL
;
2139 for (gateway
= list
; gateway
; gateway
= gateway
->Next
) count
++;
2141 if (!(ret
= heap_alloc( sizeof(*ret
) ))) return NULL
;
2142 if (!(ptr
= heap_alloc( sizeof(*ptr
) * count
)))
2147 for (gateway
= list
; gateway
; gateway
= gateway
->Next
)
2149 buflen
= sizeof(buf
)/sizeof(buf
[0]);
2150 if (WSAAddressToStringW( gateway
->Address
.lpSockaddr
, gateway
->Address
.iSockaddrLength
,
2151 NULL
, buf
, &buflen
) || !(ptr
[i
++] = heap_strdupW( buf
)))
2153 for (; i
> 0; i
--) heap_free( ptr
[i
- 1] );
2163 static struct array
*get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS
*list
)
2165 IP_ADAPTER_DNS_SERVER_ADDRESS
*server
;
2167 ULONG buflen
, i
= 0, count
= 0;
2168 WCHAR
**ptr
, *p
, buf
[54]; /* max IPv6 address length */
2170 if (!list
) return NULL
;
2171 for (server
= list
; server
; server
= server
->Next
) count
++;
2173 if (!(ret
= heap_alloc( sizeof(*ret
) ))) return NULL
;
2174 if (!(ptr
= heap_alloc( sizeof(*ptr
) * count
)))
2179 for (server
= list
; server
; server
= server
->Next
)
2181 buflen
= sizeof(buf
)/sizeof(buf
[0]);
2182 if (WSAAddressToStringW( server
->Address
.lpSockaddr
, server
->Address
.iSockaddrLength
,
2183 NULL
, buf
, &buflen
) || !(ptr
[i
++] = heap_strdupW( buf
)))
2185 for (; i
> 0; i
--) heap_free( ptr
[i
- 1] );
2190 if ((p
= strrchrW( ptr
[i
- 1], ':' ))) *p
= 0;
2196 static WCHAR
*get_settingid( UINT32 index
)
2200 memset( &guid
, 0, sizeof(guid
) );
2202 UuidToStringW( &guid
, &str
);
2203 ret
= heap_strdupW( str
);
2204 RpcStringFreeW( &str
);
2208 static enum fill_status
fill_networkadapterconfig( struct table
*table
, const struct expr
*cond
)
2210 struct record_networkadapterconfig
*rec
;
2211 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
2212 UINT row
= 0, offset
= 0, count
= 0;
2213 DWORD size
= 0, ret
;
2214 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2216 ret
= GetAdaptersAddresses( AF_UNSPEC
, GAA_FLAG_INCLUDE_ALL_GATEWAYS
, NULL
, NULL
, &size
);
2217 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
2219 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
2220 if (GetAdaptersAddresses( AF_UNSPEC
, GAA_FLAG_INCLUDE_ALL_GATEWAYS
, NULL
, buffer
, &size
))
2222 heap_free( buffer
);
2223 return FILL_STATUS_FAILED
;
2225 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2227 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
2229 if (!resize_table( table
, count
, sizeof(*rec
) ))
2231 heap_free( buffer
);
2232 return FILL_STATUS_FAILED
;
2234 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2236 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
2238 rec
= (struct record_networkadapterconfig
*)(table
->data
+ offset
);
2239 rec
->defaultipgateway
= get_defaultipgateway( aa
->FirstGatewayAddress
);
2240 rec
->description
= heap_strdupW( aa
->Description
);
2241 rec
->dhcpenabled
= -1;
2242 rec
->dnshostname
= get_dnshostname( aa
->FirstUnicastAddress
);
2243 rec
->dnsserversearchorder
= get_dnsserversearchorder( aa
->FirstDnsServerAddress
);
2244 rec
->index
= aa
->u
.s
.IfIndex
;
2245 rec
->ipconnectionmetric
= 20;
2246 rec
->ipenabled
= -1;
2247 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
2248 rec
->settingid
= get_settingid( rec
->index
);
2249 if (!match_row( table
, row
, cond
, &status
))
2251 free_row_values( table
, row
);
2254 offset
+= sizeof(*rec
);
2257 TRACE("created %u rows\n", row
);
2258 table
->num_rows
= row
;
2260 heap_free( buffer
);
2264 static enum fill_status
fill_physicalmemory( struct table
*table
, const struct expr
*cond
)
2266 struct record_physicalmemory
*rec
;
2267 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2270 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2272 rec
= (struct record_physicalmemory
*)table
->data
;
2273 rec
->capacity
= get_total_physical_memory();
2274 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2277 TRACE("created %u rows\n", row
);
2278 table
->num_rows
= row
;
2282 static enum fill_status
fill_printer( struct table
*table
, const struct expr
*cond
)
2284 struct record_printer
*rec
;
2285 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2286 PRINTER_INFO_2W
*info
;
2287 DWORD i
, offset
= 0, count
= 0, size
= 0;
2289 EnumPrintersW( PRINTER_ENUM_LOCAL
, NULL
, 2, NULL
, 0, &size
, &count
);
2290 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
) return FILL_STATUS_FAILED
;
2292 if (!(info
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
2293 if (!EnumPrintersW( PRINTER_ENUM_LOCAL
, NULL
, 2, (BYTE
*)info
, size
, &size
, &count
))
2296 return FILL_STATUS_FAILED
;
2298 if (!resize_table( table
, count
, sizeof(*rec
) ))
2301 return FILL_STATUS_FAILED
;
2304 for (i
= 0; i
< count
; i
++)
2306 rec
= (struct record_printer
*)(table
->data
+ offset
);
2307 rec
->attributes
= info
[i
].Attributes
;
2308 rec
->drivername
= heap_strdupW( info
[i
].pDriverName
);
2309 rec
->horizontalresolution
= info
[i
].pDevMode
->u1
.s1
.dmPrintQuality
;
2311 rec
->name
= heap_strdupW( info
[i
].pPrinterName
);
2313 if (!match_row( table
, i
, cond
, &status
))
2315 free_row_values( table
, i
);
2318 offset
+= sizeof(*rec
);
2320 TRACE("created %u rows\n", count
);
2321 table
->num_rows
= count
;
2327 static WCHAR
*get_cmdline( DWORD process_id
)
2329 if (process_id
== GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
2330 return NULL
; /* FIXME handle different process case */
2333 static enum fill_status
fill_process( struct table
*table
, const struct expr
*cond
)
2335 static const WCHAR fmtW
[] = {'%','u',0};
2337 struct record_process
*rec
;
2338 PROCESSENTRY32W entry
;
2340 enum fill_status status
= FILL_STATUS_FAILED
;
2341 UINT row
= 0, offset
= 0;
2343 snap
= CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS
, 0 );
2344 if (snap
== INVALID_HANDLE_VALUE
) return FILL_STATUS_FAILED
;
2346 entry
.dwSize
= sizeof(entry
);
2347 if (!Process32FirstW( snap
, &entry
)) goto done
;
2348 if (!resize_table( table
, 8, sizeof(*rec
) )) goto done
;
2352 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) goto done
;
2354 rec
= (struct record_process
*)(table
->data
+ offset
);
2355 rec
->caption
= heap_strdupW( entry
.szExeFile
);
2356 rec
->commandline
= get_cmdline( entry
.th32ProcessID
);
2357 rec
->description
= heap_strdupW( entry
.szExeFile
);
2358 sprintfW( handle
, fmtW
, entry
.th32ProcessID
);
2359 rec
->handle
= heap_strdupW( handle
);
2360 rec
->name
= heap_strdupW( entry
.szExeFile
);
2361 rec
->process_id
= entry
.th32ProcessID
;
2362 rec
->pprocess_id
= entry
.th32ParentProcessID
;
2363 rec
->thread_count
= entry
.cntThreads
;
2364 rec
->workingsetsize
= 0;
2365 rec
->get_owner
= process_get_owner
;
2366 if (!match_row( table
, row
, cond
, &status
))
2368 free_row_values( table
, row
);
2371 offset
+= sizeof(*rec
);
2373 } while (Process32NextW( snap
, &entry
));
2375 TRACE("created %u rows\n", row
);
2376 table
->num_rows
= row
;
2377 status
= FILL_STATUS_UNFILTERED
;
2380 CloseHandle( snap
);
2384 static inline void do_cpuid( unsigned int ax
, unsigned int *p
)
2390 __asm__("pushl %%ebx\n\t"
2392 "movl %%ebx, %%esi\n\t"
2394 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
2399 static const WCHAR
*get_osarchitecture(void)
2402 GetNativeSystemInfo( &info
);
2403 if (info
.u
.s
.wProcessorArchitecture
== PROCESSOR_ARCHITECTURE_AMD64
) return os_64bitW
;
2406 static void get_processor_caption( WCHAR
*caption
)
2408 static const WCHAR fmtW
[] =
2409 {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ',
2410 'M','o','d','e','l',' ','%','u',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2411 static const WCHAR x86W
[] = {'x','8','6',0};
2412 static const WCHAR intel64W
[] = {'I','n','t','e','l','6','4',0};
2413 const WCHAR
*arch
= (get_osarchitecture() == os_32bitW
) ? x86W
: intel64W
;
2414 unsigned int regs
[4] = {0, 0, 0, 0};
2416 do_cpuid( 1, regs
);
2417 sprintfW( caption
, fmtW
, arch
, (regs
[0] & (15 << 8)) >> 8, (regs
[0] & (15 << 4)) >> 4, regs
[0] & 15 );
2419 static void get_processor_version( WCHAR
*version
)
2421 static const WCHAR fmtW
[] =
2422 {'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2423 unsigned int regs
[4] = {0, 0, 0, 0};
2425 do_cpuid( 1, regs
);
2426 sprintfW( version
, fmtW
, (regs
[0] & (15 << 4)) >> 4, regs
[0] & 15 );
2428 static void get_processor_id( WCHAR
*processor_id
)
2430 static const WCHAR fmtW
[] = {'%','0','8','X','%','0','8','X',0};
2431 unsigned int regs
[4] = {0, 0, 0, 0};
2433 do_cpuid( 1, regs
);
2434 sprintfW( processor_id
, fmtW
, regs
[3], regs
[0] );
2436 static void regs_to_str( unsigned int *regs
, unsigned int len
, WCHAR
*buffer
)
2439 unsigned char *p
= (unsigned char *)regs
;
2441 for (i
= 0; i
< len
; i
++) { buffer
[i
] = *p
++; }
2444 static void get_processor_manufacturer( WCHAR
*manufacturer
)
2446 unsigned int tmp
, regs
[4] = {0, 0, 0, 0};
2448 do_cpuid( 0, regs
);
2449 tmp
= regs
[2]; /* swap edx and ecx */
2453 regs_to_str( regs
+ 1, 12, manufacturer
);
2455 static void get_processor_name( WCHAR
*name
)
2457 unsigned int regs
[4] = {0, 0, 0, 0};
2459 do_cpuid( 0x80000000, regs
);
2460 if (regs
[0] >= 0x80000004)
2462 do_cpuid( 0x80000002, regs
);
2463 regs_to_str( regs
, 16, name
);
2464 do_cpuid( 0x80000003, regs
);
2465 regs_to_str( regs
, 16, name
+ 16 );
2466 do_cpuid( 0x80000004, regs
);
2467 regs_to_str( regs
, 16, name
+ 32 );
2470 static UINT
get_processor_currentclockspeed( UINT index
)
2472 PROCESSOR_POWER_INFORMATION
*info
;
2473 UINT ret
= 1000, size
= get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION
);
2476 if ((info
= heap_alloc( size
)))
2478 status
= NtPowerInformation( ProcessorInformation
, NULL
, 0, info
, size
);
2479 if (!status
) ret
= info
[index
].CurrentMhz
;
2484 static UINT
get_processor_maxclockspeed( UINT index
)
2486 PROCESSOR_POWER_INFORMATION
*info
;
2487 UINT ret
= 1000, size
= get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION
);
2490 if ((info
= heap_alloc( size
)))
2492 status
= NtPowerInformation( ProcessorInformation
, NULL
, 0, info
, size
);
2493 if (!status
) ret
= info
[index
].MaxMhz
;
2499 static enum fill_status
fill_processor( struct table
*table
, const struct expr
*cond
)
2501 static const WCHAR fmtW
[] = {'C','P','U','%','u',0};
2502 WCHAR caption
[100], device_id
[14], processor_id
[17], manufacturer
[13], name
[49] = {0}, version
[50];
2503 struct record_processor
*rec
;
2504 UINT i
, offset
= 0, num_cores
, num_logical_processors
, count
= get_processor_count();
2505 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2507 if (!resize_table( table
, count
, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2509 get_processor_caption( caption
);
2510 get_processor_id( processor_id
);
2511 get_processor_manufacturer( manufacturer
);
2512 get_processor_name( name
);
2513 get_processor_version( version
);
2515 num_logical_processors
= get_logical_processor_count( &num_cores
) / count
;
2518 for (i
= 0; i
< count
; i
++)
2520 rec
= (struct record_processor
*)(table
->data
+ offset
);
2521 rec
->addresswidth
= get_osarchitecture() == os_32bitW
? 32 : 64;
2522 rec
->caption
= heap_strdupW( caption
);
2523 rec
->cpu_status
= 1; /* CPU Enabled */
2524 rec
->currentclockspeed
= get_processor_currentclockspeed( i
);
2525 rec
->datawidth
= get_osarchitecture() == os_32bitW
? 32 : 64;
2526 rec
->description
= heap_strdupW( caption
);
2527 sprintfW( device_id
, fmtW
, i
);
2528 rec
->device_id
= heap_strdupW( device_id
);
2529 rec
->family
= 2; /* Unknown */
2530 rec
->manufacturer
= heap_strdupW( manufacturer
);
2531 rec
->maxclockspeed
= get_processor_maxclockspeed( i
);
2532 rec
->name
= heap_strdupW( name
);
2533 rec
->num_cores
= num_cores
;
2534 rec
->num_logical_processors
= num_logical_processors
;
2535 rec
->processor_id
= heap_strdupW( processor_id
);
2536 rec
->processortype
= 3; /* central processor */
2537 rec
->unique_id
= NULL
;
2538 rec
->version
= heap_strdupW( version
);
2539 if (!match_row( table
, i
, cond
, &status
))
2541 free_row_values( table
, i
);
2544 offset
+= sizeof(*rec
);
2547 TRACE("created %u rows\n", count
);
2548 table
->num_rows
= count
;
2552 static WCHAR
*get_lastbootuptime(void)
2554 static const WCHAR fmtW
[] =
2555 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2556 '.','%','0','6','u','+','0','0','0',0};
2557 SYSTEM_TIMEOFDAY_INFORMATION ti
;
2561 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2563 NtQuerySystemInformation( SystemTimeOfDayInformation
, &ti
, sizeof(ti
), NULL
);
2564 RtlTimeToTimeFields( &ti
.liKeBootTime
, &tf
);
2565 sprintfW( ret
, fmtW
, tf
.Year
, tf
.Month
, tf
.Day
, tf
.Hour
, tf
.Minute
, tf
.Second
, tf
.Milliseconds
* 1000 );
2568 static WCHAR
*get_localdatetime(void)
2570 static const WCHAR fmtW
[] =
2571 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2572 '.','%','0','6','u','%','+','0','3','d',0};
2573 TIME_ZONE_INFORMATION tzi
;
2579 Status
= GetTimeZoneInformation(&tzi
);
2581 if(Status
== TIME_ZONE_ID_INVALID
) return NULL
;
2583 if(Status
== TIME_ZONE_ID_DAYLIGHT
)
2584 Bias
+= tzi
.DaylightBias
;
2586 Bias
+= tzi
.StandardBias
;
2587 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2590 sprintfW( ret
, fmtW
, st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
, st
.wMilliseconds
* 1000, -Bias
);
2593 static WCHAR
*get_systemdirectory(void)
2598 if (!(ret
= heap_alloc( MAX_PATH
* sizeof(WCHAR
) ))) return NULL
;
2599 Wow64DisableWow64FsRedirection( &redir
);
2600 GetSystemDirectoryW( ret
, MAX_PATH
);
2601 Wow64RevertWow64FsRedirection( redir
);
2604 static WCHAR
*get_codeset(void)
2606 static const WCHAR fmtW
[] = {'%','u',0};
2607 WCHAR
*ret
= heap_alloc( 11 * sizeof(WCHAR
) );
2608 if (ret
) sprintfW( ret
, fmtW
, GetACP() );
2611 static WCHAR
*get_countrycode(void)
2613 WCHAR
*ret
= heap_alloc( 6 * sizeof(WCHAR
) );
2614 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ICOUNTRY
, ret
, 6 );
2617 static WCHAR
*get_locale(void)
2619 WCHAR
*ret
= heap_alloc( 5 * sizeof(WCHAR
) );
2620 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ILANGUAGE
, ret
, 5 );
2624 static enum fill_status
fill_os( struct table
*table
, const struct expr
*cond
)
2626 struct record_operatingsystem
*rec
;
2627 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2630 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2632 rec
= (struct record_operatingsystem
*)table
->data
;
2633 rec
->buildnumber
= os_buildnumberW
;
2634 rec
->caption
= os_captionW
;
2635 rec
->codeset
= get_codeset();
2636 rec
->countrycode
= get_countrycode();
2637 rec
->csdversion
= os_csdversionW
;
2638 rec
->installdate
= os_installdateW
;
2639 rec
->lastbootuptime
= get_lastbootuptime();
2640 rec
->localdatetime
= get_localdatetime();
2641 rec
->locale
= get_locale();
2642 rec
->name
= os_nameW
;
2643 rec
->osarchitecture
= get_osarchitecture();
2644 rec
->oslanguage
= GetSystemDefaultLangID();
2645 rec
->osproductsuite
= 2461140; /* Windows XP Professional */
2646 rec
->ostype
= 18; /* WINNT */
2648 rec
->serialnumber
= os_serialnumberW
;
2649 rec
->servicepackmajor
= 3;
2650 rec
->servicepackminor
= 0;
2651 rec
->suitemask
= 272; /* Single User + Terminal */
2652 rec
->systemdirectory
= get_systemdirectory();
2653 rec
->totalvisiblememorysize
= get_total_physical_memory() / 1024;
2654 rec
->version
= os_versionW
;
2655 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2658 TRACE("created %u rows\n", row
);
2659 table
->num_rows
= row
;
2663 static const WCHAR
*get_service_type( DWORD type
)
2665 static const WCHAR filesystem_driverW
[] =
2666 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
2667 static const WCHAR kernel_driverW
[] =
2668 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
2669 static const WCHAR own_processW
[] =
2670 {'O','w','n',' ','P','r','o','c','e','s','s',0};
2671 static const WCHAR share_processW
[] =
2672 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
2674 if (type
& SERVICE_KERNEL_DRIVER
) return kernel_driverW
;
2675 else if (type
& SERVICE_FILE_SYSTEM_DRIVER
) return filesystem_driverW
;
2676 else if (type
& SERVICE_WIN32_OWN_PROCESS
) return own_processW
;
2677 else if (type
& SERVICE_WIN32_SHARE_PROCESS
) return share_processW
;
2678 else ERR("unhandled type 0x%08x\n", type
);
2681 static const WCHAR
*get_service_state( DWORD state
)
2683 static const WCHAR runningW
[] =
2684 {'R','u','n','n','i','n','g',0};
2685 static const WCHAR start_pendingW
[] =
2686 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
2687 static const WCHAR stop_pendingW
[] =
2688 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
2689 static const WCHAR stoppedW
[] =
2690 {'S','t','o','p','p','e','d',0};
2691 static const WCHAR unknownW
[] =
2692 {'U','n','k','n','o','w','n',0};
2696 case SERVICE_STOPPED
: return stoppedW
;
2697 case SERVICE_START_PENDING
: return start_pendingW
;
2698 case SERVICE_STOP_PENDING
: return stop_pendingW
;
2699 case SERVICE_RUNNING
: return runningW
;
2701 ERR("unknown state %u\n", state
);
2705 static const WCHAR
*get_service_startmode( DWORD mode
)
2707 static const WCHAR bootW
[] = {'B','o','o','t',0};
2708 static const WCHAR systemW
[] = {'S','y','s','t','e','m',0};
2709 static const WCHAR autoW
[] = {'A','u','t','o',0};
2710 static const WCHAR manualW
[] = {'M','a','n','u','a','l',0};
2711 static const WCHAR disabledW
[] = {'D','i','s','a','b','l','e','d',0};
2712 static const WCHAR unknownW
[] = {'U','n','k','n','o','w','n',0};
2716 case SERVICE_BOOT_START
: return bootW
;
2717 case SERVICE_SYSTEM_START
: return systemW
;
2718 case SERVICE_AUTO_START
: return autoW
;
2719 case SERVICE_DEMAND_START
: return manualW
;
2720 case SERVICE_DISABLED
: return disabledW
;
2722 ERR("unknown mode 0x%x\n", mode
);
2726 static QUERY_SERVICE_CONFIGW
*query_service_config( SC_HANDLE manager
, const WCHAR
*name
)
2728 QUERY_SERVICE_CONFIGW
*config
= NULL
;
2732 if (!(service
= OpenServiceW( manager
, name
, SERVICE_QUERY_CONFIG
))) return NULL
;
2733 QueryServiceConfigW( service
, NULL
, 0, &size
);
2734 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
) goto done
;
2735 if (!(config
= heap_alloc( size
))) goto done
;
2736 if (QueryServiceConfigW( service
, config
, size
, &size
)) goto done
;
2737 heap_free( config
);
2741 CloseServiceHandle( service
);
2745 static enum fill_status
fill_service( struct table
*table
, const struct expr
*cond
)
2747 struct record_service
*rec
;
2749 ENUM_SERVICE_STATUS_PROCESSW
*tmp
, *services
= NULL
;
2750 SERVICE_STATUS_PROCESS
*status
;
2751 WCHAR sysnameW
[MAX_COMPUTERNAME_LENGTH
+ 1];
2752 DWORD len
= sizeof(sysnameW
) / sizeof(sysnameW
[0]);
2753 UINT i
, row
= 0, offset
= 0, size
= 256, needed
, count
;
2754 enum fill_status fill_status
= FILL_STATUS_FAILED
;
2757 if (!(manager
= OpenSCManagerW( NULL
, NULL
, SC_MANAGER_ENUMERATE_SERVICE
))) return FILL_STATUS_FAILED
;
2758 if (!(services
= heap_alloc( size
))) goto done
;
2760 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2761 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2762 &count
, NULL
, NULL
);
2765 if (GetLastError() != ERROR_MORE_DATA
) goto done
;
2767 if (!(tmp
= heap_realloc( services
, size
))) goto done
;
2769 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2770 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2771 &count
, NULL
, NULL
);
2772 if (!ret
) goto done
;
2774 if (!resize_table( table
, count
, sizeof(*rec
) )) goto done
;
2776 GetComputerNameW( sysnameW
, &len
);
2777 fill_status
= FILL_STATUS_UNFILTERED
;
2779 for (i
= 0; i
< count
; i
++)
2781 QUERY_SERVICE_CONFIGW
*config
;
2783 if (!(config
= query_service_config( manager
, services
[i
].lpServiceName
))) continue;
2785 status
= &services
[i
].ServiceStatusProcess
;
2786 rec
= (struct record_service
*)(table
->data
+ offset
);
2787 rec
->accept_pause
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_PAUSE_CONTINUE
) ? -1 : 0;
2788 rec
->accept_stop
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_STOP
) ? -1 : 0;
2789 rec
->displayname
= heap_strdupW( services
[i
].lpDisplayName
);
2790 rec
->name
= heap_strdupW( services
[i
].lpServiceName
);
2791 rec
->process_id
= status
->dwProcessId
;
2792 rec
->servicetype
= get_service_type( status
->dwServiceType
);
2793 rec
->startmode
= get_service_startmode( config
->dwStartType
);
2794 rec
->state
= get_service_state( status
->dwCurrentState
);
2795 rec
->systemname
= heap_strdupW( sysnameW
);
2796 rec
->pause_service
= service_pause_service
;
2797 rec
->resume_service
= service_resume_service
;
2798 rec
->start_service
= service_start_service
;
2799 rec
->stop_service
= service_stop_service
;
2800 heap_free( config
);
2801 if (!match_row( table
, row
, cond
, &fill_status
))
2803 free_row_values( table
, row
);
2806 offset
+= sizeof(*rec
);
2810 TRACE("created %u rows\n", row
);
2811 table
->num_rows
= row
;
2814 CloseServiceHandle( manager
);
2815 heap_free( services
);
2819 static WCHAR
*get_accountname( LSA_TRANSLATED_NAME
*name
)
2821 if (!name
|| !name
->Name
.Buffer
) return NULL
;
2822 return heap_strdupW( name
->Name
.Buffer
);
2824 static struct array
*get_binaryrepresentation( PSID sid
, UINT len
)
2826 struct array
*array
= heap_alloc( sizeof(struct array
) );
2829 UINT8
*ret
= heap_alloc( len
);
2832 memcpy( ret
, sid
, len
);
2841 static WCHAR
*get_referenceddomainname( LSA_REFERENCED_DOMAIN_LIST
*domain
)
2843 if (!domain
|| !domain
->Domains
|| !domain
->Domains
->Name
.Buffer
) return NULL
;
2844 return heap_strdupW( domain
->Domains
->Name
.Buffer
);
2846 static const WCHAR
*find_sid_str( const struct expr
*cond
)
2848 const struct expr
*left
, *right
;
2849 const WCHAR
*ret
= NULL
;
2851 if (!cond
|| cond
->type
!= EXPR_COMPLEX
|| cond
->u
.expr
.op
!= OP_EQ
) return NULL
;
2853 left
= cond
->u
.expr
.left
;
2854 right
= cond
->u
.expr
.right
;
2855 if (left
->type
== EXPR_PROPVAL
&& right
->type
== EXPR_SVAL
&& !strcmpiW( left
->u
.propval
->name
, prop_sidW
))
2857 ret
= right
->u
.sval
;
2859 else if (left
->type
== EXPR_SVAL
&& right
->type
== EXPR_PROPVAL
&& !strcmpiW( right
->u
.propval
->name
, prop_sidW
))
2866 static enum fill_status
fill_sid( struct table
*table
, const struct expr
*cond
)
2869 LSA_REFERENCED_DOMAIN_LIST
*domain
;
2870 LSA_TRANSLATED_NAME
*name
;
2872 LSA_OBJECT_ATTRIBUTES attrs
;
2874 struct record_sid
*rec
;
2877 if (!(str
= find_sid_str( cond
))) return FILL_STATUS_FAILED
;
2878 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2880 if (!ConvertStringSidToSidW( str
, &sid
)) return FILL_STATUS_FAILED
;
2881 len
= GetLengthSid( sid
);
2883 memset( &attrs
, 0, sizeof(attrs
) );
2884 attrs
.Length
= sizeof(attrs
);
2885 if (LsaOpenPolicy( NULL
, &attrs
, POLICY_ALL_ACCESS
, &handle
))
2888 return FILL_STATUS_FAILED
;
2890 if (LsaLookupSids( handle
, 1, &sid
, &domain
, &name
))
2894 return FILL_STATUS_FAILED
;
2897 rec
= (struct record_sid
*)table
->data
;
2898 rec
->accountname
= get_accountname( name
);
2899 rec
->binaryrepresentation
= get_binaryrepresentation( sid
, len
);
2900 rec
->referenceddomainname
= get_referenceddomainname( domain
);
2901 rec
->sid
= heap_strdupW( str
);
2902 rec
->sidlength
= len
;
2904 TRACE("created 1 row\n");
2905 table
->num_rows
= 1;
2907 LsaFreeMemory( domain
);
2908 LsaFreeMemory( name
);
2911 return FILL_STATUS_FILTERED
;
2914 static UINT32
get_bits_per_pixel( UINT
*hres
, UINT
*vres
)
2916 HDC hdc
= GetDC( NULL
);
2919 if (!hdc
) return 32;
2920 ret
= GetDeviceCaps( hdc
, BITSPIXEL
);
2921 *hres
= GetDeviceCaps( hdc
, HORZRES
);
2922 *vres
= GetDeviceCaps( hdc
, VERTRES
);
2923 ReleaseDC( NULL
, hdc
);
2926 static WCHAR
*get_pnpdeviceid( DXGI_ADAPTER_DESC
*desc
)
2928 static const WCHAR fmtW
[] =
2929 {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
2930 '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
2931 '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
2934 if (!(ret
= heap_alloc( sizeof(fmtW
) + 2 * sizeof(WCHAR
) ))) return NULL
;
2935 sprintfW( ret
, fmtW
, desc
->VendorId
, desc
->DeviceId
, desc
->SubSysId
, desc
->Revision
);
2939 static enum fill_status
fill_videocontroller( struct table
*table
, const struct expr
*cond
)
2942 struct record_videocontroller
*rec
;
2944 IDXGIFactory
*factory
= NULL
;
2945 IDXGIAdapter
*adapter
= NULL
;
2946 DXGI_ADAPTER_DESC desc
;
2947 UINT hres
= 1024, vres
= 768, vidmem
= 512 * 1024 * 1024;
2948 const WCHAR
*name
= videocontroller_deviceidW
;
2949 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2952 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2954 memset (&desc
, 0, sizeof(desc
));
2955 hr
= CreateDXGIFactory( &IID_IDXGIFactory
, (void **)&factory
);
2956 if (FAILED(hr
)) goto done
;
2958 hr
= IDXGIFactory_EnumAdapters( factory
, 0, &adapter
);
2959 if (FAILED(hr
)) goto done
;
2961 hr
= IDXGIAdapter_GetDesc( adapter
, &desc
);
2964 vidmem
= desc
.DedicatedVideoMemory
;
2965 name
= desc
.Description
;
2969 rec
= (struct record_videocontroller
*)table
->data
;
2970 rec
->adapter_dactype
= videocontroller_dactypeW
;
2971 rec
->adapter_ram
= vidmem
;
2972 rec
->availability
= 3; /* Running or Full Power */
2973 rec
->caption
= heap_strdupW( name
);
2974 rec
->current_bitsperpixel
= get_bits_per_pixel( &hres
, &vres
);
2975 rec
->current_horizontalres
= hres
;
2976 rec
->current_refreshrate
= 0; /* default refresh rate */
2977 rec
->current_scanmode
= 2; /* Unknown */
2978 rec
->current_verticalres
= vres
;
2979 rec
->description
= heap_strdupW( name
);
2980 rec
->device_id
= videocontroller_deviceidW
;
2981 rec
->driverversion
= videocontroller_driverversionW
;
2982 rec
->name
= heap_strdupW( name
);
2983 rec
->pnpdevice_id
= get_pnpdeviceid( &desc
);
2984 rec
->videoarchitecture
= 2; /* Unknown */
2985 rec
->videomemorytype
= 2; /* Unknown */
2986 rec
->videoprocessor
= heap_strdupW( name
);
2987 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2990 TRACE("created %u rows\n", row
);
2991 table
->num_rows
= row
;
2993 if (adapter
) IDXGIAdapter_Release( adapter
);
2994 if (factory
) IDXGIFactory_Release( factory
);
2998 static struct table builtin_classes
[] =
3000 { class_baseboardW
, SIZEOF(col_baseboard
), col_baseboard
, SIZEOF(data_baseboard
), 0, (BYTE
*)data_baseboard
},
3001 { class_biosW
, SIZEOF(col_bios
), col_bios
, SIZEOF(data_bios
), 0, (BYTE
*)data_bios
},
3002 { class_cdromdriveW
, SIZEOF(col_cdromdrive
), col_cdromdrive
, 0, 0, NULL
, fill_cdromdrive
},
3003 { class_compsysW
, SIZEOF(col_compsys
), col_compsys
, 0, 0, NULL
, fill_compsys
},
3004 { class_compsysproductW
, SIZEOF(col_compsysproduct
), col_compsysproduct
, SIZEOF(data_compsysproduct
), 0, (BYTE
*)data_compsysproduct
},
3005 { class_datafileW
, SIZEOF(col_datafile
), col_datafile
, 0, 0, NULL
, fill_datafile
},
3006 { class_desktopmonitorW
, SIZEOF(col_desktopmonitor
), col_desktopmonitor
, 0, 0, NULL
, fill_desktopmonitor
},
3007 { class_directoryW
, SIZEOF(col_directory
), col_directory
, 0, 0, NULL
, fill_directory
},
3008 { class_diskdriveW
, SIZEOF(col_diskdrive
), col_diskdrive
, 0, 0, NULL
, fill_diskdrive
},
3009 { class_diskpartitionW
, SIZEOF(col_diskpartition
), col_diskpartition
, 0, 0, NULL
, fill_diskpartition
},
3010 { class_logicaldiskW
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
3011 { class_logicaldisk2W
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
3012 { class_networkadapterW
, SIZEOF(col_networkadapter
), col_networkadapter
, 0, 0, NULL
, fill_networkadapter
},
3013 { class_networkadapterconfigW
, SIZEOF(col_networkadapterconfig
), col_networkadapterconfig
, 0, 0, NULL
, fill_networkadapterconfig
},
3014 { class_osW
, SIZEOF(col_os
), col_os
, 0, 0, NULL
, fill_os
},
3015 { class_paramsW
, SIZEOF(col_param
), col_param
, SIZEOF(data_param
), 0, (BYTE
*)data_param
},
3016 { class_physicalmediaW
, SIZEOF(col_physicalmedia
), col_physicalmedia
, SIZEOF(data_physicalmedia
), 0, (BYTE
*)data_physicalmedia
},
3017 { class_physicalmemoryW
, SIZEOF(col_physicalmemory
), col_physicalmemory
, 0, 0, NULL
, fill_physicalmemory
},
3018 { class_printerW
, SIZEOF(col_printer
), col_printer
, 0, 0, NULL
, fill_printer
},
3019 { class_processW
, SIZEOF(col_process
), col_process
, 0, 0, NULL
, fill_process
},
3020 { class_processorW
, SIZEOF(col_processor
), col_processor
, 0, 0, NULL
, fill_processor
},
3021 { class_processor2W
, SIZEOF(col_processor
), col_processor
, 0, 0, NULL
, fill_processor
},
3022 { class_qualifiersW
, SIZEOF(col_qualifier
), col_qualifier
, SIZEOF(data_qualifier
), 0, (BYTE
*)data_qualifier
},
3023 { class_serviceW
, SIZEOF(col_service
), col_service
, 0, 0, NULL
, fill_service
},
3024 { class_sidW
, SIZEOF(col_sid
), col_sid
, 0, 0, NULL
, fill_sid
},
3025 { class_sounddeviceW
, SIZEOF(col_sounddevice
), col_sounddevice
, SIZEOF(data_sounddevice
), 0, (BYTE
*)data_sounddevice
},
3026 { class_stdregprovW
, SIZEOF(col_stdregprov
), col_stdregprov
, SIZEOF(data_stdregprov
), 0, (BYTE
*)data_stdregprov
},
3027 { class_systemsecurityW
, SIZEOF(col_systemsecurity
), col_systemsecurity
, SIZEOF(data_systemsecurity
), 0, (BYTE
*)data_systemsecurity
},
3028 { class_systemenclosureW
, SIZEOF(col_systemenclosure
), col_systemenclosure
, SIZEOF(data_systemenclosure
), 0, (BYTE
*)data_systemenclosure
},
3029 { class_videocontrollerW
, SIZEOF(col_videocontroller
), col_videocontroller
, 0, 0, NULL
, fill_videocontroller
}
3032 void init_table_list( void )
3034 static struct list tables
= LIST_INIT( tables
);
3037 for (i
= 0; i
< SIZEOF(builtin_classes
); i
++) list_add_tail( &tables
, &builtin_classes
[i
].entry
);
3038 table_list
= &tables
;