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

write, apppaths, and tcc

Discussion in 'T&T - Miscellaneous' started by w_krieger, Nov 3, 2008.

  1. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    176
    Likes Received:
    0
    Here's a neat trick for running tcc (or any other app) from a non-pathed directory. You need to do this, because some programs do not search apppath (eg explorer 'run' dialog)

    write.exe is used by windows to load wordpad.exe, first by searching the path, and then apppath in registry. You can easily modify it to load any file or document, by inserting the new name in the file (look for 'wordpad.exe' in the binary. Note that if you use the same name for the loader (eg wordpad.exe), it will keep reloading itself.

    You can make an NT4 style windisk.exe by using a copy of write.exe to load "dskmgmt.msc"

    Copy write to 4nt.exe, and change 'wordpad.exe' to 'tcc.exe' (padding the rest with 00x (if you use a hex editor). You need to add tcc.exe to the apppath folder - there's freeware proggies that do this for you. You can also update the icon and strings with reshack.

    You run 4nt from the prompt, and it loads tcc.exe from the selected directory.
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    No criticism of the cleverness of your technique, but I'm pretty sure that the Run dialog is AppPath aware. I run TCC.EXE from Start/Run often, and I have TCC in AppPaths but not in the system search path.
     
  3. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,190
    Likes Received:
    11
    What's the advantage of this? Why not just use the 4nt.exe that's
    supplied? Or create a link usng MKLNK or MKLINK?

    -Scott

    "JP Software Forums" <neil@jpsoft.com> wrote on 11/03/2008 04:22:21 AM:


    directory.
     
  4. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    176
    Likes Received:
    0
    I have run across programs that are not aware of apppath, though.

    For example, something like file commander / w is not apppath aware. I have never been fond of making links, but i should try it one day.
     
  5. DMcCunney

    Joined:
    Jun 7, 2008
    Messages:
    96
    Likes Received:
    3
    Links can be handy, properly used.

    NTFS 5 supports "hard" links, where the same program or file can appear in more than one directory. I use this for Firefox 3, because I have several Firefox profiles I want to use the same bookmarks file, and FF3 removed the preference from earlier versions that would let you specify the bookmarks location. I create a hard link the the master bookmarks file I wish to use in each profile directory I want to use it.

    Hard links can't span file systems, so you are limited to links on the same volume. If you run Vista, true symbolic links are supported, and symlinks can span file systems.
     
  6. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    176
    Likes Received:
    0
    cmd.exe does not support apppath, and programs that are launched directly via cmd.exe can not make use of this. 4nt 8.x does support it, and i assume tcc 9.x does too. (my normal DOS is Win2k).

    fcw ( http://silk.apana.org.au/fc.html ) does indeed support whatever comspec does. So if comspec is cmd, it won't find utilities except as redirected by something.

    I suppose, whatever ye make of the thing, having a real file that can be patched is similar to having a hardlink, except that ye can load things like .msc documents in this way.
     
  7. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    176
    Likes Received:
    0
    Here is cmdopen. http://www.ktechcomputing.com/cmdopen/ It's an open source GPL thing.

    It's a shellext that opens a command prompt at the current folder.

    It's designed to open a 3-letter file in the system32 directory, for example, cmd.exe. You can hexedit it to open some other file, eg 4nt.exe or tcc.exe. However. this file must be in the system32 directory.

    If you make a hardlink, and are just relying in the INI registration, then 4nt won't see the reg key. So instead, i modified the cmdopen.dll to open cmx.exe (and renamed it to cmxopen.dll), also created alternate CMX's for cmd and for 4nt.

    You then get cmx.exe to open 4nt off the path, and add it to apppaths, or if it's in the path, no apppath entry is needed. 4nt opens wonderfully.
     

Share This Page