⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newstuff.c

📁 GNU FreeDOS兼容MS DOS很好的东东.
💻 C
📖 第 1 页 / 共 2 页
字号:
  tn_printf(("CDS entry: #%u @%p (%u) '%S'\n", result, cdsEntry,            cdsEntry->cdsBackslashOffset, cdsEntry->cdsCurrentPath));  /* is the current_ldt thing necessary for compatibly??     -- 2001/09/03 ska*/  current_ldt = cdsEntry;  if (cdsEntry->cdsFlags & CDSNETWDRV)    result |= IS_NETWORK;    dhp = IsDevice(src);  if (dhp)    result |= IS_DEVICE;  /* Try if the Network redirector wants to do it */  dest[0] = '\0';		/* better probable for sanity check below --                                   included by original truename() */  /* MUX succeeded and really something */  if (QRemote_Fn(dest, src) == SUCCESS && dest[0] != '\0')  {    tn_printf(("QRemoteFn() returned: \"%S\"\n", dest));#ifdef DEBUG_TRUENAME    if (strlen(dest) >= SFTMAX)      panic("Truename: QRemote_Fn() overflowed output buffer");#endif    if (dest[2] == '/' && (result & IS_DEVICE))      result &= ~IS_NETWORK;    return result;  }  /* Redirector interface failed --> proceed with local mapper */  dest[0] = drNrToLetter(result & 0x1f);  dest[1] = ':';  /* Do we have a drive? */  if (src[1] == ':')    src += 2;/*    Code repoff from dosfns.c    MSD returns X:/CON for truename con. Not X:\CON*/  /* check for a device  */  dest[2] = '\\';  if (result & IS_DEVICE)  {    froot = get_root(src);    if (froot == src || froot == src + 5)    {      if (froot == src + 5)      {        fmemcpy(dest + 3, src, 5);        DosUpMem(dest + 3, 5);        if (dest[3] == '/') dest[3] = '\\';        if (dest[7] == '/') dest[7] = '\\';      }      if (froot == src || memcmp(dest + 3, "\\DEV\\", 5) == 0)      {        /* /// Bugfix: NUL.LST is the same as NUL.  This is true for all           devices.  On a device name, the extension is irrelevant           as long as the name matches.           - Ron Cemer */        dest[2] = '/';        result &= ~IS_NETWORK;        /* /// DOS will return C:/NUL.LST if you pass NUL.LST in.           DOS will also return C:/NUL.??? if you pass NUL.* in.           Code added here to support this.           - Ron Cemer */        src = froot;      }    }  }      /* Make fully-qualified logical path */  /* register these two used characters and the \0 terminator byte */  /* we always append the current dir to stat the drive;     the only exceptions are devices without paths */  rootPos = p = dest + 2;  if (*p != '/') /* i.e., it's a backslash! */  {    if (!(mode & CDS_MODE_SKIP_PHYSICAL))    {      tn_printf(("SUBSTing from: %S\n", cdsEntry->cdsCurrentPath));/* What to do now: the logical drive letter will be replaced by the hidden   portion of the associated path. This is necessary for NETWORK and   SUBST drives. For local drives it should not harm.   This is actually the reverse mechanism of JOINED drives. */      fmemcpy(dest, cdsEntry->cdsCurrentPath, cdsEntry->cdsBackslashOffset);      if (cdsEntry->cdsFlags & CDSSUBST)      {        /* The drive had been changed --> update the CDS pointer */        if (dest[1] == ':')        {  /* sanity check if this really is a local drive still */          unsigned i = drLetterToNr(dest[0]);                    if (i < lastdrive) /* sanity check #2 */            result = (result & 0xffe0) | i;        }      }      rootPos = p = dest + current_ldt->cdsBackslashOffset;      *p = '\\'; /* force backslash! */    }    p++;    if (DosGetCuDir((UBYTE)((result & 0x1f) + 1), p) < 0)      return DE_PATHNOTFND;    if (*src != '\\' && *src != '/')      p += strlen(p);    else /* skip the absolute path marker */      src++;    /* remove trailing separator */    if (p[-1] == '\\') p--;  }  /* append the path specified in src */  addSep = ADD;			/* add separator */  while(*src)  {    /* New segment.  If any wildcards in previous       segment(s), this is an invalid path. */    if (gotAnyWildcards)      return DE_PATHNOTFND;    switch(*src++)    {         case '/':      case '\\':	/* skip multiple separators (duplicated slashes) */        addSep = ADD;        break;      case '.':	/* special directory component */        switch(*src)        {          case '/':          case '\\':          case '\0':            /* current path -> ignore */            addSep = ADD_UNLESS_LAST;            /* If (/ or \) && no ++src               --> addSep = ADD next turn */            continue;	/* next char */          case '.':	/* maybe ".." entry */            switch(src[1])            {              case '/':              case '\\':              case '\0':                /* remove last path component */                while(*--p != '\\')                  if (p <= rootPos) /* already on root */                    return DE_PATHNOTFND;                /* the separator was removed -> add it again */                ++src;		/* skip the second dot */                /* If / or \, next turn will find them and                   assign addSep = ADD */                addSep = ADD_UNLESS_LAST;                continue;	/* next char */            }        }                /* ill-formed .* or ..* entries => return error */    errRet:        /* The error is either PATHNOTFND or FILENOTFND           depending on if it is not the last component */        return fstrchr(src, '/') == 0 && fstrchr(src, '\\') == 0          ? DE_FILENOTFND          : DE_PATHNOTFND;      default:	/* normal component */        if (addSep != DONT_ADD)        {	/* append backslash */          addChar(*rootPos);          addSep = DONT_ADD;        }                /* append component in 8.3 convention */        --src;        /* first character skipped in switch() */        i = parse_name_ext(FNAME_SIZE, &src, &p, dest);        if (i == -1)          PATH_ERROR;        if (i & PNE_WILDCARD)          gotAnyWildcards = TRUE;        /* strip trailing dot */        if ((i & PNE_DOT) && *src != '/' && *src != '\\')        {          if (*src == '\0')            continue;          /* we arrive here only when an extension-dot has been found */          addChar('.');          i = parse_name_ext(FEXT_SIZE, &src, &p, dest);          if (i == -1 || i & PNE_DOT) /* multiple dots are ill-formed */            PATH_ERROR;          if (i & PNE_WILDCARD)            gotAnyWildcards = TRUE;        }        --src;			/* terminator or separator was skipped */        break;    }  }  if (gotAnyWildcards && !(mode & CDS_MODE_ALLOW_WILDCARDS))    return DE_PATHNOTFND;  if (addSep == ADD || p == dest + 2)  {    /* MS DOS preserves a trailing '\\', so an access to "C:\\DOS\\"       or "CDS.C\\" fails. */    /* But don't add the separator, if the last component was ".." */    /* we must also add a seperator if dest = "c:" */      addChar('\\');  }    *p = '\0';				/* add the string terminator */  DosUpFString(rootPos);	        /* upcase the file/path name */  /** Note:    Only the portions passed in by the user are upcased, because it is    assumed that the CDS is configured correctly and if it contains    lower case letters, it is required so **/    tn_printf(("Absolute logical path: \"%s\"\n", dest));    /* Now, all the steps 1) .. 7) are fullfilled. Join now */  /* search, if this path is a joined drive */  if (dest[2] != '/' && (!(mode & CDS_MODE_SKIP_PHYSICAL)) && njoined)  {    struct cds FAR *cdsp = CDSp;    for(i = 0; i < lastdrive; ++i, ++cdsp)    {      /* How many bytes must match */      size_t j = fstrlen(cdsp->cdsCurrentPath);      /* the last component must end before the backslash offset and */      /* the path the drive is joined to leads the logical path */      if ((cdsp->cdsFlags & CDSJOINED) && (dest[j] == '\\' || dest[j] == '\0')         && fmemcmp(dest, cdsp->cdsCurrentPath, j) == 0)      { /* JOINed drive found */        dest[0] = drNrToLetter(i);	/* index is physical here */        dest[1] = ':';        if (dest[j] == '\0')        {	/* Reduce to root direc */          dest[2] = '\\';          dest[3] = 0;          /* move the relative path right behind the drive letter */        }        else if (j != 2)        {          strcpy(dest + 2, dest + j);        }        result = (result & 0xffe0) | i;        current_ldt = cdsp;        result &= ~IS_NETWORK;        if (cdsp->cdsFlags & CDSNETWDRV)          result |= IS_NETWORK;	tn_printf(("JOINed path: \"%S\"\n", dest));        return result;      }    }    /* nothing found => continue normally */  }  if ((mode & CDS_MODE_CHECK_DEV_PATH) &&      ((result & (IS_DEVICE|IS_NETWORK)) == IS_DEVICE) &&      dest[2] != '/' && !dir_exists(dest))    return DE_PATHNOTFND;  tn_printf(("Physical path: \"%s\"\n", dest));  return result;}#if 0/**********************************************	Result of INTRSPY	Calling RBIL's INT.COM in MS DOS v6.22=== Script: MUX.SCRintercept 2fh    function 11h    ; network redirector    	subfunction 23h		; Qualify path and filename			on_entry				output "1123: IN: " (ds:SI->byte,asciiz,64)			on_exit				if (cflag == 1)					sameline " [FAIL " ax "]"				output "1123: OUT: " (es:dI->byte,asciiz,64)				output "1123: orig buffer: " (ds:sI->byte,asciiz,64)	function 12h		subfunction 21h			on_entry				output "1221: IN: " (ds:SI->byte,asciiz,64)			on_exit				if (cflag == 1)					sameline " [FAIL " ax "]"				output "1221: OUT: " (es:dI->byte,asciiz,64)=== Batch file: SPY_INT.BAT@echo offif exist report.out del report.outcmdspy stopcmdspy flushcmdspy restartint ax=0x6000 -buf ds:si="abc鰂lkgsxkf\0" -buf es:di="%256s" -int 0x21 -d es:di:128 >spy_int.outcmdspy stopcmdspy report report.outmore report.out=== Intspy report file: REPORT.OUT1123: IN:  C:\INTRSPY\SPY_INT.BAT [FAIL 0001]1123: OUT:  1123: orig buffer:  C:\INTRSPY\SPY_INT.BAT1123: IN:  int.??? [FAIL 0001]1123: OUT:  C:\INTRSPY1123: orig buffer:  int.???1123: IN:  C:\TOOL\int.??? [FAIL 0001]1123: OUT:  C:\INTRSPY1123: orig buffer:  C:\TOOL\int.???1123: IN:  spy_int.out [FAIL 0001]1123: OUT:  C:\TOOL\INT.???1123: orig buffer:  spy_int.out1123: IN:  C:\TOOL\INT.COM [FAIL 0001]1123: OUT:  C:\INTRSPY\SPY_INT.OUT1123: orig buffer:  C:\TOOL\INT.COM1123: IN:  abc鰂lkgsxkf [FAIL 0001]1123: OUT:  C:\TOOL\INT.COM1123: orig buffer:  abc鰂lkgsxkf1123: IN:  C:\INTRSPY\SPY_INT.BAT [FAIL 0001]1123: OUT:  C:\INTRSPY\ABC諪LKG1123: orig buffer:  C:\INTRSPY\SPY_INT.BAT1123: IN:  cmdspy.??? [FAIL 0001]1123: OUT:  C:\INTRSPY1123: orig buffer:  cmdspy.???1123: IN:  C:\INTRSPY\CMDSPY.EXE [FAIL 0001]1123: OUT:  C:\INTRSPY1123: orig buffer:  C:\INTRSPY\CMDSPY.EXE=== INT.COM output: SPY_INT.OUT              000   CX=0000   DX=0000SI=4A5E   DI=4A76   BP=FF70   SP=FF64CS=0000   DS=279D   ES=279D   SS=0000   CPU Flags: 0n00oditsz0a0p1cINT: 0x21AX=0059   BX=0000   CX=0000   DX=0000SI=4A5E   DI=4A76   BP=FF70   SP=FF64CS=0000   DS=279D   ES=279D   SS=0000   CPU Flags: 0N11odItSz0A0P1cDOSERR: 0000 (0)*<es:di:128> {43(C) 3A(:) 5C(\) 49(I) 4E(N) 54(T) 52(R) 53(S) 50(P) 59(Y) 5C(\) 41(A)42(B) 43(C) 99(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -