CryptGetOIDFunctionAddress

The CryptGetOIDFunctionAddress function searches the list of registered and installed functions for an encoding type and OID match. If a registry match is found, the Dll containing the function is loaded.

#include <wincrypt.h>
BOOL WINAPI CryptGetOIDFunctionAddress(
  HCRYPTOIDFUNCSET hFuncSet,       // in
  DWORD dwEncodingType,            // in
  LPCSTR pszOID,                   // in
  DWORD dwFlags,                   // in
  void **ppvFuncAddr,              // out
  HCRYPTOIDFUNCADDR *phFuncAddr    // 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

pszOID
If the high-order word of the OID is nonzero, pszOID is a pointer to either an OID string, such as "2.5.29.1" or an ASCII string, such as "file". If the high-order word of the OID is zero, the low-order word specifies the numeric identifier to be used as the object identifier. This resulting OID maps to the function that was either installed or registered with the same OID.
dwFlags
The flag values.
Flag Name Value Description
CRYPT_GET_INSTALLED _OID_FUNC_FLAG 0x1 Search only the installed list of functions.
ppvFuncAddr
If a match is found, *ppvFuncAddr contains the function address.
phFuncAddr
If a match is found, *phFuncAddr contains the handle of the function address. The function's handle count is incremented. CryptFreeOIDFunctionAddress needs to be called to release it.

Note  By default, both the registered and installed function lists are searched. Set CRYPT_GET_INSTALLED_OID_FUNC_FLAG to search only the installed list of functions. This flag would be set by a registered function to get the address of a pre-installed function it was replacing. For example, the registered function might handle a new special case and call the pre-installed function to handle the remaining cases.

Return Values

Returns TRUE if a match is found. Returns FALSE if a match is not found.

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.