📄 secpkg.h
字号:
//
typedef NTSTATUS
(LSA_AP_INITIALIZE_PACKAGE) (
IN ULONG AuthenticationPackageId,
IN PLSA_DISPATCH_TABLE LsaDispatchTable,
IN PLSA_STRING Database OPTIONAL,
IN PLSA_STRING Confidentiality OPTIONAL,
OUT PLSA_STRING *AuthenticationPackageName
);
typedef NTSTATUS
(LSA_AP_LOGON_USER) (
IN PLSA_CLIENT_REQUEST ClientRequest,
IN SECURITY_LOGON_TYPE LogonType,
IN PVOID AuthenticationInformation,
IN PVOID ClientAuthenticationBase,
IN ULONG AuthenticationInformationLength,
OUT PVOID *ProfileBuffer,
OUT PULONG ProfileBufferLength,
OUT PLUID LogonId,
OUT PNTSTATUS SubStatus,
OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
OUT PVOID *TokenInformation,
OUT PLSA_UNICODE_STRING *AccountName,
OUT PLSA_UNICODE_STRING *AuthenticatingAuthority
);
typedef NTSTATUS
(LSA_AP_LOGON_USER_EX) (
IN PLSA_CLIENT_REQUEST ClientRequest,
IN SECURITY_LOGON_TYPE LogonType,
IN PVOID AuthenticationInformation,
IN PVOID ClientAuthenticationBase,
IN ULONG AuthenticationInformationLength,
OUT PVOID *ProfileBuffer,
OUT PULONG ProfileBufferLength,
OUT PLUID LogonId,
OUT PNTSTATUS SubStatus,
OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
OUT PVOID *TokenInformation,
OUT PUNICODE_STRING *AccountName,
OUT PUNICODE_STRING *AuthenticatingAuthority,
OUT PUNICODE_STRING *MachineName
);
typedef NTSTATUS
(LSA_AP_CALL_PACKAGE) (
IN PLSA_CLIENT_REQUEST ClientRequest,
IN PVOID ProtocolSubmitBuffer,
IN PVOID ClientBufferBase,
IN ULONG SubmitBufferLength,
OUT PVOID *ProtocolReturnBuffer,
OUT PULONG ReturnBufferLength,
OUT PNTSTATUS ProtocolStatus
);
typedef VOID
(LSA_AP_LOGON_TERMINATED) (
IN PLUID LogonId
);
typedef LSA_AP_CALL_PACKAGE LSA_AP_CALL_PACKAGE_UNTRUSTED;
typedef NTSTATUS
(NTAPI SpInitializeFn)(
IN ULONG PackageId,
IN PSECPKG_PARAMETERS Parameters,
IN PLSA_SECPKG_FUNCTION_TABLE FunctionTable
);
typedef NTSTATUS
(NTAPI SpShutdownFn)(
VOID
);
typedef NTSTATUS
(NTAPI SpGetInfoFn)(
OUT PSecPkgInfo PackageInfo
);
typedef NTSTATUS
(NTAPI SpGetExtendedInformationFn)(
IN SECPKG_EXTENDED_INFORMATION_CLASS Class,
OUT PSECPKG_EXTENDED_INFORMATION * ppInformation
);
typedef NTSTATUS
(LSA_AP_LOGON_USER_EX2) (
IN PLSA_CLIENT_REQUEST ClientRequest,
IN SECURITY_LOGON_TYPE LogonType,
IN PVOID AuthenticationInformation,
IN PVOID ClientAuthenticationBase,
IN ULONG AuthenticationInformationLength,
OUT PVOID *ProfileBuffer,
OUT PULONG ProfileBufferLength,
OUT PLUID LogonId,
OUT PNTSTATUS SubStatus,
OUT PLSA_TOKEN_INFORMATION_TYPE TokenInformationType,
OUT PVOID *TokenInformation,
OUT PUNICODE_STRING *AccountName,
OUT PUNICODE_STRING *AuthenticatingAuthority,
OUT PUNICODE_STRING *MachineName,
OUT PSECPKG_PRIMARY_CRED PrimaryCredentials,
OUT PULONG CachedCredentialCount,
OUT PSECPKG_SUPPLEMENTAL_CRED * CachedCredentials
);
typedef LSA_AP_LOGON_USER_EX2 *PLSA_AP_LOGON_USER_EX2;
#define LSA_AP_NAME_LOGON_USER_EX2 "LsaApLogonUserEx2\0"
typedef NTSTATUS
(NTAPI SpAcceptCredentialsFn)(
IN SECURITY_LOGON_TYPE LogonType,
IN PUNICODE_STRING AccountName,
IN PSECPKG_PRIMARY_CRED PrimaryCredentials,
IN PSECPKG_SUPPLEMENTAL_CRED SupplementalCredentials
);
#define SP_ACCEPT_CREDENTIALS_NAME "SpAcceptCredentials\0"
typedef NTSTATUS
(NTAPI SpAcquireCredentialsHandleFn)(
IN OPTIONAL PUNICODE_STRING PrincipalName,
IN ULONG CredentialUseFlags,
IN OPTIONAL PLUID LogonId,
IN PVOID AuthorizationData,
IN PVOID GetKeyFunciton,
IN PVOID GetKeyArgument,
OUT PULONG CredentialHandle,
OUT PTimeStamp ExpirationTime
);
typedef NTSTATUS
(NTAPI SpFreeCredentialsHandleFn)(
IN ULONG CredentialHandle
);
typedef NTSTATUS
(NTAPI SpQueryCredentialsAttributesFn)(
IN ULONG CredentialHandle,
IN ULONG CredentialAttribute,
IN OUT PVOID Buffer
);
typedef NTSTATUS
(NTAPI SpSaveCredentialsFn)(
IN ULONG CredentialHandle,
IN PSecBuffer Credentials);
typedef NTSTATUS
(NTAPI SpGetCredentialsFn)(
IN ULONG CredentialHandle,
IN OUT PSecBuffer Credentials
);
typedef NTSTATUS
(NTAPI SpDeleteCredentialsFn)(
IN ULONG CredentialHandle,
IN PSecBuffer Key
);
typedef NTSTATUS
(NTAPI SpInitLsaModeContextFn)(
IN OPTIONAL ULONG CredentialHandle,
IN OPTIONAL ULONG ContextHandle,
IN OPTIONAL PUNICODE_STRING TargetName,
IN ULONG ContextRequirements,
IN ULONG TargetDataRep,
IN PSecBufferDesc InputBuffers,
OUT PULONG NewContextHandle,
IN OUT PSecBufferDesc OutputBuffers,
OUT PULONG ContextAttributes,
OUT PTimeStamp ExpirationTime,
OUT PBOOLEAN MappedContext,
OUT PSecBuffer ContextData
);
typedef NTSTATUS
(NTAPI SpDeleteContextFn)(
IN ULONG ContextHandle
);
typedef NTSTATUS
(NTAPI SpApplyControlTokenFn)(
IN ULONG ContextHandle,
IN PSecBufferDesc ControlToken);
typedef NTSTATUS
(NTAPI SpAcceptLsaModeContextFn)(
IN OPTIONAL ULONG CredentialHandle,
IN OPTIONAL ULONG ContextHandle,
IN PSecBufferDesc InputBuffer,
IN ULONG ContextRequirements,
IN ULONG TargetDataRep,
OUT PULONG NewContextHandle,
OUT PSecBufferDesc OutputBuffer,
OUT PULONG ContextAttributes,
OUT PTimeStamp ExpirationTime,
OUT PBOOLEAN MappedContext,
OUT PSecBuffer ContextData
);
typedef NTSTATUS
(NTAPI SpGetUserInfoFn)(
IN PLUID LogonId,
IN ULONG Flags,
OUT PSecurityUserData * UserData
);
typedef NTSTATUS
(NTAPI SpQueryContextAttributesFn)(
IN ULONG ContextHandle,
IN ULONG ContextAttribute,
IN OUT PVOID Buffer);
typedef struct _SECPKG_FUNCTION_TABLE {
PLSA_AP_INITIALIZE_PACKAGE InitializePackage;
PLSA_AP_LOGON_USER LogonUser;
PLSA_AP_CALL_PACKAGE CallPackage;
PLSA_AP_LOGON_TERMINATED LogonTerminated;
PLSA_AP_CALL_PACKAGE_UNTRUSTED CallPackageUntrusted;
PLSA_AP_LOGON_USER_EX LogonUserEx;
PLSA_AP_LOGON_USER_EX2 LogonUserEx2;
SpInitializeFn * Initialize;
SpShutdownFn * Shutdown;
SpGetInfoFn * GetInfo;
SpAcceptCredentialsFn * AcceptCredentials;
SpAcquireCredentialsHandleFn * AcquireCredentialsHandle;
SpQueryCredentialsAttributesFn * QueryCredentialsAttributes;
SpFreeCredentialsHandleFn * FreeCredentialsHandle;
SpSaveCredentialsFn * SaveCredentials;
SpGetCredentialsFn * GetCredentials;
SpDeleteCredentialsFn * DeleteCredentials;
SpInitLsaModeContextFn * InitLsaModeContext;
SpAcceptLsaModeContextFn * AcceptLsaModeContext;
SpDeleteContextFn * DeleteContext;
SpApplyControlTokenFn * ApplyControlToken;
SpGetUserInfoFn * GetUserInfo;
SpGetExtendedInformationFn * GetExtendedInformation ;
SpQueryContextAttributesFn * QueryContextAttributes ;
} SECPKG_FUNCTION_TABLE, *PSECPKG_FUNCTION_TABLE;
//
// The following prototypes are to functions that will be called while in the
// context of a user process that is using the functions through the security
// DLL.
//
typedef NTSTATUS
(NTAPI SpInstanceInitFn)(
IN ULONG Version,
IN PSECPKG_DLL_FUNCTIONS FunctionTable,
OUT PVOID * UserFunctions
);
typedef NTSTATUS
(NTAPI SpInitUserModeContextFn)(
IN ULONG ContextHandle,
IN PSecBuffer PackedContext
);
typedef NTSTATUS
(NTAPI SpMakeSignatureFn)(
IN ULONG ContextHandle,
IN ULONG QualityOfProtection,
IN PSecBufferDesc MessageBuffers,
IN ULONG MessageSequenceNumber
);
typedef NTSTATUS
(NTAPI SpVerifySignatureFn)(
IN ULONG ContextHandle,
IN PSecBufferDesc MessageBuffers,
IN ULONG MessageSequenceNumber,
OUT PULONG QualityOfProtection
);
typedef NTSTATUS
(NTAPI SpSealMessageFn)(
IN ULONG ContextHandle,
IN ULONG QualityOfProtection,
IN PSecBufferDesc MessageBuffers,
IN ULONG MessageSequenceNumber
);
typedef NTSTATUS
(NTAPI SpUnsealMessageFn)(
IN ULONG ContextHandle,
IN PSecBufferDesc MessageBuffers,
IN ULONG MessageSequenceNumber,
OUT PULONG QualityOfProtection
);
typedef NTSTATUS
(NTAPI SpGetContextTokenFn)(
IN ULONG ContextHandle,
OUT PHANDLE ImpersonationToken
);
typedef NTSTATUS
(NTAPI SpExportSecurityContextFn)(
ULONG phContext, // (in) context to export
ULONG fFlags, // (in) option flags
PSecBuffer pPackedContext, // (out) marshalled context
PHANDLE pToken // (out, optional) token handle for impersonation
);
typedef NTSTATUS
(NTAPI SpImportSecurityContextFn)(
PSecBuffer pPackedContext, // (in) marshalled context
HANDLE Token, // (in, optional) handle to token for context
PULONG phContext // (out) new context handle
);
typedef NTSTATUS
(NTAPI SpCompleteAuthTokenFn)(
IN ULONG ContextHandle,
IN PSecBufferDesc InputBuffer
);
typedef NTSTATUS
(NTAPI SpFormatCredentialsFn)(
IN PSecBuffer Credentials,
OUT PSecBuffer FormattedCredentials
);
typedef NTSTATUS
(NTAPI SpMarshallSupplementalCredsFn)(
IN ULONG CredentialSize,
IN PUCHAR Credentials,
OUT PULONG MarshalledCredSize,
OUT PVOID * MarshalledCreds);
typedef struct _SECPKG_USER_FUNCTION_TABLE {
SpInstanceInitFn * InstanceInit;
SpInitUserModeContextFn * InitUserModeContext;
SpMakeSignatureFn * MakeSignature;
SpVerifySignatureFn * VerifySignature;
SpSealMessageFn * SealMessage;
SpUnsealMessageFn * UnsealMessage;
SpGetContextTokenFn * GetContextToken;
SpQueryContextAttributesFn * QueryContextAttributes;
SpCompleteAuthTokenFn * CompleteAuthToken;
SpDeleteContextFn * DeleteUserModeContext;
SpFormatCredentialsFn * FormatCredentials;
SpMarshallSupplementalCredsFn * MarshallSupplementalCreds;
SpExportSecurityContextFn * ExportContext;
SpImportSecurityContextFn * ImportContext;
} SECPKG_USER_FUNCTION_TABLE, *PSECPKG_USER_FUNCTION_TABLE;
typedef NTSTATUS
(SEC_ENTRY * SpLsaModeInitializeFn)(
IN ULONG LsaVersion,
OUT PULONG PackageVersion,
OUT PSECPKG_FUNCTION_TABLE * ppTables,
OUT PULONG pcTables);
typedef NTSTATUS
(SEC_ENTRY * SpUserModeInitializeFn)(
IN ULONG LsaVersion,
OUT PULONG PackageVersion,
OUT PSECPKG_USER_FUNCTION_TABLE *ppTables,
OUT PULONG pcTables
);
#define SECPKG_LSAMODEINIT_NAME "SpLsaModeInitialize"
#define SECPKG_USERMODEINIT_NAME "SpUserModeInitialize"
#define SECPKG_INTERFACE_VERSION 0x00010000
typedef struct _SECPKG_KERNEL_FUNCTIONS {
PLSA_ALLOCATE_LSA_HEAP AllocateHeap;
PLSA_FREE_LSA_HEAP FreeHeap;
} SECPKG_KERNEL_FUNCTIONS, *PSECPKG_KERNEL_FUNCTIONS;
typedef NTSTATUS
(NTAPI KspInitPackageFn)(
PSECPKG_KERNEL_FUNCTIONS FunctionTable
);
typedef NTSTATUS
(NTAPI KspDeleteContextFn)(
IN ULONG ContextId,
OUT PULONG LsaContextId
);
typedef NTSTATUS
(NTAPI KspInitContextFn)(
IN ULONG ContextId,
IN PSecBuffer ContextData,
OUT PULONG NewContextId
);
typedef NTSTATUS
(NTAPI KspMakeSignatureFn)(
IN ULONG ContextId,
IN ULONG fQOP,
IN OUT PSecBufferDesc Message,
IN ULONG MessageSeqNo
);
typedef NTSTATUS
(NTAPI KspVerifySignatureFn)(
IN ULONG ContextId,
IN OUT PSecBufferDesc Message,
IN ULONG MessageSeqNo,
OUT PULONG pfQOP
);
typedef NTSTATUS
(NTAPI KspSealMessageFn)(
IN ULONG ContextId,
IN ULONG fQOP,
IN OUT PSecBufferDesc Message,
IN ULONG MessageSeqNo
);
typedef NTSTATUS
(NTAPI KspUnsealMessageFn)(
IN ULONG ContextId,
IN OUT PSecBufferDesc Message,
IN ULONG MessageSeqNo,
OUT PULONG pfQOP
);
typedef NTSTATUS
(NTAPI KspGetTokenFn)(
IN ULONG ContextId,
OUT PHANDLE ImpersonationToken,
OUT OPTIONAL PACCESS_TOKEN * RawToken
);
typedef NTSTATUS
(NTAPI KspQueryAttributesFn)(
IN ULONG ContextId,
IN ULONG Attribute,
IN OUT PVOID Buffer
);
typedef NTSTATUS
(NTAPI KspCompleteTokenFn)(
IN ULONG ContextId,
IN PSecBufferDesc Token
);
typedef NTSTATUS
(NTAPI KspMapHandleFn)(
IN ULONG ContextId,
OUT PULONG LsaContextId
);
typedef struct _SECPKG_KERNEL_FUNCTION_TABLE {
KspInitPackageFn * Initialize;
KspDeleteContextFn * DeleteContext;
KspInitContextFn * InitContext;
KspMapHandleFn * MapHandle;
KspMakeSignatureFn * Sign;
KspVerifySignatureFn * Verify;
KspSealMessageFn * Seal;
KspUnsealMessageFn * Unseal;
KspGetTokenFn * GetToken;
KspQueryAttributesFn * QueryAttributes;
KspCompleteTokenFn * CompleteToken;
} SECPKG_KERNEL_FUNCTION_TABLE, *PSECPKG_KERNEL_FUNCTION_TABLE;
SECURITY_STATUS
SEC_ENTRY
KsecRegisterSecurityProvider(
PSECURITY_STRING ProviderName,
PSECPKG_KERNEL_FUNCTION_TABLE Table
);
extern SECPKG_KERNEL_FUNCTIONS KspKernelFunctions;
//
// Common types used by negotiable security packages
//
#define SEC_WINNT_AUTH_IDENTITY_MARSHALLED 0x4
#define SEC_WINNT_AUTH_IDENTITY_EXTENDED 0x8
#endif // __SECPKG_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -