[File] [PATCH] Magdir/database XBase index *.idx *.cdx *.dcx + dBase Printer Form *.prf; + *.DBC

Jörg Jenderek joerg.jen.der.ek at gmx.net
Mon Sep 27 17:35:45 UTC 2021


Hello,

some times ago i send patches for Xbase database with file name
extension DBF. Often there are companions. Samples with CDX and
IDX file name extension are index files and examples with PRF
extension are dBase Printer Forms.

When running running file command version 5.40 and later on such
index examples, companion databases and related files i get an output
like:

algolib.hdb:            Maple help database
COMPUTER.CDX:           Maple help database
COMPUTER.DBF:           FoxBase+/dBase III DBF,
			1000 records * 73,
			update-date 115-12-19,
			at offset 225 1st record
			"           1SuperComp54
CRYPT.CDX:              Maple help database
CRYPT.DBF:              xBase (0x6) DBF,
			3 records * 564,
			update-date 107-11-23, with index file .MDX,
			at offset 161 1st record
			"    rZ\006F    C/2z
DATA.DBF:               Clipper SIX with memo DBF,
			7 records * 55,
			update-date 96-4-29,
			at offset 193 1st record
			"Tim Johnson                   16.
dbase3float.dbf:        VISUAL OBJECTS, with memo file DBF,
			1 record * 12,
			update-date 14-11-7,
			codepage ID=0x3,
			at offset 65 1st record
			"          1"
dbase5.DBF:             dBase IV, with SQL table DBF,
			2 records * 27,
			update-date 114-10-20,
			codepage ID=0x37,
			at offset 97 1st record
			"1234567890               1 234567890ABCDE
dbase_31.dbf:           Visual FoxPro, autoincrement DBF,
			77 records * 95,
			update-date 02-8-2,
			codepage ID=0x3, with index file .MDX,
			at offset 648 1st record
			"\001"
dbase_32.dbf:           Visual FoxPro, with field type Varchar DBF,
			1 record * 252,
			update-date 12-1-29,
			codepage ID=0x3,
			at offset 360 1st record
			"Bad Meets Evil
dbase_f5.dbf:           FoxPro with memo DBF,
			975 records * 969,
			update-date 04-2-28,
			at offset 1921 1st record
			"    1hjoan-ramon          ivern
dbase_f5.fpt:           FoxPro FPT, blocks size 64,
			next free block index 566,
			field type 1, field length 2752, 1st item
			"El meu pare."
FOXPRO-DB-TEST.DBC:     Visual FoxPro DBF,
			58 records * 165,
			update-date 15-4-28,
			codepage ID=0x3,
			with index file .MDX, with memo .FPT,
			DataBaseContainer,
			at offset 552 1st record
			"\001"
INVENTRY.DBF:           dBase IV, with SQL table DBF,
			33 records * 65,
			update-date 88-7-12,
			at offset 225 1st record
			"001001WORKSTATION-ELECTRONIC OFFICE
LABEL.PRF:              data
maple-veclib.hdb:       Maple help database
mitarbei.dbf:           FoxBase DBF,
			9 records * 374,
			update-date 94-1-17,
			with index file .MDX,
			at offset 513 1st record
			"         1Davolio  Nancy    Verkaufsrepr
REPORT.PRF:             data
SCRIPTS.CDX:            Maple help database
SCRIPTS.DBF:            xBase (0xf6) DBF,
			no records * 77,
			update-date 105-6-27,
			with index file .MDX
SYLLABI2.CDX:           data
SYLLABI2.DBF:           FoxBase+/dBase III DBF,
			1 record * 3165,
			update-date 99-2-9,
			with index file .MDX,
			at offset 321 1st record
			"Windows XP Home Edition Schritt f r Schritt
SYLLABUS.CDX:           data
SYLLABUS.DBF:           FoxBase+/dBase III DBF,
			no records * 987,
			update-date 99-2-9,
			with index file .MDX
t3.DBF:                 FoxBase+/dBase III, with memo .DBT DBF,
			11 records * 139,
			update-date 00-6-12,
			at offset 193 1st record
			"One
t3.DBT:                 dBase III DBT,
			next free block index 11, 1st item
			"First memo\032\032"
t6.DBF:                 dBase IV, with memo .DBT DBF,
			10 records * 70,
			update-date 100-6-13,
			with index file .MDX,
			at offset 225 1st record
			"One       1.0000000000000000001
T6.PRF:                 StarOffice Gallery theme :\DBASE\IV\T6.txts
T6.TXT:                 data
test-memo.DBF:          dBase IV with SQL table, with memo .DBT DBF,
			3 records * 31,
			update-date 114-9-6,
			codepage ID=0x37,
			at offset 97 1st record
			"         3            11.00000          2
