Export (0) Print
Expand All

ImageGetCertificateData function

Retrieves a complete certificate from a file.

Syntax


BOOL ImageGetCertificateData(
  _In_     HANDLE FileHandle,
  _In_     DWORD CertificateIndex,
  _Out_    LPWIN_CERTIFICATE Certificate,
  _Inout_  PDWORD RequiredLength
);

Parameters

FileHandle [in]

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

CertificateIndex [in]

The index of the certificate to be returned.

Certificate [out]

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 [in, out]

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

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Imagehlp.h

Library

Imagehlp.lib

DLL

Imagehlp.dll

See also

ImageHlp Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft