ICertPolicy::GetDescription 方法 (certpol.h)

GetDescription 方法會傳回原則模組及其函式的人類可讀取描述。

語法

HRESULT GetDescription(
  [out] BSTR *pstrDescription
);

參數

[out] pstrDescription

描述原則模組的 BSTR 指標。

傳回值

C++

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

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

VB

傳回描述原則模組及其函式的字串。

備註

當您撰寫自定義原則模組時,請實作此方法。

範例

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

STDMETHODIMP CCertPolicy::GetDescription(
    /* [out, retval] */ BSTR __RPC_FAR *pstrDescription)
{
    if (NULL == pstrDescription)
    {
        // Bad pointer address
        return ( E_POINTER );
    }
    if (NULL != *pstrDescription)
    {
        SysFreeString(*pstrDescription);
        *pstrDescription=NULL;
    }
    // wszMyModuleDesc defined elsewhere, for example:
    // #define wszMyModuleDesc L"My Policy Module"
    *pstrDescription = SysAllocString(wszMyModuleDesc);
    if (NULL == *pstrDescription)
    {
        // Not enough memory
        return ( E_OUTOFMEMORY );
    }
    // Success
    return( S_OK );
}

規格需求

需求
最低支援的用戶端 都不支援
最低支援的伺服器 Windows Server 2003 [僅限桌面應用程式]
目標平台 Windows
標頭 certpol.h (包含 Certsrv.h)
程式庫 Certidl.lib

另請參閱

ICertPolicy

ICertPolicy2