Commit f87c4a36 authored by Robert van Herk's avatar Robert van Herk Committed by Alexandre Julliard

msi: Fixed MsiGetFileHashW for empty files.

parent b08f2237
......@@ -4014,6 +4014,8 @@ UINT WINAPI MsiGetFileHashW( LPCWSTR szFilePath, DWORD dwOptions,
}
length = GetFileSize( handle, NULL );
if (length)
{
mapping = CreateFileMappingW( handle, NULL, PAGE_READONLY, 0, 0, NULL );
if (mapping)
{
......@@ -4032,6 +4034,14 @@ UINT WINAPI MsiGetFileHashW( LPCWSTR szFilePath, DWORD dwOptions,
}
CloseHandle( mapping );
}
}
else
{
/* Empty file -> set hash to 0 */
memset( pHash->dwData, 0, sizeof pHash->dwData );
r = ERROR_SUCCESS;
}
CloseHandle( handle );
return r;
......
......@@ -417,6 +417,12 @@ static const struct
MSIFILEHASHINFO hash;
} hash_data[] =
{
{ "", 0,
{ HASHSIZE,
{ 0, 0, 0, 0 },
},
},
{ "abc", 0,
{ HASHSIZE,
{ 0x98500190, 0xb04fd23c, 0x7d3f96d6, 0x727fe128 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment