views:

26

answers:

1

My application consists of two parts: A Windows Service running under the LocalSystem account and a client process running under the currently logged in regular user.

I need to deploy the application across Windows versions from XP up to Win7.

The client will retrieve files from the web and collect user data from the user.

The service will construct files and data of it's own which the client needs to read.

I'm trying to figure out the best place (registry or filesystem, or mix) to store all this. One file the client or service needs to be able to retrieve from the net is an update_patch executable which needs to run whenever an upgrade is available.

I need to be sure the initial installer SETUP.EXE, and also the update_patch can figure out this ideal location and set a RegKey to be read later by both client and server telling them the magic location (The SETUP.EXE will run with elevated privileges since it needs to install the service)

On my Win7 test system the service %APPDATA% points to:

C:\Windows\system32\config\systemprofile\AppData\Roaming

and the %APPDATA% of the client points to:

C:\Users\(username)\AppData\Roaming

Interestingly Google Chrome stores everything (App and Data) in

C:\Users\(username)\AppData\Local\Google\Chrome

Chrome runs pretty much in exactly the way I want my suite to run (able to silently update itself in the background)

What I'm trying to avoid is nasty popups warning the user that the app wants to modify the system, and I want to avoid problems when VirtualStore doesn't exist because the user is running XP/2000/2003 or has UAC turned off.

My target audience are non-tech-savvy general Windows users.

A: 

Chrome doesn't have any services running under the LocalSystem account, though.

If you want to have files that can be shared between accounts on the same system, store them under the %ALLUSERSPROFILE% folder.

If you just want to be able to auto-update programs, then doing what Chrome does is fine: just make sure you launch the updated elevated when UAC is turned on.

Dean Harding
so on my w2k3 test machine I'm getting "C:\Documents and Settings\All Users" and on w7 I'm getting "C:\ProgramData" for both service and client. I presume I should have my SETUP.EXE create a <company>\<product> tree in there right? And it will be writable to all?
rwired
That's right, yes. You do still need to be careful with permissions, though, because a file created by LocalSystem will (by default) only be *readable* by regular users (not writable). That is true no matter where you create the file, though. This is what the `lpSecurityAttributes` parameter of CreateFile is for, if you set that correctly, you can make the file writeable by whoever you like.
Dean Harding
Here's a problem I'm finding now. Under both test machines there is an "Application Data" under the %ALLUSERPROFILE% folder where apps seem to be storing stuff, but on w7 this is a locked folder (even for administrator). To be consistent with other apps, shouldn't I be storing under there instead of higher in the tree?
rwired
OK. That wasn't a problem. On Win7 Application Data is just a Junction pointing the the dir above. So works fine on XP/Win7 without needing to modify my app.
rwired