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.

75 lines
2.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows NT Security
  4. // Copyright (C) Microsoft Corporation, 1997 - 1999
  5. //
  6. // File: cgou.cpp
  7. //
  8. // Contents: CryptGetObjectUrl implementation
  9. //
  10. // History: 16-Sep-97 kirtd Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <global.hxx>
  14. //+---------------------------------------------------------------------------
  15. //
  16. // Function: CryptGetObjectUrl
  17. //
  18. // Synopsis: get a locator from a CAPI object
  19. //
  20. //----------------------------------------------------------------------------
  21. BOOL WINAPI
  22. CryptGetObjectUrl (
  23. IN LPCSTR pszUrlOid,
  24. IN LPVOID pvPara,
  25. IN DWORD dwFlags,
  26. OUT OPTIONAL PCRYPT_URL_ARRAY pUrlArray,
  27. IN OUT DWORD* pcbUrlArray,
  28. OUT OPTIONAL PCRYPT_URL_INFO pUrlInfo,
  29. IN OUT OPTIONAL DWORD* pcbUrlInfo,
  30. IN OPTIONAL LPVOID pvReserved
  31. )
  32. {
  33. BOOL fResult;
  34. HCRYPTOIDFUNCADDR hGetObjectUrl;
  35. PFN_GET_OBJECT_URL_FUNC pfnGetObjectUrl;
  36. DWORD LastError;
  37. if ( CryptGetOIDFunctionAddress(
  38. hGetObjectUrlFuncSet,
  39. X509_ASN_ENCODING,
  40. pszUrlOid,
  41. 0,
  42. (LPVOID *)&pfnGetObjectUrl,
  43. &hGetObjectUrl
  44. ) == FALSE )
  45. {
  46. return( FALSE );
  47. }
  48. if ( dwFlags == 0 )
  49. {
  50. dwFlags |= CRYPT_GET_URL_FROM_PROPERTY;
  51. dwFlags |= CRYPT_GET_URL_FROM_EXTENSION;
  52. dwFlags |= CRYPT_GET_URL_FROM_UNAUTH_ATTRIBUTE;
  53. dwFlags |= CRYPT_GET_URL_FROM_AUTH_ATTRIBUTE;
  54. }
  55. fResult = ( *pfnGetObjectUrl )(
  56. pszUrlOid,
  57. pvPara,
  58. dwFlags,
  59. pUrlArray,
  60. pcbUrlArray,
  61. pUrlInfo,
  62. pcbUrlInfo,
  63. pvReserved
  64. );
  65. LastError = GetLastError();
  66. CryptFreeOIDFunctionAddress( hGetObjectUrl, 0 );
  67. SetLastError( LastError );
  68. return( fResult );
  69. }