Re: [Freedos-kernel] CONFIG.C ANNOYANCE

2004-06-24 Thread Arkady V.Belousov
Hi!

23-Июн-2004 20:13 [EMAIL PROTECTED] (tom ehlert) wrote to
[EMAIL PROTECTED]:

te> I'M HIGHLY DISAPPOINTED TO FIND THAT SOME FORMERLY
te> WORKING CODE DOESN'T WORK ANYMORE;

 ?! All work, (now) I test code before reporting.

te> I'M IN PARTICULAR DISAPPOINTED AS
te> THIS CODE WAS ONLY CHANGED TO SAVE SOME 20 BYTE OF INIT CODE.

 Who says about "save some bytes"?! YES! Executable _also_ reduced (for
example, now kernel.sys after OW is shorter by 1.3k, but some of this
reduction is part of resident code reduction), but all what I report here
before is report about BUGFIXES, FIXES and ENHANCEMENTS!

 Wel, new portion of changes:

__O\_/_\_/O__
config.c

- when tracing, Esc now turns off asks for following lines with "?" and
  assumes "Y" for all; F8 now behaves similar to Esc.

main.c

- kernel(): now "/D" or "/Y" option inserted even if command line is too
  long (by trimming command line tail).

task.c

! P_0(): old shell command line stored in SecPathName buffer and, thus, will
  be overwritten by DOS rename function with argument, longer than 50 bytes.

- bugfix: P_0() was copy argument of SHELL line into Shell buffer without
  checking length of source (NOTE: max length of SHELL argument is a 74
  bytes, because Shell=SecPathName+50 and sizeof SecPathName=128).
- P_0(): now supported command line without space between command and
  options (starting from '/').
_
  O/~\ /~\O

My near TODO is to:

- detect redefinition of env variables (and replace definition).
- add environment before each INSTALL=.

BTW, because SET processed with INSTALL= in one pass, now possible to
redefine variables between INSTALL= (unlike MS-DOS, which parses all SET
before INSTALL=).




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] VERSION= issue

2004-06-24 Thread Arkady V.Belousov
Hi!

 MS-DEBUG doesn't runs from FD because "Incorrect DOS version". Setting
required through VERSION= doesn't helps. Analyzing of inthndlr.c shows, that
os_major and os_minor returned only through INT21/3306, for INT21/30 used
os_setver_*. Is this bug (in config.c:sysVersion(), which not sets
os_setver_*)?




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] CONFIG.C ANNOYANCE

2004-06-24 Thread Arkady V.Belousov
Hi!

24-Июн-2004 19:36 Arkady V.Belousov wrote to
[EMAIL PROTECTED]:

AVB> My near TODO is to:
AVB> - detect redefinition of env variables (and replace definition).
AVB> - add environment before each INSTALL=.

 BTW, forget to mention. Some years ago I report about BUG in
ChildEnv(), which wrongly handles empty environment. And, yes, this is easy
to see: run some program through INSTALL= (in current FD) and review its
environment.




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] VERSION= issue

2004-06-24 Thread tom ehlert
Hello Arkady,

>  MS-DEBUG doesn't runs from FD because "Incorrect DOS version". Setting
> required through VERSION= doesn't helps. Analyzing of inthndlr.c shows, that
> os_major and os_minor returned only through INT21/3306, for INT21/30 used
> os_setver_*. Is this bug (in config.c:sysVersion(), which not sets
> os_setver_*)?

RBIL:
INT 21 - DOS 5+ - GET TRUE VERSION NUMBER

AX = 3306h
Return: BL = major version
BH = minor version
DL = revision (bits 2-0, all others 0)
DH = version flags
bit 3: DOS is in ROM
bit 4: DOS is in HMA
AL = FFh if true DOS version < 5.0
Notes:  this function always returns the true version number, unlike AH=30h,
  whose return value may be changed with SETVER
because of the conflict from the CBIS redirector (see next
  entry), programs should check whether BH is less than 100 (64h)
  and BL is at least 5 before accepting the returned BX as the true
  version number; however, even this is not entirely reliable when
  that redirector is loaded
fully reentrant


the only bug here: FD 21/3306 isn't reentrant

BTW: debug call int21/30 only.

