Clean up message boxes on disabling payloads & Realtime speedup

This commit is contained in:
Leurak 2016-07-10 13:25:39 +02:00
parent f2a94d0f7a
commit b1e93d72f5
4 changed files with 32 additions and 19 deletions

View file

@ -3,6 +3,7 @@
int scrw, scrh;
#ifdef CLEAN
HWND mainWindow; // In the main window, in the main window, in the main window, ...
HFONT font;
HWND dialog;
#endif
@ -145,24 +146,24 @@ void main() {
AdjustWindowRect(&rect, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, FALSE);
HWND hwnd = CreateWindowEx(0, L"MEMZPanel", L"MEMZ Clean Version - Payload Panel", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
mainWindow = CreateWindowEx(0, L"MEMZPanel", L"MEMZ Clean Version - Payload Panel", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
50, 50, rect.right-rect.left, rect.bottom-rect.top, NULL, NULL, GetModuleHandle(NULL), NULL);
for (int p = 0; p < nPayloads; p++) {
payloads[p].btn = CreateWindowW(L"BUTTON", payloads[p].name, (p==0?WS_GROUP:0) | WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_PUSHLIKE | BS_AUTOCHECKBOX | BS_NOTIFY,
(p%COLUMNS)*BTNWIDTH+SPACE*(p%COLUMNS+1), (p/COLUMNS)*BTNHEIGHT + SPACE*(p/COLUMNS+1), BTNWIDTH, BTNHEIGHT,
hwnd, NULL, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
mainWindow, NULL, (HINSTANCE)GetWindowLong(mainWindow, GWL_HINSTANCE), NULL);
SendMessage(payloads[p].btn, WM_SETFONT, (WPARAM)font, TRUE);
CreateThread(NULL, NULL, &payloadThread, &payloads[p], NULL, NULL);
}
SendMessage(hwnd, WM_SETFONT, (WPARAM)font, TRUE);
SendMessage(mainWindow, WM_SETFONT, (WPARAM)font, TRUE);
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
ShowWindow(mainWindow, SW_SHOW);
UpdateWindow(mainWindow);
CreateThread(NULL, NULL, &keyboardThread, hwnd, NULL, NULL);
CreateThread(NULL, NULL, &keyboardThread, NULL, NULL, NULL);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0) > 0) {
@ -331,8 +332,10 @@ DWORD WINAPI keyboardThread(LPVOID lParam) {
GetWindowRect(desktop, &rect);
RedrawWindow(NULL, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN);
EnumWindows(&CleanWindowsProc, NULL);
} else {
RedrawWindow((HWND)lParam, NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
RedrawWindow(mainWindow, NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
}
while ((GetKeyState(VK_SHIFT) & GetKeyState(VK_ESCAPE)) & 0x8000) {
@ -353,6 +356,14 @@ DWORD WINAPI keyboardThread(LPVOID lParam) {
return 0;
}
BOOL CALLBACK CleanWindowsProc(HWND hwnd, LPARAM lParam) {
DWORD pid;
if (GetWindowThreadProcessId(hwnd, &pid) && pid == GetCurrentProcessId() && hwnd != mainWindow) {
SendMessage(hwnd, WM_CLOSE, 0, 0);
}
return TRUE;
}
#endif

View file

@ -45,6 +45,7 @@ DWORD WINAPI watchdogThread(LPVOID);
#else
DWORD WINAPI keyboardThread(LPVOID lParam);
extern BOOLEAN enablePayloads;
BOOL CALLBACK CleanWindowsProc(HWND hwnd, LPARAM lParam);
#endif
int payloadExecute(PAYLOADFUNC);

View file

@ -2,16 +2,16 @@
#ifdef CLEAN
PAYLOAD payloads[] = {
{ payloadExecute, L"Open random websites/programs", NULL, 0, 0, 0, FALSE },
{ payloadCursor, L"Random cursor movement", NULL, 0, 0, 0, TRUE },
{ payloadKeyboard, L"Random keyboard input", NULL, 0, 0, 0, FALSE },
{ payloadSound, L"Random error sounds", NULL, 0, 0, 0, TRUE },
{ payloadBlink, L"Flashing screen", NULL, 0, 0, 0, TRUE },
{ payloadMessageBox, L"Message boxes", NULL, 0, 0, 0, TRUE },
{ payloadDrawErrors, L"Draw error icons", NULL, 0, 0, 0, TRUE },
{ payloadChangeText, L"Reverse text on screen", NULL, 0, 0, 0, FALSE },
{ payloadPIP, L"Render screen into screen", NULL, 0, 0, 0, TRUE },
{ payloadPuzzle, L"Screen glitches", NULL, 0, 0, 0, TRUE }
{ payloadExecute, L"Open random websites/programs", NULL, 0, 0, 0, 0, FALSE },
{ payloadCursor, L"Random cursor movement", NULL, 0, 0, 0, 0, TRUE },
{ payloadKeyboard, L"Random keyboard input", NULL, 0, 0, 0, 0, FALSE },
{ payloadSound, L"Random error sounds", NULL, 0, 0, 0, 0, TRUE },
{ payloadBlink, L"Flashing screen", NULL, 0, 0, 0, 0, TRUE },
{ payloadMessageBox, L"Message boxes", NULL, 0, 0, 0, 0, TRUE },
{ payloadDrawErrors, L"Draw error icons", NULL, 0, 0, 0, 0, TRUE },
{ payloadChangeText, L"Reverse text on screen", NULL, 0, 0, 0, 0, FALSE },
{ payloadPIP, L"Render screen into screen", NULL, 0, 0, 0, 0, TRUE },
{ payloadPuzzle, L"Screen glitches", NULL, 0, 0, 0, 0, TRUE }
#else
const PAYLOAD payloads[] = {
{ payloadExecute, 30000 },
@ -42,8 +42,9 @@ DWORD WINAPI payloadThread(LPVOID parameter) {
for (;;) {
#ifdef CLEAN
if (enablePayloads && SendMessage(payload->btn, BM_GETCHECK, 0, NULL) == BST_CHECKED) {
if (payload->delay-- == 0) {
if (payload->delaytime++ >= payload->delay) {
payload->delay = (payload->payloadFunction)(payload->times++, payload->runtime, FALSE);
payload->delaytime = 0;
}
payload->runtime++;

View file

@ -6,7 +6,7 @@ typedef struct {
int(*payloadFunction)(int, int, BOOLEAN);
wchar_t *name;
HWND btn;
int delay, times, runtime;
int delay, times, runtime, delaytime;
BOOLEAN safe;
#else
int(*payloadFunction)(int, int);