Mod settings file format
mod-settings.dat is a binary stream file format. The data is read from start of file until there is no more data. If there is no data and you are at a point where there should be data then the file is malformed. If you're at a point when you expect no more data but there is data then the file is malformed.
A C# example on how to parse the file format can be found here: https://forums.factorio.com/59851
The file format
The first 8 bytes are the version of the game the file was created in. After these 8 bytes there is one bool (1 byte), always set to false.
Next is a single Property tree