Metodo ICertServerExit::GetRequestAttribute (certif.h)

Il metodo GetRequestAttribute restituisce un valore di attributo denominato da una richiesta.

Prima di chiamare questo metodo, è necessario chiamare ICertServerExit::SetContext.

Sintassi

HRESULT GetRequestAttribute(
  [in]  const BSTR strAttributeName,
  [out] BSTR       *pstrAttributeValue
);

Parametri

[in] strAttributeName

Nome dell'attributo da recuperare.

[out] pstrAttributeValue

Puntatore a un valore BSTR che conterrà il valore dell'attributo.

Valore restituito

C++

Se il metodo ha esito positivo, il metodo restituisce S_OK e *pstrAttributeValue è impostato su BSTR che contiene il valore dell'attributo.

Per usare questo metodo, creare una variabile di tipo BSTR, impostare la variabile uguale a NULL e passare l'indirizzo di questa variabile come pstrAttributeValue.

Al termine dell'uso della funzione BSTR, liberarla chiamando la funzione SysFreeString .

Se il metodo ha esito negativo, restituisce un valore HRESULT che indica l'errore. Per un elenco di codici di errore comuni, vedere Valori HRESULT comuni.

VB

Il valore restituito è una stringa che rappresenta il valore dell'attributo.

Commenti

È necessario chiamare ICertServerExit::SetContext prima di usare questo metodo.

Gli attributi di richiesta seguenti sono univoci per le richieste di stile KEYGEN.

Nome proprietà Type Descrizione
Sfida Stringa Stringa di sfida che accompagna la richiesta.
ExpectedChallenge Stringa Se la stringa di sfida non è corretta, il server imposta il valore di questo attributo della richiesta alla richiesta prevista in modo che sia possibile diagnosticare l'errore.
 

Esempio

BSTR       bstrAttribValue = NULL;
HRESULT    hr;

// Get the request attribute.
// bstrAttribName is a BSTR assigned by EnumerateAttributes.
// Also, ICertServerExit::SetContext has already been
// called by pCertServerExit.
hr = pCertServerExit->GetRequestAttribute(bstrAttribName,
                                          &bstrAttribValue);

if (FAILED(hr))
{
    printf("Failed GetRequestAttribute [%x]\n", hr);
    goto error;
}
else
{

    // Successful call. Use bstrAttribValue as needed.
    // ...
}

// Done processing. Free BSTR.
if (NULL != bstrAttribValue)
    SysFreeString(bstrAttribValue);

Requisiti

Requisito Valore
Client minimo supportato Nessuno supportato
Server minimo supportato Windows Server 2003 [solo app desktop]
Piattaforma di destinazione Windows
Intestazione certif.h (include Certsrv.h)
Libreria Certidl.lib
DLL Certcli.dll

Vedi anche

ICertServerExit

ICertServerExit::SetContext