-
Execute Command As Administrator
Okay, so I have to execute a batch command on a restricted user's account, however the batch command will not work unless the process has Administrative Privileges.
currently i call the batch command via
Code:
system("command here");
I, as the programmer, know the Administrator user/password on the WinXP machine this is to be executed on.
How can i execute this command/program as an administrator? I'm thinking about using the
SetThreadToken() function (http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx) but I do not know how to construct the token object properly
Thanks,
Philly0494
-
Make a shortcut to the program. Open this, and fool with the advance stuff; you can tell it to run under different credientails.
Now, from the code:
system("c:\whatever\...\shortcut.lnk");
will run your shortcut which will handle the credentials for you easily.
-
 Originally Posted by jonnin
Make a shortcut to the program. Open this, and fool with the advance stuff; you can tell it to run under different credientails.
Now, from the code:
system("c:\whatever\...\shortcut.lnk");
will run your shortcut which will handle the credentials for you easily.
Could the user then exploit this to either figure out the admin password or replace the program I made with another program that he/she wants to run as administrator in the office for non-work related purposes?
-
I dont think so, depends on how good the person is. You should be able to lock down the shortcut file to execute only for the non-priveledged account via permisisons. I am not really sure how secure that actually would be though. It would aggravate a normal user, a skilled one may find a door here.
I think that anyone who can hack the shortcut, if you lock it up, could probably also hack an executable with a hex editor to read off the password or change the destination of the command. System calls in a program are not exactly secure =)
Edit: I was wrong, its been a while since I did this --- that shortcut feature has a menu for the user to say what account he runs the program as, then he has to enter the password, so it is no good for your application. Its for people you trust with your admin password only I guess.
All that to say I am not sure how to construct your object. Maybe google to find an example of the object in use or something... sorry I can't help with that one.
Last edited by jonnin; 11-14-2009 at 03:44 PM.
Similar Threads
-
By Jim Anderson in forum Database
Replies: 2
Last Post: 07-01-2009, 03:39 PM
-
By naveenkumarg1 in forum Java
Replies: 1
Last Post: 11-18-2005, 07:13 PM
-
By aish in forum Database
Replies: 1
Last Post: 09-21-2005, 09:57 AM
-
By Ervin Rodriguez in forum Database
Replies: 1
Last Post: 10-03-2002, 02:55 PM
-
By Ervin Rodriguez in forum Database
Replies: 3
Last Post: 08-23-2002, 10:32 PM
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks