Announcement

Collapse
No announcement yet.

Retrieve fcbs setting?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tom Hanlin
    replied
    I tried that approach, but it doesn't return meaningful results under
    Windows 2000. Good to hear that you got it working for you.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Georg Potthast
    replied
    Dear Tom,

    thank you for your reply to my post. It is disappointing when you don't get a reply at all.

    Your reply inspired me to look further into it and I found that I can retrieve the size
    of the fcb area DOS makes depending on the setting of fcbs= in config.sys. From that you
    can calculate the number of fcbs.

    You could amend this program to retrieve the files=, buffers=, lastdrive= and stacks=
    setting too. Details about the dos tables used and interrupts can be found in Ralf Brown's
    interrupt list.

    This code reads the subsegment control block of the fcb area in memory. It will work from
    DOS 4.0 up. I tested it with Win98 and Dos 6.22.

    '
    Code:
    defint a-z
    cls
    
    'determine location of "invars" table calling int21/ah=52
    reg 1,&H5200
    call interrupt &H21
    
    'read location of first memory control block from "invars" table
    esseg=reg(9)
    bxreg=reg(2)
    def seg = esseg
    mcbseg = peeki(bxreg-2)
    
    'determine if MCB found
    def seg = mcbseg
    if peek(&H0)=ascii("M") then print "MCB found"
    
    'set to segment of first subsegment control block:
    def seg = mcbseg+1
    
    'loop through up to 20 subsegment control blocks to find fcb area ("X")
    for i=1 to 20
    if instr(chr$(peek(&H0)),any "DEIFXCBLS") then  'subsegment types
    	print "SubMCB found: ";
    	print chr$(peek(&H0)),peek$(&H08,8)
    end if
    if chr$(peek(&H0))="X" then  'FCB area found - X is fcb subsegment type
       fcbsize=peeki(&H03)+1     'read size of fcb area in paragraphs and add 1 for SubMCB length
       fcbsize=(fcbsize-1)*16    'determine fcb area in byte
       			     'as displayed by "mem /d /p"
       exit for                  
    else                         'read next Subsegment control block
       sbcsize=sbcsize+peeki(&H03)+1    'read and add size of SubMCB
       def seg = mcbseg +1 + sbcsize    'set segment to new SubMCB
    end if
    next i
    
    if i<20 then
    	print "FCBSIZE: ";fcbsize
    end if
    
    select case fcbsize  'these values read from the mem /d command
    	case 80
            fcbsnumber=1
            case 128
            fcbsnumber=2
            case 192
            fcbsnumber=3
            case 256
            fcbsnumber=4
    	case 304
            fcbsnumber=5
            case 368
            fcbsnumber=6
            case 432
            fcbsnumber=7
            case 480
            fcbsnumber=8
            case 544
            fcbsnumber=9
            case 608
            fcbsnumber=10
    end select
    
    print "FCBS=";fcbsnumber
    
    end
    
    '
    ------------------


    [This message has been edited by Georg Potthast (edited May 01, 2003).]

    Leave a comment:


  • Tom Hanlin
    replied
    Near as I can find, that information is not available to a DOS program
    running under Windows.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Georg Potthast
    started a topic Retrieve fcbs setting?

    Retrieve fcbs setting?

    How can you determine with a PBDos program, how many file control blocks have been set with the fcbs=x command in config.sys or config.nt. I use Win98 at the moment. When I call Int21/52, offset 1E/1F in the "Invars" table are zero. The DOS mem command displays the correct fcbs setting, however.

    Can anyone tell me where and how the setting is stored by DOS? Reading config.sys/config.nt requires locating these files which seems to be difficult with DOS.

    ------------------
Working...
X