共用方式為


ICertServerPolicy::SetContext 方法 (certif.h)

SetContext 方法會指定要作為憑證服務後續呼叫 內容 的要求。

語法

HRESULT SetContext(
  [in] LONG Context
);

參數

[in] Context

指定要求。 此參數必須設定為 在 的 Context 參數中傳回的相同值
ICertPolicy::VerifyRequest 方法。

傳回值

VB

如果方法成功,此方法會傳回S_OK。

如果方法失敗,它會傳回指出錯誤的 HRESULT 值。 如需常見錯誤碼的清單,請參閱 一般 HRESULT 值

言論

原則模組必須先呼叫 SetContext 方法,再呼叫任何其他 ICertServerPolicy 方法,讓介面參考有效的要求。

例子

// Set the context. The value nContext (long) would be the same
// as the context parameter in ICertPolicy::VerifyRequest.
// hr is defined as an HRESULT.
hr = pCertServerPolicy->SetContext( nContext );
if (FAILED(hr))
{
    printf("Failed SetContext [%x]\n", hr);
    goto error;
}

要求

要求 價值
最低支援的用戶端 不支援
支援的最低伺服器 Windows Server 2003 [僅限傳統型應用程式]
目標平臺 窗戶
標頭 certif.h (包括 Certsrv.h)
連結庫 Certidl.lib
DLL Certcli.dll

另請參閱

ICertPolicy::VerifyRequest

ICertServerPolicy