1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

4NT, TCC/LE : "IF EXIST X:\NUL" always fails

Discussion in 'Support' started by rlsx, Aug 30, 2008.

  1. rlsx

    Joined:
    Aug 30, 2008
    Messages:
    2
    Likes Received:
    0
    Using 4NT or TCC/LE, the test:
    IF EXIST X:\NUL ...
    always fails.

    Under CMD.EXE it is used to test the existence of drive X:
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    Here, it only fails if X: doesn't exist (or isn't ready). It behaves identically to CMD in every test I've tried -- can you give me an explicit example where it fails in TCC but works in CMD?

    Rex Conn
    JP Software
    ----- Original Message -----
    From: rlsx
    To: rconn@jpsoft.com
    Sent: Saturday, August 30, 2008 7:34 PM
    Subject: [Support-t-422] 4NT, TCC/LE : "IF EXIST X:\NUL" always fails


    Using 4NT or TCC/LE, the test:
    IF EXIST X:\NUL ...
    always fails.

    Under CMD.EXE it is used to test the existence of drive X:
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    On Sat, 30 Aug 2008 21:59:43 -0500, rconn <> wrote:


    I have an x: drive (physical, permanent, ready) and

    TCC 9.02.151 Windows XP [Version 5.1.2600]
    Copyright 2008 Rex Conn & JP Software Inc. All Rights Reserved
    Registered to Vincent Fatica - 5 System License

    v:\> if exist x:\nul echo yes

    v:\>

    While,

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    v:\> if exist x:\nul echo yes
    yes

    v:\>

    It works for all root directories in CMD and for none in TCCv9. I have to go
    back to 4NTv5 to see it work.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    vefatica wrote:
    | On Sat, 30 Aug 2008 21:59:43 -0500, rconn <> wrote:
    |
    |
    |
    | ---Quote---
    || Here, it only fails if X: doesn't exist (or isn't ready). It
    || behaves identically to CMD in every test I've tried -- can you give
    || me an explicit example where it fails in TCC but works in CMD?
    | ---End Quote---
    | I have an x: drive (physical, permanent, ready) and
    |
    | TCC 9.02.151 Windows XP [Version 5.1.2600]
    | Copyright 2008 Rex Conn & JP Software Inc. All Rights Reserved
    | Registered to Vincent Fatica - 5 System License
    |
    | v:\> if exist x:\nul echo yes
    |
    | v:\>
    |
    | While,
    |
    | Microsoft Windows XP [Version 5.1.2600]
    | (C) Copyright 1985-2001 Microsoft Corp.
    |
    | v:\> if exist x:\nul echo yes
    | yes
    |
    | v:\>
    |
    | It works for all root directories in CMD and for none in TCCv9. I
    | have to go back to 4NTv5 to see it work.

    Test environments:

    4NT 7.01.370 Windows XP [Version 5.1.2600]
    4NT 8.02.106 Windows XP [Version 5.1.2600]
    TCC 9.02.151 Windows XP [Version 5.1.2600]

    Testing using command

    for %d in (%_drives) (echo %d %@ready[%d] ^ if exist %d\NUL echo exist)

    All 3 versions behaved identically; "exist" was never displayed. In all 3
    versions I had an "exception processing" pop-up message for each drive that
    was not ready, 1 for DVD-RW, 1 for CD-ROM, and 1 for each empty slot for SD,
    etc. cards.

    --
    Steve
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    I have both an X: drive (physical) and a Y: (network mapped) and they both work with TCC v9.

    The test is actually being done by Windows, not by TCC, so I suspect it's a configuration issue.

    Rex Conn
    JP Software
    ----- Original Message -----
    From: vefatica
    To: rconn@jpsoft.com
    Sent: Saturday, August 30, 2008 11:55 PM
    Subject: RE: [Support-t-422] 4NT, TCC/LE : "IF EXIST X:\NUL" always fails


    On Sat, 30 Aug 2008 21:59:43 -0500, rconn <> wrote:



    Quote:
    >Here, it only fails if X: doesn't exist (or isn't ready). It behaves identically to CMD in every test I've tried -- can you give me an explicit example where it fails in TCC but works in CMD?

    I have an x: drive (physical, permanent, ready) and

    TCC 9.02.151 Windows XP [Version 5.1.2600]
    Copyright 2008 Rex Conn & JP Software Inc. All Rights Reserved
    Registered to Vincent Fatica - 5 System License

    v:\> if exist x:\nul echo yes

    v:\>

    While,

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    v:\> if exist x:\nul echo yes
    yes

    v:\>

    It works for all root directories in CMD and for none in TCCv9. I have to go
    back to 4NTv5 to see it work.
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    On Sun, 31 Aug 2008 11:08:28 -0500, rconn <> wrote:


    What API function do you use to invoke that test?

    I don't think there's much Windows configuring that will affect NUL. I have
    "NUL=\Device\Null" in

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    On Sun, 31 Aug 2008 13:11:46 -0500, vefatica <> wrote:


    And device manager shows it enabled and working correctly.
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    On Sun, 31 Aug 2008 13:27:23 -0500, vefatica <> wrote:



    When I do this in a plugin

    WCHAR szFile = L"x:\\nul";
    WIN32_FIND_DATA fd;
    HANDLE hFind = FindFirstFile(szFile, &fd);
    if ( hFind != INVALID_HANDLE_VALUE )
    {
    Printf(L"%s\r\n", fd.cFileName);
    FindClose(hFind);
    }

    I get "nul".

    If I change szFile to L"o:\\nul" (no drive o:) I don't get "nul".
     
  9. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    On Sun, 31 Aug 2008 13:27:23 -0500, vefatica <> wrote:



    When I do this in a plugin

    WCHAR szFile = L"x:\\nul";
    WIN32_FIND_DATA fd;
    HANDLE hFind = FindFirstFile(szFile, &fd);
    if ( hFind != INVALID_HANDLE_VALUE )
    {
    Printf(L"%s\r\n", fd.cFileName);
    FindClose(hFind);
    }

    I get "nul".

    If I change szFile to L"o:\\nul" (no drive o:) I don't get "nul".
     
  10. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    My previous post was mailed only once (got SMTP delivery logs to show it) yet it appears here and in my mailbox twice.

    And vBulletin changed my colon-right_paren to a smiley. Isn't that cute!
     
  11. rlsx

    Joined:
    Aug 30, 2008
    Messages:
    2
    Likes Received:
    0
    -------------
    Windows XP + SP3
    TCC LE 9.02.151

    c:\> if exist c:\nul echo yes

    c:\>
    -------------
    Another machine:

    Windows XP + SP3 (French)
    4NT 8.02.106

    c:\> if exist c:\nul echo yes

    c:\>
    -------------

    Needless to say, C: exists on both machines.
     
  12. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    There seem to be a lot of us for whom the exist test with NUL does not
    work. Here's what my systems does (IFTEST is an alias that reports
    whether the test returned true or false).

    C:\>iftest exist c:\nul
    FALSE

    C:\>d:\

    D:\>iftest exist d:\nul
    FALSE

    Obviously, both drives do exist.

    -- Jay
     
  13. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    When I "if exist x:\nul echo yes ...

    I see that TCC ultimately uses FindFirstFile() which works here when given L"x:\\nul". I also see that first, QueryIsFileOrDirectory() is called with an argument L"x:\\nul" and then find_file() is called with an argument of L"x:\\"
    (no "nul", is that right?) ... the fourth character of L"x:\\nul" had been replaced by a \0. And then, FindFirstFile() is called with an arg of L"x:\\" ... which is documented to fail.

    Oddly, when I do this on a local drive, TCC proceeds to QueryIsFile(), find_file(), FindFirstFile() all with arg L"d:\\tcmd9\\tcc.exe".
     
  14. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    604
    Likes Received:
    0
    On Sat, Aug 30, 2008 at 7:59 PM, rconn <> wrote:

    My C: is a physical drive. D: is SUBST C:\RAM, E: is a CDROM, G: is
    mapped to a Windows server. F: does not exist.

    TCC fails in every case if the drive actually exists. TCC correctly
    says F: does not exist. CMD gives the proper answer in all cases.

    D:\>ver /r

    TCC 9.02.151 Windows XP [Version 5.1.2600]
    TCC Build 151 Windows XP Build 2600 Service Pack 3

    D:\>type test.bat
    if exist %1:\nul echo exist %1

    D:\>echo %_drives
    C: D: E: G: I: J: L: M: N: O: P: Q: R: S: T: U: W: Y: Z:

    D:\>test c
    if exist %1:\nul echo exist %1

    D:\>test d
    if exist %1:\nul echo exist %1

    D:\>test e
    if exist %1:\nul echo exist %1

    D:\>test f
    if exist %1:\nul echo exist %1

    D:\>test g
    if exist %1:\nul echo exist %1



    D:\>ver

    Microsoft Windows XP [Version 5.1.2600]

    D:\>test c

    D:\>if exist c:\nul echo exist c
    exist c

    D:\>test d

    D:\>if exist d:\nul echo exist d
    exist d

    D:\>test e

    D:\>if exist e:\nul echo exist e

    D:\>test f

    D:\>if exist f:\nul echo exist f

    D:\>test g

    D:\>if exist g:\nul echo exist g
    exist g

    D:\>


    --
    2008 Fridays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Saturday.
    Measure wealth by the things you have for which you would not take money.
     

Share This Page