CryptCATAdminAddCatalog function (mscat.h)

[The CryptCATAdminAddCatalog function is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

The CryptCATAdminAddCatalog function adds a catalog to the catalog database. The catalog database is an index that associates file hashes with the catalogs that contain them. It is used to speed the identification of the catalogs when verifying the file signature. This function is the only supported way to programmatically add catalogs to the Windows catalog database. The function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Wintrust.dll.


HCATINFO CryptCATAdminAddCatalog(
  [in] HCATADMIN hCatAdmin,
  [in] PWSTR     pwszCatalogFile,
  [in] PWSTR     pwszSelectBaseName,
  [in] DWORD     dwFlags


[in] hCatAdmin

Handle previously assigned by the CryptCATAdminAcquireContext function.

[in] pwszCatalogFile

A pointer to a null-terminated string for the fully qualified path of the catalog to be added.

[in] pwszSelectBaseName

A pointer to a null-terminated string for the name of the catalog when it is stored. If the parameter is NULL, then a unique name will be generated for the catalog.

[in] dwFlags

If the CRYPTCAT_ADDCATALOG_HARDLINK (0x00000001) flag is specified, the catalog specified in the call will be hard-linked to rather than copied. Hard-linking instead of copying a catalog reduces the amount of disk space required by Windows.

Return value

If the function succeeds, the return value is a handle to the catalog information context. If the function fails, the return value is NULL. After you have finished using the returned handle, free it by calling the CryptCATAdminReleaseCatalogContext function.

For extended error information, call the GetLastError function. For a complete list of error codes provided by the operating system, see System Error Codes.


Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header mscat.h
Library Wintrust.lib
DLL Wintrust.dll

See also