CryptGetDefaultOIDFunctionAddress

The CryptGetDefaultOIDFunctionAddress function either gets the first or next installed DEFAULT function or loads the Dll containing the DEFAULT function.

#include <wincrypt.h>
BOOL WINAPI CryptGetDefaultOIDFunctionAddress(
  HCRYPTOIDFUNCSET hFuncSet,        // in
  DWORD dwEncodingType,             // in
  LPCWSTR pwszDll,                  // in, optional
  DWORD dwFlags,                    // in
  void **ppvFuncAddr,               // out
  HCRYPTOIDFUNCADDR *phFuncAddr     // in, out
);
 

Parameters

hFuncSet
A function set handle previously obtained from a call to CryptInitOIDFunctionSet.
dwEncodingType
The type of encoding specified. Note that either a certificate or message encoding type is required. If the low-order word containing the certificate encoding type is nonzero, then it is used. Otherwise, the high-order word containing the message encoding type is used. If both are specified, the certificate encoding type in the low-order word is used.

Currently defined encoding types are shown in the following table:
Encoding type Value
None 0x00000000
CRYPT_ASN_ENCODING 0x00000001
X509_ASN_ENCODING 0x00000001
PKCS_7_ASN_ENCODING 0x00010000

pwszDll
When this parameter is NULL, a search is performed on the list of installed DEFAULT functions. Otherwise, pwszDll is the name of the Dll to load. Normally, the Dll name is obtained from the list returned by CryptGetDefaultOIDDllList.
dwFlags
The flag values. This parameter is reserved for future use and should be set to zero in the interim.
ppvFuncAddr
When this function is successful, *ppvFuncAddr is updated with the function's address.
phFuncAddr
When pwszDll is NULL, *phFuncAddr must be NULL to get the first installed function. Successive installed functions are obtained by setting *phFuncAddr to the hFuncAddr returned by the previous call. The input *phFuncAddr is always freed via a call to CryptFreeOIDFunctionAddress by this function, even if an error results.

When pwszDll is not NULL, then an attempt is made to load the Dll and the DEFAULT function. *phFuncAddr is ignored upon entry and is not freed via a call to CryptFreeOIDFunctionAddress.

When this function is successful, *phFuncAddr is updated with the function address's handle. The function's handle count is incremented. CryptFreeOIDFunctionAddress needs to be called to release it, or CryptGetOIDFunctionAddress can also be called for a NULL value of pwszDll.

Return Values

TRUE if the function succeeded. FALSE if the function failed.

Call GetLastError to see the reason for any failures.

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later. Available also in IE 3.02 and later.
  Windows: Requires Windows 98 (or Windows 95 with IE 3.02 or later).
  Windows CE: Unsupported.
  Header: Declared in wincrypt.h.
  Import Library: Use crypt32.lib.