|
-
Nov 20th, 2008, 04:01 AM
#1
[RESOLVED] Run as Administrator Vista Privileges
Problem: how can I get my program to write to Program Files without making a Vista user (we can assume they're an administrator if needed) take any extra steps? Literally nothing changes on their part, no dialogs, no property changes, nothing.
Background: years ago to learn VB and programming in general I wrote this app. It ended up being worthwhile to sell, but now I have a rather poorly written (though quite usable) program with a number of users. With Vista becoming more and more prevalent, my users will eventually switch over, and I want the program to at least run with little to no hassle. (I'll almost certainly have to rewrite it in a few years if it's life cycle lasts that long, but that's a ways off.)
One of the things I did was write to the program's directory. In context it's actually quite logical; they're files that the user should never see, and sticking them in say My Documents would be potentially dangerous. These users are pretty computer illiterate, hence me wanting to save them every hassle; some know just enough to be dangerous, so the files should be in a place they'd never go on their own. Right now it's not worth it to change my program's directory structure, so I'll have to somehow get the program to write to its directory without hassle on their end.
What I've got so far: I searched for a while but information seemed sketchy at best about how to programmatically increase privileges. I can't test any of it myself because I don't have Vista. I would be inclined to say it can't be done as a security issue, except that InnoSetup seems to have done it. I was troubleshooting the first installation of this program on Vista over the phone and had them run a setup I sent, and they didn't say anything about access privileges even though that setup overwrote something in Program Files.
Right now I'm just having them Run as Administrator each time they launch the program. I would have them set Always Run as Administrator, but I'm not sure what happens when that shortcut or exe gets updated/replaced by a newer copy, and this is a patch at best. I found some things that mention you can request higher privileges with a Manifest file, but that a prompt will come up with that option.
So... I'm hoping there's some magical way for me to do this. I guess if worst comes to worst I can dig for an option in Inno that lets me reset the program to always run as administrator upon installation/update, which would likely require a button press from the user (though maybe not, I can't test it without a significant hassle, i.e. getting them on the phone and trying out the new thing). If I can avoid this extra step and hassle, I'd like to.
Thanks!
Last edited by jemidiah; Nov 21st, 2008 at 05:51 PM.
Reason: Resolved
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|