Browse Source

Clean up mpqapi_write_hash_table

pull/88/head
Anders Jenbo 7 years ago
parent
commit
bdc8786542
  1. 21
      Source/mpqapi.cpp
  2. 2
      Source/mpqapi.h

21
Source/mpqapi.cpp

@ -684,21 +684,18 @@ BOOLEAN mpqapi_write_block_table()
return v2 && NumberOfBytesWritten == 0x8000; return v2 && NumberOfBytesWritten == 0x8000;
} }
BOOLEAN mpqapi_write_hash_table() BOOL mpqapi_write_hash_table()
{ {
int v1; // eax BOOL success;
BOOL v2; // ebx DWORD NumberOfBytesWritten;
int v3; // eax
DWORD NumberOfBytesWritten; // [esp+4h] [ebp-4h]
if (SetFilePointer(sghArchive, 32872, NULL, FILE_BEGIN) == -1) if (SetFilePointer(sghArchive, 32872, NULL, FILE_BEGIN) == -1)
return 0; return FALSE;
v1 = Hash("(hash table)", 3);
Encrypt(sgpHashTbl, 0x8000, v1); Encrypt(sgpHashTbl, 0x8000, Hash("(hash table)", 3));
v2 = WriteFile(sghArchive, sgpHashTbl, 0x8000u, &NumberOfBytesWritten, 0); success = WriteFile(sghArchive, sgpHashTbl, 0x8000, &NumberOfBytesWritten, 0);
v3 = Hash("(hash table)", 3); Decrypt(sgpHashTbl, 0x8000, Hash("(hash table)", 3));
Decrypt(sgpHashTbl, 0x8000, v3); return success && NumberOfBytesWritten == 0x8000;
return v2 && NumberOfBytesWritten == 0x8000;
} }
BOOLEAN mpqapi_can_seek() BOOLEAN mpqapi_can_seek()

2
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); void mpqapi_flush_and_close(const char *pszArchive, BOOL bFree, int dwChar);
BOOLEAN mpqapi_write_header(); BOOLEAN mpqapi_write_header();
BOOLEAN mpqapi_write_block_table(); BOOLEAN mpqapi_write_block_table();
BOOLEAN mpqapi_write_hash_table(); BOOL mpqapi_write_hash_table();
BOOLEAN mpqapi_can_seek(); BOOLEAN mpqapi_can_seek();
/* rdata */ /* rdata */

Loading…
Cancel
Save