SecHandle newContext = null;
SecHandle pContext = params.myCtxHandle;
if (pContext == null) {
newContext = new SecHandle();
newContext.dwLower = new NativeLong(0);
newContext.dwUpper = new NativeLong(0);
newContext.write();
params.myCtxHandle = newContext;
} else {
newContext = pContext;
}
SecBuffer outSecBuffer = new SecBuffer();
outSecBuffer.cbBuffer = new NativeLong(512);
outSecBuffer.BufferType = new NativeLong(ISVNSecurityLibrary.SECBUFFER_TOKEN);
outSecBuffer.pvBuffer = new Memory(512);
outSecBuffer.write();
SecBufferDesc outBufferDescription = new SecBufferDesc();
outBufferDescription.ulVersion = new NativeLong(0);
outBufferDescription.cBuffers = new NativeLong(1);
outBufferDescription.pBuffers = outSecBuffer.getPointer();
outBufferDescription.write();
SecBufferDesc inBufferDescription = null;
SecBuffer inSecBuffer = null;
if (lastToken != null) {
inSecBuffer = new SecBuffer();
inSecBuffer.cbBuffer = new NativeLong(lastToken.length);
inSecBuffer.BufferType = new NativeLong(ISVNSecurityLibrary.SECBUFFER_TOKEN);
inSecBuffer.pvBuffer = new Memory(lastToken.length);
inSecBuffer.pvBuffer.write(0, lastToken, 0, lastToken.length);
inSecBuffer.write();
inBufferDescription = new SecBufferDesc();
inBufferDescription.ulVersion = new NativeLong(0);
inBufferDescription.cBuffers = new NativeLong(1);
inBufferDescription.pBuffers = inSecBuffer.getPointer();
inBufferDescription.write();
}
Pointer contextAttributes = new Memory(NativeLong.SIZE);
TimeStamp ltime = new TimeStamp();
ltime.HighPart = new NativeLong(0);
ltime.LowPart = new NativeLong(0);
ltime.write();
int securityStatus = library.InitializeSecurityContextW(params.myCrdHandle.getPointer(),
pContext != null ? pContext.getPointer() : Pointer.NULL,
null,
new NativeLong(0),
new NativeLong(0),
new NativeLong(ISVNSecurityLibrary.SECURITY_NATIVE_DREP),
lastToken != null ? inBufferDescription.getPointer() : Pointer.NULL,
new NativeLong(0),
newContext.getPointer(),
outBufferDescription.getPointer(),
contextAttributes,
ltime.getPointer());