ImageEnumerateCertificates Function

Debug Help Library

ImageEnumerateCertificates Function

Retrieves information about the certificates currently contained in an image file.

BOOL ImageEnumerateCertificates(
  __in          HANDLE FileHandle,
  __in          WORD TypeFilter,
  __out         PDWORD CertificateCount,
  __in_out      PDWORD Indices,
  __in_opt      DWORD IndexCount
);

Parameters

FileHandle

A handle to the image file to be examined. This handle must be opened for FILE_READ_DATA access.

TypeFilter

The certificate section type to be used as a filter when returning certificate information. CERT_SECTION_TYPE_ANY should be passed for information on all section types present in the image.

CertificateCount

A pointer to a variable that receives the number of certificates in the image containing sections of the type specified by the TypeFilter parameter. If none are found, this parameter is zero.

Indices

Optionally provides a buffer to use to return an array of indices to the certificates containing sections of the specified type. No ordering should be assumed for the index values, nor are they guaranteed to be contiguous when CERT_SECTION_TYPE_ANY is queried.

IndexCount

The size of the Indices buffer, in DWORDs. This parameter will be examined whenever Indices is present. If CertificateCount is greater than IndexCount, Indices will be filled in with the first IndexCount sections found in the image; any others will not be returned.

Return Value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError.

Remarks

The ImageEnumerateCertificates function returns information about the certificates currently contained in an image file. It has filtering capabilities which allow certificates containing sections of any single type (or of any type) to be returned.

After the indices of interesting certificates are discovered, they can be passed to the ImageGetCertificateData function to obtain the actual bodies of the certificates.

All ImageHlp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

Requirements

Client

Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0, Windows Me, Windows 98, or Windows 95.

Server

Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Header

Declared in Imagehlp.h.

Library

Use Imagehlp.lib.

DLL

Requires Imagehlp.dll.

See Also

ImageHlp FunctionsImageGetCertificateData


Send comments about this topic to Microsoft

Build date: 9/25/2007

© 2007 Microsoft Corporation. All rights reserved.