Mail Archives: djgpp/1999/05/31/09:09:54
On Mon, 31 May 1999, K.C. Adams wrote:
> Trying to write a little commandline utility under windows 95. I need to
> access the dos (short/8.3) filename as well as the windows LFN.
One way is simply to push "LFN=n" into the environment (e.g. by calling
`putenv' library function), then call any file-oriented function you
want. When you need the long name again, push "LFN=y" into the
environment and call the same function to get the long name.
Alternatively, you could use a special function of Interrupt 21h provided
by Windows for this (DJGPP library uses it internally when you call
`system' or `spawnXX' functions). Here's an untested fragment that should
do what you want:
__dpmi_regs r;
char short_name[FILENAME_MAX], long_name[FILENAME_MAX];
_put_path (long_name);
r.x.ax = 0x7160;
r.x.cx = 1;
r.x.ds = r.x.es = __tb / 16;
r.x.si = r.x.di = __tb & 15
__dpmi_int(0x21, &r);
if (r.x.flags & 1)
/* error return */
else
dosmemget(__tb, FILENAME_MAX, short_name);
- Raw text -