mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
57 lines
1.2 KiB
//+-----------------------------------------------------------------------
|
|
//
|
|
// File: CSUMMGR.c
|
|
//
|
|
// Contents: Checksum management functions
|
|
//
|
|
//
|
|
// History: 25 Feb 92, RichardW, Created
|
|
//
|
|
//------------------------------------------------------------------------
|
|
|
|
#include <nt.h>
|
|
#include <ntrtl.h>
|
|
#include <nturtl.h>
|
|
#include <windows.h>
|
|
|
|
#include <kerbcon.h>
|
|
#include <security.h>
|
|
#include <cryptdll.h>
|
|
|
|
#define MAX_CHECK_SUMS 16
|
|
|
|
CHECKSUM_FUNCTION CheckSumFns[MAX_CHECK_SUMS];
|
|
ULONG cCheckSums = 0;
|
|
|
|
#ifdef KERNEL_MODE
|
|
#pragma alloc_text( PAGEMSG, CDRegisterCheckSum )
|
|
#pragma alloc_text( PAGEMSG, CDLocateCheckSum )
|
|
#endif
|
|
|
|
NTSTATUS NTAPI
|
|
CDRegisterCheckSum( PCHECKSUM_FUNCTION pcsfSum)
|
|
{
|
|
if (cCheckSums < MAX_CHECK_SUMS)
|
|
{
|
|
CheckSumFns[cCheckSums++] = *pcsfSum;
|
|
return(S_OK);
|
|
}
|
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
|
}
|
|
|
|
NTSTATUS NTAPI
|
|
CDLocateCheckSum( ULONG dwCheckSumType,
|
|
PCHECKSUM_FUNCTION * ppcsfSum)
|
|
{
|
|
ULONG iCS = cCheckSums;
|
|
while (iCS--)
|
|
{
|
|
if (CheckSumFns[iCS].CheckSumType == dwCheckSumType)
|
|
{
|
|
*ppcsfSum = &CheckSumFns[iCS];
|
|
return(S_OK);
|
|
}
|
|
}
|
|
return(SEC_E_CHECKSUM_NOT_SUPP);
|
|
}
|
|
|