ChatGPT——请生成rundll32.exe 可以运行的打开计算器程序的dll C++代码,并给出编译代码和运行方式
请生成rundll32.exe 可以运行的打开计算器程序的dll C++代码,并给出编译代码和运行方式。
#include <windows.h> BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } // 此函数被 rundll32.exe 调用 extern "C" __declspec(dllexport) void CALLBACK OpenCalculator(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) { ShellExecute(NULL, "open", "calc.exe", NULL, NULL, SW_SHOW); }
编译后,
运行: