http://bugs.winehq.org/show_bug.cgi?id=34770
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|Installer |download, source Status|UNCONFIRMED |NEW URL| |http://www.cppfans.com/cntf | |ile.asp?fn=wmi_bcb CC| |focht@gmx.net Component|-unknown |wmi&wbemprox Summary|DS License Server: Cannot |WMI applications fail when |obtain a valid computer ID |incorrectly passing | |WBEM_MASK_CONDITION_ORIGIN | |to | |IWbemClassObject::GetNames | |method (DS License Server, | |some WMI examples) Ever Confirmed|0 |1
--- Comment #7 from Anastasius Focht focht@gmx.net 2013-10-20 12:35:45 CDT --- Hello folks,
probably another case of broken app code, exhibiting an inconsistency of MSDN documentation and real implementation.
The flags value 0x00000070 can be also constructed by passing:
(WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN)
The reason the MSDN entry for IWbemClassObject::GetNames() doesn't talk about WBEM_MASK_xxx values is because they are meant to be used by _implementation_ and not by caller (to filter out some groups).
Source: http://source.winehq.org/git/wine.git/blob/46cbc36041278dc19c9ea14223325987e...
--- snip --- 192 typedef [v1_enum] enum tag_WBEM_CONDITION_FLAG_TYPE 193 { 194 WBEM_FLAG_ALWAYS = 0, 195 WBEM_FLAG_ONLY_IF_TRUE = 0x1, 196 WBEM_FLAG_ONLY_IF_FALSE = 0x2, 197 WBEM_FLAG_ONLY_IF_IDENTICAL = 0x3, 198 WBEM_MASK_PRIMARY_CONDITION = 0x3,
199 WBEM_FLAG_KEYS_ONLY = 0x4, 200 WBEM_FLAG_REFS_ONLY = 0x8,
201 WBEM_FLAG_LOCAL_ONLY = 0x10, 202 WBEM_FLAG_PROPAGATED_ONLY = 0x20, 203 WBEM_FLAG_SYSTEM_ONLY = 0x30, 204 WBEM_FLAG_NONSYSTEM_ONLY = 0x40, 205 WBEM_MASK_CONDITION_ORIGIN = 0x70,
206 WBEM_FLAG_CLASS_OVERRIDES_ONLY = 0x100, 207 WBEM_FLAG_CLASS_LOCAL_AND_OVERRIDES = 0x200, 208 WBEM_MASK_CLASS_CONDITION = 0x300 209 } WBEM_CONDITION_FLAG_TYPE; --- snip ---
The MSDN entry for IWbemClassObject::BeginEnumeration() method gives a bit of hint:
MSDN http://msdn.microsoft.com/en-us/windows/aa391434%28v=vs.71%29.aspx
--- quote --- WBEM_MASK_CLASS_CONDITION
For classes only. Not a flag - this is just a mask to apply against a flags variable to check if either WBEM_FLAG_CLASS_OVERRIDES_ONLY or WBEM_FLAG_CLASS_LOCAL_AND_OVERRIDES is set. --- quote ---
If you search the web for this strange "WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN" value you will find some source code examples/snippets. The majority coming from asian "programming" websites. It is likely they copied from each other, spreading bad code further.
It could be very well this invalid value passes on Windows despite MSDN saying otherwise. "flags from the same group are mutually exclusive" (flags) "to check if either x or y is set" (mask)
You can download source code and binary that basically does the same (wrong) thing as the commercial software here:
http://www.cppfans.com/articles/system/bcb_wmi.asp
--- snip --- ... while(pEnumClassObject->Next(WBEM_INFINITE, uCount, &pClassObject, &uReturned) == S_OK) { ... SAFEARRAY *pvNames = NULL; if(pClassObject->GetNames(NULL, WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN, NULL, &pvNames) == S_OK) { ... --- snip ---
Refining the bug accordingly.
Regards