……
HRESULT hr;
COAUTHIDENTITY idendtity = {0};
idendtity.User = (USHORT *)L"User";
idendtity.UserLength = 4;
idendtity.Password = (USHORT *)L"Password";
idendtity.PasswordLength = 8;
idendtity.Password = NULL;
idendtity.PasswordLength = 0;
idendtity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
COAUTHINFO auth = {
RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NONE,
NULL,
RPC_C_AUTHN_LEVEL_CALL,
RPC_C_IMP_LEVEL_IMPERSONATE,
&idendtity,
EOAC_NONE
};
COSERVERINFO serverInfo = {0};
serverInfo.pwszName = L"192.168.0.2";
serverInfo.pAuthInfo = &auth;
MULTI_QI qi = { &IID_ITestObject, NULL, S_OK };
hr = CoCreateInstanceEx(CLSID_TestObject, NULL, CLSCTX_ALL, &serverInfo, 1, &qi);