vista privilege

Started by
6 comments, last by AcidZombie24 15 years, 5 months ago
1) How do i get that UAC dialog to appear when i start up my all (i want read/write access on the registry and install a few things) 2) How do i get my app to load on bootup (preferably on all user names) 3) If i can do #2 can i make it so #1 doesnt happen every time a user boots up (that would be very annoying). This is for a server i am writing. I want to turn on my comp, walk away and have everything load up with me pressing keys. I'd love if i dont have to login to do this.
<SkilletAudio> Your framerate proves your lack of manhood
Advertisement
For #2, you'll want to look into creating a service (Which isn't that hard). I'm not sure about #1.

You'll need to say what language you're using for us to help you much further though.
I am not to sure about the UAC, but I can give you a little advice about the startup. How is the program going to load if nobody is logged in? A local company hired me to design a program for them that would run on their server and this is the problem I ran into. I ended up having to install the program as a service so it would run regardless if a user was logged in or not. You can set the service up to run as administrator, but that may still not get around the UAC...

It's still early so I hope it makes sense.
Service = Program runs always
Startup = Program runs only when a user is loged in
I've never done #1 myself, but the thing to google is "requestedExecutionLevel". The basics are that you create a manifest that tells Windows that you need to run elevated and then when your app starts the UAC dialog will popup.

For 2&3 the problem you may run into with a service is that a service is not the same thing as an app run by the user. Services generally cannot interact directly with users - the users would have to run a different app that acts as a front-end.

What exactly are you doing that requires you not only to whack protected registry items, but to do it every single time a user logs on? Sounds like sketchy design at best.
-Mike
Quote:Original post by Anon Mike
I've never done #1 myself, but the thing to google is "requestedExecutionLevel". The basics are that you create a manifest that tells Windows that you need to run elevated and then when your app starts the UAC dialog will popup.

For 2&3 the problem you may run into with a service is that a service is not the same thing as an app run by the user. Services generally cannot interact directly with users - the users would have to run a different app that acts as a front-end.

What exactly are you doing that requires you not only to whack protected registry items, but to do it every single time a user logs on? Sounds like sketchy design at best.


That's true in most cases. The application I wrote we had to check that "Allow service to interact with the desktop" (or whatever it is) and restart the service, which brought up the program. So if that is checked you should still be able to interact with it. The only major problem I had was with the working directory. I had a heck of a time trying to get it to save settings, but I eventually worked it out.

At first I thought this maybe a virus or trojan the way he wants to get around permissions, send commands remotely, no login, etc. I would be interested in hearing about the intent as well.
Quote:Original post by UltimaX
The only major problem I had was with the working directory. I had a heck of a time trying to get it to save settings, but I eventually worked it out.
What does the working directory have to do with saving settings? Writing a settings file to the applications working directory is a Really Bad Idea, and will cause all sorts of problems when you try running as non-Administrator with your EXE in a location like Program Files.
The "Correct" place to store settings is in the Application Data directory, which you can get from some Win32 call (SHGetSpecialFolder() or something).
Quote:Original post by UltimaX
The application I wrote we had to check that "Allow service to interact with the desktop"


That checkbox does not exist on Vista because no services can interact with the desktop. If you want your service to pop up some UI, do the UI in another application and use some sort of IPC (e.g. named pipes, sockets, etc) to communicate with the service. That is far more secure than "allow service to interact with the desktop" ever was.

Also, as to the OP's question, if you run the program as a service (which seems to be what you want) you can run it under whatever user account you like without worrying about UAC. Personally, I'd suggest running it under an account you create specifically for you application, and only granting that user account the exact permissions you need (i.e. don't run it as Administrator, run it as a regular user and grant that user access to the registry keys, etc, that you need).
Quote:Original post by UltimaX
At first I thought this maybe a virus or trojan the way he wants to get around permissions, send commands remotely, no login, etc. I would be interested in hearing about the intent as well.


No login so ANYONE can start up the machine and my service/app.
get around permissions so i can install it on my machine (i tried using old code to write data to the registry and it seems that vista blocks it causing a reset to default options)
write to the registry so i can store/retrieve data
and send cmds remotely bc its a game server.

I aim for something like FileZilla if you ever used their server. I like it very much.

Guys, how do i create a service and register it with the OS?
Lets say i write a dummy one that write to c:/myserverIsAlive.txt and prints out the time every few minutes. How do i register it and unregister it? i found this http://msdn.microsoft.com/en-us/library/ms683500(VS.85).aspx

But i am unsure how to use it. I am not n vista anymore, XP might be easier to test and i'll try it on vista when its complete or near complete. Dont i need some type of UAC before i install anything to the system?

Also i compile things on codeblock as i notice msvc exes doesnt run on my nondev machines (in release mode of course).
<SkilletAudio> Your framerate proves your lack of manhood

This topic is closed to new replies.

Advertisement