我有一个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);