tom











---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] VERSION= issue

2004-06-24 Thread Arkady V.Belousov
Hi!

 Eric Auer suggests, that VERSION= should change os_setver_m*, not
os_m*. What you think? Is there is bug in current FD and Eric's suggestion
is patch for this?




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] VERSION= behavior

2004-06-24 Thread Arkady V.Belousov
Hi!

 BTW, Eric says, that RBIL describes INT2F/122F functions, which (also)
sets returned DOS version. Currently FD not implements this functio (says
error for it on screen), but implements (similar) INT21/33FC. Should I
_re_define INT21/33FC as INT2F/122F?




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] VERSION= issue

2004-06-24 Thread Arkady V.Belousov
Hi!

24-Июн-2004 18:35 [EMAIL PROTECTED] (tom ehlert) wrote to "Arkady V.Belousov"
<[EMAIL PROTECTED]>:

>>  MS-DEBUG doesn't runs from FD because "Incorrect DOS version". Setting
>> required through VERSION= doesn't helps. Analyzing of inthndlr.c shows, that
>> os_major and os_minor returned only through INT21/3306, for INT21/30 used
>> os_setver_*. Is this bug (in config.c:sysVersion(), which not sets
>> os_setver_*)?
te> RBIL:
te> INT 21 - DOS 5+ - GET TRUE VERSION NUMBER
te> AX = 3306h
te> the only bug here: FD 21/3306 isn't reentrant
te> BTW: debug call int21/30 only.

 tom, I understand that debug call INT21/30 and this is why in current
FD VERSION= doesn't helps to run it. I ask: is there are some hidden reasons
to not _initialize_ os_setver_major and os_setver_minor for VERSION= in
config.c:sysVersion() to same values, as os_major and os_minor?

PS: BTW, main.c:init_kernel() initializes both os_m* and os_setver_*; even
with VERSION= FreeCOM VER/R returns 7.10.




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] PATCH: nls.c

2004-06-24 Thread Eduardo Casino
Hi,

Trivial patch. Pass correct values for codepage and country from DOS-38
and DOS-65-XX functions to MUX-14 functions.

Eduardo.

diff -uNrp ke2035.orig/kernel/nls.c ke2035/kernel/nls.c
--- ke2035.orig/kernel/nls.c2004-06-24 22:41:18.0 +0200
+++ ke2035/kernel/nls.c 2004-06-24 22:15:52.0 +0200
@@ -520,8 +520,8 @@ COUNT DosGetData(int subfct, UWORD cp, U
direct-access flag is disabled, the request must
be passed through MUX */
 return (subfct == NLS_DOS_38)
-? mux38(nls->cp, nls->cntry, bufsize, buf)
-: mux65(subfct, nls->cp, nls->cntry, bufsize, buf);
+? mux38(cp, cntry, bufsize, buf)
+: mux65(subfct, cp, cntry, bufsize, buf);
   }
 
   /* Direct access to the data */




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


[Freedos-kernel] PATCH: inthndlr.c

2004-06-24 Thread Eduardo Casino
Hi!

I'm implementing NLSFUNC for FreeDOS and I've found that many (most) of
the needed MUX functions are missing.

This patch implements functions 2F1226h to 2F1229h. This, together with
my previous nls.c patch, allowed me to make a first working
implementation of NLSFUNC's int 2F1404h, but the patch looks so simple
that I must have done something wrong :)  so, kernel guys, please, have
a look at it. It is mainly cut'n'paste from int21_service()

Eduardo.


