ImageGetCertificateData function (imagehlp.h)
Retrieves a complete certificate from a file.
Syntax
BOOL IMAGEAPI ImageGetCertificateData(
[in] HANDLE FileHandle,
[in] DWORD CertificateIndex,
[out] LPWIN_CERTIFICATE Certificate,
[in, out] PDWORD RequiredLength
);
Parameters
[in] FileHandle
A handle to the image file. This handle must be opened for FILE_READ_DATA access.
[in] CertificateIndex
The index of the certificate to be returned.
[out] 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.
[in, out] 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
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | imagehlp.h |
Library | Imagehlp.lib |
DLL | Imagehlp.dll |