sp; Alias "AcceptSecurityContext" (ByRef phCredential As SecHandle, _ ByVal phContext As Long, ByRef pInput As SecBufferDesc, _ ByVal fContextReq As Long, ByVal TargetDataRep As Long, _ ByRef phNewContext As SecHandle, ByRef pOutput As SecBufferDesc, _ ByRef pfContextAttr As Long, ByRef ptsExpiry As TimeStamp) As Long
Private Declare Function AcceptSecurityContext2 Lib "secur32" _ Alias "AcceptSecurityContext" (ByRef phCredential As SecHandle, _ ByVal phContext As Long, ByRef pInput As SecBufferDesc, _ ByVal fContextReq As Long, ByVal TargetDataRep As Long, _ ByRef phNewContext As SecHandle, ByRef pOutput As SecBufferDesc, _ ByRef pfContextAttr As Long, ByRef ptsExpiry As TimeStamp) As Long
Private Declare Function NT4CompleteAuthToken Lib "security" _ Alias "CompleteAuthToken" (ByRef phContext As SecHandle, _ ByRef pToken As SecBufferDesc) As Long
Private Declare Function CompleteAuthToken Lib "secur32" _ (ByRef phContext As SecHandle, _ ByRef pToken As SecBufferDesc) As Long
Private Declare Function NT4DeleteSecurityContext Lib "security" _ Alias "DeleteSecurityContext" (ByRef phContext As SecHandle) _ As Long
Private Declare Function DeleteSecurityContext Lib "secur32" _ (ByRef phContext As SecHandle) _ As Long
Private Declare Function NT4FreeCredentialsHandle Lib "security" _ Alias "FreeCredentialsHandle" (ByRef phContext As SecHandle) _ As Long
Private Declare Function FreeCredentialsHandle Lib "secur32" _ (ByRef phContext As SecHandle) _ As Long
Private Declare Function GetProcessHeap Lib "kernel32" () As Long
Private Declare Function HeapAlloc Lib "kernel32" _ (ByVal hHeap As Long, ByVal dwFlags As Long, _ ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, _ ByVal dwFlags As Long, ByVal lpMem As Long) As Long
Private Declare Function GetVersionExA Lib "kernel32" _ (lpVersionInformation As OSVERSIONINFO) As Integer
Dim g_NT4 As Boolean
Private Function GenClientContext(ByRef AuthSeq As AUTH_SEQ, _ ByRef AuthIdentity As SEC_WINNT_AUTH_IDENTITY, _ ByVal pIn As Long, ByVal cbIn As Long, _ ByVal pOut As Long, ByRef cbOut As Long, _ ByRef fDone As Boolean) As Boolean
Dim ss As Long Dim tsExpiry As TimeStamp Dim sbdOut As SecBufferDesc Dim sbOut As SecBuffer Dim sbdIn As SecBufferDesc Dim sbIn As SecBuffer Dim fContextAttr As Long
GenClientContext = False
If Not AuthSeq.fInitialized Then
If g_NT4 Then ss = NT4AcquireCredentialsHandle(0&, "NTLM", _ SECPKG_CRED_OUTBOUND, 0&, AuthIdentity, 0&, 0&, _ AuthSeq.hcred, tsExpiry) Else ss = AcquireCredentialsHandle(0&, "NTLM", _ SECPKG_CRED_OUTBOUND, 0&, AuthIdentity, 0&, 0&, _ AuthSeq.hcred, tsExpiry) End If
If Not AuthSeq.fInitialized Then AuthSeq.fInitialized = True End If
fDone = Not (ss = SEC_I_CONTINUE_NEEDED _ Or ss = SEC_I_COMPLETE_AND_CONTINUE)
GenClientContext = True
FreeResourcesAndExit:
If sbdOut.pBuffers <> 0 Then HeapFree GetProcessHeap(), 0, sbdOut.pBuffers End If
If sbdIn.pBuffers <> 0 Then HeapFree GetProcessHeap(), 0, sbdIn.pBuffers End If
End Function
Private Function GenServerContext(ByRef AuthSeq As AUTH_SEQ, _ ByVal pIn As Long, ByVal cbIn As Long, _ ByVal pOut As Long, ByRef cbOut As Long, _ ByRef fDone As Boolean) As Boolean
Dim ss As Long Dim tsExpiry As TimeStamp Dim sbdOut As SecBufferDesc Dim sbOut As SecBuffer Dim sbdIn As SecBufferDesc