-1

Trying to compile this DLL in MingGWx64, using the following command

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

Through trial and error I moved the "int fireMyLaser ()" below the declaration, from the bottom of the code sample I found. But I still get an error on the load of the EXE that it can't find the entry-point timeGetTime. Anyone have any ideas?

#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;
}`

Compiling the DLL works, on loading the EXE I get "The procedure entry point timeGetTime could not be located in the dynamic link library"

Morgan
  • 14
  • 3

1 Answers1

0

I don't have access to the exe code, but through trial and error the below worked.

// 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;
}
Morgan
  • 14
  • 3