Bienvenido a Tecnohackers

Tecnohackers » Programacion » Area de Programacion » Programacion a Bajo Nivel. APIs, Hooking, ASM, C/C++, etc.
 » 

Apagado-Shutdown Function



Autor Tema: Apagado-Shutdown Function  (Leído 1030 veces)

Desconectado P4|3L0

  • Asiduo
  • *
  • Mensajes: 75
  • TecnoHacker un nuevo proyecto.
    • http://www.tecnohacker.com
Apagado-Shutdown Function
« en: Diciembre 29, 2009, 11:00:51 am »
Código: You are not allowed to view links. Register or Login
//Aquí empezaba con API de Windows, quien me diria.... ;D

#include <windows.h>

      int main()
      {
      HANDLE hToken;
      TOKEN_PRIVILEGES tokpr;
      if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
      {
      LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tokpr.Privileges[0].Luid);
      tokpr.PrivilegeCount = 1;
      tokpr.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
      if(AdjustTokenPrivileges(hToken, FALSE, &tokpr, 0, (PTOKEN_PRIVILEGES)NULL, 0))
      {
      ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF|EWX_FORCE,0);
      }
      }
      }



Tags:
Tags:

 


SMF 2.0.19 | SMF © 2016, Simple Machines
Paginas Afiliadas
Twitter - FaceBook - Daraxblog
Designed by Smf Personal