diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 5133fbe62..1429eac46 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -684,21 +684,18 @@ BOOLEAN mpqapi_write_block_table() return v2 && NumberOfBytesWritten == 0x8000; } -BOOLEAN mpqapi_write_hash_table() +BOOL mpqapi_write_hash_table() { - int v1; // eax - BOOL v2; // ebx - int v3; // eax - DWORD NumberOfBytesWritten; // [esp+4h] [ebp-4h] + BOOL success; + DWORD NumberOfBytesWritten; if (SetFilePointer(sghArchive, 32872, NULL, FILE_BEGIN) == -1) - return 0; - v1 = Hash("(hash table)", 3); - Encrypt(sgpHashTbl, 0x8000, v1); - v2 = WriteFile(sghArchive, sgpHashTbl, 0x8000u, &NumberOfBytesWritten, 0); - v3 = Hash("(hash table)", 3); - Decrypt(sgpHashTbl, 0x8000, v3); - return v2 && NumberOfBytesWritten == 0x8000; + return FALSE; + + Encrypt(sgpHashTbl, 0x8000, Hash("(hash table)", 3)); + success = WriteFile(sghArchive, sgpHashTbl, 0x8000, &NumberOfBytesWritten, 0); + Decrypt(sgpHashTbl, 0x8000, Hash("(hash table)", 3)); + return success && NumberOfBytesWritten == 0x8000; } BOOLEAN mpqapi_can_seek() diff --git a/Source/mpqapi.h b/Source/mpqapi.h index 513ebf264..b97492641 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -32,7 +32,7 @@ void mpqapi_store_modified_time(const char *pszArchive, int dwChar); void mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar); BOOLEAN mpqapi_write_header(); BOOLEAN mpqapi_write_block_table(); -BOOLEAN mpqapi_write_hash_table(); +BOOL mpqapi_write_hash_table(); BOOLEAN mpqapi_can_seek(); /* rdata */