Getting REGDB_E_CLASSNOTREG error when trying to get interfaces from ResourceManager class (WSRM + COM) RRS feed

  • Question

  • Architecture of my program is 32-bit, compiler is mingw. Program running as a service, logging in as a LOCAL SERVICE, OS: Windows Server 2008 R2 Standard.

    I am trying to implement Windows System Recource Management functions in my program, so I need to use COM functionality. According to MS-WSRM protocol guide, I should create COM object for ResourceManager class then use IUnknown::QueryInterface to get necessary interfaces. Code below illustrates my work:

    CheckCom(::CoInitializeEx(nullptr, COINIT_MULTITHREADED));
    -1, // COM negotiates service
    nullptr,// Authentication services
    nullptr,// Reserved
    RPC_C_AUTHN_LEVEL_PKT_PRIVACY,// authentication
    RPC_C_IMP_LEVEL_IMPERSONATE,// Impersonation
    nullptr,// Authentication info
    EOAC_STATIC_CLOAKING,// Additional capabilities
    nullptr// Reserved

    ComObject<IUnknown> m_control;

    CheckApiError(::CoCreateInstance(CLSID_ResourceManager, nullptr, CLSCTX_LOCAL_SERVER, IID_IUnknown, reinterpret_cast<void**>(&m_control)));

    ComObject<IDispatch> disp;

    ComObject<IWRMConfig> sys_config;
    CheckApiError(m_control->QueryInterface(IID_IDispatch, reinterpret_cast<void**> (&disp)));
    CheckApiError(m_control->QueryInterface(IID_IWRMConfig, reinterpret_cast<void**> (&sys_config)));

    I am trying to get IDispatch interface just to show that I successfully get it, but when I'm trying to get IWRMConfig interface, I get REGDB_E_CLASSNOTREG error (as a result of QueryInterface function, and it is strange).

    CheckApiError and CheckCom are only macroses to check for result of executing functions, CLSIDs and IIDs are valid and are in registry (Installed when i have installed WSRM component of server). Please, help me to find out a solvation of the problem.

    Friday, May 25, 2012 1:46 AM