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.

64 lines
1.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: sipload.cpp
  8. //
  9. // Contents: Microsoft Internet Security SIP Provider
  10. //
  11. // Functions: CryptLoadSip
  12. // CryptUnloadSips
  13. //
  14. // History: 04-Jun-1997 pberkman created
  15. //
  16. //--------------------------------------------------------------------------
  17. #include "global.hxx"
  18. // backwords compatibility w/tools!
  19. extern "C"
  20. BOOL WINAPI CryptLoadSip(const GUID *pgSubject, DWORD dwFlags, SIP_DISPATCH_INFO *psSipTable)
  21. {
  22. return(CryptSIPLoad(pgSubject, dwFlags, psSipTable));
  23. }
  24. BOOL WINAPI CryptSIPLoad(const GUID *pgSubject, DWORD dwFlags, SIP_DISPATCH_INFO *psSipTable)
  25. {
  26. if (!(pgSubject) ||
  27. (dwFlags != 0) ||
  28. !(psSipTable))
  29. {
  30. SetLastError((DWORD) ERROR_INVALID_PARAMETER);
  31. return(FALSE);
  32. }
  33. HCRYPTOIDFUNCADDR hPfn;
  34. pCryptSIPPutSignedDataMsg pfn;
  35. char szGuid[REG_MAX_GUID_TEXT];
  36. if (!(_Guid2Sz((GUID *)pgSubject, &szGuid[0])))
  37. {
  38. SetLastError((DWORD) TRUST_E_SUBJECT_FORM_UNKNOWN);
  39. return(FALSE);
  40. }
  41. if (!(CryptGetOIDFunctionAddress(hPutFuncSet, 0, &szGuid[0], 0, (void **)&pfn, &hPfn)))
  42. {
  43. SetLastError((DWORD) TRUST_E_SUBJECT_FORM_UNKNOWN);
  44. return(FALSE);
  45. }
  46. CryptFreeOIDFunctionAddress(hPfn, 0);
  47. psSipTable->hSIP = NULL;
  48. psSipTable->pfGet = CryptSIPGetSignedDataMsg;
  49. psSipTable->pfPut = CryptSIPPutSignedDataMsg;
  50. psSipTable->pfCreate = CryptSIPCreateIndirectData;
  51. psSipTable->pfVerify = CryptSIPVerifyIndirectData;
  52. psSipTable->pfRemove = CryptSIPRemoveSignedDataMsg;
  53. return(TRUE);
  54. }