Exportar (0) Imprimir
Expandir Tudo
EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

MsiGetFileHash function

The MsiGetFileHash function takes the path to a file and returns a 128-bit hash of that file. Authoring tools may use MsiGetFileHash to obtain the file hash needed to populate the MsiFileHash table.

Windows Installer uses file hashing as a means to detect and eliminate unnecessary file copying. A file hash stored in the MsiFileHash table may be compared to a hash of an existing file on the user's computer.

Syntax


UINT MsiGetFileHash(
  _In_   LPCTSTR szFilePath,
  _In_   DWORD dwOptions,
  _Out_  PMSIFILEHASHINFO pHash
);

Parameters

szFilePath [in]

Path to file that is to be hashed.

dwOptions [in]

The value in this column must be 0. This parameter is reserved for future use.

pHash [out]

Pointer to the returned file hash information.

Return value

ValueMeaning
ERROR_SUCCESS

The function completed successfully.

ERROR_FILE_NOT_FOUND

The file does not exist.

ERROR_ACCESS_DENIED

The file could not be opened to get version information.

E_FAIL

Unexpected error has occurred.

 

Remarks

The entire 128-bit file hash is returned as four 32-bit fields. The numbering of the four fields is zero-based. The values returned by MsiGetFileHash correspond to the four fields of the MSIFILEHASHINFO structure. The first field corresponds to the HashPart1 column of the MsiFileHash table, the second field corresponds to the HashPart2 column, the third field corresponds to the HashPart3 column, and the fourth field corresponds to the HashPart4 column.

The hash information entered into the MsiFileHash table must be obtained by calling MsiGetFileHash or the FileHash method. Do not attempt to use other methods to generate the file hash.

Requirements

Version

Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003 or Windows XP. See the Windows Installer Run-Time Requirements for information about the minimum Windows service pack that is required by a Windows Installer version.

Header

Msi.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiGetFileHashW (Unicode) and MsiGetFileHashA (ANSI)

See also

MsiFileHash table
MSIFILEHASHINFO
Default File Versioning

 

 

Contribuições da comunidade

ADICIONAR
Mostrar:
© 2014 Microsoft