TEST.DBF:               FoxBase+/dBase III DBF,
			100 records * 200,
			update-date 97-8-28,
			with index file .MDX,
			at offset 386 1st record
			"Homer               Simpson             41
TEST.IDX:               Maple help database
test3memo.DBF:          dBase IV, with memo DBF,
			3 records * 31,
			update-date 114-9-6,
			codepage ID=0x37,
			at offset 97 1st record
			"            61.00000         1
TESTDATA.DCX:           Maple help database
trinity-r15-s870628.z4: Infocom (Z-machine 4,
			Release 15, Serial 870628)
ttcomp-bin-1k.bin:      data
umlaut-test-v4.dbf:     dBase IV DBF,
			7 records * 17,
			update-date 113-2-21,
			at offset 165 1st record
			"        ae               oe
umlaut-test7.dbf:       dBase V DBF,
			7 records * 17,
			update-date 113-2-21,
			at offset 165 1st record
			"        ae               oe
USER_LEV.DBF:           Visual FoxPro DBF,
			4 records * 46,
			update-date 95-4-5,
			codepage ID=0x3,
			with index file .MDX, with memo .FPT,
			at offset 392 1st record
			"     1Customer Service Rep

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html).

All HDB examples are described correctly by TrID as "Maple Help
Database" by hdb-maple.trid.xml, but it misidentifies these examples
also as "TTComp archive compressed (bin-1K)" by
ark-ttcomp-bin-1k.trid.xml. Many of the CDX examples, which are
misidentified by file command, are described correctly as "Compound
index MS Visual FoxPro 7" by cdx-vfp7.trid.xml or as "Sybase
iAnywhere index files" by sybase-ianywhere-cdx.trid.xml (See appended
cdx-trid-v.txt.gz ).

Luckily on the web site www.clicketyclick.dk which was mentioned for
Xbase Data file (*.dbf) there exist also a page cdx.html about the
Xbase Compound Index files (*.cdx). That is expressed inside
Magdir/database by additional comment lines likes:
# URL: https://www.clicketyclick.dk/databases/xbase/format/cdx.html
# Ref.:https://mark0.net/download/triddefs_xml.7z
#	defs/s/sybase-ianywhere-cdx.trid.xml
#	defs/c/cdx-vfp7.trid.xml

On that site exist an archive dbase_ex.zip with some dBASE test
examples (t6.DBF T6.TXT T6.PRF).
More test exampled can be found in Keith Morrison dbf library found at
	https://github.com/infused/dbf

Unfortunately there exist no strong significant magic pattern for
index files. So i put displaying part inside sub routine xbase-index
which starts like:
  0	name			xbase-index
  >0	ulelong		x	xBase
  !:mime	application/x-dbase-index

The byte at offset 14 contain the index options ( with typical values
like 24h E0h E8h) which are printed later by lines like:
  >14	ubyte		x		\b, index options (0x%x
  >14	ubyte		&0x01		\b, unique
  >14	ubyte		&0x08		\b, has FOR clause
  >14	ubyte		&0x10		\b, bit vector (SoftC)
  >14	ubyte		&0x20		\b, compact format
  #>14	ubyte		&0x40		\b, compound header
  >14	ubyte		&0x80		\b, structure
  >14	ubyte		x		\b)

Interesting is the value 64 (40 hexadecimal). This means Compounding
index header (FoxPro) which use CDX file name extension, whereas
"normal" index like TEST.IDX without that flag seems to use IDX
extension. So this information is shown as second part by lines like:
  >14	ubyte		&0x40			compound index
  !:ext	cdx/dcx
  >14	ubyte		^0x40			index
  !:ext	idx

I also found compound index files with DCX extension instead of CDX.
This is used for "FoxPro database index", but i do not know what is
difference.

Third information is printed by line like:
  >0	ulelong		!0x400			\b, root pointer 0x%x
This value seems to a multiple of the block size. So lowest value
seems to be 400h. This is found in most examples. So display unusual
values by above line. I found 2 examples like SYLLABI2.CDX and
SYLLABUS.CDX with value 800h and 1 example kunde.cdx with value
1C00h. The examples with higher values are not recognised by TrID
tool. So i use this as first test criterium by lines like:

  0	ulelong		0x1C00
  >0	use			xbase-index
  0	ulelong		0x0800
  >0	use			xbase-index

Next the free node node pointer is shown by line like
  >4	ulelong		!0		\b, free node pointer 0x%x
In my examples this value was 0 and value -1 (hexadecimal FFffFFff)
means empty.

Erik Bachmann documentation is not official and it is not complete.
According to page about Detecting CDX changes on foxpert web site
the next reserved field value is incremented whenever Visual FoxPro
updates the index file. So value is many cases 0 but i also found
examples with values like:
02000000h 03000000h 460c0000h 780f0000h 89000000h 9fdc0100h
According to Eric Bachman this value is the Numbers of pages in file
(for Foxbase, FoxPro 1.x). So show that information by line like:
  >8	ulelong		!0		\b, reserved counter 0x%x
But both interpretations does not looks logical for me.

  >12	uleshort	!0x000A		\b, key length 0x%x
By above line the key length is shown. For most examples this value
was 000Ah (10 decimal). This is also found in the 2 TrID definitions.
The only exception was example TEST.IDX with value 0028h.

  >15	ubyte		!0		\b, index signature 0x%x
By above line the index signature is shown for non zero values. I
only found two possible values (0 or 1). I do not know what this
exactly means. The only thing i notice is that examples with value 0
are described by TrID definition sybase-ianywhere-cdx.trid.xml and
samples with value 1 are described by TrID cdx-vfp7.trid.xml.

Afterwards til about offset 500 the area is declared as reserved.
That means filled with 0-bytes. That seems to be varying for CDX,
compressed and uncompressed IDX. So display possible unexpected
values by lines like:
  >16	quad		!0		\b, at 16 reserved 0x%llx
  >492	quad		!0		\b, at 492 reserved 0x%llx
Furthermore i use this as third test to skip misidentified Maple help
database hsum.hdb which look like CDX with 0400 root pointer by lines
like:
  0	ulelong		0x0400
  >1028	string		!version
  >>492	quad		=0
  >>>0	use		xbase-index

All PRF examples are described correctly by TrID as "dBase Print
Form" by prf-dbase.trid.xml but it misidentifies 2 of 3 examples
also as "Z-Code V4 adventure for Infocom Z-Machine" by z4.trid.xml.

On Wikipedia there exist a page about dBase DBF. In section about
other file types found in dBASE there PRF and PR2 are mentioned. That
is expressed inside Magdir/database by additional comment lines likes:
# URL:		https://en.wikipedia.org/wiki/.dbf
#		#Other_file_types_found_in_dBASE
# Reference:	https://mark0.net/download/triddefs_xml.7z
#		/defs/p/prf-dbase.trid.xml

Unfortunately there exist few file format information. So i am left
on my own observations. The PRF samples have no strong significant
magic pattern. So i translate TrID XML constructs and put displaying
part inside sub routine xbase-prf which starts like:

  0	name			xbase-prf	dBase Printer Form
  !:mime	application/x-dbase-prf
  !:ext	prf
  #>0	ubyte		x		\b, version %u
  #>2	ubyte		!0		\b, flag %u
  >3	string		>\0		\b, output file %s
  >0x48	 uquad		!0		\b, at 0x48 padding 0x%llx

All my 3 examples start with 2 byte sequence 0400. Probably this is a
version field. So value 4 corresponds with database engine version.
In this case it would be DBASE IV.

In one example T6.PRF at offset 3 a full DOS name like
E:\DBASE\IV\T6.txt was stored. Obviously this is the ASCII text
printer output file. Afterwards til offset 0x53 come some nil bytes.
I assume this padding is used for longer text file names. In 2
examples without text names this area is totally filled with nil
bytes. The byte before this name has value 1 for T6.PRF and 0 for
other examples. So probably that byte is a flag for text file name
existence.

At offset 0x56 the dBASE printer driver name ( like Generic.PR2
ASCII.PR2) is stored. So show that information by line like
  >0x56	string		>\0		\b, using printer driver %s
This seems to be significant. So i use this (printer driver name
extension PRF) as second test, which is done by lines like
  0	ubeshort	0x0400
  >0x58	search/8	.PR2
  >>0	use		xbase-prf
The first test for "version 4" is not unique enough, because it is
also true for some Xbase Index files *.ndx and Infocom (Z-machine 4)
*.z4 handled by Magdir/adventure.

The PRF samples contain many nil bytes after driver name. But some
bytes are not nil. So print such values by lines like:
  >0x2ab	ubequad	!0x100ff7f01000001	\b, at 0x2ab unknown 0x%llx
  >0x2b3	ubeshort 	!0x0042		\b, at 0x2b3 unknown 0x%4.4x
I do not know what these values mean. I guess that there information
like page size, margin sizes are encoded here.

Some database are recognized only generic like CRYPT.DBF as "xBase
(0x6) DBF" and SCRIPTS.DBF as "xBase (0xf6) DBF". These seems to be
variants for the Apollo Database Server 9.7. So i add lines like:
  >>0	ubyte		0x06	Apollo
  !:mime	application/x-dbf
  >>0	ubyte		0xF6	Apollo, with SQL table with memo
  !:mime	application/x-dbf

According to Microsoft documentation the flag byte in databases were
interpreted by lines like:
  >>>>>>>>>>>>28	ubyte&0x01	1	\b, with index file .MDX
  >>>>>>>>>>>>28	ubyte&0x02	2	\b, with memo .FPT
  >>>>>>>>>>>>28	ubyte&0x04	4	\b, DataBaseContainer

For DataBaseContainer variants DBC extension is used instead of DBF.
So i removed the last line and replaced the magic line which prints
phrase "DBF" by lines like:
  >>>>>>>>>>>>28	ubyte&0x04	=0	\b DBF
  !:ext	dbf
  >>>>>>>>>>>>28	ubyte&0x04	=4	\b DataBaseContainer
  !:ext	dbc

After applying the above mentioned modifications by patch
file-database-cdx.diff and file-database-dbf.diff then all my DBF and
index examples and Printer Form PRF are correctly identified like:

algolib.hdb:            Maple help database
COMPUTER.CDX:           xBase compound index,
			reserved counter 0x9fdc0100,
			index options (0xe0,
			compact format, structure),
			sort order 0
COMPUTER.DBF:           FoxBase+/dBase III DBF,
			1000 records * 73,
			update-date 115-12-19,
			at offset 225 1st record
			"           1SuperComp54
CRYPT.CDX:              xBase compound index,
			reserved counter 0x7000000,
			index options (0xe0,
			compact format, structure),
			sort order 0
CRYPT.DBF:              Apollo DBF,
			3 records * 564,
			update-date 107-11-23, with index file .MDX,
			at offset 161 1st record
			"    rZ\006F    C/2z
DATA.DBF:               Clipper SIX with memo DBF,
			7 records * 55,
			update-date 96-4-29,
			at offset 193 1st record
			"Tim Johnson                   16.
dbase3float.dbf:        VISUAL OBJECTS, with memo file DBF,
			1 record * 12,
			update-date 14-11-7,
			codepage ID=0x3,
			at offset 65 1st record
			"          1"
dbase5.DBF:             dBase IV, with SQL table DBF,
			2 records * 27,
			update-date 114-10-20,
			codepage ID=0x37,
			at offset 97 1st record
			"1234567890               1 234567890ABCDE
dbase_31.dbf:           Visual FoxPro, autoincrement DBF,
			77 records * 95,
			update-date 02-8-2,
			codepage ID=0x3, with index file .MDX,
			at offset 648 1st record
			"\001"
dbase_32.dbf:           Visual FoxPro, with field type Varchar DBF,
			1 record * 252,
			update-date 12-1-29,
			codepage ID=0x3,
			at offset 360 1st record
			"Bad Meets Evil
dbase_f5.dbf:           FoxPro with memo DBF,
			975 records * 969,
			update-date 04-2-28,
			at offset 1921 1st record
			"    1hjoan-ramon          ivern
dbase_f5.fpt:           FoxPro FPT, blocks size 64,
			next free block index 566,
			field type 1, field length 2752, 1st item
			"El meu pare."
FOXPRO-DB-TEST.DBC:     Visual FoxPro DataBaseContainer,
			58 records * 165,
			update-date 15-4-28,
			codepage ID=0x3,
			with index file .MDX, with memo .FPT,
			at offset 552 1st record
			"\001"
INVENTRY.DBF:           dBase IV, with SQL table DBF,
			33 records * 65,
			update-date 88-7-12,
			at offset 225 1st record
			"001001WORKSTATION-ELECTRONIC OFFICE
LABEL.PRF:              dBase Printer Form,
			using printer driver Generic.PR2,
			at 0xa8 unknown 0x03020300,
			at 0x2b6 unknown 0x23000000
maple-veclib.hdb:       Maple help database
mitarbei.dbf:           FoxBase DBF,
			9 records * 374,
			update-date 94-1-17,
			with index file .MDX,
			at offset 513 1st record
			"         1Davolio  Nancy    Verkaufsrepr
REPORT.PRF:             dBase Printer Form,
			using printer driver Generic.PR2,
			at 0xa8 unknown 0x03020100
SCRIPTS.CDX:            xBase compound index,
			index options (0xe0,
			compact format, structure),
			sort order 0
SCRIPTS.DBF:            Apollo, with SQL table with memo DBF,
			no records * 77,
			update-date 105-6-27, with index file .MDX
SYLLABI2.CDX:           xBase compound index,
			root pointer 0x800,
			reserved counter 0x89000000,
			index options (0xe0,
			compact format, structure),
			index signature 1,
			sort order 0, expression length 1
SYLLABI2.DBF:           FoxBase+/dBase III DBF,
			1 record * 3165,
			update-date 99-2-9,
			with index file .MDX,
			at offset 321 1st record
			"Windows XP Home Edition Schritt f r Schritt
SYLLABUS.CDX:           xBase compound index,
			root pointer 0x800,
			reserved counter 0x2000000,
			index options (0xe0,
			compact format, structure),
			index signature 1,
			sort order 0, expression length 1
SYLLABUS.DBF:           FoxBase+/dBase III DBF,
			no records * 987,
			update-date 99-2-9,
			with index file .MDX
t3.DBF:                 FoxBase+/dBase III, with memo .DBT DBF,
			11 records * 139,
			update-date 00-6-12,
			at offset 193 1st record
			"One
t3.DBT:                 dBase III DBT,
			next free block index 11, 1st item
			"First memo\032\032"
t6.DBF:                 dBase IV, with memo .DBT DBF,
			10 records * 70,
			update-date 100-6-13,
			with index file .MDX,
			at offset 225 1st record
			"One       1.0000000000000000001
T6.PRF:                 dBase Printer Form,
			output file E:\DBASE\IV\T6.txt,
			using printer driver ASCII.PR2,
			at 0xa8 unknown 0x03020100
T6.TXT:                 data
test-memo.DBF:          dBase IV with SQL table, with memo .DBT DBF,
			3 records * 31,
			update-date 114-9-6,
			codepage ID=0x37,
			at offset 97 1st record
			"         3            11.00000          2
TEST.DBF:               FoxBase+/dBase III DBF,
			100 records * 200,
			update-date 97-8-28,
			with index file .MDX,
			at offset 386 1st record
			"Homer               Simpson             41
TEST.IDX:               xBase index,
			reserved counter 0x3000000,
			key length 0x28,
			index options (0x24,
			compact format)
test3memo.DBF:          dBase IV, with memo DBF,
			3 records * 31,
			update-date 114-9-6,
			codepage ID=0x37,
			at offset 97 1st record
			"            61.00000         1
TESTDATA.DCX:           xBase compound index,
			index options (0xe8,
			has FOR clause, compact format, structure),
			index signature 1,
			sort order 0, expression length 1
trinity-r15-s870628.z4: Infocom (Z-machine 4,
			Release 15, Serial 870628)
ttcomp-bin-1k.bin:      data
umlaut-test-v4.dbf:     dBase IV DBF,
			7 records * 17,
			update-date 113-2-21,
			at offset 165 1st record
			"        ae               oe
umlaut-test7.dbf:       dBase V DBF,
			7 records * 17,
			update-date 113-2-21,
			at offset 165 1st record
			"        ae               oe
USER_LEV.DBF:           Visual FoxPro DBF,
			4 records * 46,
			update-date 95-4-5,
			codepage ID=0x3,
			with index file .MDX, with memo .FPT,
			at offset 392 1st record
			"     1Customer Service Rep

I hope my diff files can be applied in future version of file utility.


With best wishes
Jörg Jenderek
--
Jörg Jenderek







































-------------- next part --------------
--- file-master/magic/Magdir/database.old	2021-09-24 16:17:24.000000000 +0200
+++ file-master/magic/Magdir/database	2021-09-27 16:06:20.905967980 +0200
@@ -183,3 +183,6 @@
 # database file
->>>>>>>>>>>>0	ubyte			x		\b DBF
+>>>>>>>>>>>>28	ubyte&0x04		=0		\b DBF
+!:ext	dbf
+>>>>>>>>>>>>28	ubyte&0x04		=4		\b DataBaseContainer
+!:ext	dbc
 >>>>>>>>>>>>4	lelong			0		\b, no records
@@ -199,5 +202,6 @@
 #>>>>>>>>>>>>28	ubyte&0x01		0		\b, no index file
+# MDX or CDX index
 >>>>>>>>>>>>28	ubyte&0x01		1		\b, with index file .MDX
 >>>>>>>>>>>>28	ubyte&0x02		2		\b, with memo .FPT
->>>>>>>>>>>>28	ubyte&0x04		4		\b, DataBaseContainer
+#>>>>>>>>>>>>28	ubyte&0x04		4		\b, DataBaseContainer
 # 1st record offset + 1 = header size
@@ -243,2 +247,4 @@
 >>0	ubyte		0x02		FoxBase
+!:mime	application/x-dbf
+# like: ACCESS.DBF USER.DBF dbase3date.dbf mitarbei.dbf produkte.dbf umlaut-test-v2.dbf
 # FoxBase+/dBaseIII+, no memo
@@ -246,2 +252,3 @@
 !:mime	application/x-dbf
+# like: 92DATA.DBF MSCATLOG.DBF SYLLABI2.DBF SYLLABUS.DBF T4.DBF Teleadr.dbf us_city.dbf
 # dBASE IV no memo file
@@ -249,2 +256,3 @@
 !:mime	application/x-dbf
+# like: Quattro-test11.dbf umlaut-test-v4.dbf
 # dBASE V no memo file
@@ -252,6 +260,19 @@
 !:mime	application/x-dbf
+# like: dbase4double.dbf Quattro-test2.dbf umlaut-test7.dbf
+!:ext	dbf
+# probably Apollo Database Server 9.7? xBase (0x6)
+>>0	ubyte		0x06		Apollo
+!:mime	application/x-dbf
+# like: ALIAS.DBF CRYPT.DBF PROCS.DBF USERS.DBF
+# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
+>>0	ubyte		0x2F		FoxBase+/Dbase III plus, no memo
+!:mime	application/x-dbf
+# no example
 >>0	ubyte		0x30		Visual FoxPro
 !:mime	application/x-dbf
+# like: 26FRX.DBF 30DBC.DBF 30DBCPRO.DBF BEHINDSC.DBF USER_LEV.DBF
+# Microsoft Visual FoxPro Database Container File like: FOXPRO-DB-TEST.DBC TESTDATA.DBC TASTRADE.DBC
 >>0	ubyte		0x31		Visual FoxPro, autoincrement
 !:mime	application/x-dbf
+# like: AI_Table.DBF dbase_31.dbf w_cityFoxpro.dbf 
 # Visual FoxPro, with field type Varchar or Varbinary
@@ -259,2 +280,3 @@
 !:mime	application/x-dbf
+# like: dbase_32.dbf
 # dBASE IV SQL, no memo;dbv memo var size (Flagship)
@@ -262,5 +284,7 @@
 !:mime	application/x-dbf
-# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
-#>>0	ubyte		0x62		dBase IV, with SQL table
+# like: ASSEMBLY.DBF INVENTRY.DBF STAFF.DBF
+# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
+>>0	ubyte		0x62		dBase IV, with SQL table
 #!:mime	application/x-dbf
+# no example
 # dBASE IV, with memo!!
@@ -268,5 +292,7 @@
 !:mime	application/x-dbf
-# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
-#>>0	ubyte		0x82		dBase IV, with SQL system
+# like: test3memo.DBF dbase5.DBF
+# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
+>>0	ubyte		0x82		dBase IV, with SQL system
 #!:mime	application/x-dbf
+# no example
 # FoxBase+/dBaseIII+ with memo .DBT!
@@ -274,2 +300,3 @@
 !:mime	application/x-dbf
+# like: T2.DBF t3.DBF biblio.dbf dbase_83.dbf dbase3dbt0_4.dbf fsadress.dbf stop.dbf
 # VISUAL OBJECTS (first 1.0 versions) for the Dbase III files (NTX clipper driver); memo file
@@ -277,5 +304,7 @@
 !:mime	application/x-dbf
-# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
-#>>0	ubyte		0x8A		FoxBase+/dBase III, with memo .DBT
+# like: ACCESS.DBF dbase3date.dbf dbase3float.dbf holdings.dbf mitarbei.dbf
+# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
+>>0	ubyte		0x8A		FoxBase+/dBase III, with memo .DBT
 #!:mime	application/x-dbf
+# no example
 # dBASE IV with memo!
@@ -283,2 +312,3 @@
 !:mime	application/x-dbf
+# like: animals.dbf archive.dbf callin.dbf dbase_8b.dbf phnebook.dbf t6.dbf
 # dBase IV with SQL Table,no memo?
@@ -286,7 +316,11 @@
 !:mime	application/x-dbf
+# like: dbase5.DBF test3memo.DBF test-memo.DBF
 # .dbv and .dbt memo (Flagship)?
 >>0	ubyte		0xB3		Flagship
-# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
-#>>0	ubyte		0xCA		dBase IV with memo .DBT
+!:mime	application/x-dbf
+# no example
+# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
+>>0	ubyte		0xCA		dBase IV with memo .DBT
 #!:mime	application/x-dbf
+# no example
 # dBASE IV with SQL table, with memo .DBT
@@ -294,2 +328,3 @@
 !:mime	application/x-dbf
+# like: dbase5.DBF test3memo.DBF test-memo.DBF
 # HiPer-Six format;Clipper SIX, with SMT memo file
@@ -297,10 +332,18 @@
 !:mime	application/x-dbf
-# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
-#>>0	ubyte		0xF4		dBase IV, with SQL table, with memo
+# like: dbase5.DBF test3memo.DBF test-memo.DBF testClipper.dbf DATA.DBF
+# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
+>>0	ubyte		0xF4		dBase IV, with SQL table, with memo
 #!:mime	application/x-dbf
+# no example
 >>0	ubyte		0xF5		FoxPro with memo
 !:mime	application/x-dbf
-# https://msdn.microsoft.com/en-US/library/st4a0s68(v=vs.80).aspx
+# like: CUSTOMER.DBF FOXUSER1.DBF Invoice.DBF NG.DBF OBJSAMP.DBF dbase_f5.dbf kunde.dbf
+# probably Apollo Database Server 9.7 with SQL and memo mask? xBase (0xF6)
+>>0	ubyte		0xF6		Apollo, with SQL table with memo
+!:mime	application/x-dbf
+# like: SCRIPTS.DBF
+# https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/st4a0s68(v=vs.80)
 #>>0	ubyte		0xFA		FoxPro 2.x, with memo
 #!:mime	application/x-dbf
+# no example
 # unknown version (should not happen)
-------------- next part --------------
--- file-master/magic/Magdir/database.old	2021-09-24 16:17:24.000000000 +0200
+++ file-master/magic/Magdir/database	2021-09-27 15:49:05.468378818 +0200
@@ -456,8 +456,129 @@
 >>>520		string		>\0		\b, 1st item "%s"
 
