locked
"Getinterfacefromglobal" method returning error code "0x8000ffff" ATL COM( win32, VC++) RRS feed

  • Question

  • I've implimented a ATL single thread apartment based project .

    class ATL_NO_VTABLE CMySrv :
    public CComObjectRootEx<ccomsinglethreadmodel>,
    public CComCoClass<cmysrv,&clsid_mysrv>,
    public IMySrv

    In the method, I'm creating multiple worker threads and accessing the interface pointer from one context to another with using COM Interface "IGlobalInterfaceTable"

    In the main thread registered the interface

    void CMySrv::save()
    {
    CComQIPtr<imysrv> pMySrv(GetUnknown());
    CComPtr<iglobalinterfacetable> l_git;
    l_git.CoCreateInstance( CLSID_StdGlobalInterfaceTable );
    l_git->RegisterInterfaceInGlobal(pMySrv, __uuidof(IMySrv), &dwCookie );

    for(int i=0;i<9;i++)
    _beginthreadex( 0,0,&(CParllelThreadOperations::ThreadFunc),LPVOID(&dwCookie), 0, &dwThId);

    ////logic implemented to wait for all the child threads

    }

    In the worker thread I'm passing the cookie information and would get the interface

    CComPtr<iglobalinterfacetable> git;
    CComPtr<imysrv> pMySrv;
    HRESULT hr= 0;
    if(git.CoCreateInstance( CLSID_StdGlobalInterfaceTable)>=0)
    hr= git->GetInterfaceFromGlobal( dwCookie, __uuidof(IMySrv), (void**)&pMySrv);

    But "GetInterfaceFromGlobal" returning "0x8000ffff" error code(it is happening rarely )

    Could you please help me on this

    Sunday, November 8, 2020 7:39 PM

All replies

  • Did you try using ATL's CComGITPtr class?

    Did you register a proxy/stub dll?

    Can you share a minimal sample that reproduces the problem?

    Also, questions about C++ and ATL  should be posted to https://docs.microsoft.com/en-us/answers/topics/c++.html


    • Edited by RLWA32 Sunday, November 8, 2020 9:53 PM
    Sunday, November 8, 2020 9:50 PM
  • Most of the times the developed code is working ,but some times it is failing, 

    Could you please let me know me that what causes "Getinterfacefromglobal" API to generate 0x8000ffff error code.
    • Edited by Rajesh_vc Monday, November 9, 2020 5:58 AM
    Monday, November 9, 2020 5:54 AM
  • Hi Rajesh_vc,

    Thanks for your feedback.

    Since your question is more related to C++, as RLWA32 suggested, you can consider posting your question on C++(Q&A) forum for more efficient responses.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 9, 2020 7:04 AM
  • Thank you Xingyu Zhao,

    I've posted this in  C++(Q&A) forum : 

    https://docs.microsoft.com/en-us/answers/questions/155912/34getinterfacefromglobal34-method-returning-error.html

    Monday, November 9, 2020 9:04 AM