Leaked source code of windows server 2003
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.

69 lines
1.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: certprov.cpp
  8. //
  9. // Contents: Microsoft Internet Security Authenticode Policy Provider
  10. //
  11. // Functions: SoftpubDefCertInit
  12. //
  13. // History: 02-Oct-1997 pberkman created
  14. //
  15. //--------------------------------------------------------------------------
  16. #include "global.hxx"
  17. HRESULT WINAPI SoftpubDefCertInit(CRYPT_PROVIDER_DATA *pProvData)
  18. {
  19. if (!(pProvData->padwTrustStepErrors) ||
  20. (pProvData->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_WVTINIT] != ERROR_SUCCESS))
  21. {
  22. return(S_FALSE);
  23. }
  24. if (!(_ISINSTRUCT(CRYPT_PROVIDER_DATA, pProvData->cbStruct, pszUsageOID)))
  25. {
  26. pProvData->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_INITPROV] = ERROR_INVALID_PARAMETER;
  27. return(S_FALSE);
  28. }
  29. HRESULT hr;
  30. GUID gAuthenticode = WINTRUST_ACTION_GENERIC_VERIFY_V2;
  31. CRYPT_PROVIDER_FUNCTIONS sAuthenticodePfns;
  32. //
  33. // fill in the Authenticode Functions
  34. //
  35. memset(&sAuthenticodePfns, 0x00, sizeof(CRYPT_PROVIDER_FUNCTIONS));
  36. sAuthenticodePfns.cbStruct = sizeof(CRYPT_PROVIDER_FUNCTIONS);
  37. if (!(WintrustLoadFunctionPointers(&gAuthenticode, &sAuthenticodePfns)))
  38. {
  39. pProvData->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_INITPROV] = TRUST_E_PROVIDER_UNKNOWN;
  40. return(S_FALSE);
  41. }
  42. hr = S_OK;
  43. if (sAuthenticodePfns.pfnInitialize)
  44. {
  45. hr = sAuthenticodePfns.pfnInitialize(pProvData);
  46. }
  47. //
  48. // assign our usage
  49. //
  50. if (pProvData->pWintrustData)
  51. {
  52. if (pProvData->pWintrustData->pPolicyCallbackData)
  53. {
  54. pProvData->pszUsageOID = (char *)pProvData->pWintrustData->pPolicyCallbackData;
  55. }
  56. }
  57. return(hr);
  58. }