Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

App Paths of type REG_EXPAND_SZ

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.
 
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.
 
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

Back
Top