From: "Rafał Cygnarowski" <zswi@pers.pl>
To: linux-msdos@vger.kernel.org
Subject: Re: documentation for fs redirector
Date: Thu, 15 Nov 2007 19:52:19 +0100 [thread overview]
Message-ID: <200711151952.25905.zswi@pers.pl> (raw)
In-Reply-To: <473C833F.7000408@sbcglobal.net>
[-- Attachment #1: Type: text/plain, Size: 3130 bytes --]
Hi!
Dnia czwartek, 15 listopada 2007, Mike McCarty napisał:
> Without actually seeing the defective code from DOS and your
> attempted workaround, it's impossible to tell. I am an old hand
> at MSDOS and assembler, though not much with the undocumented
> I/Fs. However, if you want you can shoot me some code and I'll
> have a look. Perhaps we can work this out via e-mail.
>
> A TSR may not be able to do what you want, unless it is rather
> "smart". CX may be clobbered so far up that there's no way
> for you to fix it, except in a DOS version specific manner,
> if at all. One possibility is to patch DOS at install. IOW,
> find the defective code, and patch over it, possibly jumping
> out into your own code in a couple of places. It may not be
> possible to fix this w/o clobbering something else that DOS needs,
> so the patches might be significant. IOW, you might need to
> trap multiple interrupt vectors and save information for more
> than one level of DOS, along with flags indicating what was
> taking place at the time CX got clobbered, and restore the
> values the various levels of DOS need.
This is fragment of dosemu code called after int2f AX=112E (just before
quitting):
if (LOW(state->eax) == MULTIPURPOSE_OPEN /* 2E */) {
u_char *stack_ch, *stack_cl;
// original CX value when int21 ah=6c00 is called
u_short in2e_fileattr = sda_ext_attr(sda);
// normally this should be enought
SETWORD(&(state->ecx), out2e_result);
// but I try to modify pushed CX on stack
stack_ch = (u_char *) (Addr(state, ss, esp) - (784 + 6));
stack_cl = (u_char *) (Addr(state, ss, esp) - (784 + 7));
if (
((in2e_fileattr & 0x00ff) != *stack_cl) &&
((in2e_fileattr & 0xff00) != *stack_ch)
) {
// sanity check
error("Wrong stack offset for MULTIPURPOSE_OPEN!"
"Expected value: 0x%04x. Value on stack 0x%02x%02x\n",
in2e_fileattr, *stack_ch, *stack_cl);
leavedos(1);
}
*stack_ch = (out2e_result & 0xFF00) >> 16;
*stack_cl = out2e_result & 0x00FF;
}
I use this program to test if CX was set correctly:
#include <stdio.h>
#include <io.h>
#include <dos.h>
#include <conio.h>
#include <errno.h>
#define u_short unsigned int
#define u_char unsigned char
int open2e(u_short openmode, u_short fileattr, u_short fci, char *filename,
int *respond)
{
int __fd = -1, res;
asm {
mov ax, 0x6c00
mov bx, openmode
mov cx, fileattr
mov dx, fci
mov si, filename
int 0x21
jc blad
}
asm mov res, cx;
asm mov __fd, ax;
*respond = res;
return __fd;
blad:
asm mov errno, ax;
return -1;
}
int main(void)
{
int fd, res;
char *filename = "F:\\TEST.TXT";
clrscr();
fd = open2e(0x0042, 0x002a, 0x0001, filename, &res);
if (fd == -1) {
perror("open2e");
} else {
printf("2e respond: 0x%04x\n", res);
printf("fd == %d\n", fd);
write(fd, "write test", 11);
close(fd);
}
getch();
return 0;
}
If you need more do not hesitate to ask.
Best regards,
--
Rafał Cygnarowski
rafi@pers.pl
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2007-11-15 18:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-12 22:00 documentation for fs redirector Rafał Cygnarowski
2007-11-12 22:51 ` Bart Oldeman
2007-11-15 16:26 ` Rafał Cygnarowski
2007-11-15 17:34 ` Mike McCarty
2007-11-15 18:52 ` Rafał Cygnarowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200711151952.25905.zswi@pers.pl \
--to=zswi@pers.pl \
--cc=linux-msdos@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.