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

Discussion in 'Windows Vista Drivers' started by nutrageous_1, May 8, 2009.

  1. nutrageous_1

    nutrageous_1 Guest

    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
     
    nutrageous_1, May 8, 2009
    #1
    1. Advertisements

  2. 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, May 8, 2009
    #2
    1. Advertisements

  3. nutrageous_1

    Zulk Guest

    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.
     
    Zulk, May 8, 2009
    #3
  4. nutrageous_1

    slswamy

    Joined:
    Jul 15, 2010
    Messages:
    1
    Likes Received:
    0
    Hi,

    Please post the solution to access embedded object MSFC_HBAPortAttributesResults.

    I need to access PortWWN from MSFC_HBAPortAttributesResults.

    Thanks in advance.

    Regards,
    Swamy
     
    slswamy, Jul 15, 2010
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.