Thursday, March 16, 2006

.Net Framework Applications Writing to the Windows Root Directory

After deploying a Winform app to Citrix yesterday, we could not get it to run. It would throw a hard exception and die before it ever displayed anything. After a little poking around, we discovered that the fault was an "Access Denied" message while trying to create a randomly named folder in the Windows root directory.

I used .Net Reflector to look into the application code a bit, but quickly became irritated by the complexity of the startup routine and decided to write a simple repro. After making my repro as simple a .Net app as you can run, it seems that every .Net application writes some sort of randomly named test folder to the windows root directory at startup.

Here's the repro code:

class Class1
{
[System.STAThread]
static void Main(string[] args)
{
}
}


And here's what FileMon says it's doing:



This wouldn't be too big a deal on a regular desktop, but it is really not acceptable to have to give every Citrix user the rights to delete arbitrary files from the Windows root directory!

Anybody know of a good place to read up on the behavior of the framework as it loads up a process? I think we'll be opening a PSS case on this one.

File Under: Technology,

No comments:

Post a Comment