Dll缺少入口点timeGetTime

时间:2018-03-27 06:02:44

标签: dll dllexport dll-injection

尝试使用以下命令

在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时我得到“程序入口点timeGetTime无法在动态链接库中找到”

1 个答案:

答案 0 :(得分:0)

我无法访问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;
}