Jump to content

[Version 1] [snippet]admin Cmd In Vista/win7

Recommended Posts

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){
  /*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);

/*Run highlighted program as Administrator
*by invoking and accepting the UAC prompt.*/
void UACRunAsAdmin(void){
  /*Press CTRL+SHIFT+ENTER for UAC prompt*/
  keyboard_modifier_keys = KEY_CTRL | KEY_SHIFT;
  keyboard_keys[0] = KEY_ENTER;
  keyboard_modifier_keys = 0;
  keyboard_keys[0] = 0;
  _delay_ms(800); /*Time for UAC to appear*/
  /*Accept UAC prompt*/
  usb_keyboard_press(KEY_LEFT, 0);
  usb_keyboard_press(KEY_ENTER, 0);

/*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;
  keyboard_modifier_keys = 0;
  keyboard_keys[0] = 0;

Edited by H@L0_F00
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...