QueryInterface returns E_ACCESSDANIED general access denied error after successfull CoCreateInstanceEx

827 views Asked by At

I am making a simple client to connect to an OPC Server via DCOM on a virtual machine. I tested the same code on a Windows 7 Machine and it worked properly, but after moving the coding to Windows 10 it stopped working (the virtual machine containing the DCOM server is the same). The point is that I am able to instantiate a the COM object but I am not able to call any of its methods because I am receiving the E_ACCESSDENIED result. These are the steps:

tagMULTI_QI res;
res.pIID = &__uuidof(IOPCServer);
res.pItf = NULL;

hr = CoCreateInstanceEx(
    clsid,
    NULL,
    CLSCTX_INPROC_SERVER,
    &sin,
    1,
    &res);

This returns hr = S_OK and the res.hr has S_OK value as well. But after that any call retrieves E_ACCESSDENIED result. This is:

hr = server->GetStatus(&status);

IOPCItemProperties* ItemProperties;

hr = server->QueryInterface(
            __uuidof(IOPCItemProperties),
            (void**)&ItemProperties);

Any idea what can be causing the problem? Could be someting related to the Windows 10 OS?

0

There are 0 answers