From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?q?Rafa=C5=82_Cygnarowski?= Subject: Re: documentation for fs redirector Date: Thu, 15 Nov 2007 19:52:19 +0100 Message-ID: <200711151952.25905.zswi@pers.pl> References: <200711122300.05659.zswi@pers.pl> <200711151726.57487.zswi@pers.pl> <473C833F.7000408@sbcglobal.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart6872242.dYNCbhaFVq"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <473C833F.7000408@sbcglobal.net> Sender: linux-msdos-owner@vger.kernel.org List-Id: To: linux-msdos@vger.kernel.org --nextPart6872242.dYNCbhaFVq Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi! Dnia czwartek, 15 listopada 2007, Mike McCarty napisa=C5=82: > 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=3D112E (just before=20 quitting): if (LOW(state->eax) =3D=3D MULTIPURPOSE_OPEN /* 2E */) { u_char *stack_ch, *stack_cl; // original CX value when int21 ah=3D6c00 is called u_short in2e_fileattr =3D sda_ext_attr(sda);=20 // normally this should be enought SETWORD(&(state->ecx), out2e_result); // but I try to modify pushed CX on stack stack_ch =3D (u_char *) (Addr(state, ss, esp) - (784 + 6)); stack_cl =3D (u_char *) (Addr(state, ss, esp) - (784 + 7)); if ( ((in2e_fileattr & 0x00ff) !=3D *stack_cl) && ((in2e_fileattr & 0xff00) !=3D *stack_ch) ) { // sanity check error("Wrong stack offset for MULTIPURPOSE_OPEN!" =09 "Expected value: 0x%04x. Value on stack 0x%02x%02x\n", in2e_fileattr, *stack_ch, *stack_cl); leavedos(1); } *stack_ch =3D (out2e_result & 0xFF00) >> 16; *stack_cl =3D out2e_result & 0x00FF; } I use this program to test if CX was set correctly: #include #include #include #include #include #define u_short unsigned int #define u_char unsigned char int open2e(u_short openmode, u_short fileattr, u_short fci, char *filename,= =20 int *respond) { int __fd =3D -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 =3D res; return __fd; blad: asm mov errno, ax; return -1; } int main(void) { int fd, res; char *filename =3D "F:\\TEST.TXT"; clrscr(); fd =3D open2e(0x0042, 0x002a, 0x0001, filename, &res); if (fd =3D=3D -1) { perror("open2e"); } else { printf("2e respond: 0x%04x\n", res); printf("fd =3D=3D %d\n", fd); write(fd, "write test", 11); close(fd); } getch(); return 0; } If you need more do not hesitate to ask. Best regards, =2D-=20 Rafa=C5=82 Cygnarowski rafi@pers.pl --nextPart6872242.dYNCbhaFVq Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.5 (GNU/Linux) iD8DBQBHPJVpiTbqoF5x7W4RAlFxAJ0UPf+QDS9rMHMT009Re9ltPZ4ABQCfcrDb P4ssysWsjKiZKOu/HG2I40Q= =+Psz -----END PGP SIGNATURE----- --nextPart6872242.dYNCbhaFVq--