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

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    1

    CreateInstanceEnum fails with error c0000005

    Hi !

    I am writing a management app for our company. I am using visual studio 2005 and VC++. Its a

    client server architecture. One of the services provided by the server is setting of static IP for

    NIC's. I am using WMI class Win32_NetworkAdapterConfiguration and EnableStatic method. I

    am using IWbemServices::CreateInstanceEnum method to enumerate instances of Adapters with a particular interfaceindex. All the WMI code is inside the function SetAdapterIpAddress

    which i made into a dll and the server links to this dll to provide the service. The first time the

    server executes the function conatining the code it succeeds, but the subsequent calls to this

    function fails...the point of failure is the line containing the function CreateInstanceEnum....the

    return code is c0000005. please help me. thank you.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: CreateInstanceEnum fails with error c0000005

    Well, MSDN clearly tells you that:
    IWbemServices::CreateInstanceEnum
    ....
    Return Values
    This method returns an HRESULT object that indicates the status of the method call.

    Value
    WBEM_E_ACCESS_DENIED ....
    WBEM_E_FAILED ....
    WBEM_E_INVALID_CLASS ....
    WBEM_E_INVALID_PARAMETER ....
    WBEM_E_OUT_OF_MEMORY ....
    WBEM_E_TRANSPORT_FAILURE ....
    WBEM_S_NO_ERROR ....

    On failure, you can obtain any available information from the COM function GetErrorInfo.
    So what you have to do is to compare the return code with one of these values and then look for the error meaning in MSDN.
    And don't forget GetErrorInfo!
    Victor Nijegorodov

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