#include <stdio.h> #include <stdlib.h> #include <windows.h> #include <time.h> _declspec(dllexport) void go1() { while (1) { malloc(10 * 1024 * 1024); Sleep(3000); } } _declspec(dllexport) void go2() { MessageBoxA(0, "哈哈", "ok", 0); } _declspec(dllexport) void runGo() { time_t t; int num; srand((unsigned) time(&t)); num = rand() % 100; num > 50 ? go1() : go2(); } void main(){ }
利用dll注射工具进行执行runGo函数