2 * Copyright 2012 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wbemprox_private.h"
34 static const WCHAR class_baseboardW
[] =
35 {'W','i','n','3','2','_','B','a','s','e','B','o','a','r','d',0};
36 static const WCHAR class_biosW
[] =
37 {'W','i','n','3','2','_','B','I','O','S',0};
38 static const WCHAR class_cdromdriveW
[] =
39 {'W','i','n','3','2','_','C','D','R','O','M','D','r','i','v','e',0};
40 static const WCHAR class_compsysW
[] =
41 {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m',0};
42 static const WCHAR class_compsysproductW
[] =
43 {'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};
44 static const WCHAR class_datafileW
[] =
45 {'C','I','M','_','D','a','t','a','F','i','l','e',0};
46 static const WCHAR class_desktopmonitorW
[] =
47 {'W','i','n','3','2','_','D','e','s','k','t','o','p','M','o','n','i','t','o','r',0};
48 static const WCHAR class_directoryW
[] =
49 {'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0};
50 static const WCHAR class_diskdriveW
[] =
51 {'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e',0};
52 static const WCHAR class_diskpartitionW
[] =
53 {'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
54 static const WCHAR class_logicaldiskW
[] =
55 {'W','i','n','3','2','_','L','o','g','i','c','a','l','D','i','s','k',0};
56 static const WCHAR class_logicaldisk2W
[] =
57 {'C','I','M','_','L','o','g','i','c','a','l','D','i','s','k',0};
58 static const WCHAR class_networkadapterW
[] =
59 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',0};
60 static const WCHAR class_networkadapterconfigW
[] =
61 {'W','i','n','3','2','_','N','e','t','w','o','r','k','A','d','a','p','t','e','r',
62 'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
63 static const WCHAR class_osW
[] =
64 {'W','i','n','3','2','_','O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
65 static const WCHAR class_paramsW
[] =
66 {'_','_','P','A','R','A','M','E','T','E','R','S',0};
67 static const WCHAR class_physicalmediaW
[] =
68 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0};
69 static const WCHAR class_physicalmemoryW
[] =
70 {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
71 static const WCHAR class_printerW
[] =
72 {'W','i','n','3','2','_','P','r','i','n','t','e','r',0};
73 static const WCHAR class_process_getowner_outW
[] =
74 {'_','_','W','I','N','3','2','_','P','R','O','C','E','S','S','_','G','E','T','O','W',
75 'N','E','R','_','O','U','T',0};
76 static const WCHAR class_processorW
[] =
77 {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
78 static const WCHAR class_processor2W
[] =
79 {'C','I','M','_','P','r','o','c','e','s','s','o','r',0};
80 static const WCHAR class_qualifiersW
[] =
81 {'_','_','Q','U','A','L','I','F','I','E','R','S',0};
82 static const WCHAR class_sidW
[] =
83 {'W','i','n','3','2','_','S','I','D',0};
84 static const WCHAR class_sounddeviceW
[] =
85 {'W','i','n','3','2','_','S','o','u','n','d','D','e','v','i','c','e',0};
86 static const WCHAR class_systemenclosureW
[] =
87 {'W','i','n','3','2','_','S','y','s','t','e','m','E','n','c','l','o','s','u','r','e',0};
88 static const WCHAR class_videocontrollerW
[] =
89 {'W','i','n','3','2','_','V','i','d','e','o','C','o','n','t','r','o','l','l','e','r',0};
91 static const WCHAR prop_accountnameW
[] =
92 {'A','c','c','o','u','n','t','N','a','m','e',0};
93 static const WCHAR prop_acceptpauseW
[] =
94 {'A','c','c','e','p','t','P','a','u','s','e',0};
95 static const WCHAR prop_acceptstopW
[] =
96 {'A','c','c','e','p','t','S','t','o','p',0};
97 static const WCHAR prop_accessmaskW
[] =
98 {'A','c','c','e','s','s','M','a','s','k',0};
99 static const WCHAR prop_adapterdactypeW
[] =
100 {'A','d','a','p','t','e','r','D','A','C','T','y','p','e',0};
101 static const WCHAR prop_adapterramW
[] =
102 {'A','d','a','p','t','e','r','R','A','M',0};
103 static const WCHAR prop_adaptertypeW
[] =
104 {'A','d','a','p','t','e','r','T','y','p','e',0};
105 static const WCHAR prop_addresswidthW
[] =
106 {'A','d','d','r','e','s','s','W','i','d','t','h',0};
107 static const WCHAR prop_attributesW
[] =
108 {'A','t','t','r','i','b','u','t','e','s',0};
109 static const WCHAR prop_availabilityW
[] =
110 {'A','v','a','i','l','a','b','i','l','i','t','y',0};
111 static const WCHAR prop_binaryrepresentationW
[] =
112 {'B','i','n','a','r','y','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0};
113 static const WCHAR prop_bootableW
[] =
114 {'B','o','o','t','a','b','l','e',0};
115 static const WCHAR prop_bootpartitionW
[] =
116 {'B','o','o','t','P','a','r','t','i','t','i','o','n',0};
117 static const WCHAR prop_buildnumberW
[] =
118 {'B','u','i','l','d','N','u','m','b','e','r',0};
119 static const WCHAR prop_capacityW
[] =
120 {'C','a','p','a','c','i','t','y',0};
121 static const WCHAR prop_captionW
[] =
122 {'C','a','p','t','i','o','n',0};
123 static const WCHAR prop_chassistypesW
[] =
124 {'C','h','a','s','s','i','s','T','y','p','e','s',0};
125 static const WCHAR prop_classW
[] =
126 {'C','l','a','s','s',0};
127 static const WCHAR prop_codesetW
[] =
128 {'C','o','d','e','S','e','t',0};
129 static const WCHAR prop_commandlineW
[] =
130 {'C','o','m','m','a','n','d','L','i','n','e',0};
131 static const WCHAR prop_countrycodeW
[] =
132 {'C','o','u','n','t','r','y','C','o','d','e',0};
133 static const WCHAR prop_cpustatusW
[] =
134 {'C','p','u','S','t','a','t','u','s',0};
135 static const WCHAR prop_csdversionW
[] =
136 {'C','S','D','V','e','r','s','i','o','n',0};
137 static const WCHAR prop_currentbitsperpixelW
[] =
138 {'C','u','r','r','e','n','t','B','i','t','s','P','e','r','P','i','x','e','l',0};
139 static const WCHAR prop_currentclockspeedW
[] =
140 {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0};
141 static const WCHAR prop_currenthorizontalresW
[] =
142 {'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};
143 static const WCHAR prop_currentrefreshrateW
[] =
144 {'C','u','r','r','e','n','t','R','e','f','r','e','s','h','R','a','t','e',0};
145 static const WCHAR prop_currentscanmodeW
[] =
146 {'C','u','r','r','e','n','t','S','c','a','n','M','o','d','e',0};
147 static const WCHAR prop_currentverticalresW
[] =
148 {'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};
149 static const WCHAR prop_datawidthW
[] =
150 {'D','a','t','a','W','i','d','t','h',0};
151 static const WCHAR prop_defaultipgatewayW
[] =
152 {'D','e','f','a','u','l','t','I','P','G','a','t','e','w','a','y',0};
153 static const WCHAR prop_defaultvalueW
[] =
154 {'D','e','f','a','u','l','t','V','a','l','u','e',0};
155 static const WCHAR prop_descriptionW
[] =
156 {'D','e','s','c','r','i','p','t','i','o','n',0};
157 static const WCHAR prop_deviceidW
[] =
158 {'D','e','v','i','c','e','I','d',0};
159 static const WCHAR prop_dhcpenabledW
[] =
160 {'D','H','C','P','E','n','a','b','l','e','d',0};
161 static const WCHAR prop_directionW
[] =
162 {'D','i','r','e','c','t','i','o','n',0};
163 static const WCHAR prop_displaynameW
[] =
164 {'D','i','s','p','l','a','y','N','a','m','e',0};
165 static const WCHAR prop_diskindexW
[] =
166 {'D','i','s','k','I','n','d','e','x',0};
167 static const WCHAR prop_dnshostnameW
[] =
168 {'D','N','S','H','o','s','t','N','a','m','e',0};
169 static const WCHAR prop_dnsserversearchorderW
[] =
170 {'D','N','S','S','e','r','v','e','r','S','e','a','r','c','h','O','r','d','e','r',0};
171 static const WCHAR prop_domainW
[] =
172 {'D','o','m','a','i','n',0};
173 static const WCHAR prop_domainroleW
[] =
174 {'D','o','m','a','i','n','R','o','l','e',0};
175 static const WCHAR prop_driveW
[] =
176 {'D','r','i','v','e',0};
177 static const WCHAR prop_drivernameW
[] =
178 {'D','r','i','v','e','r','N','a','m','e',0};
179 static const WCHAR prop_driverversionW
[] =
180 {'D','r','i','v','e','r','V','e','r','s','i','o','n',0};
181 static const WCHAR prop_drivetypeW
[] =
182 {'D','r','i','v','e','T','y','p','e',0};
183 static const WCHAR prop_familyW
[] =
184 {'F','a','m','i','l','y',0};
185 static const WCHAR prop_filesystemW
[] =
186 {'F','i','l','e','S','y','s','t','e','m',0};
187 static const WCHAR prop_flavorW
[] =
188 {'F','l','a','v','o','r',0};
189 static const WCHAR prop_freespaceW
[] =
190 {'F','r','e','e','S','p','a','c','e',0};
191 static const WCHAR prop_handleW
[] =
192 {'H','a','n','d','l','e',0};
193 static const WCHAR prop_horizontalresolutionW
[] =
194 {'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
195 static const WCHAR prop_idW
[] =
197 static const WCHAR prop_identificationcodeW
[] =
198 {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0};
199 static const WCHAR prop_identifyingnumberW
[] =
200 {'I','d','e','n','t','i','f','y','i','n','g','N','u','m','b','e','r',0};
201 static const WCHAR prop_indexW
[] =
202 {'I','n','d','e','x',0};
203 static const WCHAR prop_installdateW
[] =
204 {'I','n','s','t','a','l','l','D','a','t','e',0};
205 static const WCHAR prop_interfaceindexW
[] =
206 {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0};
207 static const WCHAR prop_interfacetypeW
[] =
208 {'I','n','t','e','r','f','a','c','e','T','y','p','e',0};
209 static const WCHAR prop_intvalueW
[] =
210 {'I','n','t','e','g','e','r','V','a','l','u','e',0};
211 static const WCHAR prop_ipconnectionmetricW
[] =
212 {'I','P','C','o','n','n','e','c','t','i','o','n','M','e','t','r','i','c',0};
213 static const WCHAR prop_ipenabledW
[] =
214 {'I','P','E','n','a','b','l','e','d',0};
215 static const WCHAR prop_lastbootuptimeW
[] =
216 {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
217 static const WCHAR prop_localW
[] =
218 {'L','o','c','a','l',0};
219 static const WCHAR prop_localdatetimeW
[] =
220 {'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
221 static const WCHAR prop_localeW
[] =
222 {'L','o','c','a','l','e',0};
223 static const WCHAR prop_locationW
[] =
224 {'L','o','c','a','t','i','o','n',0};
225 static const WCHAR prop_lockpresentW
[] =
226 {'L','o','c','k','P','r','e','s','e','n','t',0};
227 static const WCHAR prop_macaddressW
[] =
228 {'M','A','C','A','d','d','r','e','s','s',0};
229 static const WCHAR prop_manufacturerW
[] =
230 {'M','a','n','u','f','a','c','t','u','r','e','r',0};
231 static const WCHAR prop_maxclockspeedW
[] =
232 {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
233 static const WCHAR prop_mediatypeW
[] =
234 {'M','e','d','i','a','T','y','p','e',0};
235 static const WCHAR prop_memberW
[] =
236 {'M','e','m','b','e','r',0};
237 static const WCHAR prop_methodW
[] =
238 {'M','e','t','h','o','d',0};
239 static const WCHAR prop_modelW
[] =
240 {'M','o','d','e','l',0};
241 static const WCHAR prop_netconnectionstatusW
[] =
242 {'N','e','t','C','o','n','n','e','c','t','i','o','n','S','t','a','t','u','s',0};
243 static const WCHAR prop_networkW
[] =
244 {'N','e','t','w','o','r','k',0};
245 static const WCHAR prop_numcoresW
[] =
246 {'N','u','m','b','e','r','O','f','C','o','r','e','s',0};
247 static const WCHAR prop_numlogicalprocessorsW
[] =
248 {'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};
249 static const WCHAR prop_numprocessorsW
[] =
250 {'N','u','m','b','e','r','O','f','P','r','o','c','e','s','s','o','r','s',0};
251 static const WCHAR prop_osarchitectureW
[] =
252 {'O','S','A','r','c','h','i','t','e','c','t','u','r','e',0};
253 static const WCHAR prop_oslanguageW
[] =
254 {'O','S','L','a','n','g','u','a','g','e',0};
255 static const WCHAR prop_osproductsuiteW
[] =
256 {'O','S','P','r','o','d','u','c','t','S','u','i','t','e',0};
257 static const WCHAR prop_ostypeW
[] =
258 {'O','S','T','y','p','e',0};
259 static const WCHAR prop_parameterW
[] =
260 {'P','a','r','a','m','e','t','e','r',0};
261 static const WCHAR prop_physicaladapterW
[] =
262 {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
263 static const WCHAR prop_pixelsperxlogicalinchW
[] =
264 {'P','i','x','e','l','s','P','e','r','X','L','o','g','i','c','a','l','I','n','c','h',0};
265 static const WCHAR prop_pnpdeviceidW
[] =
266 {'P','N','P','D','e','v','i','c','e','I','D',0};
267 static const WCHAR prop_portnameW
[] =
268 {'P','o','r','t','N','a','m','e',0};
269 static const WCHAR prop_pprocessidW
[] =
270 {'P','a','r','e','n','t','P','r','o','c','e','s','s','I','D',0};
271 static const WCHAR prop_primaryW
[] =
272 {'P','r','i','m','a','r','y',0};
273 static const WCHAR prop_processidW
[] =
274 {'P','r','o','c','e','s','s','I','D',0};
275 static const WCHAR prop_processoridW
[] =
276 {'P','r','o','c','e','s','s','o','r','I','d',0};
277 static const WCHAR prop_processortypeW
[] =
278 {'P','r','o','c','e','s','s','o','r','T','y','p','e',0};
279 static const WCHAR prop_productW
[] =
280 {'P','r','o','d','u','c','t',0};
281 static const WCHAR prop_productnameW
[] =
282 {'P','r','o','d','u','c','t','N','a','m','e',0};
283 static const WCHAR prop_referenceddomainnameW
[] =
284 {'R','e','f','e','r','e','n','c','e','d','D','o','m','a','i','n','N','a','m','e',0};
285 static const WCHAR prop_releasedateW
[] =
286 {'R','e','l','e','a','s','e','D','a','t','e',0};
287 static const WCHAR prop_serialnumberW
[] =
288 {'S','e','r','i','a','l','N','u','m','b','e','r',0};
289 static const WCHAR prop_servicepackmajorW
[] =
290 {'S','e','r','v','i','c','e','P','a','c','k','M','a','j','o','r','V','e','r','s','i','o','n',0};
291 static const WCHAR prop_servicepackminorW
[] =
292 {'S','e','r','v','i','c','e','P','a','c','k','M','i','n','o','r','V','e','r','s','i','o','n',0};
293 static const WCHAR prop_servicetypeW
[] =
294 {'S','e','r','v','i','c','e','T','y','p','e',0};
295 static const WCHAR prop_settingidW
[] =
296 {'S','e','t','t','i','n','g','I','D',0};
297 static const WCHAR prop_smbiosbiosversionW
[] =
298 {'S','M','B','I','O','S','B','I','O','S','V','e','r','s','i','o','n',0};
299 static const WCHAR prop_startmodeW
[] =
300 {'S','t','a','r','t','M','o','d','e',0};
301 static const WCHAR prop_sidW
[] =
303 static const WCHAR prop_sidlengthW
[] =
304 {'S','i','d','L','e','n','g','t','h',0};
305 static const WCHAR prop_sizeW
[] =
307 static const WCHAR prop_speedW
[] =
308 {'S','p','e','e','d',0};
309 static const WCHAR prop_startingoffsetW
[] =
310 {'S','t','a','r','t','i','n','g','O','f','f','s','e','t',0};
311 static const WCHAR prop_stateW
[] =
312 {'S','t','a','t','e',0};
313 static const WCHAR prop_statusinfoW
[] =
314 {'S','t','a','t','u','s','I','n','f','o',0};
315 static const WCHAR prop_strvalueW
[] =
316 {'S','t','r','i','n','g','V','a','l','u','e',0};
317 static const WCHAR prop_suitemaskW
[] =
318 {'S','u','i','t','e','M','a','s','k',0};
319 static const WCHAR prop_systemdirectoryW
[] =
320 {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
321 static const WCHAR prop_systemnameW
[] =
322 {'S','y','s','t','e','m','N','a','m','e',0};
323 static const WCHAR prop_tagW
[] =
325 static const WCHAR prop_threadcountW
[] =
326 {'T','h','r','e','a','d','C','o','u','n','t',0};
327 static const WCHAR prop_totalphysicalmemoryW
[] =
328 {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
329 static const WCHAR prop_totalvisiblememorysizeW
[] =
330 {'T','o','t','a','l','V','i','s','i','b','l','e','M','e','m','o','r','y','S','i','z','e',0};
331 static const WCHAR prop_typeW
[] =
333 static const WCHAR prop_uniqueidW
[] =
334 {'U','n','i','q','u','e','I','d',0};
335 static const WCHAR prop_usernameW
[] =
336 {'U','s','e','r','N','a','m','e',0};
337 static const WCHAR prop_uuidW
[] =
339 static const WCHAR prop_varianttypeW
[] =
340 {'V','a','r','i','a','n','t','T','y','p','e',0};
341 static const WCHAR prop_versionW
[] =
342 {'V','e','r','s','i','o','n',0};
343 static const WCHAR prop_videoarchitectureW
[] =
344 {'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0};
345 static const WCHAR prop_videomemorytypeW
[] =
346 {'V','i','d','e','o','M','e','m','o','r','y','T','y','p','e',0};
347 static const WCHAR prop_videomodedescriptionW
[] =
348 {'V','i','d','e','o','M','o','d','e','D','e','s','c','r','i','p','t','i','o','n',0};
349 static const WCHAR prop_videoprocessorW
[] =
350 {'V','i','d','e','o','P','r','o','c','e','s','s','o','r',0};
351 static const WCHAR prop_volumenameW
[] =
352 {'V','o','l','u','m','e','N','a','m','e',0};
353 static const WCHAR prop_volumeserialnumberW
[] =
354 {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0};
355 static const WCHAR prop_workingsetsizeW
[] =
356 {'W','o','r','k','i','n','g','S','e','t','S','i','z','e',0};
358 /* column definitions must be kept in sync with record structures below */
359 static const struct column col_baseboard
[] =
361 { prop_manufacturerW
, CIM_STRING
},
362 { prop_modelW
, CIM_STRING
},
363 { prop_nameW
, CIM_STRING
},
364 { prop_productW
, CIM_STRING
},
365 { prop_serialnumberW
, CIM_STRING
},
366 { prop_tagW
, CIM_STRING
|COL_FLAG_KEY
},
367 { prop_versionW
, CIM_STRING
}
369 static const struct column col_bios
[] =
371 { prop_descriptionW
, CIM_STRING
},
372 { prop_identificationcodeW
, CIM_STRING
},
373 { prop_manufacturerW
, CIM_STRING
},
374 { prop_nameW
, CIM_STRING
},
375 { prop_releasedateW
, CIM_DATETIME
},
376 { prop_serialnumberW
, CIM_STRING
},
377 { prop_smbiosbiosversionW
, CIM_STRING
},
378 { prop_versionW
, CIM_STRING
|COL_FLAG_KEY
}
380 static const struct column col_cdromdrive
[] =
382 { prop_deviceidW
, CIM_STRING
|COL_FLAG_KEY
},
383 { prop_driveW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
384 { prop_mediatypeW
, CIM_STRING
},
385 { prop_nameW
, CIM_STRING
},
386 { prop_pnpdeviceidW
, CIM_STRING
}
388 static const struct column col_compsys
[] =
390 { prop_descriptionW
, CIM_STRING
},
391 { prop_domainW
, CIM_STRING
},
392 { prop_domainroleW
, CIM_UINT16
, VT_I4
},
393 { prop_manufacturerW
, CIM_STRING
},
394 { prop_modelW
, CIM_STRING
},
395 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
396 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
397 { prop_numprocessorsW
, CIM_UINT32
, VT_I4
},
398 { prop_totalphysicalmemoryW
, CIM_UINT64
},
399 { prop_usernameW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
401 static const struct column col_compsysproduct
[] =
403 { prop_identifyingnumberW
, CIM_STRING
|COL_FLAG_KEY
},
404 { prop_uuidW
, CIM_STRING
}
406 static const struct column col_datafile
[] =
408 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
409 { prop_versionW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
411 static const struct column col_desktopmonitor
[] =
413 { prop_pixelsperxlogicalinchW
, CIM_UINT32
}
415 static const struct column col_directory
[] =
417 { prop_accessmaskW
, CIM_UINT32
},
418 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
}
420 static const struct column col_diskdrive
[] =
422 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
423 { prop_indexW
, CIM_UINT32
, VT_I4
},
424 { prop_interfacetypeW
, CIM_STRING
},
425 { prop_manufacturerW
, CIM_STRING
},
426 { prop_mediatypeW
, CIM_STRING
},
427 { prop_modelW
, CIM_STRING
},
428 { prop_pnpdeviceidW
, CIM_STRING
},
429 { prop_serialnumberW
, CIM_STRING
},
430 { prop_sizeW
, CIM_UINT64
}
432 static const struct column col_diskpartition
[] =
434 { prop_bootableW
, CIM_BOOLEAN
},
435 { prop_bootpartitionW
, CIM_BOOLEAN
},
436 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
437 { prop_diskindexW
, CIM_UINT32
, VT_I4
},
438 { prop_indexW
, CIM_UINT32
, VT_I4
},
439 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
440 { prop_sizeW
, CIM_UINT64
},
441 { prop_startingoffsetW
, CIM_UINT64
},
442 { prop_typeW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
444 static const struct column col_logicaldisk
[] =
446 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
447 { prop_drivetypeW
, CIM_UINT32
, VT_I4
},
448 { prop_filesystemW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
449 { prop_freespaceW
, CIM_UINT64
},
450 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
451 { prop_sizeW
, CIM_UINT64
},
452 { prop_volumenameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
453 { prop_volumeserialnumberW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
455 static const struct column col_networkadapter
[] =
457 { prop_adaptertypeW
, CIM_STRING
},
458 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
459 { prop_indexW
, CIM_UINT32
, VT_I4
},
460 { prop_interfaceindexW
, CIM_UINT32
, VT_I4
},
461 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
462 { prop_manufacturerW
, CIM_STRING
},
463 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
464 { prop_netconnectionstatusW
, CIM_UINT16
, VT_I4
},
465 { prop_physicaladapterW
, CIM_BOOLEAN
},
466 { prop_pnpdeviceidW
, CIM_STRING
},
467 { prop_speedW
, CIM_UINT64
}
469 static const struct column col_networkadapterconfig
[] =
471 { prop_defaultipgatewayW
, CIM_STRING
|CIM_FLAG_ARRAY
|COL_FLAG_DYNAMIC
},
472 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
473 { prop_dhcpenabledW
, CIM_BOOLEAN
},
474 { prop_dnshostnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
475 { prop_dnsserversearchorderW
, CIM_STRING
|CIM_FLAG_ARRAY
|COL_FLAG_DYNAMIC
},
476 { prop_indexW
, CIM_UINT32
|COL_FLAG_KEY
, VT_I4
},
477 { prop_ipconnectionmetricW
, CIM_UINT32
, VT_I4
},
478 { prop_ipenabledW
, CIM_BOOLEAN
},
479 { prop_macaddressW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
480 { prop_settingidW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
482 static const struct column col_os
[] =
484 { prop_buildnumberW
, CIM_STRING
},
485 { prop_captionW
, CIM_STRING
},
486 { prop_codesetW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
487 { prop_countrycodeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
488 { prop_csdversionW
, CIM_STRING
},
489 { prop_installdateW
, CIM_DATETIME
},
490 { prop_lastbootuptimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
491 { prop_localdatetimeW
, CIM_DATETIME
|COL_FLAG_DYNAMIC
},
492 { prop_localeW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
493 { prop_nameW
, CIM_STRING
},
494 { prop_osarchitectureW
, CIM_STRING
},
495 { prop_oslanguageW
, CIM_UINT32
, VT_I4
},
496 { prop_osproductsuiteW
, CIM_UINT32
, VT_I4
},
497 { prop_ostypeW
, CIM_UINT16
, VT_I4
},
498 { prop_primaryW
, CIM_BOOLEAN
},
499 { prop_serialnumberW
, CIM_STRING
},
500 { prop_servicepackmajorW
, CIM_UINT16
, VT_I4
},
501 { prop_servicepackminorW
, CIM_UINT16
, VT_I4
},
502 { prop_suitemaskW
, CIM_UINT32
, VT_I4
},
503 { prop_systemdirectoryW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
504 { prop_totalvisiblememorysizeW
, CIM_UINT64
},
505 { prop_versionW
, CIM_STRING
}
507 static const struct column col_param
[] =
509 { prop_classW
, CIM_STRING
},
510 { prop_methodW
, CIM_STRING
},
511 { prop_directionW
, CIM_SINT32
},
512 { prop_parameterW
, CIM_STRING
},
513 { prop_typeW
, CIM_UINT32
},
514 { prop_varianttypeW
, CIM_UINT32
},
515 { prop_defaultvalueW
, CIM_UINT32
}
517 static const struct column col_physicalmedia
[] =
519 { prop_serialnumberW
, CIM_STRING
},
520 { prop_tagW
, CIM_STRING
}
522 static const struct column col_physicalmemory
[] =
524 { prop_capacityW
, CIM_UINT64
}
526 static const struct column col_printer
[] =
528 { prop_attributesW
, CIM_UINT32
},
529 { prop_drivernameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
530 { prop_horizontalresolutionW
, CIM_UINT32
},
531 { prop_localW
, CIM_BOOLEAN
},
532 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
533 { prop_networkW
, CIM_BOOLEAN
},
534 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
535 { prop_portnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
536 { prop_locationW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
538 static const struct column col_process
[] =
540 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
541 { prop_commandlineW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
542 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
543 { prop_handleW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
544 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
545 { prop_pprocessidW
, CIM_UINT32
, VT_I4
},
546 { prop_processidW
, CIM_UINT32
, VT_I4
},
547 { prop_threadcountW
, CIM_UINT32
, VT_I4
},
548 { prop_workingsetsizeW
, CIM_UINT64
},
550 { method_getownerW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
552 static const struct column col_processor
[] =
554 { prop_addresswidthW
, CIM_UINT16
, VT_I4
},
555 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
556 { prop_cpustatusW
, CIM_UINT16
},
557 { prop_currentclockspeedW
, CIM_UINT32
, VT_I4
},
558 { prop_datawidthW
, CIM_UINT16
, VT_I4
},
559 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
560 { prop_deviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
561 { prop_familyW
, CIM_UINT16
, VT_I4
},
562 { prop_manufacturerW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
563 { prop_maxclockspeedW
, CIM_UINT32
, VT_I4
},
564 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
565 { prop_numcoresW
, CIM_UINT32
, VT_I4
},
566 { prop_numlogicalprocessorsW
, CIM_UINT32
, VT_I4
},
567 { prop_processoridW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
568 { prop_processortypeW
, CIM_UINT16
, VT_I4
},
569 { prop_uniqueidW
, CIM_STRING
},
570 { prop_versionW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
572 static const struct column col_qualifier
[] =
574 { prop_classW
, CIM_STRING
},
575 { prop_memberW
, CIM_STRING
},
576 { prop_typeW
, CIM_UINT32
},
577 { prop_flavorW
, CIM_SINT32
},
578 { prop_nameW
, CIM_STRING
},
579 { prop_intvalueW
, CIM_SINT32
},
580 { prop_strvalueW
, CIM_STRING
}
582 static const struct column col_service
[] =
584 { prop_acceptpauseW
, CIM_BOOLEAN
},
585 { prop_acceptstopW
, CIM_BOOLEAN
},
586 { prop_displaynameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
587 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
588 { prop_processidW
, CIM_UINT32
},
589 { prop_servicetypeW
, CIM_STRING
},
590 { prop_startmodeW
, CIM_STRING
},
591 { prop_stateW
, CIM_STRING
},
592 { prop_systemnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
594 { method_pauseserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
595 { method_resumeserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
596 { method_startserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
597 { method_stopserviceW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
599 static const struct column col_sid
[] =
601 { prop_accountnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
602 { prop_binaryrepresentationW
, CIM_UINT8
|CIM_FLAG_ARRAY
|COL_FLAG_DYNAMIC
},
603 { prop_referenceddomainnameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
604 { prop_sidW
, CIM_STRING
|COL_FLAG_DYNAMIC
|COL_FLAG_KEY
},
605 { prop_sidlengthW
, CIM_UINT32
}
607 static const struct column col_sounddevice
[] =
609 { prop_nameW
, CIM_STRING
},
610 { prop_productnameW
, CIM_STRING
},
611 { prop_statusinfoW
, CIM_UINT16
, VT_I4
}
613 static const struct column col_stdregprov
[] =
615 { method_enumkeyW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
616 { method_enumvaluesW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
617 { method_getstringvalueW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
}
619 static const struct column col_systemenclosure
[] =
621 { prop_captionW
, CIM_STRING
},
622 { prop_chassistypesW
, CIM_UINT16
|CIM_FLAG_ARRAY
},
623 { prop_descriptionW
, CIM_STRING
},
624 { prop_lockpresentW
, CIM_BOOLEAN
},
625 { prop_manufacturerW
, CIM_STRING
},
626 { prop_nameW
, CIM_STRING
},
627 { prop_tagW
, CIM_STRING
},
629 static const struct column col_systemsecurity
[] =
631 { method_getsdW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
632 { method_setsdW
, CIM_FLAG_ARRAY
|COL_FLAG_METHOD
},
634 static const struct column col_videocontroller
[] =
636 { prop_adapterdactypeW
, CIM_STRING
},
637 { prop_adapterramW
, CIM_UINT32
, VT_I4
},
638 { prop_availabilityW
, CIM_UINT16
},
639 { prop_captionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
640 { prop_currentbitsperpixelW
, CIM_UINT32
, VT_I4
},
641 { prop_currenthorizontalresW
, CIM_UINT32
, VT_I4
},
642 { prop_currentrefreshrateW
, CIM_UINT32
, VT_I4
},
643 { prop_currentscanmodeW
, CIM_UINT16
, VT_I4
},
644 { prop_currentverticalresW
, CIM_UINT32
, VT_I4
},
645 { prop_descriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
646 { prop_deviceidW
, CIM_STRING
|COL_FLAG_KEY
},
647 { prop_driverversionW
, CIM_STRING
},
648 { prop_nameW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
649 { prop_pnpdeviceidW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
650 { prop_videoarchitectureW
, CIM_UINT16
, VT_I4
},
651 { prop_videomemorytypeW
, CIM_UINT16
, VT_I4
},
652 { prop_videomodedescriptionW
, CIM_STRING
|COL_FLAG_DYNAMIC
},
653 { prop_videoprocessorW
, CIM_STRING
|COL_FLAG_DYNAMIC
}
656 static const WCHAR baseboard_manufacturerW
[] =
657 {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
658 static const WCHAR baseboard_serialnumberW
[] =
660 static const WCHAR baseboard_tagW
[] =
661 {'B','a','s','e',' ','B','o','a','r','d',0};
662 static const WCHAR baseboard_versionW
[] =
664 static const WCHAR bios_descriptionW
[] =
665 {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0};
666 static const WCHAR bios_manufacturerW
[] =
667 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
668 static const WCHAR bios_nameW
[] =
669 {'W','I','N','E',' ','B','I','O','S',0};
670 static const WCHAR bios_releasedateW
[] =
671 {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
672 static const WCHAR bios_serialnumberW
[] =
674 static const WCHAR bios_smbiosbiosversionW
[] =
676 static const WCHAR bios_versionW
[] =
677 {'W','I','N','E',' ',' ',' ','-',' ','1',0};
678 static const WCHAR cdromdrive_mediatypeW
[] =
679 {'C','D','-','R','O','M',0};
680 static const WCHAR cdromdrive_nameW
[] =
681 {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0};
682 static const WCHAR cdromdrive_pnpdeviceidW
[]=
683 {'I','D','E','\\','C','D','R','O','M','W','I','N','E','_','C','D','-','R','O','M',
684 '_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_','_',
685 '_','_','_','_','_','_','_','1','.','0','_','_','_','_','_','\\','5','&','3','A','2',
686 'A','5','8','5','4','&','0','&','1','.','0','.','0',0};
687 static const WCHAR compsys_descriptionW
[] =
688 {'A','T','/','A','T',' ','C','O','M','P','A','T','I','B','L','E',0};
689 static const WCHAR compsys_domainW
[] =
690 {'W','O','R','K','G','R','O','U','P',0};
691 static const WCHAR compsys_manufacturerW
[] =
692 {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0};
693 static const WCHAR compsys_modelW
[] =
695 static const WCHAR compsysproduct_identifyingnumberW
[] =
697 static const WCHAR compsysproduct_uuidW
[] =
698 {'0','0','0','0','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-','0','0','0','0','-',
699 '0','0','0','0','0','0','0','0','0','0','0','0',0};
700 static const WCHAR diskdrive_interfacetypeW
[] =
702 static const WCHAR diskdrive_manufacturerW
[] =
703 {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0};
704 static const WCHAR diskdrive_mediatype_fixedW
[] =
705 {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0};
706 static const WCHAR diskdrive_mediatype_removableW
[] =
707 {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0};
708 static const WCHAR diskdrive_modelW
[] =
709 {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0};
710 static const WCHAR diskdrive_pnpdeviceidW
[] =
711 {'I','D','E','\\','D','i','s','k','\\','V','E','N','_','W','I','N','E',0};
712 static const WCHAR diskdrive_serialW
[] =
713 {'W','I','N','E','H','D','I','S','K',0};
714 static const WCHAR networkadapter_pnpdeviceidW
[]=
715 {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&',
716 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\',
717 '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0};
718 static const WCHAR os_32bitW
[] =
719 {'3','2','-','b','i','t',0};
720 static const WCHAR os_64bitW
[] =
721 {'6','4','-','b','i','t',0};
722 static const WCHAR os_buildnumberW
[] =
724 static const WCHAR os_captionW
[] =
725 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
726 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0};
727 static const WCHAR os_csdversionW
[] =
728 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0};
729 static const WCHAR os_installdateW
[] =
730 {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0};
731 static const WCHAR os_nameW
[] =
732 {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ',
733 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S',
734 '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0',
735 '\\','P','a','r','t','i','t','i','o','n','1',0};
736 static const WCHAR os_serialnumberW
[] =
737 {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0};
738 static const WCHAR os_versionW
[] =
739 {'5','.','1','.','2','6','0','0',0};
740 static const WCHAR physicalmedia_tagW
[] =
741 {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0};
742 static const WCHAR sounddevice_productnameW
[] =
743 {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0};
744 static const WCHAR systemenclosure_systemenclosureW
[] =
745 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',0};
746 static const WCHAR systemenclosure_tagW
[] =
747 {'S','y','s','t','e','m',' ','E','n','c','l','o','s','u','r','e',' ','0',0};
748 static const WCHAR systemenclosure_manufacturerW
[] =
750 static const WCHAR videocontroller_dactypeW
[] =
751 {'I','n','t','e','g','r','a','t','e','d',' ','R','A','M','D','A','C',0};
752 static const WCHAR videocontroller_deviceidW
[] =
753 {'V','i','d','e','o','C','o','n','t','r','o','l','l','e','r','1',0};
754 static const WCHAR videocontroller_driverversionW
[] =
757 #include "pshpack1.h"
758 struct record_baseboard
760 const WCHAR
*manufacturer
;
763 const WCHAR
*product
;
764 const WCHAR
*serialnumber
;
766 const WCHAR
*version
;
770 const WCHAR
*description
;
771 const WCHAR
*identificationcode
;
772 const WCHAR
*manufacturer
;
774 const WCHAR
*releasedate
;
775 const WCHAR
*serialnumber
;
776 const WCHAR
*smbiosbiosversion
;
777 const WCHAR
*version
;
779 struct record_cdromdrive
781 const WCHAR
*device_id
;
783 const WCHAR
*mediatype
;
785 const WCHAR
*pnpdevice_id
;
787 struct record_computersystem
789 const WCHAR
*description
;
792 const WCHAR
*manufacturer
;
795 UINT32 num_logical_processors
;
796 UINT32 num_processors
;
797 UINT64 total_physical_memory
;
798 const WCHAR
*username
;
800 struct record_computersystemproduct
802 const WCHAR
*identifyingnumber
;
805 struct record_datafile
808 const WCHAR
*version
;
810 struct record_desktopmonitor
812 UINT32 pixelsperxlogicalinch
;
814 struct record_directory
819 struct record_diskdrive
821 const WCHAR
*device_id
;
823 const WCHAR
*interfacetype
;
824 const WCHAR
*manufacturer
;
825 const WCHAR
*mediatype
;
827 const WCHAR
*pnpdevice_id
;
828 const WCHAR
*serialnumber
;
831 struct record_diskpartition
835 const WCHAR
*device_id
;
838 const WCHAR
*pnpdevice_id
;
840 UINT64 startingoffset
;
843 struct record_logicaldisk
845 const WCHAR
*device_id
;
847 const WCHAR
*filesystem
;
851 const WCHAR
*volumename
;
852 const WCHAR
*volumeserialnumber
;
854 struct record_networkadapter
856 const WCHAR
*adaptertype
;
857 const WCHAR
*device_id
;
859 UINT32 interface_index
;
860 const WCHAR
*mac_address
;
861 const WCHAR
*manufacturer
;
863 UINT16 netconnection_status
;
865 const WCHAR
*pnpdevice_id
;
868 struct record_networkadapterconfig
870 const struct array
*defaultipgateway
;
871 const WCHAR
*description
;
873 const WCHAR
*dnshostname
;
874 const struct array
*dnsserversearchorder
;
876 UINT32 ipconnectionmetric
;
878 const WCHAR
*mac_address
;
879 const WCHAR
*settingid
;
881 struct record_operatingsystem
883 const WCHAR
*buildnumber
;
884 const WCHAR
*caption
;
885 const WCHAR
*codeset
;
886 const WCHAR
*countrycode
;
887 const WCHAR
*csdversion
;
888 const WCHAR
*installdate
;
889 const WCHAR
*lastbootuptime
;
890 const WCHAR
*localdatetime
;
893 const WCHAR
*osarchitecture
;
895 UINT32 osproductsuite
;
898 const WCHAR
*serialnumber
;
899 UINT16 servicepackmajor
;
900 UINT16 servicepackminor
;
902 const WCHAR
*systemdirectory
;
903 UINT64 totalvisiblememorysize
;
904 const WCHAR
*version
;
911 const WCHAR
*parameter
;
916 struct record_physicalmedia
918 const WCHAR
*serialnumber
;
921 struct record_physicalmemory
925 struct record_printer
928 const WCHAR
*drivername
;
929 UINT32 horizontalresolution
;
933 const WCHAR
*device_id
;
934 const WCHAR
*portname
;
935 const WCHAR
*location
;
937 struct record_process
939 const WCHAR
*caption
;
940 const WCHAR
*commandline
;
941 const WCHAR
*description
;
947 UINT64 workingsetsize
;
949 class_method
*get_owner
;
951 struct record_processor
954 const WCHAR
*caption
;
956 UINT32 currentclockspeed
;
958 const WCHAR
*description
;
959 const WCHAR
*device_id
;
961 const WCHAR
*manufacturer
;
962 UINT32 maxclockspeed
;
965 UINT32 num_logical_processors
;
966 const WCHAR
*processor_id
;
967 UINT16 processortype
;
968 const WCHAR
*unique_id
;
969 const WCHAR
*version
;
971 struct record_qualifier
979 const WCHAR
*strvalue
;
981 struct record_service
985 const WCHAR
*displayname
;
988 const WCHAR
*servicetype
;
989 const WCHAR
*startmode
;
991 const WCHAR
*systemname
;
993 class_method
*pause_service
;
994 class_method
*resume_service
;
995 class_method
*start_service
;
996 class_method
*stop_service
;
1000 const WCHAR
*accountname
;
1001 const struct array
*binaryrepresentation
;
1002 const WCHAR
*referenceddomainname
;
1006 struct record_sounddevice
1009 const WCHAR
*productname
;
1012 struct record_stdregprov
1014 class_method
*enumkey
;
1015 class_method
*enumvalues
;
1016 class_method
*getstringvalue
;
1018 struct record_systemsecurity
1020 class_method
*getsd
;
1021 class_method
*setsd
;
1023 struct record_systemenclosure
1025 const WCHAR
*caption
;
1026 const struct array
*chassistypes
;
1027 const WCHAR
*description
;
1029 const WCHAR
*manufacturer
;
1033 struct record_videocontroller
1035 const WCHAR
*adapter_dactype
;
1037 UINT16 availability
;
1038 const WCHAR
*caption
;
1039 UINT32 current_bitsperpixel
;
1040 UINT32 current_horizontalres
;
1041 UINT32 current_refreshrate
;
1042 UINT16 current_scanmode
;
1043 UINT32 current_verticalres
;
1044 const WCHAR
*description
;
1045 const WCHAR
*device_id
;
1046 const WCHAR
*driverversion
;
1048 const WCHAR
*pnpdevice_id
;
1049 UINT16 videoarchitecture
;
1050 UINT16 videomemorytype
;
1051 const WCHAR
*videomodedescription
;
1052 const WCHAR
*videoprocessor
;
1054 #include "poppack.h"
1056 static const struct record_baseboard data_baseboard
[] =
1058 { baseboard_manufacturerW
, baseboard_tagW
, baseboard_tagW
, baseboard_tagW
, baseboard_serialnumberW
, baseboard_versionW
}
1060 static const struct record_bios data_bios
[] =
1062 { bios_descriptionW
, bios_descriptionW
, bios_manufacturerW
, bios_nameW
, bios_releasedateW
, bios_serialnumberW
,
1063 bios_smbiosbiosversionW
, bios_versionW
}
1065 static const struct record_computersystemproduct data_compsysproduct
[] =
1067 { compsysproduct_identifyingnumberW
, compsysproduct_uuidW
}
1069 static const struct record_param data_param
[] =
1071 { class_processW
, method_getownerW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1072 { class_processW
, method_getownerW
, -1, param_userW
, CIM_STRING
},
1073 { class_processW
, method_getownerW
, -1, param_domainW
, CIM_STRING
},
1074 { class_serviceW
, method_pauseserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1075 { class_serviceW
, method_resumeserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1076 { class_serviceW
, method_startserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1077 { class_serviceW
, method_stopserviceW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1078 { class_stdregprovW
, method_enumkeyW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
1079 { class_stdregprovW
, method_enumkeyW
, 1, param_subkeynameW
, CIM_STRING
},
1080 { class_stdregprovW
, method_enumkeyW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1081 { class_stdregprovW
, method_enumkeyW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
1082 { class_stdregprovW
, method_enumvaluesW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
1083 { class_stdregprovW
, method_enumvaluesW
, 1, param_subkeynameW
, CIM_STRING
},
1084 { class_stdregprovW
, method_enumvaluesW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1085 { class_stdregprovW
, method_enumvaluesW
, -1, param_namesW
, CIM_STRING
|CIM_FLAG_ARRAY
},
1086 { class_stdregprovW
, method_enumvaluesW
, -1, param_typesW
, CIM_SINT32
|CIM_FLAG_ARRAY
},
1087 { class_stdregprovW
, method_getstringvalueW
, 1, param_defkeyW
, CIM_SINT32
, 0, 0x80000002 },
1088 { class_stdregprovW
, method_getstringvalueW
, 1, param_subkeynameW
, CIM_STRING
},
1089 { class_stdregprovW
, method_getstringvalueW
, 1, param_valuenameW
, CIM_STRING
},
1090 { class_stdregprovW
, method_getstringvalueW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1091 { class_stdregprovW
, method_getstringvalueW
, -1, param_valueW
, CIM_STRING
},
1092 { class_systemsecurityW
, method_getsdW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1093 { class_systemsecurityW
, method_getsdW
, -1, param_sdW
, CIM_UINT8
|CIM_FLAG_ARRAY
},
1094 { class_systemsecurityW
, method_setsdW
, 1, param_sdW
, CIM_UINT8
|CIM_FLAG_ARRAY
},
1095 { class_systemsecurityW
, method_setsdW
, -1, param_returnvalueW
, CIM_UINT32
, VT_I4
},
1098 #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\
1099 WBEM_FLAVOR_ORIGIN_PROPAGATED)
1101 static const struct record_physicalmedia data_physicalmedia
[] =
1103 { diskdrive_serialW
, physicalmedia_tagW
}
1105 static const struct record_qualifier data_qualifier
[] =
1107 { class_process_getowner_outW
, param_userW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 0 },
1108 { class_process_getowner_outW
, param_domainW
, CIM_SINT32
, FLAVOR_ID
, prop_idW
, 1 }
1110 static const struct record_sounddevice data_sounddevice
[] =
1112 { sounddevice_productnameW
, sounddevice_productnameW
, 3 /* enabled */ }
1114 static const struct record_stdregprov data_stdregprov
[] =
1116 { reg_enum_key
, reg_enum_values
, reg_get_stringvalue
}
1118 static UINT16 systemenclosure_chassistypes
[] =
1122 static const struct array systemenclosure_chassistypes_array
=
1124 SIZEOF(systemenclosure_chassistypes
),
1125 &systemenclosure_chassistypes
1127 static const struct record_systemenclosure data_systemenclosure
[] =
1130 systemenclosure_systemenclosureW
,
1131 &systemenclosure_chassistypes_array
,
1132 systemenclosure_systemenclosureW
,
1134 systemenclosure_manufacturerW
,
1135 systemenclosure_systemenclosureW
,
1136 systemenclosure_tagW
,
1139 static const struct record_systemsecurity data_systemsecurity
[] =
1141 { security_get_sd
, security_set_sd
}
1144 /* check if row matches condition and update status */
1145 static BOOL
match_row( const struct table
*table
, UINT row
, const struct expr
*cond
, enum fill_status
*status
)
1152 *status
= FILL_STATUS_UNFILTERED
;
1155 if (eval_cond( table
, row
, cond
, &val
, &type
) != S_OK
)
1157 *status
= FILL_STATUS_FAILED
;
1160 *status
= FILL_STATUS_FILTERED
;
1164 static BOOL
resize_table( struct table
*table
, UINT row_count
, UINT row_size
)
1166 if (!table
->num_rows_allocated
)
1168 if (!(table
->data
= heap_alloc( row_count
* row_size
))) return FALSE
;
1169 table
->num_rows_allocated
= row_count
;
1172 if (row_count
> table
->num_rows_allocated
)
1175 UINT count
= max( row_count
, table
->num_rows_allocated
* 2 );
1176 if (!(data
= heap_realloc( table
->data
, count
* row_size
))) return FALSE
;
1178 table
->num_rows_allocated
= count
;
1183 static enum fill_status
fill_cdromdrive( struct table
*table
, const struct expr
*cond
)
1185 static const WCHAR fmtW
[] = {'%','c',':',0};
1186 WCHAR drive
[3], root
[] = {'A',':','\\',0};
1187 struct record_cdromdrive
*rec
;
1188 UINT i
, row
= 0, offset
= 0;
1189 DWORD drives
= GetLogicalDrives();
1190 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1192 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1194 for (i
= 0; i
< 26; i
++)
1196 if (drives
& (1 << i
))
1199 if (GetDriveTypeW( root
) != DRIVE_CDROM
)
1202 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1204 rec
= (struct record_cdromdrive
*)(table
->data
+ offset
);
1205 rec
->device_id
= cdromdrive_pnpdeviceidW
;
1206 sprintfW( drive
, fmtW
, 'A' + i
);
1207 rec
->drive
= heap_strdupW( drive
);
1208 rec
->mediatype
= cdromdrive_mediatypeW
;
1209 rec
->name
= cdromdrive_nameW
;
1210 rec
->pnpdevice_id
= cdromdrive_pnpdeviceidW
;
1211 if (!match_row( table
, row
, cond
, &status
))
1213 free_row_values( table
, row
);
1216 offset
+= sizeof(*rec
);
1220 TRACE("created %u rows\n", row
);
1221 table
->num_rows
= row
;
1225 static UINT
get_processor_count(void)
1227 SYSTEM_BASIC_INFORMATION info
;
1229 if (NtQuerySystemInformation( SystemBasicInformation
, &info
, sizeof(info
), NULL
)) return 1;
1230 return info
.NumberOfProcessors
;
1233 static UINT
get_logical_processor_count( UINT
*num_cores
)
1235 SYSTEM_LOGICAL_PROCESSOR_INFORMATION
*info
;
1236 UINT i
, j
, count
= 0;
1240 if (num_cores
) *num_cores
= get_processor_count();
1241 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, NULL
, 0, &len
);
1242 if (status
!= STATUS_INFO_LENGTH_MISMATCH
) return get_processor_count();
1244 if (!(info
= heap_alloc( len
))) return get_processor_count();
1245 status
= NtQuerySystemInformation( SystemLogicalProcessorInformation
, info
, len
, &len
);
1246 if (status
!= STATUS_SUCCESS
)
1249 return get_processor_count();
1251 if (num_cores
) *num_cores
= 0;
1252 for (i
= 0; i
< len
/ sizeof(*info
); i
++)
1254 if (info
[i
].Relationship
== RelationProcessorCore
)
1256 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) count
++;
1258 else if (info
[i
].Relationship
== RelationProcessorPackage
&& num_cores
)
1260 for (j
= 0; j
< sizeof(ULONG_PTR
); j
++) if (info
[i
].ProcessorMask
& (1 << j
)) (*num_cores
)++;
1267 static UINT64
get_total_physical_memory(void)
1269 MEMORYSTATUSEX status
;
1271 status
.dwLength
= sizeof(status
);
1272 if (!GlobalMemoryStatusEx( &status
)) return 1024 * 1024 * 1024;
1273 return status
.ullTotalPhys
;
1276 static WCHAR
*get_computername(void)
1279 DWORD size
= MAX_COMPUTERNAME_LENGTH
+ 1;
1281 if (!(ret
= heap_alloc( size
* sizeof(WCHAR
) ))) return NULL
;
1282 GetComputerNameW( ret
, &size
);
1286 static WCHAR
*get_username(void)
1289 DWORD compsize
, usersize
;
1293 GetComputerNameW( NULL
, &compsize
);
1295 GetUserNameW( NULL
, &usersize
);
1296 size
= compsize
+ usersize
; /* two null terminators account for the \ */
1297 if (!(ret
= heap_alloc( size
* sizeof(WCHAR
) ))) return NULL
;
1298 GetComputerNameW( ret
, &compsize
);
1299 ret
[compsize
] = '\\';
1300 GetUserNameW( ret
+ compsize
+ 1, &usersize
);
1304 static enum fill_status
fill_compsys( struct table
*table
, const struct expr
*cond
)
1306 struct record_computersystem
*rec
;
1307 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1310 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1312 rec
= (struct record_computersystem
*)table
->data
;
1313 rec
->description
= compsys_descriptionW
;
1314 rec
->domain
= compsys_domainW
;
1315 rec
->domainrole
= 0; /* standalone workstation */
1316 rec
->manufacturer
= compsys_manufacturerW
;
1317 rec
->model
= compsys_modelW
;
1318 rec
->name
= get_computername();
1319 rec
->num_logical_processors
= get_logical_processor_count( NULL
);
1320 rec
->num_processors
= get_processor_count();
1321 rec
->total_physical_memory
= get_total_physical_memory();
1322 rec
->username
= get_username();
1323 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
1326 TRACE("created %u rows\n", row
);
1327 table
->num_rows
= row
;
1339 static struct dirstack
*alloc_dirstack( UINT size
)
1341 struct dirstack
*dirstack
;
1343 if (!(dirstack
= heap_alloc( sizeof(*dirstack
) ))) return NULL
;
1344 if (!(dirstack
->dirs
= heap_alloc( sizeof(WCHAR
*) * size
)))
1346 heap_free( dirstack
);
1349 if (!(dirstack
->len_dirs
= heap_alloc( sizeof(UINT
) * size
)))
1351 heap_free( dirstack
->dirs
);
1352 heap_free( dirstack
);
1355 dirstack
->num_dirs
= 0;
1356 dirstack
->num_allocated
= size
;
1360 static void clear_dirstack( struct dirstack
*dirstack
)
1363 for (i
= 0; i
< dirstack
->num_dirs
; i
++) heap_free( dirstack
->dirs
[i
] );
1364 dirstack
->num_dirs
= 0;
1367 static void free_dirstack( struct dirstack
*dirstack
)
1369 clear_dirstack( dirstack
);
1370 heap_free( dirstack
->dirs
);
1371 heap_free( dirstack
->len_dirs
);
1372 heap_free( dirstack
);
1375 static BOOL
push_dir( struct dirstack
*dirstack
, WCHAR
*dir
, UINT len
)
1377 UINT size
, i
= dirstack
->num_dirs
;
1379 if (!dir
) return FALSE
;
1381 if (i
== dirstack
->num_allocated
)
1386 size
= dirstack
->num_allocated
* 2;
1387 if (!(tmp
= heap_realloc( dirstack
->dirs
, size
* sizeof(WCHAR
*) ))) return FALSE
;
1388 dirstack
->dirs
= tmp
;
1389 if (!(len_tmp
= heap_realloc( dirstack
->len_dirs
, size
* sizeof(UINT
) ))) return FALSE
;
1390 dirstack
->len_dirs
= len_tmp
;
1391 dirstack
->num_allocated
= size
;
1393 dirstack
->dirs
[i
] = dir
;
1394 dirstack
->len_dirs
[i
] = len
;
1395 dirstack
->num_dirs
++;
1399 static WCHAR
*pop_dir( struct dirstack
*dirstack
, UINT
*len
)
1401 if (!dirstack
->num_dirs
)
1406 dirstack
->num_dirs
--;
1407 *len
= dirstack
->len_dirs
[dirstack
->num_dirs
];
1408 return dirstack
->dirs
[dirstack
->num_dirs
];
1411 static const WCHAR
*peek_dir( struct dirstack
*dirstack
)
1413 if (!dirstack
->num_dirs
) return NULL
;
1414 return dirstack
->dirs
[dirstack
->num_dirs
- 1];
1417 static WCHAR
*build_glob( WCHAR drive
, const WCHAR
*path
, UINT len
)
1422 if (!(ret
= heap_alloc( (len
+ 6) * sizeof(WCHAR
) ))) return NULL
;
1428 memcpy( ret
+ i
, path
, len
* sizeof(WCHAR
) );
1437 static WCHAR
*build_name( WCHAR drive
, const WCHAR
*path
)
1439 UINT i
= 0, len
= 0;
1443 for (p
= path
; *p
; p
++)
1445 if (*p
== '\\') len
+= 2;
1448 if (!(ret
= heap_alloc( (len
+ 5) * sizeof(WCHAR
) ))) return NULL
;
1453 for (p
= path
; *p
; p
++)
1455 if (*p
!= '\\') ret
[i
++] = *p
;
1466 static WCHAR
*build_dirname( const WCHAR
*path
, UINT
*ret_len
)
1468 const WCHAR
*p
= path
, *start
;
1472 if (!isalphaW( p
[0] ) || p
[1] != ':' || p
[2] != '\\' || p
[3] != '\\' || !p
[4]) return NULL
;
1474 len
= strlenW( start
);
1475 p
= start
+ len
- 1;
1476 if (*p
== '\\') return NULL
;
1478 while (p
>= start
&& *p
!= '\\') { len
--; p
--; };
1479 while (p
>= start
&& *p
== '\\') { len
--; p
--; };
1481 if (!(ret
= heap_alloc( (len
+ 1) * sizeof(WCHAR
) ))) return NULL
;
1482 for (i
= 0, p
= start
; p
< start
+ len
; p
++)
1484 if (p
[0] == '\\' && p
[1] == '\\')
1496 static BOOL
seen_dir( struct dirstack
*dirstack
, const WCHAR
*path
)
1499 for (i
= 0; i
< dirstack
->num_dirs
; i
++) if (!strcmpW( dirstack
->dirs
[i
], path
)) return TRUE
;
1503 /* optimize queries of the form WHERE Name='...' [OR Name='...']* */
1504 static UINT
seed_dirs( struct dirstack
*dirstack
, const struct expr
*cond
, WCHAR root
, UINT
*count
)
1506 const struct expr
*left
, *right
;
1508 if (!cond
|| cond
->type
!= EXPR_COMPLEX
) return *count
= 0;
1510 left
= cond
->u
.expr
.left
;
1511 right
= cond
->u
.expr
.right
;
1512 if (cond
->u
.expr
.op
== OP_EQ
)
1516 const WCHAR
*str
= NULL
;
1518 if (left
->type
== EXPR_PROPVAL
&& right
->type
== EXPR_SVAL
&&
1519 !strcmpW( left
->u
.propval
->name
, prop_nameW
) &&
1520 toupperW( right
->u
.sval
[0] ) == toupperW( root
))
1522 str
= right
->u
.sval
;
1524 else if (left
->type
== EXPR_SVAL
&& right
->type
== EXPR_PROPVAL
&&
1525 !strcmpW( right
->u
.propval
->name
, prop_nameW
) &&
1526 toupperW( left
->u
.sval
[0] ) == toupperW( root
))
1530 if (str
&& (path
= build_dirname( str
, &len
)))
1532 if (seen_dir( dirstack
, path
))
1537 else if (push_dir( dirstack
, path
, len
)) return ++*count
;
1542 else if (cond
->u
.expr
.op
== OP_OR
)
1544 UINT left_count
= 0, right_count
= 0;
1546 if (!(seed_dirs( dirstack
, left
, root
, &left_count
))) return *count
= 0;
1547 if (!(seed_dirs( dirstack
, right
, root
, &right_count
))) return *count
= 0;
1548 return *count
+= left_count
+ right_count
;
1553 static WCHAR
*append_path( const WCHAR
*path
, const WCHAR
*segment
, UINT
*len
)
1555 UINT len_path
= 0, len_segment
= strlenW( segment
);
1559 if (path
) len_path
= strlenW( path
);
1560 if (!(ret
= heap_alloc( (len_path
+ len_segment
+ 2) * sizeof(WCHAR
) ))) return NULL
;
1561 if (path
&& len_path
)
1563 memcpy( ret
, path
, len_path
* sizeof(WCHAR
) );
1564 ret
[len_path
] = '\\';
1565 *len
+= len_path
+ 1;
1567 memcpy( ret
+ *len
, segment
, len_segment
* sizeof(WCHAR
) );
1568 *len
+= len_segment
;
1573 static WCHAR
*get_file_version( const WCHAR
*filename
)
1575 static const WCHAR slashW
[] = {'\\',0}, fmtW
[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
1576 VS_FIXEDFILEINFO
*info
;
1581 if (!(ret
= heap_alloc( (4 * 5 + sizeof(fmtW
) / sizeof(fmtW
[0])) * sizeof(WCHAR
) ))) return NULL
;
1582 if (!(size
= GetFileVersionInfoSizeW( filename
, NULL
)) || !(block
= heap_alloc( size
)))
1587 if (!GetFileVersionInfoW( filename
, 0, size
, block
) ||
1588 !VerQueryValueW( block
, slashW
, (void **)&info
, &size
))
1594 sprintfW( ret
, fmtW
, info
->dwFileVersionMS
>> 16, info
->dwFileVersionMS
& 0xffff,
1595 info
->dwFileVersionLS
>> 16, info
->dwFileVersionLS
& 0xffff );
1600 static enum fill_status
fill_datafile( struct table
*table
, const struct expr
*cond
)
1602 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1603 struct record_datafile
*rec
;
1604 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1605 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1606 DWORD drives
= GetLogicalDrives();
1607 WIN32_FIND_DATAW data
;
1609 struct dirstack
*dirstack
;
1610 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1612 if (!resize_table( table
, 8, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1614 dirstack
= alloc_dirstack(2);
1616 for (i
= 0; i
< 26; i
++)
1618 if (!(drives
& (1 << i
))) continue;
1621 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1623 num_expected_rows
= 0;
1624 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1630 path
= pop_dir( dirstack
, &len
);
1631 if (!(glob
= build_glob( root
[0], path
, len
)))
1633 status
= FILL_STATUS_FAILED
;
1636 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1640 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1642 status
= FILL_STATUS_FAILED
;
1643 FindClose( handle
);
1646 if (!strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
)) continue;
1647 new_path
= append_path( path
, data
.cFileName
, &len
);
1649 if (data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
1651 if (push_dir( dirstack
, new_path
, len
)) continue;
1652 heap_free( new_path
);
1653 FindClose( handle
);
1654 status
= FILL_STATUS_FAILED
;
1657 rec
= (struct record_datafile
*)(table
->data
+ offset
);
1658 rec
->name
= build_name( root
[0], new_path
);
1659 rec
->version
= get_file_version( rec
->name
);
1660 if (!match_row( table
, row
, cond
, &status
))
1662 free_row_values( table
, row
);
1665 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1668 FindClose( handle
);
1669 status
= FILL_STATUS_FILTERED
;
1672 offset
+= sizeof(*rec
);
1675 while (FindNextFileW( handle
, &data
));
1676 FindClose( handle
);
1678 if (!peek_dir( dirstack
)) break;
1683 free_dirstack( dirstack
);
1687 TRACE("created %u rows\n", row
);
1688 table
->num_rows
= row
;
1692 static UINT32
get_pixelsperxlogicalinch(void)
1694 HDC hdc
= GetDC( NULL
);
1697 if (!hdc
) return 96;
1698 ret
= GetDeviceCaps( hdc
, LOGPIXELSX
);
1699 ReleaseDC( NULL
, hdc
);
1703 static enum fill_status
fill_desktopmonitor( struct table
*table
, const struct expr
*cond
)
1705 struct record_desktopmonitor
*rec
;
1706 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1709 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1711 rec
= (struct record_desktopmonitor
*)table
->data
;
1712 rec
->pixelsperxlogicalinch
= get_pixelsperxlogicalinch();
1714 if (match_row( table
, row
, cond
, &status
)) row
++;
1716 TRACE("created %u rows\n", row
);
1717 table
->num_rows
= row
;
1721 static enum fill_status
fill_directory( struct table
*table
, const struct expr
*cond
)
1723 static const WCHAR dotW
[] = {'.',0}, dotdotW
[] = {'.','.',0};
1724 struct record_directory
*rec
;
1725 UINT i
, len
, row
= 0, offset
= 0, num_expected_rows
;
1726 WCHAR
*glob
= NULL
, *path
= NULL
, *new_path
, root
[] = {'A',':','\\',0};
1727 DWORD drives
= GetLogicalDrives();
1728 WIN32_FIND_DATAW data
;
1730 struct dirstack
*dirstack
;
1731 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1733 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1735 dirstack
= alloc_dirstack(2);
1737 for (i
= 0; i
< 26; i
++)
1739 if (!(drives
& (1 << i
))) continue;
1742 if (GetDriveTypeW( root
) != DRIVE_FIXED
) continue;
1744 num_expected_rows
= 0;
1745 if (!seed_dirs( dirstack
, cond
, root
[0], &num_expected_rows
)) clear_dirstack( dirstack
);
1751 path
= pop_dir( dirstack
, &len
);
1752 if (!(glob
= build_glob( root
[0], path
, len
)))
1754 status
= FILL_STATUS_FAILED
;
1757 if ((handle
= FindFirstFileW( glob
, &data
)) != INVALID_HANDLE_VALUE
)
1761 if (!resize_table( table
, row
+ 1, sizeof(*rec
) ))
1763 FindClose( handle
);
1764 status
= FILL_STATUS_FAILED
;
1767 if (!(data
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
) ||
1768 !strcmpW( data
.cFileName
, dotW
) || !strcmpW( data
.cFileName
, dotdotW
))
1771 new_path
= append_path( path
, data
.cFileName
, &len
);
1772 if (!(push_dir( dirstack
, new_path
, len
)))
1774 heap_free( new_path
);
1775 FindClose( handle
);
1776 status
= FILL_STATUS_FAILED
;
1779 rec
= (struct record_directory
*)(table
->data
+ offset
);
1780 rec
->accessmask
= FILE_ALL_ACCESS
;
1781 rec
->name
= build_name( root
[0], new_path
);
1782 if (!match_row( table
, row
, cond
, &status
))
1784 free_row_values( table
, row
);
1787 else if (num_expected_rows
&& row
== num_expected_rows
- 1)
1790 FindClose( handle
);
1791 status
= FILL_STATUS_FILTERED
;
1794 offset
+= sizeof(*rec
);
1797 while (FindNextFileW( handle
, &data
));
1798 FindClose( handle
);
1800 if (!peek_dir( dirstack
)) break;
1805 free_dirstack( dirstack
);
1809 TRACE("created %u rows\n", row
);
1810 table
->num_rows
= row
;
1814 static UINT64
get_freespace( const WCHAR
*dir
, UINT64
*disksize
)
1816 WCHAR root
[] = {'\\','\\','.','\\','A',':',0};
1817 ULARGE_INTEGER free
;
1818 DISK_GEOMETRY_EX info
;
1820 DWORD bytes_returned
;
1822 free
.QuadPart
= 512 * 1024 * 1024;
1823 GetDiskFreeSpaceExW( dir
, NULL
, NULL
, &free
);
1826 handle
= CreateFileW( root
, GENERIC_READ
, FILE_SHARE_READ
|FILE_SHARE_WRITE
, NULL
, OPEN_EXISTING
, 0, 0 );
1827 if (handle
!= INVALID_HANDLE_VALUE
)
1829 if (DeviceIoControl( handle
, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
, NULL
, 0, &info
, sizeof(info
), &bytes_returned
, NULL
))
1830 *disksize
= info
.DiskSize
.QuadPart
;
1831 CloseHandle( handle
);
1833 return free
.QuadPart
;
1836 static enum fill_status
fill_diskdrive( struct table
*table
, const struct expr
*cond
)
1838 static const WCHAR fmtW
[] =
1839 {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0};
1840 WCHAR device_id
[sizeof(fmtW
)/sizeof(fmtW
[0]) + 10], root
[] = {'A',':','\\',0};
1841 struct record_diskdrive
*rec
;
1842 UINT i
, row
= 0, offset
= 0, index
= 0, type
;
1843 UINT64 size
= 1024 * 1024 * 1024;
1844 DWORD drives
= GetLogicalDrives();
1845 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1847 if (!resize_table( table
, 2, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1849 for (i
= 0; i
< 26; i
++)
1851 if (drives
& (1 << i
))
1854 type
= GetDriveTypeW( root
);
1855 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1858 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1860 rec
= (struct record_diskdrive
*)(table
->data
+ offset
);
1861 sprintfW( device_id
, fmtW
, index
);
1862 rec
->device_id
= heap_strdupW( device_id
);
1864 rec
->interfacetype
= diskdrive_interfacetypeW
;
1865 rec
->manufacturer
= diskdrive_manufacturerW
;
1866 if (type
== DRIVE_FIXED
)
1867 rec
->mediatype
= diskdrive_mediatype_fixedW
;
1869 rec
->mediatype
= diskdrive_mediatype_removableW
;
1870 rec
->model
= diskdrive_modelW
;
1871 rec
->pnpdevice_id
= diskdrive_pnpdeviceidW
;
1872 rec
->serialnumber
= diskdrive_serialW
;
1873 get_freespace( root
, &size
);
1875 if (!match_row( table
, row
, cond
, &status
))
1877 free_row_values( table
, row
);
1880 offset
+= sizeof(*rec
);
1885 TRACE("created %u rows\n", row
);
1886 table
->num_rows
= row
;
1890 static WCHAR
*get_filesystem( const WCHAR
*root
)
1892 static const WCHAR ntfsW
[] = {'N','T','F','S',0};
1893 WCHAR buffer
[MAX_PATH
+ 1];
1895 if (GetVolumeInformationW( root
, NULL
, 0, NULL
, NULL
, NULL
, buffer
, MAX_PATH
+ 1 ))
1896 return heap_strdupW( buffer
);
1897 return heap_strdupW( ntfsW
);
1900 static enum fill_status
fill_diskpartition( struct table
*table
, const struct expr
*cond
)
1902 static const WCHAR fmtW
[] =
1903 {'D','i','s','k',' ','#','%','u',',',' ','P','a','r','t','i','t','i','o','n',' ','#','0',0};
1904 WCHAR device_id
[32], root
[] = {'A',':','\\',0};
1905 struct record_diskpartition
*rec
;
1906 UINT i
, row
= 0, offset
= 0, type
, index
= 0;
1907 UINT64 size
= 1024 * 1024 * 1024;
1908 DWORD drives
= GetLogicalDrives();
1909 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1911 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1913 for (i
= 0; i
< 26; i
++)
1915 if (drives
& (1 << i
))
1918 type
= GetDriveTypeW( root
);
1919 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_REMOVABLE
)
1922 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1924 rec
= (struct record_diskpartition
*)(table
->data
+ offset
);
1925 rec
->bootable
= (i
== 2) ? -1 : 0;
1926 rec
->bootpartition
= (i
== 2) ? -1 : 0;
1927 sprintfW( device_id
, fmtW
, index
);
1928 rec
->device_id
= heap_strdupW( device_id
);
1929 rec
->diskindex
= index
;
1931 rec
->pnpdevice_id
= heap_strdupW( device_id
);
1932 get_freespace( root
, &size
);
1934 rec
->startingoffset
= 0;
1935 rec
->type
= get_filesystem( root
);
1936 if (!match_row( table
, row
, cond
, &status
))
1938 free_row_values( table
, row
);
1941 offset
+= sizeof(*rec
);
1946 TRACE("created %u rows\n", row
);
1947 table
->num_rows
= row
;
1951 static WCHAR
*get_volumename( const WCHAR
*root
)
1953 WCHAR buf
[MAX_PATH
+ 1] = {0};
1954 GetVolumeInformationW( root
, buf
, sizeof(buf
)/sizeof(buf
[0]), NULL
, NULL
, NULL
, NULL
, 0 );
1955 return heap_strdupW( buf
);
1957 static WCHAR
*get_volumeserialnumber( const WCHAR
*root
)
1959 static const WCHAR fmtW
[] = {'%','0','8','X',0};
1963 GetVolumeInformationW( root
, NULL
, 0, &serial
, NULL
, NULL
, NULL
, 0 );
1964 sprintfW( buffer
, fmtW
, serial
);
1965 return heap_strdupW( buffer
);
1968 static enum fill_status
fill_logicaldisk( struct table
*table
, const struct expr
*cond
)
1970 static const WCHAR fmtW
[] = {'%','c',':',0};
1971 WCHAR device_id
[3], root
[] = {'A',':','\\',0};
1972 struct record_logicaldisk
*rec
;
1973 UINT i
, row
= 0, offset
= 0, type
;
1974 UINT64 size
= 1024 * 1024 * 1024;
1975 DWORD drives
= GetLogicalDrives();
1976 enum fill_status status
= FILL_STATUS_UNFILTERED
;
1978 if (!resize_table( table
, 4, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1980 for (i
= 0; i
< 26; i
++)
1982 if (drives
& (1 << i
))
1985 type
= GetDriveTypeW( root
);
1986 if (type
!= DRIVE_FIXED
&& type
!= DRIVE_CDROM
&& type
!= DRIVE_REMOVABLE
)
1989 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
1991 rec
= (struct record_logicaldisk
*)(table
->data
+ offset
);
1992 sprintfW( device_id
, fmtW
, 'A' + i
);
1993 rec
->device_id
= heap_strdupW( device_id
);
1994 rec
->drivetype
= type
;
1995 rec
->filesystem
= get_filesystem( root
);
1996 rec
->freespace
= get_freespace( root
, &size
);
1997 rec
->name
= heap_strdupW( device_id
);
1999 rec
->volumename
= get_volumename( root
);
2000 rec
->volumeserialnumber
= get_volumeserialnumber( root
);
2001 if (!match_row( table
, row
, cond
, &status
))
2003 free_row_values( table
, row
);
2006 offset
+= sizeof(*rec
);
2010 TRACE("created %u rows\n", row
);
2011 table
->num_rows
= row
;
2015 static UINT16
get_connection_status( IF_OPER_STATUS status
)
2019 case IfOperStatusDown
:
2020 return 0; /* Disconnected */
2021 case IfOperStatusUp
:
2022 return 2; /* Connected */
2024 ERR("unhandled status %u\n", status
);
2029 static WCHAR
*get_mac_address( const BYTE
*addr
, DWORD len
)
2031 static const WCHAR fmtW
[] =
2032 {'%','0','2','x',':','%','0','2','x',':','%','0','2','x',':',
2033 '%','0','2','x',':','%','0','2','x',':','%','0','2','x',0};
2036 if (len
!= 6 || !(ret
= heap_alloc( 18 * sizeof(WCHAR
) ))) return NULL
;
2037 sprintfW( ret
, fmtW
, addr
[0], addr
[1], addr
[2], addr
[3], addr
[4], addr
[5] );
2040 static const WCHAR
*get_adaptertype( DWORD type
, int *physical
)
2042 static const WCHAR ethernetW
[] = {'E','t','h','e','r','n','e','t',' ','8','0','2','.','3',0};
2043 static const WCHAR wirelessW
[] = {'W','i','r','e','l','e','s','s',0};
2044 static const WCHAR firewireW
[] = {'1','3','9','4',0};
2045 static const WCHAR tunnelW
[] = {'T','u','n','n','e','l',0};
2049 case IF_TYPE_ETHERNET_CSMACD
: *physical
= -1; return ethernetW
;
2050 case IF_TYPE_IEEE80211
: *physical
= -1; return wirelessW
;
2051 case IF_TYPE_IEEE1394
: *physical
= -1; return firewireW
;
2052 case IF_TYPE_TUNNEL
: *physical
= 0; return tunnelW
;
2053 default: *physical
= 0; return NULL
;
2057 static enum fill_status
fill_networkadapter( struct table
*table
, const struct expr
*cond
)
2059 static const WCHAR fmtW
[] = {'%','u',0};
2060 WCHAR device_id
[11];
2061 struct record_networkadapter
*rec
;
2062 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
2063 UINT row
= 0, offset
= 0, count
= 0;
2064 DWORD size
= 0, ret
;
2066 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2068 ret
= GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, NULL
, &size
);
2069 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
2071 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
2072 if (GetAdaptersAddresses( AF_UNSPEC
, 0, NULL
, buffer
, &size
))
2074 heap_free( buffer
);
2075 return FILL_STATUS_FAILED
;
2077 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2079 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
2081 if (!resize_table( table
, count
, sizeof(*rec
) ))
2083 heap_free( buffer
);
2084 return FILL_STATUS_FAILED
;
2086 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2088 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
2090 rec
= (struct record_networkadapter
*)(table
->data
+ offset
);
2091 sprintfW( device_id
, fmtW
, aa
->u
.s
.IfIndex
);
2092 rec
->adaptertype
= get_adaptertype( aa
->IfType
, &physical
);
2093 rec
->device_id
= heap_strdupW( device_id
);
2094 rec
->index
= aa
->u
.s
.IfIndex
;
2095 rec
->interface_index
= aa
->u
.s
.IfIndex
;
2096 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
2097 rec
->manufacturer
= compsys_manufacturerW
;
2098 rec
->name
= heap_strdupW( aa
->FriendlyName
);
2099 rec
->netconnection_status
= get_connection_status( aa
->OperStatus
);
2100 rec
->physicaladapter
= physical
;
2101 rec
->pnpdevice_id
= networkadapter_pnpdeviceidW
;
2102 rec
->speed
= 1000000;
2103 if (!match_row( table
, row
, cond
, &status
))
2105 free_row_values( table
, row
);
2108 offset
+= sizeof(*rec
);
2111 TRACE("created %u rows\n", row
);
2112 table
->num_rows
= row
;
2114 heap_free( buffer
);
2118 static WCHAR
*get_dnshostname( IP_ADAPTER_UNICAST_ADDRESS
*addr
)
2120 const SOCKET_ADDRESS
*sa
= &addr
->Address
;
2121 WCHAR buf
[NI_MAXHOST
];
2123 if (!addr
) return NULL
;
2124 if (GetNameInfoW( sa
->lpSockaddr
, sa
->iSockaddrLength
, buf
, sizeof(buf
)/sizeof(buf
[0]), NULL
,
2125 0, NI_NAMEREQD
)) return NULL
;
2126 return heap_strdupW( buf
);
2128 static struct array
*get_defaultipgateway( IP_ADAPTER_GATEWAY_ADDRESS
*list
)
2130 IP_ADAPTER_GATEWAY_ADDRESS
*gateway
;
2132 ULONG buflen
, i
= 0, count
= 0;
2133 WCHAR
**ptr
, buf
[54]; /* max IPv6 address length */
2135 if (!list
) return NULL
;
2136 for (gateway
= list
; gateway
; gateway
= gateway
->Next
) count
++;
2138 if (!(ret
= heap_alloc( sizeof(*ret
) ))) return NULL
;
2139 if (!(ptr
= heap_alloc( sizeof(*ptr
) * count
)))
2144 for (gateway
= list
; gateway
; gateway
= gateway
->Next
)
2146 buflen
= sizeof(buf
)/sizeof(buf
[0]);
2147 if (WSAAddressToStringW( gateway
->Address
.lpSockaddr
, gateway
->Address
.iSockaddrLength
,
2148 NULL
, buf
, &buflen
) || !(ptr
[i
++] = heap_strdupW( buf
)))
2150 for (; i
> 0; i
--) heap_free( ptr
[i
- 1] );
2160 static struct array
*get_dnsserversearchorder( IP_ADAPTER_DNS_SERVER_ADDRESS
*list
)
2162 IP_ADAPTER_DNS_SERVER_ADDRESS
*server
;
2164 ULONG buflen
, i
= 0, count
= 0;
2165 WCHAR
**ptr
, *p
, buf
[54]; /* max IPv6 address length */
2167 if (!list
) return NULL
;
2168 for (server
= list
; server
; server
= server
->Next
) count
++;
2170 if (!(ret
= heap_alloc( sizeof(*ret
) ))) return NULL
;
2171 if (!(ptr
= heap_alloc( sizeof(*ptr
) * count
)))
2176 for (server
= list
; server
; server
= server
->Next
)
2178 buflen
= sizeof(buf
)/sizeof(buf
[0]);
2179 if (WSAAddressToStringW( server
->Address
.lpSockaddr
, server
->Address
.iSockaddrLength
,
2180 NULL
, buf
, &buflen
) || !(ptr
[i
++] = heap_strdupW( buf
)))
2182 for (; i
> 0; i
--) heap_free( ptr
[i
- 1] );
2187 if ((p
= strrchrW( ptr
[i
- 1], ':' ))) *p
= 0;
2193 static WCHAR
*get_settingid( UINT32 index
)
2197 memset( &guid
, 0, sizeof(guid
) );
2199 UuidToStringW( &guid
, &str
);
2200 ret
= heap_strdupW( str
);
2201 RpcStringFreeW( &str
);
2205 static enum fill_status
fill_networkadapterconfig( struct table
*table
, const struct expr
*cond
)
2207 struct record_networkadapterconfig
*rec
;
2208 IP_ADAPTER_ADDRESSES
*aa
, *buffer
;
2209 UINT row
= 0, offset
= 0, count
= 0;
2210 DWORD size
= 0, ret
;
2211 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2213 ret
= GetAdaptersAddresses( AF_UNSPEC
, GAA_FLAG_INCLUDE_ALL_GATEWAYS
, NULL
, NULL
, &size
);
2214 if (ret
!= ERROR_BUFFER_OVERFLOW
) return FILL_STATUS_FAILED
;
2216 if (!(buffer
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
2217 if (GetAdaptersAddresses( AF_UNSPEC
, GAA_FLAG_INCLUDE_ALL_GATEWAYS
, NULL
, buffer
, &size
))
2219 heap_free( buffer
);
2220 return FILL_STATUS_FAILED
;
2222 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2224 if (aa
->IfType
!= IF_TYPE_SOFTWARE_LOOPBACK
) count
++;
2226 if (!resize_table( table
, count
, sizeof(*rec
) ))
2228 heap_free( buffer
);
2229 return FILL_STATUS_FAILED
;
2231 for (aa
= buffer
; aa
; aa
= aa
->Next
)
2233 if (aa
->IfType
== IF_TYPE_SOFTWARE_LOOPBACK
) continue;
2235 rec
= (struct record_networkadapterconfig
*)(table
->data
+ offset
);
2236 rec
->defaultipgateway
= get_defaultipgateway( aa
->FirstGatewayAddress
);
2237 rec
->description
= heap_strdupW( aa
->Description
);
2238 rec
->dhcpenabled
= -1;
2239 rec
->dnshostname
= get_dnshostname( aa
->FirstUnicastAddress
);
2240 rec
->dnsserversearchorder
= get_dnsserversearchorder( aa
->FirstDnsServerAddress
);
2241 rec
->index
= aa
->u
.s
.IfIndex
;
2242 rec
->ipconnectionmetric
= 20;
2243 rec
->ipenabled
= -1;
2244 rec
->mac_address
= get_mac_address( aa
->PhysicalAddress
, aa
->PhysicalAddressLength
);
2245 rec
->settingid
= get_settingid( rec
->index
);
2246 if (!match_row( table
, row
, cond
, &status
))
2248 free_row_values( table
, row
);
2251 offset
+= sizeof(*rec
);
2254 TRACE("created %u rows\n", row
);
2255 table
->num_rows
= row
;
2257 heap_free( buffer
);
2261 static enum fill_status
fill_physicalmemory( struct table
*table
, const struct expr
*cond
)
2263 struct record_physicalmemory
*rec
;
2264 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2267 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2269 rec
= (struct record_physicalmemory
*)table
->data
;
2270 rec
->capacity
= get_total_physical_memory();
2271 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2274 TRACE("created %u rows\n", row
);
2275 table
->num_rows
= row
;
2279 static enum fill_status
fill_printer( struct table
*table
, const struct expr
*cond
)
2281 static const WCHAR fmtW
[] = {'P','r','i','n','t','e','r','%','d',0};
2282 struct record_printer
*rec
;
2283 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2284 PRINTER_INFO_2W
*info
;
2285 DWORD i
, offset
= 0, count
= 0, size
= 0;
2288 EnumPrintersW( PRINTER_ENUM_LOCAL
, NULL
, 2, NULL
, 0, &size
, &count
);
2289 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
) return FILL_STATUS_FAILED
;
2291 if (!(info
= heap_alloc( size
))) return FILL_STATUS_FAILED
;
2292 if (!EnumPrintersW( PRINTER_ENUM_LOCAL
, NULL
, 2, (BYTE
*)info
, size
, &size
, &count
))
2295 return FILL_STATUS_FAILED
;
2297 if (!resize_table( table
, count
, sizeof(*rec
) ))
2300 return FILL_STATUS_FAILED
;
2303 for (i
= 0; i
< count
; i
++)
2305 rec
= (struct record_printer
*)(table
->data
+ offset
);
2306 rec
->attributes
= info
[i
].Attributes
;
2307 rec
->drivername
= heap_strdupW( info
[i
].pDriverName
);
2308 rec
->horizontalresolution
= info
[i
].pDevMode
->u1
.s1
.dmPrintQuality
;
2310 rec
->name
= heap_strdupW( info
[i
].pPrinterName
);
2312 sprintfW( id
, fmtW
, i
);
2313 rec
->device_id
= heap_strdupW( id
);
2314 rec
->portname
= heap_strdupW( info
[i
].pPortName
);
2315 rec
->location
= heap_strdupW( info
[i
].pLocation
);
2316 if (!match_row( table
, i
, cond
, &status
))
2318 free_row_values( table
, i
);
2321 offset
+= sizeof(*rec
);
2323 TRACE("created %u rows\n", count
);
2324 table
->num_rows
= count
;
2330 static WCHAR
*get_cmdline( DWORD process_id
)
2332 if (process_id
== GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() );
2333 return NULL
; /* FIXME handle different process case */
2336 static enum fill_status
fill_process( struct table
*table
, const struct expr
*cond
)
2338 static const WCHAR fmtW
[] = {'%','u',0};
2340 struct record_process
*rec
;
2341 PROCESSENTRY32W entry
;
2343 enum fill_status status
= FILL_STATUS_FAILED
;
2344 UINT row
= 0, offset
= 0;
2346 snap
= CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS
, 0 );
2347 if (snap
== INVALID_HANDLE_VALUE
) return FILL_STATUS_FAILED
;
2349 entry
.dwSize
= sizeof(entry
);
2350 if (!Process32FirstW( snap
, &entry
)) goto done
;
2351 if (!resize_table( table
, 8, sizeof(*rec
) )) goto done
;
2355 if (!resize_table( table
, row
+ 1, sizeof(*rec
) )) goto done
;
2357 rec
= (struct record_process
*)(table
->data
+ offset
);
2358 rec
->caption
= heap_strdupW( entry
.szExeFile
);
2359 rec
->commandline
= get_cmdline( entry
.th32ProcessID
);
2360 rec
->description
= heap_strdupW( entry
.szExeFile
);
2361 sprintfW( handle
, fmtW
, entry
.th32ProcessID
);
2362 rec
->handle
= heap_strdupW( handle
);
2363 rec
->name
= heap_strdupW( entry
.szExeFile
);
2364 rec
->process_id
= entry
.th32ProcessID
;
2365 rec
->pprocess_id
= entry
.th32ParentProcessID
;
2366 rec
->thread_count
= entry
.cntThreads
;
2367 rec
->workingsetsize
= 0;
2368 rec
->get_owner
= process_get_owner
;
2369 if (!match_row( table
, row
, cond
, &status
))
2371 free_row_values( table
, row
);
2374 offset
+= sizeof(*rec
);
2376 } while (Process32NextW( snap
, &entry
));
2378 TRACE("created %u rows\n", row
);
2379 table
->num_rows
= row
;
2380 status
= FILL_STATUS_UNFILTERED
;
2383 CloseHandle( snap
);
2387 static inline void do_cpuid( unsigned int ax
, unsigned int *p
)
2393 __asm__("pushl %%ebx\n\t"
2395 "movl %%ebx, %%esi\n\t"
2397 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
2402 static const WCHAR
*get_osarchitecture(void)
2405 GetNativeSystemInfo( &info
);
2406 if (info
.u
.s
.wProcessorArchitecture
== PROCESSOR_ARCHITECTURE_AMD64
) return os_64bitW
;
2409 static void get_processor_caption( WCHAR
*caption
)
2411 static const WCHAR fmtW
[] =
2412 {'%','s',' ','F','a','m','i','l','y',' ','%','u',' ',
2413 'M','o','d','e','l',' ','%','u',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2414 static const WCHAR x86W
[] = {'x','8','6',0};
2415 static const WCHAR intel64W
[] = {'I','n','t','e','l','6','4',0};
2416 const WCHAR
*arch
= (get_osarchitecture() == os_32bitW
) ? x86W
: intel64W
;
2417 unsigned int regs
[4] = {0, 0, 0, 0};
2419 do_cpuid( 1, regs
);
2420 sprintfW( caption
, fmtW
, arch
, (regs
[0] & (15 << 8)) >> 8, (regs
[0] & (15 << 4)) >> 4, regs
[0] & 15 );
2422 static void get_processor_version( WCHAR
*version
)
2424 static const WCHAR fmtW
[] =
2425 {'M','o','d','e','l',' ','%','u',',',' ','S','t','e','p','p','i','n','g',' ','%','u',0};
2426 unsigned int regs
[4] = {0, 0, 0, 0};
2428 do_cpuid( 1, regs
);
2429 sprintfW( version
, fmtW
, (regs
[0] & (15 << 4)) >> 4, regs
[0] & 15 );
2431 static void get_processor_id( WCHAR
*processor_id
)
2433 static const WCHAR fmtW
[] = {'%','0','8','X','%','0','8','X',0};
2434 unsigned int regs
[4] = {0, 0, 0, 0};
2436 do_cpuid( 1, regs
);
2437 sprintfW( processor_id
, fmtW
, regs
[3], regs
[0] );
2439 static void regs_to_str( unsigned int *regs
, unsigned int len
, WCHAR
*buffer
)
2442 unsigned char *p
= (unsigned char *)regs
;
2444 for (i
= 0; i
< len
; i
++) { buffer
[i
] = *p
++; }
2447 static void get_processor_manufacturer( WCHAR
*manufacturer
)
2449 unsigned int tmp
, regs
[4] = {0, 0, 0, 0};
2451 do_cpuid( 0, regs
);
2452 tmp
= regs
[2]; /* swap edx and ecx */
2456 regs_to_str( regs
+ 1, 12, manufacturer
);
2458 static void get_processor_name( WCHAR
*name
)
2460 unsigned int regs
[4] = {0, 0, 0, 0};
2462 do_cpuid( 0x80000000, regs
);
2463 if (regs
[0] >= 0x80000004)
2465 do_cpuid( 0x80000002, regs
);
2466 regs_to_str( regs
, 16, name
);
2467 do_cpuid( 0x80000003, regs
);
2468 regs_to_str( regs
, 16, name
+ 16 );
2469 do_cpuid( 0x80000004, regs
);
2470 regs_to_str( regs
, 16, name
+ 32 );
2473 static UINT
get_processor_currentclockspeed( UINT index
)
2475 PROCESSOR_POWER_INFORMATION
*info
;
2476 UINT ret
= 1000, size
= get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION
);
2479 if ((info
= heap_alloc( size
)))
2481 status
= NtPowerInformation( ProcessorInformation
, NULL
, 0, info
, size
);
2482 if (!status
) ret
= info
[index
].CurrentMhz
;
2487 static UINT
get_processor_maxclockspeed( UINT index
)
2489 PROCESSOR_POWER_INFORMATION
*info
;
2490 UINT ret
= 1000, size
= get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION
);
2493 if ((info
= heap_alloc( size
)))
2495 status
= NtPowerInformation( ProcessorInformation
, NULL
, 0, info
, size
);
2496 if (!status
) ret
= info
[index
].MaxMhz
;
2502 static enum fill_status
fill_processor( struct table
*table
, const struct expr
*cond
)
2504 static const WCHAR fmtW
[] = {'C','P','U','%','u',0};
2505 WCHAR caption
[100], device_id
[14], processor_id
[17], manufacturer
[13], name
[49] = {0}, version
[50];
2506 struct record_processor
*rec
;
2507 UINT i
, offset
= 0, num_cores
, num_logical_processors
, count
= get_processor_count();
2508 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2510 if (!resize_table( table
, count
, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2512 get_processor_caption( caption
);
2513 get_processor_id( processor_id
);
2514 get_processor_manufacturer( manufacturer
);
2515 get_processor_name( name
);
2516 get_processor_version( version
);
2518 num_logical_processors
= get_logical_processor_count( &num_cores
) / count
;
2521 for (i
= 0; i
< count
; i
++)
2523 rec
= (struct record_processor
*)(table
->data
+ offset
);
2524 rec
->addresswidth
= get_osarchitecture() == os_32bitW
? 32 : 64;
2525 rec
->caption
= heap_strdupW( caption
);
2526 rec
->cpu_status
= 1; /* CPU Enabled */
2527 rec
->currentclockspeed
= get_processor_currentclockspeed( i
);
2528 rec
->datawidth
= get_osarchitecture() == os_32bitW
? 32 : 64;
2529 rec
->description
= heap_strdupW( caption
);
2530 sprintfW( device_id
, fmtW
, i
);
2531 rec
->device_id
= heap_strdupW( device_id
);
2532 rec
->family
= 2; /* Unknown */
2533 rec
->manufacturer
= heap_strdupW( manufacturer
);
2534 rec
->maxclockspeed
= get_processor_maxclockspeed( i
);
2535 rec
->name
= heap_strdupW( name
);
2536 rec
->num_cores
= num_cores
;
2537 rec
->num_logical_processors
= num_logical_processors
;
2538 rec
->processor_id
= heap_strdupW( processor_id
);
2539 rec
->processortype
= 3; /* central processor */
2540 rec
->unique_id
= NULL
;
2541 rec
->version
= heap_strdupW( version
);
2542 if (!match_row( table
, i
, cond
, &status
))
2544 free_row_values( table
, i
);
2547 offset
+= sizeof(*rec
);
2550 TRACE("created %u rows\n", count
);
2551 table
->num_rows
= count
;
2555 static WCHAR
*get_lastbootuptime(void)
2557 static const WCHAR fmtW
[] =
2558 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2559 '.','%','0','6','u','+','0','0','0',0};
2560 SYSTEM_TIMEOFDAY_INFORMATION ti
;
2564 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2566 NtQuerySystemInformation( SystemTimeOfDayInformation
, &ti
, sizeof(ti
), NULL
);
2567 RtlTimeToTimeFields( &ti
.liKeBootTime
, &tf
);
2568 sprintfW( ret
, fmtW
, tf
.Year
, tf
.Month
, tf
.Day
, tf
.Hour
, tf
.Minute
, tf
.Second
, tf
.Milliseconds
* 1000 );
2571 static WCHAR
*get_localdatetime(void)
2573 static const WCHAR fmtW
[] =
2574 {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
2575 '.','%','0','6','u','%','+','0','3','d',0};
2576 TIME_ZONE_INFORMATION tzi
;
2582 Status
= GetTimeZoneInformation(&tzi
);
2584 if(Status
== TIME_ZONE_ID_INVALID
) return NULL
;
2586 if(Status
== TIME_ZONE_ID_DAYLIGHT
)
2587 Bias
+= tzi
.DaylightBias
;
2589 Bias
+= tzi
.StandardBias
;
2590 if (!(ret
= heap_alloc( 26 * sizeof(WCHAR
) ))) return NULL
;
2593 sprintfW( ret
, fmtW
, st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
, st
.wMilliseconds
* 1000, -Bias
);
2596 static WCHAR
*get_systemdirectory(void)
2601 if (!(ret
= heap_alloc( MAX_PATH
* sizeof(WCHAR
) ))) return NULL
;
2602 Wow64DisableWow64FsRedirection( &redir
);
2603 GetSystemDirectoryW( ret
, MAX_PATH
);
2604 Wow64RevertWow64FsRedirection( redir
);
2607 static WCHAR
*get_codeset(void)
2609 static const WCHAR fmtW
[] = {'%','u',0};
2610 WCHAR
*ret
= heap_alloc( 11 * sizeof(WCHAR
) );
2611 if (ret
) sprintfW( ret
, fmtW
, GetACP() );
2614 static WCHAR
*get_countrycode(void)
2616 WCHAR
*ret
= heap_alloc( 6 * sizeof(WCHAR
) );
2617 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ICOUNTRY
, ret
, 6 );
2620 static WCHAR
*get_locale(void)
2622 WCHAR
*ret
= heap_alloc( 5 * sizeof(WCHAR
) );
2623 if (ret
) GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT
, LOCALE_ILANGUAGE
, ret
, 5 );
2627 static enum fill_status
fill_os( struct table
*table
, const struct expr
*cond
)
2629 struct record_operatingsystem
*rec
;
2630 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2633 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2635 rec
= (struct record_operatingsystem
*)table
->data
;
2636 rec
->buildnumber
= os_buildnumberW
;
2637 rec
->caption
= os_captionW
;
2638 rec
->codeset
= get_codeset();
2639 rec
->countrycode
= get_countrycode();
2640 rec
->csdversion
= os_csdversionW
;
2641 rec
->installdate
= os_installdateW
;
2642 rec
->lastbootuptime
= get_lastbootuptime();
2643 rec
->localdatetime
= get_localdatetime();
2644 rec
->locale
= get_locale();
2645 rec
->name
= os_nameW
;
2646 rec
->osarchitecture
= get_osarchitecture();
2647 rec
->oslanguage
= GetSystemDefaultLangID();
2648 rec
->osproductsuite
= 2461140; /* Windows XP Professional */
2649 rec
->ostype
= 18; /* WINNT */
2651 rec
->serialnumber
= os_serialnumberW
;
2652 rec
->servicepackmajor
= 3;
2653 rec
->servicepackminor
= 0;
2654 rec
->suitemask
= 272; /* Single User + Terminal */
2655 rec
->systemdirectory
= get_systemdirectory();
2656 rec
->totalvisiblememorysize
= get_total_physical_memory() / 1024;
2657 rec
->version
= os_versionW
;
2658 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2661 TRACE("created %u rows\n", row
);
2662 table
->num_rows
= row
;
2666 static const WCHAR
*get_service_type( DWORD type
)
2668 static const WCHAR filesystem_driverW
[] =
2669 {'F','i','l','e',' ','S','y','s','t','e','m',' ','D','r','i','v','e','r',0};
2670 static const WCHAR kernel_driverW
[] =
2671 {'K','e','r','n','e','l',' ','D','r','i','v','e','r',0};
2672 static const WCHAR own_processW
[] =
2673 {'O','w','n',' ','P','r','o','c','e','s','s',0};
2674 static const WCHAR share_processW
[] =
2675 {'S','h','a','r','e',' ','P','r','o','c','e','s','s',0};
2677 if (type
& SERVICE_KERNEL_DRIVER
) return kernel_driverW
;
2678 else if (type
& SERVICE_FILE_SYSTEM_DRIVER
) return filesystem_driverW
;
2679 else if (type
& SERVICE_WIN32_OWN_PROCESS
) return own_processW
;
2680 else if (type
& SERVICE_WIN32_SHARE_PROCESS
) return share_processW
;
2681 else ERR("unhandled type 0x%08x\n", type
);
2684 static const WCHAR
*get_service_state( DWORD state
)
2686 static const WCHAR runningW
[] =
2687 {'R','u','n','n','i','n','g',0};
2688 static const WCHAR start_pendingW
[] =
2689 {'S','t','a','r','t',' ','P','e','n','d','i','n','g',0};
2690 static const WCHAR stop_pendingW
[] =
2691 {'S','t','o','p',' ','P','e','n','d','i','n','g',0};
2692 static const WCHAR stoppedW
[] =
2693 {'S','t','o','p','p','e','d',0};
2694 static const WCHAR unknownW
[] =
2695 {'U','n','k','n','o','w','n',0};
2699 case SERVICE_STOPPED
: return stoppedW
;
2700 case SERVICE_START_PENDING
: return start_pendingW
;
2701 case SERVICE_STOP_PENDING
: return stop_pendingW
;
2702 case SERVICE_RUNNING
: return runningW
;
2704 ERR("unknown state %u\n", state
);
2708 static const WCHAR
*get_service_startmode( DWORD mode
)
2710 static const WCHAR bootW
[] = {'B','o','o','t',0};
2711 static const WCHAR systemW
[] = {'S','y','s','t','e','m',0};
2712 static const WCHAR autoW
[] = {'A','u','t','o',0};
2713 static const WCHAR manualW
[] = {'M','a','n','u','a','l',0};
2714 static const WCHAR disabledW
[] = {'D','i','s','a','b','l','e','d',0};
2715 static const WCHAR unknownW
[] = {'U','n','k','n','o','w','n',0};
2719 case SERVICE_BOOT_START
: return bootW
;
2720 case SERVICE_SYSTEM_START
: return systemW
;
2721 case SERVICE_AUTO_START
: return autoW
;
2722 case SERVICE_DEMAND_START
: return manualW
;
2723 case SERVICE_DISABLED
: return disabledW
;
2725 ERR("unknown mode 0x%x\n", mode
);
2729 static QUERY_SERVICE_CONFIGW
*query_service_config( SC_HANDLE manager
, const WCHAR
*name
)
2731 QUERY_SERVICE_CONFIGW
*config
= NULL
;
2735 if (!(service
= OpenServiceW( manager
, name
, SERVICE_QUERY_CONFIG
))) return NULL
;
2736 QueryServiceConfigW( service
, NULL
, 0, &size
);
2737 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER
) goto done
;
2738 if (!(config
= heap_alloc( size
))) goto done
;
2739 if (QueryServiceConfigW( service
, config
, size
, &size
)) goto done
;
2740 heap_free( config
);
2744 CloseServiceHandle( service
);
2748 static enum fill_status
fill_service( struct table
*table
, const struct expr
*cond
)
2750 struct record_service
*rec
;
2752 ENUM_SERVICE_STATUS_PROCESSW
*tmp
, *services
= NULL
;
2753 SERVICE_STATUS_PROCESS
*status
;
2754 WCHAR sysnameW
[MAX_COMPUTERNAME_LENGTH
+ 1];
2755 DWORD len
= sizeof(sysnameW
) / sizeof(sysnameW
[0]);
2756 UINT i
, row
= 0, offset
= 0, size
= 256, needed
, count
;
2757 enum fill_status fill_status
= FILL_STATUS_FAILED
;
2760 if (!(manager
= OpenSCManagerW( NULL
, NULL
, SC_MANAGER_ENUMERATE_SERVICE
))) return FILL_STATUS_FAILED
;
2761 if (!(services
= heap_alloc( size
))) goto done
;
2763 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2764 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2765 &count
, NULL
, NULL
);
2768 if (GetLastError() != ERROR_MORE_DATA
) goto done
;
2770 if (!(tmp
= heap_realloc( services
, size
))) goto done
;
2772 ret
= EnumServicesStatusExW( manager
, SC_ENUM_PROCESS_INFO
, SERVICE_TYPE_ALL
,
2773 SERVICE_STATE_ALL
, (BYTE
*)services
, size
, &needed
,
2774 &count
, NULL
, NULL
);
2775 if (!ret
) goto done
;
2777 if (!resize_table( table
, count
, sizeof(*rec
) )) goto done
;
2779 GetComputerNameW( sysnameW
, &len
);
2780 fill_status
= FILL_STATUS_UNFILTERED
;
2782 for (i
= 0; i
< count
; i
++)
2784 QUERY_SERVICE_CONFIGW
*config
;
2786 if (!(config
= query_service_config( manager
, services
[i
].lpServiceName
))) continue;
2788 status
= &services
[i
].ServiceStatusProcess
;
2789 rec
= (struct record_service
*)(table
->data
+ offset
);
2790 rec
->accept_pause
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_PAUSE_CONTINUE
) ? -1 : 0;
2791 rec
->accept_stop
= (status
->dwControlsAccepted
& SERVICE_ACCEPT_STOP
) ? -1 : 0;
2792 rec
->displayname
= heap_strdupW( services
[i
].lpDisplayName
);
2793 rec
->name
= heap_strdupW( services
[i
].lpServiceName
);
2794 rec
->process_id
= status
->dwProcessId
;
2795 rec
->servicetype
= get_service_type( status
->dwServiceType
);
2796 rec
->startmode
= get_service_startmode( config
->dwStartType
);
2797 rec
->state
= get_service_state( status
->dwCurrentState
);
2798 rec
->systemname
= heap_strdupW( sysnameW
);
2799 rec
->pause_service
= service_pause_service
;
2800 rec
->resume_service
= service_resume_service
;
2801 rec
->start_service
= service_start_service
;
2802 rec
->stop_service
= service_stop_service
;
2803 heap_free( config
);
2804 if (!match_row( table
, row
, cond
, &fill_status
))
2806 free_row_values( table
, row
);
2809 offset
+= sizeof(*rec
);
2813 TRACE("created %u rows\n", row
);
2814 table
->num_rows
= row
;
2817 CloseServiceHandle( manager
);
2818 heap_free( services
);
2822 static WCHAR
*get_accountname( LSA_TRANSLATED_NAME
*name
)
2824 if (!name
|| !name
->Name
.Buffer
) return NULL
;
2825 return heap_strdupW( name
->Name
.Buffer
);
2827 static struct array
*get_binaryrepresentation( PSID sid
, UINT len
)
2829 struct array
*array
= heap_alloc( sizeof(struct array
) );
2832 UINT8
*ret
= heap_alloc( len
);
2835 memcpy( ret
, sid
, len
);
2844 static WCHAR
*get_referenceddomainname( LSA_REFERENCED_DOMAIN_LIST
*domain
)
2846 if (!domain
|| !domain
->Domains
|| !domain
->Domains
->Name
.Buffer
) return NULL
;
2847 return heap_strdupW( domain
->Domains
->Name
.Buffer
);
2849 static const WCHAR
*find_sid_str( const struct expr
*cond
)
2851 const struct expr
*left
, *right
;
2852 const WCHAR
*ret
= NULL
;
2854 if (!cond
|| cond
->type
!= EXPR_COMPLEX
|| cond
->u
.expr
.op
!= OP_EQ
) return NULL
;
2856 left
= cond
->u
.expr
.left
;
2857 right
= cond
->u
.expr
.right
;
2858 if (left
->type
== EXPR_PROPVAL
&& right
->type
== EXPR_SVAL
&& !strcmpiW( left
->u
.propval
->name
, prop_sidW
))
2860 ret
= right
->u
.sval
;
2862 else if (left
->type
== EXPR_SVAL
&& right
->type
== EXPR_PROPVAL
&& !strcmpiW( right
->u
.propval
->name
, prop_sidW
))
2869 static enum fill_status
fill_sid( struct table
*table
, const struct expr
*cond
)
2872 LSA_REFERENCED_DOMAIN_LIST
*domain
;
2873 LSA_TRANSLATED_NAME
*name
;
2875 LSA_OBJECT_ATTRIBUTES attrs
;
2877 struct record_sid
*rec
;
2880 if (!(str
= find_sid_str( cond
))) return FILL_STATUS_FAILED
;
2881 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2883 if (!ConvertStringSidToSidW( str
, &sid
)) return FILL_STATUS_FAILED
;
2884 len
= GetLengthSid( sid
);
2886 memset( &attrs
, 0, sizeof(attrs
) );
2887 attrs
.Length
= sizeof(attrs
);
2888 if (LsaOpenPolicy( NULL
, &attrs
, POLICY_ALL_ACCESS
, &handle
))
2891 return FILL_STATUS_FAILED
;
2893 if (LsaLookupSids( handle
, 1, &sid
, &domain
, &name
))
2897 return FILL_STATUS_FAILED
;
2900 rec
= (struct record_sid
*)table
->data
;
2901 rec
->accountname
= get_accountname( name
);
2902 rec
->binaryrepresentation
= get_binaryrepresentation( sid
, len
);
2903 rec
->referenceddomainname
= get_referenceddomainname( domain
);
2904 rec
->sid
= heap_strdupW( str
);
2905 rec
->sidlength
= len
;
2907 TRACE("created 1 row\n");
2908 table
->num_rows
= 1;
2910 LsaFreeMemory( domain
);
2911 LsaFreeMemory( name
);
2914 return FILL_STATUS_FILTERED
;
2919 static UINT32
get_bits_per_pixel( UINT
*hres
, UINT
*vres
)
2921 HDC hdc
= GetDC( NULL
);
2924 if (!hdc
) return 32;
2925 ret
= GetDeviceCaps( hdc
, BITSPIXEL
);
2926 *hres
= GetDeviceCaps( hdc
, HORZRES
);
2927 *vres
= GetDeviceCaps( hdc
, VERTRES
);
2928 ReleaseDC( NULL
, hdc
);
2931 static WCHAR
*get_pnpdeviceid( DXGI_ADAPTER_DESC
*desc
)
2933 static const WCHAR fmtW
[] =
2934 {'P','C','I','\\','V','E','N','_','%','0','4','X','&','D','E','V','_','%','0','4','X',
2935 '&','S','U','B','S','Y','S','_','%','0','8','X','&','R','E','V','_','%','0','2','X','\\',
2936 '0','&','D','E','A','D','B','E','E','F','&','0','&','D','E','A','D',0};
2939 if (!(ret
= heap_alloc( sizeof(fmtW
) + 2 * sizeof(WCHAR
) ))) return NULL
;
2940 sprintfW( ret
, fmtW
, desc
->VendorId
, desc
->DeviceId
, desc
->SubSysId
, desc
->Revision
);
2944 static enum fill_status
fill_videocontroller( struct table
*table
, const struct expr
*cond
)
2946 static const WCHAR fmtW
[] = {'%','u',' ','x',' ','%','u',' ','x',' ','%','I','6','4','u',' ','c','o','l','o','r','s',0};
2947 struct record_videocontroller
*rec
;
2949 IDXGIFactory
*factory
= NULL
;
2950 IDXGIAdapter
*adapter
= NULL
;
2951 DXGI_ADAPTER_DESC desc
;
2952 UINT row
= 0, hres
= 1024, vres
= 768, vidmem
= 512 * 1024 * 1024;
2953 const WCHAR
*name
= videocontroller_deviceidW
;
2954 enum fill_status status
= FILL_STATUS_UNFILTERED
;
2957 if (!resize_table( table
, 1, sizeof(*rec
) )) return FILL_STATUS_FAILED
;
2959 memset (&desc
, 0, sizeof(desc
));
2960 hr
= CreateDXGIFactory( &IID_IDXGIFactory
, (void **)&factory
);
2961 if (FAILED(hr
)) goto done
;
2963 hr
= IDXGIFactory_EnumAdapters( factory
, 0, &adapter
);
2964 if (FAILED(hr
)) goto done
;
2966 hr
= IDXGIAdapter_GetDesc( adapter
, &desc
);
2969 vidmem
= desc
.DedicatedVideoMemory
;
2970 name
= desc
.Description
;
2974 rec
= (struct record_videocontroller
*)table
->data
;
2975 rec
->adapter_dactype
= videocontroller_dactypeW
;
2976 rec
->adapter_ram
= vidmem
;
2977 rec
->availability
= 3; /* Running or Full Power */
2978 rec
->caption
= heap_strdupW( name
);
2979 rec
->current_bitsperpixel
= get_bits_per_pixel( &hres
, &vres
);
2980 rec
->current_horizontalres
= hres
;
2981 rec
->current_refreshrate
= 0; /* default refresh rate */
2982 rec
->current_scanmode
= 2; /* Unknown */
2983 rec
->current_verticalres
= vres
;
2984 rec
->description
= heap_strdupW( name
);
2985 rec
->device_id
= videocontroller_deviceidW
;
2986 rec
->driverversion
= videocontroller_driverversionW
;
2987 rec
->name
= heap_strdupW( name
);
2988 rec
->pnpdevice_id
= get_pnpdeviceid( &desc
);
2989 rec
->videoarchitecture
= 2; /* Unknown */
2990 rec
->videomemorytype
= 2; /* Unknown */
2991 wsprintfW( mode
, fmtW
, hres
, vres
, (UINT64
)1 << rec
->current_bitsperpixel
);
2992 rec
->videomodedescription
= heap_strdupW( mode
);
2993 rec
->videoprocessor
= heap_strdupW( name
);
2994 if (!match_row( table
, row
, cond
, &status
)) free_row_values( table
, row
);
2997 TRACE("created %u rows\n", row
);
2998 table
->num_rows
= row
;
3000 if (adapter
) IDXGIAdapter_Release( adapter
);
3001 if (factory
) IDXGIFactory_Release( factory
);
3005 #endif /* !__REACTOS__ */
3007 static struct table builtin_classes
[] =
3009 { class_baseboardW
, SIZEOF(col_baseboard
), col_baseboard
, SIZEOF(data_baseboard
), 0, (BYTE
*)data_baseboard
},
3010 { class_biosW
, SIZEOF(col_bios
), col_bios
, SIZEOF(data_bios
), 0, (BYTE
*)data_bios
},
3011 { class_cdromdriveW
, SIZEOF(col_cdromdrive
), col_cdromdrive
, 0, 0, NULL
, fill_cdromdrive
},
3012 { class_compsysW
, SIZEOF(col_compsys
), col_compsys
, 0, 0, NULL
, fill_compsys
},
3013 { class_compsysproductW
, SIZEOF(col_compsysproduct
), col_compsysproduct
, SIZEOF(data_compsysproduct
), 0, (BYTE
*)data_compsysproduct
},
3014 { class_datafileW
, SIZEOF(col_datafile
), col_datafile
, 0, 0, NULL
, fill_datafile
},
3015 { class_desktopmonitorW
, SIZEOF(col_desktopmonitor
), col_desktopmonitor
, 0, 0, NULL
, fill_desktopmonitor
},
3016 { class_directoryW
, SIZEOF(col_directory
), col_directory
, 0, 0, NULL
, fill_directory
},
3017 { class_diskdriveW
, SIZEOF(col_diskdrive
), col_diskdrive
, 0, 0, NULL
, fill_diskdrive
},
3018 { class_diskpartitionW
, SIZEOF(col_diskpartition
), col_diskpartition
, 0, 0, NULL
, fill_diskpartition
},
3019 { class_logicaldiskW
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
3020 { class_logicaldisk2W
, SIZEOF(col_logicaldisk
), col_logicaldisk
, 0, 0, NULL
, fill_logicaldisk
},
3021 { class_networkadapterW
, SIZEOF(col_networkadapter
), col_networkadapter
, 0, 0, NULL
, fill_networkadapter
},
3022 { class_networkadapterconfigW
, SIZEOF(col_networkadapterconfig
), col_networkadapterconfig
, 0, 0, NULL
, fill_networkadapterconfig
},
3023 { class_osW
, SIZEOF(col_os
), col_os
, 0, 0, NULL
, fill_os
},
3024 { class_paramsW
, SIZEOF(col_param
), col_param
, SIZEOF(data_param
), 0, (BYTE
*)data_param
},
3025 { class_physicalmediaW
, SIZEOF(col_physicalmedia
), col_physicalmedia
, SIZEOF(data_physicalmedia
), 0, (BYTE
*)data_physicalmedia
},
3026 { class_physicalmemoryW
, SIZEOF(col_physicalmemory
), col_physicalmemory
, 0, 0, NULL
, fill_physicalmemory
},
3027 { class_printerW
, SIZEOF(col_printer
), col_printer
, 0, 0, NULL
, fill_printer
},
3028 { class_processW
, SIZEOF(col_process
), col_process
, 0, 0, NULL
, fill_process
},
3029 { class_processorW
, SIZEOF(col_processor
), col_processor
, 0, 0, NULL
, fill_processor
},
3030 { class_processor2W
, SIZEOF(col_processor
), col_processor
, 0, 0, NULL
, fill_processor
},
3031 { class_qualifiersW
, SIZEOF(col_qualifier
), col_qualifier
, SIZEOF(data_qualifier
), 0, (BYTE
*)data_qualifier
},
3032 { class_serviceW
, SIZEOF(col_service
), col_service
, 0, 0, NULL
, fill_service
},
3033 { class_sidW
, SIZEOF(col_sid
), col_sid
, 0, 0, NULL
, fill_sid
},
3034 { class_sounddeviceW
, SIZEOF(col_sounddevice
), col_sounddevice
, SIZEOF(data_sounddevice
), 0, (BYTE
*)data_sounddevice
},
3035 { class_stdregprovW
, SIZEOF(col_stdregprov
), col_stdregprov
, SIZEOF(data_stdregprov
), 0, (BYTE
*)data_stdregprov
},
3036 { class_systemsecurityW
, SIZEOF(col_systemsecurity
), col_systemsecurity
, SIZEOF(data_systemsecurity
), 0, (BYTE
*)data_systemsecurity
},
3037 { class_systemenclosureW
, SIZEOF(col_systemenclosure
), col_systemenclosure
, SIZEOF(data_systemenclosure
), 0, (BYTE
*)data_systemenclosure
},
3039 /* Requires dxgi.dll */
3040 { class_videocontrollerW
, SIZEOF(col_videocontroller
), col_videocontroller
, 0, 0, NULL
, fill_videocontroller
}
3044 void init_table_list( void )
3046 static struct list tables
= LIST_INIT( tables
);
3049 for (i
= 0; i
< SIZEOF(builtin_classes
); i
++) list_add_tail( &tables
, &builtin_classes
[i
].entry
);
3050 table_list
= &tables
;