ChatGPT——请生成rundll32.exe 可以运行的打开计算器程序的dll C++代码,并给出编译代码和运行方式

rundll32.exedll 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);
}

  

编译后,

 

运行:

rundll32 Project1.dll,_OpenCalculator@16
 
 
 
posted @ 2023-02-15 16:20  bonelee  阅读(82)  评论(0编辑  收藏  举报