ICertServerExit::EnumerateAttributes method

The EnumerateAttributes method returns the name of the next request attribute within the current context, then increments the internal pointer to the following attribute.

Before calling EnumerateAttributes, an application calls ICertServerExit::EnumerateAttributesSetup. When done enumerating, an application calls ICertServerExit::EnumerateAttributesClose.

Syntax


HRESULT EnumerateAttributes(
  [out] BSTR *pstrAttributeName
);

Parameters

pstrAttributeName [out]

A pointer to the enumerated attribute name.

Return value

C++

If the method succeeds, the method returns S_OK, and *pstrAttributeName is set to the BSTR that contains the name of the enumerated attribute. A value of S_FALSE is returned if the last attribute was already enumerated.

To use this method, create a variable of BSTR type, set the variable equal to NULL, and pass the address of this variable as pstrAttributeName.

When you have finished using the BSTR, free it by calling the SysFreeString function.

If the method fails, it returns an HRESULT value that indicates the error. For a list of common error codes, see Common HRESULT Values.

VB

Returns a string that contains the name of the enumerated attribute, or an empty string if the last attribute was already enumerated.

Examples


BSTR     bstrAttrib = NULL;
BSTR     bstrAttValue = NULL;
HRESULT  hr;

// Enumerate the attributes.
while (S_OK ==
    (hr = pCertServerExit->EnumerateAttributes(&bstrAttrib)))
{
  // Retrieve the attribute value.
  if (FAILED(pCertServerExit->GetRequestAttribute(
                              bstrAttrib,
                              &bstrAttValue)))
       printf("Failed GetRequestAttributes\n");
  else
       printf("Attribute: %ws\tValue: %ws\n",
               bstrAttrib,
               bstrAttValue);
}
// Determine if hr was S_FALSE, meaning the enumeration 
// was completed, or some other error.
if (S_FALSE != hr)
    printf("Failed EnumerateAttributes - %x\n", hr);
// Free BSTR resources.
if (NULL != bstrAttrib)
    SysFreeString(bstrAttrib);
if (NULL != bstrAttValue)
    SysFreeString(bstrAttValue);

Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Certif.h (include Certsrv.h)

Library

Certidl.lib

DLL

Certcli.dll

IID

IID_ICertServerExit is defined as 4BA9EB90-732C-11D0-8816-00A0C903B83C

See also

ICertServerExit
ICertServerExit::EnumerateAttributesClose
ICertServerExit::EnumerateAttributesSetup
ICertServerExit::GetRequestAttribute

 

 

Show: