大网数据广告活动
账户与安全

Creating the New Functionality

· 52CE 我爱测

The following functions are among the CryptoAPI functions that can be extended.

The following functions are among the CryptoAPI functions that can be extended.

CryptoAPI function OID function name define OID function name string
CryptEncodeObject CRYPT_OID_ENCODE_ OBJECT_FUNC "CryptDllEncodeObject"
CryptDecodeObject CRYPT_OID_DECODE_ OBJECT_FUNC "CryptDllDecodeObject"
CertOpenStore CRYPT_OID_OPEN_ STORE_PROV_FUNC "CertDllOpenStoreProv"
CertVerifyCTLUsage CRYPT_OID_VERIFY_ CTL_USAGE_FUNC "CertDllVerifyCTLUsage"
CertVerifyRevocation CRYPT_OID_VERIFY_ REVOCATION_FUNC "CertDllVerifyRevocation"

In normal use with an existing OID and encoding type, the code in the CryptoAPI function, itself, is used. If one of these functions is called with an OID and encoding type that code in the CryptoAPI function was not designed to handle, a new function, containing the new functionality, must be created in a DLL. That DLL must be registered in the registry or installed in memory.

When one of the listed functions is called with the newly designated OID and encoding type, the code in the new DLL is used rather than the code provided as part of the CryptoAPI function.

The name of the newly developed function can be the name listed under "OID function name string" in the previous table or a different name can be given when the new function code is registered.

The new function must use an appropriate prototype. In all cases except for CertOpenStore, this prototype is the same as the CryptoAPI function that calls the new function. In the case of CertOpenStore the prototype is as follows.

#include <windows.h>

BOOL WINAPI CertDllOpenStoreProv(
  IN LPCSTR lpszStoreProvider,
  IN DWORD dwEncodingType,
  IN HCRYPTPROV hCryptProv,
  IN DWORD dwFlags,
  IN const void *pvPara,
  IN HCERTSTORE hCertStore,
  IN OUT PCERT_STORE_PROV_INFO pStoreProvInfo
);

Note:
If the prototypes do not match, the system stack will be corrupted.

In addition to providing the code for the new function in a DLL, extending the functionality of CryptEncodeObject or CryptDecodeObject requires a type definition for the new C data structure to be placed in a header file included when the user's program is compiled.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。