H@L0_F00 Posted July 30, 2010 Share Posted July 30, 2010 (edited) I haven't seen this posted anywhere, so I figured I'd share what I have. It doesn't use Psychosis' PsyDuck code because I want to get a feel for the stuff before I go and start using pre-coded functions and stuff (so I have somewhat of an understanding of the underlying stuff). Anyways, this code will get you a command prompt as Administrator through the Start -> search bar void AdminCMD(void); void OpenStartMenu(void); void UACRunAsAdmin(void); void AdminCMD(void){ OpenStartMenu(); /*Type "cmd.exe" in search bar.*/ usb_keyboard_press(KEY_C, 0); usb_keyboard_press(KEY_M, 0); usb_keyboard_press(KEY_D, 0); usb_keyboard_press(KEY_PERIOD, 0); usb_keyboard_press(KEY_E, 0); usb_keyboard_press(KEY_X, 0); usb_keyboard_press(KEY_E, 0); UACRunAsAdmin(); } /*Run highlighted program as Administrator *by invoking and accepting the UAC prompt.*/ void UACRunAsAdmin(void){ /*Press CTRL+SHIFT+ENTER for UAC prompt*/ _delay_ms(50); keyboard_modifier_keys = KEY_CTRL | KEY_SHIFT; keyboard_keys[0] = KEY_ENTER; usb_keyboard_send(); _delay_ms(50); keyboard_modifier_keys = 0; keyboard_keys[0] = 0; usb_keyboard_send(); _delay_ms(800); /*Time for UAC to appear*/ /*Accept UAC prompt*/ usb_keyboard_press(KEY_LEFT, 0); _delay_ms(50); usb_keyboard_press(KEY_ENTER, 0); _delay_ms(50); } /*Open Start Menu using CTRL+ESC instead *of the Windows logo (KEY_GUI) because *that key can be completely disable, while *CTRL+ESC still works.*/ void OpenStartMenu(void){ keyboard_modifier_keys = KEY_CTRL; keyboard_keys[0] = KEY_ESC; usb_keyboard_send(); _delay_ms(50); keyboard_modifier_keys = 0; keyboard_keys[0] = 0; usb_keyboard_send(); _delay_ms(50); } Edited July 31, 2010 by H@L0_F00 Quote Link to comment Share on other sites More sharing options...
Netshroud Posted July 30, 2010 Share Posted July 30, 2010 For me I have to do "cmd.exe", not just "cmd". Visual Studio installation did some wierd things to my start menu search. Quote Link to comment Share on other sites More sharing options...
H@L0_F00 Posted July 30, 2010 Author Share Posted July 30, 2010 For me I have to do "cmd.exe", not just "cmd". Visual Studio installation did some wierd things to my start menu search. What're you talking about, it DOES types "cmd.exe"... ;) haha Fixed. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.