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

App Paths of type REG_EXPAND_SZ

Discussion in 'Support' started by Juanma Barranquero, Jan 28, 2009.

  1. Juanma Barranquero

    Joined:
    Jun 26, 2008
    Messages:
    38
    Likes Received:
    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.
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,962
    Likes Received:
    30
    On Wed, 28 Jan 2009 09:21:44 -0600, Juanma Barranquero <>
    wrote:


    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.


    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.
     
  3. Juanma Barranquero

    Joined:
    Jun 26, 2008
    Messages:
    38
    Likes Received:
    1
    Yes, that's crystal clear in the docs. I didn't deny that.

    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.
     

Share This Page