SEC_WINNT_AUTH_IDENTITY authIdentity = null;
if (user != null || password != null || domain != null) {
authIdentity = new SEC_WINNT_AUTH_IDENTITY();
if (user != null) {
authIdentity.User = new WString(user);
authIdentity.UserLength = new NativeLong(user.length());
}
if (password != null) {
authIdentity.Password = new WString(password);
authIdentity.PasswordLength = new NativeLong(password.length());
}
if (domain != null) {
authIdentity.Domain = new WString(domain);
authIdentity.DomainLength = new NativeLong(domain.length());
}
authIdentity.Flags = new NativeLong(ISVNSecurityLibrary.SEC_WINNT_AUTH_IDENTITY_UNICODE);
authIdentity.write();
}
SecHandle pCred = new SecHandle();
pCred.dwLower = new NativeLong(0);
pCred.dwUpper = new NativeLong(0);
pCred.write();
ISVNSecurityLibrary.TimeStamp ltime = new ISVNSecurityLibrary.TimeStamp();
ltime.HighPart = new NativeLong(0);
ltime.LowPart = new NativeLong(0);
ltime.write();
int securityStatus = library.AcquireCredentialsHandleW(null, new WString("NTLM"),
new NativeLong(ISVNSecurityLibrary.SECPKG_CRED_OUTBOUND), Pointer.NULL,
authIdentity != null ? authIdentity.getPointer() : Pointer.NULL,
Pointer.NULL, Pointer.NULL, pCred.getPointer(), ltime.getPointer());
if (securityStatus == 0) {
pCred.read();