Dll 缺少入口点 timeGetTime

Dll missing entry point timeGetTime

正在尝试使用以下命令在 MingGWx64 中编译此 DLL

gcc -shared -o evil.dll evil.cpp -DWIN32_LEAN_AND_MEAN

通过反复试验,我将 "int fireMyLaser ()" 从我找到的代码示例的底部移动到声明下方。但是我仍然在加载EXE时出错,它找不到入口点timeGetTime。有人有什么想法吗?

#include <windows.h>
#define DllExport __declspec (dllexport)

int fireMyLaser()
{
 WinExec("calc", 0);
 return 0;
}

DllExport void timeGetTime() { fireMyLaser(); }

BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason, LPVOID lpvReserved)
{
    fireMyLaser();
    return 0;
}`

编译 DLL 成功,在加载 EXE 时我得到 "The procedure entry point timeGetTime could not be located in the dynamic link library"

我无法访问 exe 代码,但通过反复试验,下面的代码有效。

// includes adjusted here to allow for timeGetTime to be used as an entry point
#include <windef.h>
#include <stdio.h>
#include <WinBase.h>
//entrypoint timeGetTime below for exe to hit... repeatedly
extern "C" __declspec(dllexport) int timeGetTime() {
 WinExec("calc.exe", 0);
 return 0;
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason, LPVOID lpvReserved)
{
 timeGetTime();
 return TRUE;
}