ImageAddCertificate Function

Debug Help Library

ImageAddCertificate Function

Adds a certificate to the specified file.

BOOL ImageAddCertificate(
  __in          HANDLE FileHandle,
  __in          LPWIN_CERTIFICATE Certificate,
  __out         PDWORD Index



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


A pointer to a WIN_CERTIFICATE header and all associated sections. The Length member in the certificate header will be used to determine the length of this buffer.


A pointer to a variable that receives the index of the newly added 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.


The certificate is added at the end of the existing list of certificates and is assigned an index.

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.



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


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


Declared in Imagehlp.h.


Use Imagehlp.lib.


Requires Imagehlp.dll.

See Also

ImageHlp FunctionsImageRemoveCertificate

Send comments about this topic to Microsoft

Build date: 9/25/2007

© 2007 Microsoft Corporation. All rights reserved.