ImageGetCertificateData Function

Debug Help Library

ImageGetCertificateData Function

Retrieves a complete certificate from a file.

BOOL ImageGetCertificateData(
  __in          HANDLE FileHandle,
  __in          DWORD CertificateIndex,
  __out         LPWIN_CERTIFICATE Certificate,
  __in_out      PDWORD RequiredLength
);

Parameters

FileHandle

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

CertificateIndex

The index of the certificate to be returned.

Certificate

A pointer to a WIN_CERTIFICATE structure that receives the certificate data. If the buffer is not large enough to contain the structure, the function fails and the last error code is set to ERROR_INSUFFICIENT_BUFFER.

RequiredLength

On input, this parameter specifies the length of the Certificate buffer in bytes. On success, it receives the length of the certificate.

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 WIN_CERTIFICATE structure is defined as follows:

typedef struct _WIN_CERTIFICATE {
    DWORD       dwLength;
    WORD        wRevision;
    WORD        wCertificateType;   // WIN_CERT_TYPE_xxx
    BYTE        bCertificate[ANYSIZE_ARRAY];
} WIN_CERTIFICATE, *LPWIN_CERTIFICATE;

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 Functions

Send comments about this topic to Microsoft

Build date: 9/25/2007

© 2007 Microsoft Corporation. All rights reserved.