CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    19

    Lightbulb Error setting input parameter in instance of CIM class/WMI

    Hello.

    I am using C++ to write code to create a network 'team' on a machine having an intel proset network adapter. I am using the IANet_TeamOfAdapter CIM class as mentioned in their WMI scripting guide ( http://downloadmirror.intel.com/9405..._Reference.pdf ).

    To be specific I am unable to set the TeamingMode property of this class. It requires a UINT32 type variable. Hence I first tried with using a variant whose vt type was VT_UI4 but to no avail. I then also tried with VT_UINT but it didnt work as well. I am getting a "WBEM_E_TYPE_MISMATCH" error. Does anyone has any experience with this? How did you go about solving this??

    Another problem that I am facing is this:
    I need to create a variant of type VT_ARRAY thereby holding an array of BSTRs (corresponding to the path of the physical adapters) which I am doing like so:

    Step1:
    CPP / C++ / C Code:
    Code:
    //get the path of the physical adapter which we are going to bind a team on
    _bstr_t PhysicalAdapterPath;
    /*
    Here I get the path using the __PATH variable of the current physical 
    adapter instance and I update PhysicalAdapterPath with it.
    Ive verifed that the correct path was indeed stored using WMI object
    browser. I later use this variable to create a variant holding an array
    of BSTRS which corresponds to this path. 
    */
    Step2:
    CPP / C++ / C Code:
    Code:
    //create a safearray with the physical adapter path
    CComSafeArray<BSTR> PhysicalAdapterPaths;
    //create a 1D safe array with 1 element and lowest index as 0
    PhysicalAdapterPaths.Create(1,0); 
    PhysicalAdapterPaths.Add(PhysicalAdapterPath);
    wprintf(L"Retrieved Adapter Path is \"&#37;s\"\n", \\
    static_cast<wchar_t*>(PhysicalAdapterPaths.GetAt(0)));
    The above wide char printf does not show the content that PhysicalAdapterPath holds. Which means that either the array was not populated properly from PhysicalAdapterPaths or I do not how to get/print/check the content of that location i.e. the BSTR at the 0th index of that array of BSTRS..I even tried to print the contents of the memory location where the array is supposed to start from...specifically I tried printing the memory contents of memory pointed to by parray.. msdn mentions that this variable within a variant gives the "dimentions, size and in-memory location of the array". I strongly think that by merely printing the content of memory starting from 'parray' is the wrong way to print the contents of the array. So..does anyone know how to check the contents of a safearray manually?? Using a debugger like windbg??

    any input would be appreciated....even if you haven't come across this specific issue, anything related and how you went about resolving it would be helpful
    Last edited by aijazbaig1; September 29th, 2011 at 12:21 AM.
    Best Regards,
    Aijaz Baig.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured