Code:
' Memo files contain one header record and any number of ' block structures. The size of the blocks is determined ' by the SET BLOCKSIZE command when the file is created. ' The Header record starts at file position zero and occupies ' 512 bytes. For dbase memo files, we do not use big endian ' format or a BlockSize (it is always 512). We also must set the Version field. Type DBF_MEMOHEADER_TYPE NextFreeBlock As Dword '4 ' Location of next free block (FoxPro uses Big Endian format) Reserved1 As Word '6 ' unused BlockSize As Word '8 ' Block size (0 for dBase) (Foxpro uses Big Endian format) Reserved2 As Long '12 ' unused Reserved3 As Long '16 ' unused MemVersion As Byte '17 ' Only used for dbase files (&H03) Reserved2 as asciiz * 495 ' unused End Type Type DBF_MEMOBLOCK_TYPE ' used for FoxPro memo entries Signature As Dword ' Block signature (indicates the type of data in the block) ' (uses Big Endian format) ' 0 - picture/object (picture field type) ' 1 - text (memo field type) MemoLength As Dword ' Length of memo (in bytes) (uses Big Endian format) End Type
Notice that the values are in Big Endian format. You can use the following function to make it useable for our purposes:
Code:
'// '// Swap bytes of a DWORD sized variable (Big Endian format) '// Function SwapBytesDWord (ByVal n As Long) As Dword Local p As Byte Ptr p = VarPtr(n) Swap @p[0], @p[3] Swap @p[1], @p[2] Function = n End Function
Leave a comment: