App Paths of type REG_EXPAND_SZ

Jun 26, 2008
38
1
I have a Path value in "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\emacs.exe" which is of type REG_EXPAND_SZ instead of REG_SZ, and which contains "C:\emacs\%MYEMACSVERSION%"

Apparently, REG_EXPAND_SZ is not forbidden in App Paths. Several Microsoft programs use it, for example wab.exe has:

Path="%ProgramFiles%\Outlook Express"

There are two issues:

1.- TCC is prepending the "App Paths" Path entry to the PATH environment variable. If I read the MSDN docs correctly, that should only be done for programs executed via ShellExecute (see, for example, KB 837633).

2.- More important, TCC is not expanding the Path entry before passing it to the program, so in my case it receives a literal "C:\emacs\%MYEMACSVERSION%"

1) is a feature, I suppose, but 2) definitely seems like a bug.
 
May 20, 2008
11,407
99
Syracuse, NY, USA
On Wed, 28 Jan 2009 09:21:44 -0600, Juanma Barranquero <>
wrote:


>1.- TCC is prepending the "App Paths" Path entry to the PATH environment variable. If I read the MSDN docs correctly, that should only be done for programs executed via ShellExecute (see, for example, KB 837633).

I don't think you are reading it correctly. **Any** app can be started with
ShellExecute(). And when an app with an "App Paths\Path" entry is started using
ShellExecute(), ShellExecute() adjusts the path. When an app is started with
CreateProcess() (which TCC uses) this does not happen automatically. So TCC
does it. So, indeed it is a feature.


>2.- More important, TCC is not expanding the Path entry before passing it to the program, so in my case it receives a literal "C:\emacs\%MYEMACSVERSION%"

Indeed! I set (REG_EXPAND_SZ) "...\App Paths\tcc.exe\Path=%userprofile%,
started TCC and from there, started another TCC. The second TCC got:

v:\> path
PATH=%userprofile%;C:\WINDOWS\system32;C:\WINDOWS;[...]

Type REG_EXPAND_SZ should be a signal to TCC to expand variables before using
the data.
 
Jun 26, 2008
38
1
I don't think you are reading it correctly. **Any** app can be started with
ShellExecute(). And when an app with an "App Paths\Path" entry is started using
ShellExecute(), ShellExecute() adjusts the path.

Yes, that's crystal clear in the docs. I didn't deny that.

When an app is started with
CreateProcess() (which TCC uses) this does not happen automatically. So TCC
does it.
The question would be, it is App Paths intended to be used, other than by ShellExecute()? My gut feeling, after perusing the references to App Paths in the MSDN, is negative (AFAICS, CMD.EXE does not use it, for example).

Anyway, that's not really relevant. What I'm interested in, is the REG_EXPAND_SZ bug. I'm glad we agree that it is a bug.
 
Similar threads
Thread starter Title Forum Replies Date
D Open Windows 10 Photos app from command line Support 11
A Windows 10 This app can't run on your PC Support 2
vefatica Job handle in target app Support 4
B How to get window status of a running app Support 3
D TCC can't start app if @shfolder[42] used for path Support 1
Y Wait for GUI app to finish Support 3
O Problems opening an app in a tab from the toolbar Support 28
J Paths shown in DIR /B Support 2
J How to? Disable unix-style paths interpretation of / Support 2
M Incorrect ARGV1 when using linux-style paths Support 4
mfarah How to? Getting pdir to display relative paths. Support 2
R Fixed Using %~dp1 for paths with unavailable drives Support 6
T Paths in ZIP Support 1
S blanks in environment variable paths Support 4
S Listing the paths of all directories of a given name Support 4
L File completion window saws long paths Support 3
Joe Caverly Using TYPE with non-English text Support 22
vefatica TYPE behaving randomly Support 10
vefatica Garbage from TYPE Support 2
vefatica TYPE resets console tab settings Support 14
Joe Caverly Get a variable type Support 2
Joe Caverly v24 TYPE Re-direction Support 4
vefatica TYPE goes crazy with no-BOM Unicode file Support 7
J Piping ANSI control sequences through 'type' Support 4
nickles How to? Follow a JUNCTION type directory link Support 9
S International characters - TYPE vs %@LINE function Support 5
thedave WAD Unable to type various characters using Windows 8's onscreen keyboard Support 7
vefatica Fixed TYPE http://... incomplete data Support 40
Phileosophos Documentation TPIPE /string type code confusion Support 4
S WAD %_do_errors does not report errors when loop control variable type is not directory entry Support 1
vefatica TYPE beeping? Support 12
Charles Dye TYPE /P behaves strangely with piped/redirected input Support 0
vefatica LIST and TYPE show UTF8 BOM Support 4
vefatica TYPE, Unicode, installer Support 10
Charles Dye Fixed TYPE /X reports FF for all values >= 80h Support 6
M More SafeChars type issues... Support 4
Charles Dye Strange output, here-doc redirection, TYPE, //UnicodeOutput=Yes Support 6
Roedy MIME type for *.btm ? Support 1
S TYPE command issue Support 12
vefatica TYPE /X and Unicode files? Support 0
dcantor LIST /X and TYPE /X give different results Support 20
E colorization outside of type Support 7
p.f.moore Documentation tweak for TYPE Support 5

Similar threads