Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Guidance on how to access WMI instance members within an instance!

70 views
Skip to first unread message

nutrag...@yahoo.com

unread,
May 8, 2009, 2:21:49 PM5/8/09
to
Hi All,

Does anyone know how to query an instance within an instance in c/C++?
I can query the members of MSFC_FibrePortHBAAttributes instance but
some how is not able to query the child instance of
MSFC_HBAPortAttributesResults.

Any pointers on how to do this will be greatly appreciated. Code
snippet given below!

MOF is;

instance of MSFC_FibrePortHBAAttributes
{
Active = TRUE; <--- successfully able to access this
Attributes =
instance of MSFC_HBAPortAttributesResults <-- how to query for this
instance and its members?
{
FabricName = {16, 0, 0, 96, 15, 28, 10, 6};
NodeWWN = {20, 0, 0, 07, 34, 0, 233, 12};
NumberofDiscoveredPorts = 12;
PortActiveFc4Types = {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
PortFcId = 80640;
PortMaxFrameSize = 2048;
PortSpeed = 2;
PortState = 2;
PortSupportedClassofService = 8;
PortSupportedFc4Types = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
PortSupportedSpeed = 1;
PortType = 3;
PortWWN = {21, 0, 0, 07, 34, 0, 233, 12}; <-- Want to access this????
};
HBAStatus = 0;
InstanceName = "PCI\\VEN_1XXX&DEV_XXX&SUBSYS_0XXX&REV_03\\XXX_0";
UniquePortId = "1XXX";
};

hr_next = pIEnumWbemClassObject->Next(
WBEM_INFINITE,
1,
&pIWbemClassObjectInst, ,
&ulCount
); <--
successfully able to get the MSFC_FibrePortHBAAttributes and is
enumerating it here
if (WBEM_S_NO_ERROR == hr_next) {

hr = pIWbemClassObjectInst->BeginEnumeration
(WBEM_FLAG_NONSYSTEM_ONLY);
{
CIMTYPE pvtType;
VARIANT pVal; VariantInit(&pVal);
BSTR pstrName = NULL;

while(pIWbemClassObjectInst->Next(0, &pstrName, &pVal, &pvtType,
NULL))
{
if( pVal.vt == VT_I4 )
;
}


Thanks in advance.

- Zulk

Maxim S. Shatskih

unread,
May 8, 2009, 3:35:18 PM5/8/09
to
I would suggest to first write it in VBScript and then port to C++.

For Each operator maps to querying for IEnumXXX object and then calling ->Next on it till this will fail.

--
Maxim S. Shatskih
Windows DDK MVP
ma...@storagecraft.com
http://www.storagecraft.com

<nutrag...@yahoo.com> wrote in message news:93d7feae-6edc-4a3e...@r3g2000vbp.googlegroups.com...

Zulk

unread,
May 8, 2009, 5:23:56 PM5/8/09
to

Thanks everyone. I was able to fix. Just get another interface pointer
to the embedded instance and use Get to find all the properties.

Let me know if anyone need the code. I can post it here.

TK

unread,
Jul 26, 2013, 7:27:30 AM7/26/13
to
I know it's quite a while, but would you be able to post the code snippet?
thanks!

bhaves...@gmail.com

unread,
Jun 27, 2018, 4:49:46 AM6/27/18
to
Yes can you please share your snippet. I am also stuck at same point and i am having same requirement.
0 new messages