write, apppaths, and tcc

Nov 2, 2008
180
0
#1
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,588
46
Albuquerque, NM
prospero.unm.edu
#2
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)
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.
 

samintz

Scott Mintz
May 20, 2008
1,264
11
Solon, OH, USA
#3
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" <[email protected]> wrote on 11/03/2008 04:22:21 AM:


> 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.
 
Nov 2, 2008
180
0
#4
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.
 
Jun 7, 2008
96
3
#5
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.
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.
 
Nov 2, 2008
180
0
#6
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.
 
Nov 2, 2008
180
0
#7
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.