This is doable, but you need to be able to hide the Administrator password inside a compiled program (not perfect security by any means, but good enough for your son not to learn the Admin password).
First install psexec
from the Sysinternals suite (available as a ZIP file from Microsoft). psexec
allows you to run programs as other users (if you know the other user's password). The below code assumes you installed it at C:\sysinternals\psexec.exe
. Make sure your son's account can run the program. This will require change the security settings on psexec.exe
to grant read and execute permission to your son's account.
Then compile the below C program into an executable (let's call it rungame.exe
), but change the code to have the correct pathnames to psexec
and the game, and also change the code to set the actualy Administrator password one character at a time (see the comments in the code). This is how we obfuscate the Administrator password inside the EXE. If you lack a Microsoft compiler (e.g., Visual Studio), you can install Cygwin, which has the GCC compiler.
Then give rungame.exe
to your son (but not the source code, obviously). When he wants to run the game, he launches rungame.exe
, which will launch the game as Administrator without prompting for the password.
#include <windows.h>
#include <stdlib.h>
// Be sure to use double-backslashes as path separators in this pathnames!
char * psexec = "C:\\sysinternals\\psexec.exe"; // <-- CHANGE THIS PATH AS NEEDED
char * game = "C:\\path\\to\\game\\program.exe"; // <-- CHANGE THIS PATH AS NEEDED
int main()
{
char cmd[1024] = { 0 };
char pw[128] = { 0 };
// Create the password ("hello" in this example) so that it does not appear as a string in the
// compiled version of this program.
pw[4] = 'o';
pw[3] = 'l';
pw[2] = 'l';
pw[1] = 'e';
pw[0] = 'h';
strcpy(cmd, "\"");
strcat(cmd, psexec);
strcat(cmd, "\" -d -u Administrator -p \"");
strcat(cmd, pw);
strcat(cmd, "\" \"");
strcat(cmd, game);
strcat(cmd "\"");
system(cmd);
return 0;
}
1what is the game? – Steve Rathbone – 2012-06-16T23:42:00.853
Do you have the ability to write and compile a program in the C or C# programming languages? – Fran – 2012-06-16T23:56:11.613
2I think taking ownership of the game's executing file will be a good idea. Also you should take ownership of the folder where the game is installed. – avirk – 2012-06-17T03:54:40.007