2

我有一个 DCOM 对象,我正在尝试远程启动它。但是函数 CoCreateInstance 返回值 0x80070005 - 拒绝访问。我的测试是在 Windows 7 上完成的。可能有什么问题?

   HRESULT hr = CoInitializeEx(0, COINIT_APARTMENTTHREADED);
   hr = CoInitializeSecurity(0, -1, NULL, NULL, RPC_C_IMP_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);

    COAUTHINFO ca = {RPC_C_AUTHN_DEFAULT, RPC_C_AUTHZ_NONE, 0, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE,0, EOAC_NONE };

    COAUTHIDENTITY id = {0};
    ca.pAuthIdentityData = &id;
    id.User = (USHORT*) L"user";
    id.UserLength = userLenght;
    id.Password = (USHORT*) L"password";
    id.PasswordLength = passwordLenght;
    id.Domain = (USHORT*)L"domainName";
    id.DomainLength = domainName;
    id.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;

    COSERVERINFO c = {0};
    c.pwszName = L"machineName";
    c.pAuthInfo = &ca;
    MULTI_QI res = {0};
    res.pItf = NULL;
    res.hr = S_OK;
    res.pIID = &IID_ITextAnimationProxy;
    hr = CoCreateInstanceEx(CLSID_TextAnimationProxy,0, CLSCTX_REMOTE_SERVER,&c,1,&res);
4

0 回答 0