ICertPolicy::Initialize 方法 (certpol.h)

初始化 方法由服务器引擎调用,以允许策略模块执行初始化任务。

语法

HRESULT Initialize(
  [in] const BSTR strConfig
);

参数

[in] strConfig

表示证书服务设置过程中输入的证书颁发机构的名称。 有关配置字符串名称的信息,请参阅 ICertConfig2

返回值

VB

如果方法成功,该方法将返回S_OK。

如果方法失败,它将返回一个 指示错误的 HRESULT 值。 有关常见错误代码的列表,请参阅 通用 HRESULT 值

注解

编写自定义策略模块时,请实现此方法。

示例

#include <windows.h>
#include <Certpol.h>

STDMETHODIMP CCertPolicy::Initialize(
    /* [in] */ BSTR const strConfig)
{
    // strConfig can be used by the Policy module.
    // Here, it is stored in a BSTR member variable.
    // m_strConfig is an application-defined variable.
    // Call SysFreeString to free m_strConfig when done.
    m_strConfig = SysAllocString( strConfig );
    // Check to determine whether there was enough memory.
    if (NULL == m_strConfig)
        return ( E_OUTOFMEMORY );  // Not enough memory

    return( S_OK );
}

要求

要求
最低受支持的客户端 无受支持的版本
最低受支持的服务器 Windows Server 2003 [仅限桌面应用]
目标平台 Windows
标头 certpol.h (包括 Certsrv.h)
Library Certidl.lib

另请参阅

ICertConfig

ICertPolicy

ICertPolicy2