mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-01-18 14:08:25 +01:00
+ More paratemer checking to make nitpickers happy
This commit is contained in:
@@ -725,11 +725,20 @@ bool WINAPI SFileCreateFile(
|
||||
nError = ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Check for MPQs that have invalid block table size
|
||||
// The number of files must not overflow the maximum
|
||||
// Example: size of block table: 0x41, size of hash table: 0x40
|
||||
if(nError == ERROR_SUCCESS)
|
||||
{
|
||||
if(ha->dwFileTableSize > ha->dwMaxFileCount)
|
||||
DWORD dwReservedFiles = ha->dwReservedFiles;
|
||||
|
||||
if(dwReservedFiles == 0)
|
||||
{
|
||||
dwReservedFiles += ha->dwFileFlags1 ? 1 : 0;
|
||||
dwReservedFiles += ha->dwFileFlags2 ? 1 : 0;
|
||||
dwReservedFiles += ha->dwFileFlags3 ? 1 : 0;
|
||||
}
|
||||
|
||||
if((ha->dwFileTableSize + dwReservedFiles) > ha->dwMaxFileCount)
|
||||
nError = ERROR_DISK_FULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user