diff -uNrp ke2035.orig/kernel/inthndlr.c ke2035/kernel/inthndlr.c
--- ke2035.orig/kernel/inthndlr.c   2004-06-24 22:41:20.0 +0200
+++ ke2035/kernel/inthndlr.c2004-06-24 22:41:09.0 +0200
@@ -1656,6 +1656,9 @@ struct int2f12regs {
  */
 VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
 {
+  COUNT rc;
+  long lrc;
+
   if (r.AH == 0x4a)
   {
 size_t size = 0, offs = 0x;
@@ -1869,6 +1875,42 @@ VOID ASMCFUNC int2F_12_handler(struct in
   r.CX = fstrlen(MK_FP(r.DS, r.SI)) + 1;
   break;
 
+case 0x26: /* open file */
+  r.FLAGS &= ~FLG_CARRY;
+  CritErrCode = SUCCESS;
+  lrc = DosOpen(MK_FP(r.DS, r.DX), O_LEGACY | O_OPEN | r.CL, 0);
+  goto long_check;
+
+case 0x27: /* close file */
+  r.FLAGS &= ~FLG_CARRY;
+  CritErrCode = SUCCESS;
+  rc = DosClose(r.BX);
+  goto short_check;
+
+case 0x28: /* move file pointer */
+  r.FLAGS &= ~FLG_CARRY;
+  CritErrCode = SUCCESS;
+  r.BP &= 0x00ff;
+  if (r.BP > 2)
+goto error_invalid;
+  lrc = DosSeek(r.BX, (LONG)ULONG) (r.CX)) << 16) | r.DX),
r.BP);
+  if (lrc == -1)
+  {
+lrc = DE_INVLDHNDL;
+  }
+  else
+  {
+r.DX = (UWORD)(lrc >> 16);
+lrc = (UWORD) lrc;
+  }
+  goto long_check;
+
+case 0x29: /* read from file */
+  r.FLAGS &= ~FLG_CARRY;
+  CritErrCode = SUCCESS;
+  lrc = DosRead(r.BX, r.CX, MK_FP(r.DS, r.DX));
+  goto long_check;
+
 case 0x2a: /* Set FastOpen but does nothing. */
 
   r.FLAGS &= ~FLG_CARRY;
@@ -1897,6 +1939,26 @@ VOID ASMCFUNC int2F_12_handler(struct in
 r.FLAGS |= FLG_CARRY;
   }
   }
+  goto real_exit;
+long_check:
+  if (lrc >= SUCCESS)
+  {
+r.AX = (UWORD)lrc;
+goto real_exit;
+  }
+  rc = (int)lrc;
+short_check:
+  if (rc < SUCCESS)
+goto error_exit;
+  goto real_exit;
+error_invalid:
+  rc = DE_INVLDFUNC;
+error_exit:
+  r.AX = -rc;
+  if (CritErrCode == SUCCESS)
+CritErrCode = r.AX;  /* Maybe set */
+  r.FLAGS |= FLG_CARRY;
+real_exit:;
 }
 
 /*




---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel


Re: [Freedos-kernel] PATCH: nls.c

2004-06-24 Thread Steffen Kaiser
On Fri, 25 Jun 2004, Eduardo Casino wrote:
Trivial patch. Pass correct values for codepage and country from DOS-38
and DOS-65-XX functions to MUX-14 functions.
I would actually suggest the following function, as searchPackage is to 
resolve the default values as well; otherwise your patch breaks the 
possibility of non-direct (MUX-only) country data, which in turn breaks 
the whole current NLS design, which would make it better to replace all 
the code. Latter would be better, I guess, anyway.

COUNT DosGetData(int subfct, UWORD cp, UWORD cntry, UWORD bufsize,
 VOID FAR * buf)
{
  struct nlsPackage FAR *nls;   /* NLS package to use to return the info 
from */

  log(("NLS: GetData(): subfct=%x, cp=%u, cntry=%u, bufsize=%u\n",
   subfct, cp, cntry, bufsize));
  if (!buf || !bufsize)
return DE_INVLDDATA;
  if (subfct == 0)  /* Currently not supported */
return DE_INVLDFUNC;
  /* nls := NLS package of cntry/codepage */
  if ((nls = searchPackage(cp, cntry)) != NULL) {
/* matching NLS package found */
if((nls->flags & NLS_FLAG_DIRECT_GETDATA) != 0)
  /* Direct access to the data */
  return nlsGetData(nls, subfct, buf, bufsize);
cp = nls->cp;
cntry = nls->cntry;
  }
/* If the NLS pkg is not loaded into memory or the
   direct-access flag is disabled, the request must
   be passed through MUX */
  return (subfct == NLS_DOS_38)
? mux38(cp, cntry, bufsize, buf)
: mux65(subfct, cp, cntry, bufsize, buf);
}
--
Steffen Kaiser
---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel