delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/09/12:59:12

Date: Thu, 09 Nov 2000 19:58:46 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: ad354 AT FreeNet DOT Carleton DOT CA (James Owens)
Message-Id: <2110-Thu09Nov2000195846+0200-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.8
CC: djgpp AT delorie DOT com
In-reply-to: <8uee2v$1v7$1@freenet9.carleton.ca> (ad354@FreeNet.Carleton.CA)
Subject: Re: InfoZIP vol label: force it, but please advise
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1001108090500 DOT 4601G-100000 AT is> <8ubi1t$j7k$1 AT freenet9 DOT carleton DOT ca> <1659-Wed08Nov2000195636+0200-eliz AT is DOT elta DOT co DOT il> <8uc9gb$mvn$1 AT freenet9 DOT carleton DOT ca> <9003-Thu09Nov2000002038+0200-eliz AT is DOT elta DOT co DOT il> <8uee2v$1v7$1 AT freenet9 DOT carleton DOT ca>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: ad354 AT FreeNet DOT Carleton DOT CA (James Owens)
> Newsgroups: comp.os.msdos.djgpp
> Date: 9 Nov 2000 14:58:39 GMT
> 
> Here are what seem to be the relevant bits of volumelabel():
> 
> /*---------------------------------------------------------------------------
>     If not previously labelled, write a new label.  Otherwise just rename,
>     since MS-DOS 2.x has a bug that damages the FAT when the old label is
>     deleted.
> ---------------------------------------------------------------------------*/
>         regs.h.ah = 0x17;                 /* FCB rename */
> 
>         F_intdosx(&regs, &regs, &sregs);
>         if (regs.h.al) {
>             Trace((stderr, "Unable to change volume name (AL = %x)\n",
>               regs.h.al));
>             retv = 1;
> 
> 
> F_intdosx is defined thus (for non-Watcom compilers):
> 
> #  define F_intdosx(ir,or,sr) intdosx(ir, or, sr)

Are you sure that the above definition of F_intdosx is used for DJGPP?
If so, that's the bug, right there: intdosx cannot be used in DJGPP to
call DOS functions that need pointers to buffers.  (In this case,
function 17h needs a pointer to the FCB, where the old and the new
names are stored.)  Unless the code you didn't show uses dosmemput to
copy the FCB into the transfer buffer, and loads the address of the
transfer buffer into DS:DX, this code won't work.

I suggest to rewrite this function for DJGPP as follows (you can read
the details in sections 18.2, 18.4, and 18.5 of the FAQ):

#include <dpmi.h>
#include <go32.h>
...
  __dpmi_regs r;

  dosmemput(FCB, 0x22, __tb);
  r.h.ah = 0x17;
  r.x.ds = __tb >> 4;
  r.x.dx = __tb & 15;
  __dpmi_int(0x21, &r);
  if (r.h.al) {
    Trace((stderr, "Unable to change volume name (AL = %x)\n",
           regs.h.al));
    retv = 1;

Here FCB should be the buffer where the code creates the File Control
Block (it is no doubt done somewhere in the part that you omitted),
and 0x22 is the size of the FCB that matters for this function.

WARNING: I didn't test this code, so it might be buggy.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019