' PBXB64 SSPI declarations for secur32.dll/security.h/sspi.h.
#IF NOT %DEF(PBX_SECUR32_PBI)
#DEFINE PBX_SECUR32_PBI
#include once "win_types.inc"

CONST SEC_E_OK = 0
CONST SEC_I_CONTINUE_NEEDED = &H00090312
CONST SEC_I_COMPLETE_NEEDED = &H00090313
CONST SEC_I_COMPLETE_AND_CONTINUE = &H00090314
CONST SECPKG_CRED_INBOUND = 1
CONST SECPKG_CRED_OUTBOUND = 2
CONST SECPKG_CRED_BOTH = 3
CONST ISC_REQ_DELEGATE = &H00000001
CONST ISC_REQ_MUTUAL_AUTH = &H00000002
CONST ISC_REQ_REPLAY_DETECT = &H00000004
CONST ISC_REQ_SEQUENCE_DETECT = &H00000008
CONST ISC_REQ_CONFIDENTIALITY = &H00000010
CONST ISC_REQ_USE_SESSION_KEY = &H00000020
CONST ISC_REQ_ALLOCATE_MEMORY = &H00000100
CONST ISC_REQ_STREAM = &H00008000
CONST ASC_REQ_DELEGATE = &H00000001
CONST ASC_REQ_MUTUAL_AUTH = &H00000002
CONST ASC_REQ_REPLAY_DETECT = &H00000004
CONST ASC_REQ_SEQUENCE_DETECT = &H00000008
CONST ASC_REQ_CONFIDENTIALITY = &H00000010
CONST ASC_REQ_ALLOCATE_MEMORY = &H00000100
CONST ASC_REQ_STREAM = &H00010000
CONST SECBUFFER_VERSION = 0
CONST SECBUFFER_EMPTY = 0
CONST SECBUFFER_DATA = 1
CONST SECBUFFER_TOKEN = 2
CONST SECBUFFER_PKG_PARAMS = 3
CONST SECBUFFER_MISSING = 4
CONST SECBUFFER_EXTRA = 5
CONST SECBUFFER_STREAM_TRAILER = 6
CONST SECBUFFER_STREAM_HEADER = 7
CONST SECBUFFER_PADDING = 9
CONST SECBUFFER_STREAM = 10
CONST SECPKG_ATTR_SIZES = 0
CONST SECPKG_ATTR_NAMES = 1
CONST SECPKG_ATTR_LIFESPAN = 2
CONST SECPKG_ATTR_DCE_INFO = 3
CONST SECPKG_ATTR_STREAM_SIZES = 4
CONST SECPKG_ATTR_KEY_INFO = 5
CONST SECPKG_ATTR_AUTHORITY = 6
CONST SECPKG_ATTR_PROTO_INFO = 7
CONST SECPKG_ATTR_PASSWORD_EXPIRY = 8
CONST SECPKG_ATTR_SESSION_KEY = 9
CONST SECPKG_ATTR_PACKAGE_INFO = 10
CONST SECURITY_NATIVE_DREP = &H00000010
CONST SECURITY_NETWORK_DREP = &H00000000

TYPE SecHandle
    dwLower AS QUAD
    dwUpper AS QUAD
END TYPE

TYPE SecBuffer
    cbBuffer AS DWORD
    BufferType AS DWORD
    pvBuffer AS QUAD
END TYPE

TYPE SecBufferDesc
    ulVersion AS DWORD
    cBuffers AS DWORD
    pBuffers AS QUAD
END TYPE

TYPE SecPkgContext_Sizes
    cbMaxToken AS DWORD
    cbMaxSignature AS DWORD
    cbBlockSize AS DWORD
    cbSecurityTrailer AS DWORD
END TYPE

TYPE SecPkgContext_StreamSizes
    cbHeader AS DWORD
    cbTrailer AS DWORD
    cbMaximumMessage AS DWORD
    cBuffers AS DWORD
    cbBlockSize AS DWORD
END TYPE

DECLARE FUNCTION AcquireCredentialsHandleA LIB "secur32.dll" ALIAS "AcquireCredentialsHandleA" (BYVAL pszPrincipal AS ASCIIZ PTR, BYVAL pszPackage AS ASCIIZ PTR, BYVAL fCredentialUse AS DWORD, BYVAL pvLogonId AS QUAD, BYVAL pAuthData AS QUAD, BYVAL pGetKeyFn AS QUAD, BYVAL pvGetKeyArgument AS QUAD, BYVAL phCredential AS QUAD, BYVAL ptsExpiry AS QUAD) AS LONG
DECLARE FUNCTION AcquireCredentialsHandleW LIB "secur32.dll" ALIAS "AcquireCredentialsHandleW" (BYVAL pszPrincipal AS WSTRING, BYVAL pszPackage AS WSTRING, BYVAL fCredentialUse AS DWORD, BYVAL pvLogonId AS QUAD, BYVAL pAuthData AS QUAD, BYVAL pGetKeyFn AS QUAD, BYVAL pvGetKeyArgument AS QUAD, BYVAL phCredential AS QUAD, BYVAL ptsExpiry AS QUAD) AS LONG
DECLARE FUNCTION FreeCredentialsHandle LIB "secur32.dll" ALIAS "FreeCredentialsHandle" (BYVAL phCredential AS QUAD) AS LONG
DECLARE FUNCTION InitializeSecurityContextA LIB "secur32.dll" ALIAS "InitializeSecurityContextA" (BYVAL phCredential AS QUAD, BYVAL phContext AS QUAD, BYVAL pszTargetName AS ASCIIZ PTR, BYVAL fContextReq AS DWORD, BYVAL Reserved1 AS DWORD, BYVAL TargetDataRep AS DWORD, BYVAL pInput AS QUAD, BYVAL Reserved2 AS DWORD, BYVAL phNewContext AS QUAD, BYVAL pOutput AS QUAD, BYVAL pfContextAttr AS QUAD, BYVAL ptsExpiry AS QUAD) AS LONG
DECLARE FUNCTION InitializeSecurityContextW LIB "secur32.dll" ALIAS "InitializeSecurityContextW" (BYVAL phCredential AS QUAD, BYVAL phContext AS QUAD, BYVAL pszTargetName AS WSTRING, BYVAL fContextReq AS DWORD, BYVAL Reserved1 AS DWORD, BYVAL TargetDataRep AS DWORD, BYVAL pInput AS QUAD, BYVAL Reserved2 AS DWORD, BYVAL phNewContext AS QUAD, BYVAL pOutput AS QUAD, BYVAL pfContextAttr AS QUAD, BYVAL ptsExpiry AS QUAD) AS LONG
DECLARE FUNCTION AcceptSecurityContext LIB "secur32.dll" ALIAS "AcceptSecurityContext" (BYVAL phCredential AS QUAD, BYVAL phContext AS QUAD, BYVAL pInput AS QUAD, BYVAL fContextReq AS DWORD, BYVAL TargetDataRep AS DWORD, BYVAL phNewContext AS QUAD, BYVAL pOutput AS QUAD, BYVAL pfContextAttr AS QUAD, BYVAL ptsExpiry AS QUAD) AS LONG
DECLARE FUNCTION CompleteAuthToken LIB "secur32.dll" ALIAS "CompleteAuthToken" (BYVAL phContext AS QUAD, BYVAL pToken AS QUAD) AS LONG
DECLARE FUNCTION DeleteSecurityContext LIB "secur32.dll" ALIAS "DeleteSecurityContext" (BYVAL phContext AS QUAD) AS LONG
DECLARE FUNCTION QueryContextAttributesA LIB "secur32.dll" ALIAS "QueryContextAttributesA" (BYVAL phContext AS QUAD, BYVAL ulAttribute AS DWORD, BYVAL pBuffer AS QUAD) AS LONG
DECLARE FUNCTION QueryContextAttributesW LIB "secur32.dll" ALIAS "QueryContextAttributesW" (BYVAL phContext AS QUAD, BYVAL ulAttribute AS DWORD, BYVAL pBuffer AS QUAD) AS LONG
DECLARE FUNCTION EncryptMessage LIB "secur32.dll" ALIAS "EncryptMessage" (BYVAL phContext AS QUAD, BYVAL fQOP AS DWORD, BYVAL pMessage AS QUAD, BYVAL MessageSeqNo AS DWORD) AS LONG
DECLARE FUNCTION DecryptMessage LIB "secur32.dll" ALIAS "DecryptMessage" (BYVAL phContext AS QUAD, BYVAL pMessage AS QUAD, BYVAL MessageSeqNo AS DWORD, BYVAL pfQOP AS QUAD) AS LONG
DECLARE FUNCTION MakeSignature LIB "secur32.dll" ALIAS "MakeSignature" (BYVAL phContext AS QUAD, BYVAL fQOP AS DWORD, BYVAL pMessage AS QUAD, BYVAL MessageSeqNo AS DWORD) AS LONG
DECLARE FUNCTION VerifySignature LIB "secur32.dll" ALIAS "VerifySignature" (BYVAL phContext AS QUAD, BYVAL pMessage AS QUAD, BYVAL MessageSeqNo AS DWORD, BYVAL pfQOP AS QUAD) AS LONG
DECLARE FUNCTION EnumerateSecurityPackagesA LIB "secur32.dll" ALIAS "EnumerateSecurityPackagesA" (BYVAL pcPackages AS QUAD, BYVAL ppPackageInfo AS QUAD) AS LONG
DECLARE FUNCTION EnumerateSecurityPackagesW LIB "secur32.dll" ALIAS "EnumerateSecurityPackagesW" (BYVAL pcPackages AS QUAD, BYVAL ppPackageInfo AS QUAD) AS LONG
DECLARE FUNCTION FreeContextBuffer LIB "secur32.dll" ALIAS "FreeContextBuffer" (BYVAL pvContextBuffer AS QUAD) AS LONG

#ENDIF
