Foxpro: Not a database file.

After a crash, Foxpro complained that a dbf was not a database file. Turns out this was due to an incorrect record count in the .dbf header. Bytes 04-07 in the header contain the record count and it seems that if this does not match the expected file size Foxpro complains. Calculate the correct record count and use a hex editor to alter the header.

Bytes 08-09 in the header are a pointer to the first record (Header size)
Bytes 10-11 contain the size of one record.

The record count can be calculated from this, although I was able to use LibreOffice base to open the .dbf. This does not complain if the file size does not match the record count.