Function 58, subfunction 0 - read file/folder.
Parameters:
- eax = 58
- ebx = pointer to the information structure
Format of the information structure:
- +0: dword: 0 = subfunction number
- +4: dword: first block to read (beginning from 0)
- +8: dword: amount of blocks to read
- +12 = +0xC: dword: pointer to buffer for data
- +16 = +0x10: dword: pointer to buffer for system operations
(4096 bytes)
- +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
given in the general description
Returned value:
- eax = 0 - success, otherwise file system error code
- ebx = file size (in bytes) or -1=0xffffffff, if file was not found
Remarks:
- Block size is 512 bytes.
- This function is obsolete, for reading files use subfunction 0
of function 70, for reading folders - subfunction 1 of
function 70.
- Function can read contents of a folder. Only FAT file system is
supported. The format of FAT-folder is described
in any FAT documentation.
- Size of a folder is determined by size of FAT clusters chain.
- If file was ended before last requested block was read,
the function will read as many as it can, and after that return
eax=6 (EOF).
- Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
in the first two cases the current implementation does not follow
to the declared rules:
for /rd/1:
- if one want to read 0 blocks, function considers,
that he requested 1;
- if one requests more than 14 blocks or starting block is
not less than 14, function returns eax=5 (not found) и ebx=-1;
- size of ramdisk root folder is 14 blocks,
0x1C00=7168 байт; but function returns ebx=0
(except of the case of previous item);
- strangely enough, it is possible to read 14th block (which
generally contains a garbage - I remind, the indexing begins
from 0);
- if some block with the number not less than 14 was requested,
function returns eax=6(EOF); otherwise eax=0.
For /fd/x:
- if the start block is not less than 14, function returns
eax=5 (not found) and ebx=0;
- note that format of FAT12 allows floppies with the root size
more or less than 14 blocks;
- check for length is not performed;
- if data was successful read, function returns
eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
- The function handles reading of special folders /,/rd,/fd,/hd[n];
but the result does not correspond to expected (on operations with
normal files/folders), does not follow the declared rules,
may be changed in future versions of the kernel and consequently
is not described. To obtain the information about the equipment
use subfunction 11 of function 18 or
read corresponding folder with subfunction 1 of function 70.