-
Notifications
You must be signed in to change notification settings - Fork 4
/
rgbquad.cpp
37 lines (35 loc) · 1.3 KB
/
rgbquad.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <windows.h>
static ULONGLONG n, r;
int randy() { return n = r, n ^= 0x8ebf635bee3c6d25, n ^= n << 5 | n >> 26, n *= 0xf3e05ca5c43e376b, r = n, n & 0x7fffffff; }
DWORD WINAPI rgb(LPVOID lpParam) {
int time = GetTickCount();
int w = GetSystemMetrics(0), h = GetSystemMetrics(1);
RGBQUAD* data = (RGBQUAD*)VirtualAlloc(0, (w * h + w) * sizeof(RGBQUAD), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
for (int i = 0;; i++, i %= 3) {
HDC desk = GetDC(NULL);
HDC hdcdc = CreateCompatibleDC(desk);
HBITMAP hbm = CreateBitmap(w, h, 1, 32, data);
SelectObject(hdcdc, hbm);
BitBlt(hdcdc, 0, 0, w, h, desk, 0, 0, SRCCOPY);
GetBitmapBits(hbm, w * h * 4, data);
int v = 0;
BYTE byte = 0;
if ((GetTickCount() - time) > 60000)
byte = randy()%0xff;
for (int i = 0; w * h > i; i++) {
if (i % h == 0 && randy() % 100 == 0)
v = randy() % 50;
((BYTE*)(data + i))[v % 3] += ((BYTE*)(data + i + v))[v] ^ byte;
}
SetBitmapBits(hbm, w * h * 4, data);
BitBlt(desk, 0, 0, w, h, hdcdc, 0, 0, SRCCOPY);
DeleteObject(hbm);
DeleteObject(hdcdc);
DeleteObject(desk);
}
return 0;
}
int main() {
CreateThread(0, 0, rgb, 0, 0, 0);
Sleep(-1);
}