SETP usually fails with a 32 bit process

May 20, 2008
10,679
83
Syracuse, NY, USA
SETP with 32-bit processes usually fails. 4572 in devenv.exe (32-bit);

Code:
d:\tc25> setp 4572 temp
TCC: Not in environment "temp"

It does work occasionally.

Code:
v:\> setp 4572 temp
temp=z:\

Most of the time I can get it to work by first using SETP on a 64-bit process.

Code:
v:\> setp 4572 temp
TCC: Not in environment "temp"

v:\> setp 4572 temp
TCC: Not in environment "temp"

v:\> setp 4572 temp
TCC: Not in environment "temp"

v:\> setp 4572 temp
TCC: Not in environment "temp"

v:\> setp %_pid temp <===================== 64-bit process
temp=z:\

v:\> setp 4572 temp
temp=z:\

v:\> setp 4572 temp
temp=z:\

v:\> setp 4572 temp
temp=z:\
 
May 20, 2008
10,679
83
Syracuse, NY, USA
Most of the time I can get it to work by first using SETP on a 64-bit process.
In fact that's pretty reliable behavior ... SETP on a 32-bit process doesn't work until SETP has been used on a 64-bit process. Here are 4 newly-started instances of TCC.

1594585541268.png
 
May 20, 2008
10,679
83
Syracuse, NY, USA
There's something else going on here. After SETP on a 64-bit process, SETP on a 32-bit process seems to work, but apparently gives the wrong answer.

Now, devenv (32-bit) is PID 6784. In a new TCC, as in a previous post,

Code:
v:\> setp 6784 temp
TCC: Not in environment "temp"

v:\> setp %_pid temp
temp=z:\

v:\> setp 6784 temp
temp=z:\

But I believe that's wrong because

1. My PSET32.EXE gives

Code:
v:\> pset32 6784 temp
C:\Users\vefatica\AppData\Local\Temp

2. devenv is writing its temp files to C:\Users\vefatica\AppData\Local\Temp (confirmed with FOLDERMONITOR)

3. devenv was started by PowerPro.exe whose TEMP is C:\Users\vefatica\AppData\Local\Temp

Here's another test; it seems to show the same thing.

Code:
v:\> set junk=foo

v:\> setp 6784 junk
TCC: Not in environment "junk"

v:\> setp %_pid junk
junk=foo

v:\> setp 6784 junk
junk=foo

v:\> set junk=bar

v:\> setp %_pid junk
junk=bar

v:\> setp 6784 junk
junk=bar