Advertisement
neongm

beep bloop

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