mdbtools icon indicating copy to clipboard operation
mdbtools copied to clipboard

question: Missing bytes in Jet 4 TDEF block?

Open ReubenFrankel opened this issue 1 year ago • 1 comments

https://github.com/mdbtools/mdbtools/blob/bb83142d474ccfd03e6ab1878600063659036806/HACKING.md?plain=1#L491-L506

In this section of the Jet4 TDEF block, the definition segments don't add up to 28 bytes (24 bytes specified, 4 missing). Should there be another entry at the end like

 +-------------------------------------------------------------------------+ 
 | Iterate for the number of num_idx (28 bytes)                            | 
 +-------------------------------------------------------------------------+ 
 | ???? | 4 bytes | unknown     | matches first unknown definition block   | 
 | ???? | 4 bytes | index_num   | Number of the index                      | 
 |      |         |             |(warn: not always in the sequential order)| 
 | ???? | 4 bytes | index_num2  | Index into index cols list               | 
 | 0x00 | 1 byte  | rel_tbl_type| type of the other table in this fk       | 
 |      |         |             | (same values as index_type)              | 
 | 0xFF | 4 bytes | rel_idx_num | index number of other index in fk        | 
 |      |         |             | (or -1 if this index is not a fk)        | 
 | 0x00 | 4 bytes | rel_tbl_page| page number of other table in fk         | 
 | 0x01 | 1 byte  | cascade_ups | flag indicating if updates are cascaded  | 
 | 0x01 | 1 byte  | cascade_dels| flag indicating if deletes are cascaded  | 
 | ???? | 1 byte  | index_type  | 0x01 if index is primary, 0x02 if foreign| 
 | ???? | 4 bytes | unknown     |                                          |
 +-------------------------------------------------------------------------+ 

?

In testing an implementation of this for access-parser, I've seen the data slowly get more out-of-sync (or offset) on each index iteration, without this 4-byte "padding". I think 28 bytes is the correct size; there's just some missing bytes to account for (my knowledge of Access files is pretty limited, so I could be way off here - I'm definitely struggling with the terminology :sweat_smile:).

ReubenFrankel avatar Jan 31 '24 18:01 ReubenFrankel

See https://github.com/claroty/access_parser/pull/23/files#diff-faab64b1369f165a198b2078670f6ba364a07e5f604335c90d5afc9de56aaa31R222 for more context.

ReubenFrankel avatar Feb 03 '24 00:02 ReubenFrankel