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)
程式庫 Certidl.lib

另請參閱

ICertConfig

ICertPolicy

ICertPolicy2