+# Summary:	DBASE Compound Index file *.CDX and FoxPro index *.IDX
+# From:		Joerg Jenderek
+# URL:		https://www.clicketyclick.dk/databases/xbase/format/cdx.html
+#		https://www.clicketyclick.dk/databases/xbase/format/idx.html
+#		https://www.clicketyclick.dk/databases/xbase/format/idx_comp.html
+# Reference:	https://mark0.net/download/triddefs_xml.7z/defs/s/sybase-ianywhere-cdx.trid.xml
+#		https://mark0.net/download/triddefs_xml.7z/defs/c/cdx-vfp7.trid.xml
+# like: kunde.cdx
+0	ulelong		0x1C00
+>0	use			xbase-index
+# like: SYLLABI2.CDX SYLLABUS.CDX
+0	ulelong		0x0800
+>0	use			xbase-index
+# often in xBase index pointer to root node 400h
+0	ulelong		0x0400
+# skip most Maple help database *.hdb with version tag handled by ./maple
+>1028	string		!version
+# skip Maple help database hsum.hdb checking for valid reserved area
+>>492	quad		=0
+# skip remaining Maple help database *.hdb by checking key length
+#>>>12	uleshort	!0x000F			KEY_LENGTHVALID
+>>>0	use			xbase-index
+#	display information about dBase/FoxPro index
+0	name			xbase-index
+>0	ulelong		x			xBase
+!:mime	application/x-dbase-index
+>14	ubyte		&0x40			compound index
+# DCX for FoxPro database index like: TESTDATA.DCX
+!:ext	cdx/dcx
+>14	ubyte		^0x40			index
+# only 1 example like: TEST.IDX
+!:ext	idx
+# pointer to root node like: 1C00h 800h often 400h 
+>0	ulelong		!0x400			\b, root pointer %#x
+# Pointer to free node list: often 0 but -1 if not present
+>4	ulelong		!0			\b, free node pointer %#x
+# MAYBE number of pages in file (Foxbase, FoxPro 1.x) or
+# http://www.foxpert.com/foxpro/knowlbits/files/knowlbits_200708_1.HTM
+# Whenever Visual FoxPro updates the index file it increments this reserved field
+# Reserved for internal use like: 02000000h 03000000h 460c0000h 780f0000h 89000000h 9fdc0100h often 0
+>8	ulelong		!0			\b, reserved counter %#x
+# length of key like: mostly 000Ah 0028h (TEST.IDX)
+>12	uleshort	!0x000A			\b, key length %#x
+# index options like: 24h E0h E8h
+# 1~a unique index 8~index has FOR clause 32~compact index format 64~compound index header
+# 16~Bit vector (SoftC) 128~Structure index (FoxPro)
+>14	ubyte		x			\b, index options (%#x
+>14	ubyte		&0x01			\b, unique
+>14	ubyte		&0x08			\b, has FOR clause
+>14	ubyte		&0x10			\b, bit vector (SoftC)
+>14	ubyte		&0x20			\b, compact format
+#>14	ubyte		&0x40			\b, compound header
+>14	ubyte		&0x80			\b, structure
+>14	ubyte		x			\b)
+# WHAT EXACTLY IS THAT? index signature like: 0 (sybase-ianywhere-cdx.trid.xml) 1 (cdx-vfp7.trid.xml)
+>15	ubyte		!0			\b, index signature %u
+# reserved area (0-bytes) til about 500, but not for uncompressed Index files *.idx
+>16	quad		!0			\b, at 16 reserved %#llx
+>492	quad		!0			\b, at 492 reserved %#llx
+# for IDX variant
+#>14	ubyte		^0x40			IDX
+# for CDX variant
+>14	ubyte		&0x40
+# Ascending or descending: 0~ascending 1~descending
+>>502	uleshort	x			\b, sort order %u
+# Total expression length (FoxPro 2) like: 0 1
+>>504	uleshort	!0			\b, expression length %u
+# FOR expression pool length like: 1
+>>506	uleshort	!1			\b, FOR expression pool length %#x
+# reserved for internal use like: 0
+>>508	uleshort	!0			\b, at 0x508 reserved %#x
+# Key expression pool length like: 1
+>>510	uleshort	!1			\b, key expression pool length %#x
+# 512 - 1023 Key & FOR expression pool (uncompiled)
+>>512	quad		!0			\b, key expression pool %#llx
+#>>520	quad		!0			\b, key expression pool %#llx
+
+# Summary:	dBASE IV Printer Form *.PRF
+# From:		Joerg Jenderek
+# URL:		https://en.wikipedia.org/wiki/.dbf#Other_file_types_found_in_dBASE	
+# Reference:	https://mark0.net/download/triddefs_xml.7z/defs/p/prf-dbase.trid.xml
+0	ubeshort	0x0400
+# skip some Xbase Index files *.ndx and Infocom (Z-machine 4) *.z4 handled by ./adventure
+# by looking for valid printer driver name extension
+>0x58	search/8	.PR2
+>>0	use			xbase-prf
+#	display information of dbase print form like printer driver *.PR2
+0	name			xbase-prf	dBase Printer Form
+!:mime	application/x-dbase-prf
+!:ext	prf
+# MAYBE version? like: 4~DBASE IV
+#>0	ubyte		x			\b, version %u
+# MAYBE flag like: 1~with output file name 0~not
+#>2	ubyte		!0			\b, flag %u
+# optional printer text output file name like E:\DBASE\IV\T6.txt
+>3	string		>\0			\b, output file %s
+# probably padding with nils til 0x53
+#>0x48	 uquad		!0			\b, at 0x48 padding %#llx
+# dBASE IV printer driver name like: Generic.PR2 ASCII.PR2
+>0x56	string		>\0			\b, using printer driver %s
+# 2 is probably last character of previous dBASE printer driver name
+#>0x60	ubyte		!0x32			\b, at 0x60 %#x
+# probably padding with nils til 0xa8
+#>0x61	uquad		!0			\b, at 0x61 padding %#llx
+# unknown 0x03020300 0x03020100 at 0xa8
+>0xa8	ubelong 	x			\b, at 0xa8 unknown %#8.8x
+# probably padding with nils til 0x2aa
+#>0x2a0	uquad		!0			\b, at 0x2a0 padding %#llx
+# unknown 0x100ff7f01000001 at 0x2AB
+>0x2ab	ubequad		!0x100ff7f01000001	\b, at 0x2ab unknown %#llx
+# unknown 0x0042 at 0x2b3
+>0x2b3	ubeshort 	!0x0042			\b, at 0x2b3 unknown %#4.4x
+# unknown last 4 bytes at 0x2b6 like: 0 0x23
+>0x2b6	ubelong		!0			\b, at 0x2b6 unknown %#8.8x
+
 # TODO:
 # DBASE index file *.NDX
-# DBASE Compound Index file *.CDX
-# dBASE IV Printer Driver *.PRF
+# dBASE compiled Format *.FMO
+# FoxPro Database memo file *.DCT
+# FoxPro Forms Memo *.SCT
+# FoxPro Generated Menu Program *.MPR
+# FoxPro Report *.FRX
+# FoxPro Report Memo *.FRT
+# Foxpro Generated Screen Program *.SPR
+# Foxpro memo *.PJT
 ## End of XBase database stuff
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-database-dbf.diff.sig
Type: application/octet-stream
Size: 1738 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210927/06015f3a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-database-cdx.diff.sig
Type: application/octet-stream
Size: 2396 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210927/06015f3a/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdx-trid-v.txt.gz
Type: application/x-gzip
Size: 1911 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210927/06015f3a/attachment-0001.bin>


More information about the File mailing list