Neverending saga of writing data into Program Files folder

by Miha Markič 30. May 2007 15:33

Writing application data into Program Files folder is bad. Period. Only the files at install time should be written to Program Files folder.

Otherwise one is facing

  • security issues (i.e. an application could inject code) and
  • practical issues (if one is not an admin then one can't use the application since there are no default permissions for non-admins to write there - application will most probably crash).

For any other data generated by applications there are better locations, such as isolated storage. Program Files folder should contain only files needed to run, eh, programs and not the data generated by those programs. And same is true for registry: HKEY_LOCAL_MACHINE is not a place to store runtime data.

However, not many developers realize these problems and so there are a ton of applications that want to store data next to their executable files. In fact, I stumbled today upon an application that should be written correctly - e-banking for companies, which I use to communicate with my bank. The application goes by name HAL E-Bank/Personal by Halcom, a Slovene e-commerce company (software, services, certificate authority), and is used by many banks in Slovenia. One would expect that such application (written by such company), where security is important, would avoid this amateur mistake. Wrong. They store a plethora of application data in Program Files folder at runtime. Ouch. Bad, bad application. And not to mention also that their executables aren't signed.

Even [MS] realized that this is a huge problem and thus it built Vista with this in mind - providing support for running problematic applications even under normal user account and thus avoiding messing with Registry and Program files folder. The feature is named File System and Registry Virtualization (you'll find more info on Vista security here), but this is another story.

The bottom line is: Don't ever build applications that write data to Program Files folder.

Tags:

Windows | Slovenia | .net

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Miha Markic

About me
Righthand
 
Microsoft MVP
 
Developer Express' DXSquad
INETA Country Leader for Slovenia
INETA Country Leader for Slovenia

Slovene Developer Users Group Lead
Friends of Red-Gate
LLBLGenPro Partner

Miha currently works as a free lance consultant and software developer specialized in .net area.
He graduated in Computer and information science at the University of Ljubljana, Slovenia. He has accumulated experience in various programming languages such as Java, Visual Basic 3-6 (MCP), Visual C++, Delphi, C# and VB.Net through years.
He has experience in practically all (technical) stages of project development, including planning, framework development, user interface, business processes, as well as testing and documenting. He has worked on big and small projects in Slovenia and abroad (e.g. participated in completing level 3 IS for the Nucor steel plant, Hertford, USA).
Currently he enjoys programming in .net environment using C#. Since 2000 he has been active in Developer Express' DX Squad and has been ECDL trainer and tester. He also gives lectures on conferences and other events in Slovenia.

Month List

Tag cloud

Most comments

Paulius Paulius
1 comments
us United States
Meh Meh
1 comments
us United States
bart dm bart dm
1 comments
nl Netherlands

RecentComments

Comment RSS