Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  As mentioned several times in this chapter, file control blocks and the
  DOS functions that use them are obsolete. We recommend that you use the
  handle-based file I/O functions introduced in DOS version 2.0 and
  described in the next chapter. Usually, the only reason to concern
  yourself with FCBs is when compatibility with DOS version 1 is an issue.

  With that in mind, let's take a look at the structure of the FCB. The
  usual FCB is a 37-byte data structure that contains a variety of
  information DOS can use to control file input/output. (See Figure 16-3.)
  A 44-byte, extended FCB is also used in some DOS functions: 7 extra bytes
  are tacked onto the beginning of the usual FCB data structure. (See Figure
  16-4.)

  The situation with the FCB extension is more than a little peculiar. The
  extension is used only when you work with the attribute field in a
  directory entry in which read-only files, hidden files, system files,
  volume labels, and subdirectories are identified. In general, you need to
  use extended FCBs only if you are performing directory searches or
  otherwise working with directory entries rather than the contents of
  files. However, all FCB-based functions recognize the extended FCB format
  if you should choose to use it.

  Offset             Field Width       Description
  --------------------------------------------------------------------------
  00H                1                 Drive identifier
  01H                8                 Filename
  09H                3                 File extension
  0CH                2                 Current-block number
  0EH                2                 Record size in bytes
  10H                4                 File size in bytes
  14H                2                 Date
  16H                2                 Time
  18H                8                 (Reserved)
  20H                1
Only the low-order 7 bits are used.
                Current-record number
  21H                4                 Random-record number
  --------------------------------------------------------------------------

  Figure 16-3.  Structure of a file control block.

  Offset             Field Width       Description
  --------------------------------------------------------------------------
  00H                1                 Extended FCB flag (always FFH)
  01H                5                 (Reserved)
  06H                1                 Attribute
  07H                1                 Drive identifier
  08H                8                 Filename
  10H                3                 File extension
  13H                2                 Current-block number
  15H                2                 Record size in bytes
  17H                4                 File size in bytes
  1BH                2                 Date
  1DH                2                 Time
  1FH                8                 (Reserved)
  27H                1
Only the low-order 7 bits are used.
                Current-record number
  28H                4                 Random-record number
  --------------------------------------------------------------------------

  Figure 16-4.  Structure of an extended file control block. The first three
  fields distinguish this data structure from a normal FCB.

  With two exceptions, all fields in an extended FCB are identical to those
  in a normal FCB. Only the offsets are different: In an extended FCB, the
  offset of a particular field is 7 bytes greater than the offset of the
  same field in a normal FCB.

  The following sections describe the fields in normal extended FCBs.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson