Question
Recently, I encountered a very strange issue, this issue only happens in Windows XP SP3 and Vista. Here are my steps:
- Create two new folders in desktop (assume folder names are A and B)
- Copy Microsoft GraphEdit (
graphedt.exe
) application to A folder, then create a emptygraphedt.exe.manifest
file as well. Rungraphedt.exe
, you will see a error message, thegraphedt.exe
can’t run due to the wrong manifest. - Copy Microsoft GraphEdit (
graphedt.exe
) application to B folder, rungraphedt.exe
and close it, then create a emptygraphedt.exe.manifest
file, rungraphedt.exe
again, you will see the manifest file can’t apply tographedt.exe
. But if you change the last modified time ofgraphed.exe
, the manifest will work again.
It seems Windows will remember the status the first time the EXE uses a manifest file, but also Windows will reset the old remembered status if you change the EXE size or last modified date.
Solution
[I'm the current SxS maintainer at Microsoft]
Good investigation Yigang. You're describing the behavior on Vista, not on XP SP3.
Probing for the existence of a manifest every time an app is run would be a performance issue, since usually apps either have a manifest or don't, and that state doesn't change much. For this reason, on Vista, the first time an application is run, we cache a bit describing "this application has an associated manifest" or "this application does not have a manifest". When you ran graphedt.exe the first time, Windows cached the absence of a manifest, and will subsequently not look for one. To reset the cache, update the last modified time on the executable.