Source code of Windows XP (NT5)
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

  1. //+-----------------------------------------------------------------------
  2. //
  3. // File: CSUMMGR.c
  4. //
  5. // Contents: Checksum management functions
  6. //
  7. //
  8. // History: 25 Feb 92, RichardW, Created
  9. //
  10. //------------------------------------------------------------------------
  11. #include <nt.h>
  12. #include <ntrtl.h>
  13. #include <nturtl.h>
  14. #include <windows.h>
  15. #include <kerbcon.h>
  16. #include <security.h>
  17. #include <cryptdll.h>
  18. #define MAX_CHECK_SUMS 16
  19. CHECKSUM_FUNCTION CheckSumFns[MAX_CHECK_SUMS];
  20. ULONG cCheckSums = 0;
  21. #ifdef KERNEL_MODE
  22. #pragma alloc_text( PAGEMSG, CDRegisterCheckSum )
  23. #pragma alloc_text( PAGEMSG, CDLocateCheckSum )
  24. #endif
  25. NTSTATUS NTAPI
  26. CDRegisterCheckSum( PCHECKSUM_FUNCTION pcsfSum)
  27. {
  28. if (cCheckSums < MAX_CHECK_SUMS)
  29. {
  30. CheckSumFns[cCheckSums++] = *pcsfSum;
  31. return(S_OK);
  32. }
  33. return(STATUS_INSUFFICIENT_RESOURCES);
  34. }
  35. NTSTATUS NTAPI
  36. CDLocateCheckSum( ULONG dwCheckSumType,
  37. PCHECKSUM_FUNCTION * ppcsfSum)
  38. {
  39. ULONG iCS = cCheckSums;
  40. while (iCS--)
  41. {
  42. if (CheckSumFns[iCS].CheckSumType == dwCheckSumType)
  43. {
  44. *ppcsfSum = &CheckSumFns[iCS];
  45. return(S_OK);
  46. }
  47. }
  48. return(SEC_E_CHECKSUM_NOT_SUPP);
  49. }