My code is running elevated but nothing can see/execute c:\windows\system32\rstrui.exe (System Restore Point UI).
I double checked to make sure the code really was running elevated (it is), and I’ve tested with File.Exist() and Directory.GetFiles() and System.Diagnostics.Process.Start(); file not found is what is returned.
The program is really there, I can really run it, I can copy/paste the path to DOS and list it, execute it (no hidden spaces, etc.).
Any ideas?
THE SOLUTION:
Tim (below) gave me the solution, instead of referencing c:\windows\system32 reference c:\windows\sysnative. The “sysnative” gets redirected, or, well, doesn’t. I’m still a bit confused about x64 redirection stuff. The point is, the following works:
Environment.GetEnvironmentVariable(“windir”) + @”\sysnative”
Thanks Tim!
Let me guess… you’re running as an x86 application on a 64 bit installation of Windows?
I’m not sure of the reason, but this thread provides some information.
If you compile it for native 64 bit (or Any CPU I suppose) instead of x86, it’ll find the file properly.
The reason for this is the System Folder Redirection that’s going on in 64bit OS’s on applications that are running under WOW64. You can read more about it here. One particularly relevant chunk of that post is talking about how to get around it:
I was unable to get the
%windir%\Sysnativeidea working, but I’m hopeful that either that works for you or you can implement the enabling/disabling of redirection.