Announcement

Collapse
No announcement yet.

Files > 2GB in DOS?

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

  • Files > 2GB in DOS?

    Does anyone know, how I can open Files > 2 GB in FreeDOS?

    By using DOS' old API-Call Int 21h-3dh, DOS stops reading by reaching 2 GB.
    After that I tried Int 21h-6Ch, byt I get DOS-Error 1: Invalid function number

    Code:
    Function iOpen4GDatei (sDtei As String * 12, ByVal bModus As Byte) As Integer
    
      Dim iDateiHandle As Local Integer, iDateiSeg As Local Integer, _
          iDateiOff As Local Integer, iErgebnis As Local Integer, _
          sDatei As Local String, bBH As Local Byte
    
      sDatei$      = Trim$(sDtei$) + CHR$(0)
      iDateiSeg% = STRSEG(sDatei$)
      iDateiOff% = STRPTR(sDatei$)
    
      bBH        = &B00010000
      '       BH =   ^654321^
    
      ! push ds                             ; Datensegment sichern
      ! push si
      ! mov ax, &h6c00                       ; Funktion Extended Open/Create
                                            '    (DOS 4.x+)
      ! mov bl, bModus                      ; bitweise kodierten Modus in B      L
      ! mov dx, iDateiOff%                  ; Offset des Dateinamens
      ! mov si, dx
      ! mov ds, iDateiSeg%                  ; Segment des Dateinamens
      ! mov bh, bBH
      ! int &h21                            ; DOS-Interrupt &h21
      ! pop si
      ! pop ds                              ; stelle Datensegment wieder her
      ! mov iDateiHandle%, ax               ; sichere Ergebnis aus ax
      ! jnc iOpenOk                         ; alles ok, dann ab zu iDelOpenOk
      iDateiHandle = iDateiHandle * (-1)    ' bei einem Fehler Wert negieren
      iOpenOk:                              ' alles ok
      Function = iDateiHandle%
    End Function
    Have I done something wrong?

    Greetings, Andy

  • #2
    Now, the Error is history...
    Code:
    Declare Function iOpen4GDatei (sDtei As String * 12, ByVal bModus As Byte _
                                  ) As Integer
    
    Function iOpen4GDatei (sDtei As String * 12, ByVal bModus As Byte) As Integer
    
      '- lokale, tempor„re Variablen definieren
      Dim iDateiHandle As Local Integer, iErgebnis As Local Integer, _
          sDatei As Local String, bBH As Local Byte, ptDatei As local String Ptr
    
      '- Variablen Initiieren
      sDatei$    = Trim$(sDtei$) + CHR$(0)
      ptDatei = StrPtr32(sDatei$)
      bBH        = &B00010000'
      '          Bit 76543210
    
      '- ”ffne sDatei
      ! push ds                             ; Datensegment sichern
      ! push si
      ! mov ax, &h6c00                        ; Funktion Extended Open/Create
                                            '     (DOS 4.x+)
      ! mov bl, bModus                      ; bitweise kodierten Modus in B        L
      ! mov bh, bBH
      ! mov dx, &B0000000000000001          ; öffne existierende Datei
      ! lds si, ptDatei
      ! int &h21                            ; DOS-Interrupt &h21
      ! pop si
      ! pop ds                              ; stelle Datensegment wieder her
      ! mov iDateiHandle%, ax               ; sichere Ergebnis aus ax
      ! jnc iOpen4GOk                       ; alles ok, dann ab zu iOpen4GOk
      iDateiHandle = iDateiHandle * (-1)    ' bei einem Fehler Wert negieren
      iOpen4GOk:                            ' alles ak, also...
      Function = iDateiHandle%              ' übergebe das Funtionsergebnis
    
    End Function
    But reading from a file via int 21h,3f00h stops at 2 GB.
    Moving the filepointer to the end of the file works fine...
    Curious behavior in todays times...

    Comment


    • #3
      Curious behavior in todays times...
      How so? 2GB is many times the size of whole drives back in DOS era. Even FAT32 (right at end of DOS) was limited to 4GB per file. FAT16 max file size is 2GB (without tricks).
      Dale

      Comment


      • #4
        I find it interesting, because my FreeDos runs under Linux in DosEmu, opens a huge 3 GB file and can move the filepointer to its real endpoint of about 3 GB. Why is DOS able to move the filepointer but can not read or write from that point of fileposition...?

        Ok, the reason is clear for me; MS wanted to promote Windows an not DOS and Users should only use the colourful desktop, klicking lucky around...

        I hoped it would be possible to find a way to do "big data" in DOS, but it seems to get a kind of "limited data"...

        Comment


        • #5
          does anyone know, how I can open Files > 2 GB in FreeDOS?
          Apparently you can "open" it just fine, you just cannot read beyond offset 2 GB

          Your ability to read data at any particular offset in a file for any particular length is one hundred percent based on the reading tool in use.

          You don't specify what tool you are using but Post #2 shows the syntax for PB for Windows and you seem happy with what it is doing.

          But if this application is actually running under Windows ( > 16-bit) I'd probably write a simple little program in PB/Windows to access the file and SHELL it (from my DOS program?) and have it return your file data.


          Curious behavior in todays times.
          Really? This is the ;pot calling the kettle black. Trying to make anything work under any form of 16-bit DOS is what is curious.

          This thread is screaming at me to "Sell an upgrade!"

          MCM

          Comment


          • #6
            Hehe,

            ok, that is another point of view I mentioned less...
            Writing Programs in PBDOS 3.5 might seem corious today...

            Ok, too: Yes I can open it well, sorry. But I hoped, It would be possible to read too. Because there is support for long filenames in FreeDos under DosEmu in Linux (both, 32 ans 64 bit).
            And I like what I am able to do in PBDOS 3.5 in DosEmu and DosBox.
            And DosBox runs under four important OSes: Windows, MacOS, Android an Linux. So, it is a kind of "retro-multiplatform"-programming, what I am doing here...

            Hope is that much important in life. And so I hope that one day I will find the way to read files <= 4 GB.

            Ehen I have found it, I will post it here...

            Comment


            • #7
              If you are writing in PB/.DOS and running under Windows, I KNOW a PB-DOS program can successfully SHELL to a 32-bit program and read that file. You might do something like this in in your DOS program..

              Code:
              File$ = "Filename"
              Offset$ = LTRIM$(STR$(offset&))
              readSize$ = LTRIM$(STR$(recordSize&)
              
              SHELL "my32BitProgram " & File$ * " " & Offset$ & " " & ReadSize$
              You have any number of options to get back the record, including STDIN (requires change to SHELL syntax) and your Win/32 program will have no problems at all reading a file of any size, although you may need to change the call params to send the low and high DWORDs of a QUAD offset separately.

              That's really about the best I can do with incomplete information. (Or for free).

              But I;'d still suggest the best course of action would be to "Sell the client an upgrade"

              MCM

              Comment


              • #8
                Ups, I write my Programs in DosEmu and DosBox under Linux:
                Originally posted by Andy Dee View Post
                Because there is support for long filenames in FreeDos under DosEmu in Linux (both, 32 ans 64 bit).
                And I like what I am able to do in PBDOS 3.5 in DosEmu and DosBox.
                And DosBox runs under four important OSes: Windows, MacOS, Android an Linux. So, it is a kind of "retro-multiplatform"-programming, what I am doing here...
                DosEmu is an Emulator for DOS-Systems under Linux.
                I use some Win32 Progs (i.e. abc95.exe) running via wine32, because they do not run under wine64.

                But running my Program in DosBox on ANY OS, it is impossible to call a win32-program in this 16-Bit "Box for DOS". There, only the 16-bit-part runs: alike "This Program can not be run in Dos Mode"...

                Thanks a lot for your help and energy to my curious project...

                Andy

                Comment


                • #9
                  By falling asleep, your words pass my world an helped me finding the solution:

                  In DosEmu one can call Linux-Commands out of DOS by using the program "unix.exe". That combined withe the ability of PBs shell-command lets me cut bigger files into <= 2gb-peaces, which then can be opened as several parts of one file...

                  Since my program identifies, if it runs under DosEmu or DosBox/plain DOS, it can give the user special OS-dependent abilities.

                  Many thanks to this so easy solution...! :-)

                  Comment

                  Working...
                  X