Here's my DLL code:
#include <Windows.h>
#include <iostream>
int sysLol(char *arg);
int sysLol(char *arg)
{
std::cout<<arg<<"\n";
return 1;
}
And here's my application code:
#include <Windows.h>
#include <iostream>
#include <TlHelp32.h>
#include <stdlib.h>
typedef int (WINAPI* Lol)(char* argv);
struct PARAMETERS
{
DWORD Lol;
};
int main()
{
PARAMETERS testData;
HMODULE e = LoadLibrary(L"LIB.dll"); //This executes without problem
if (!e) std::cout<<"LOADLIBRARY: "<<GetLastError()<<"\n";
else std::cout<<"LOADLIBRARY: "<<e<<"\n";
testData.Lol = (DWORD)GetProcAddress(e,"sysLol"); //Error 127?
if (!testData.Lol) std::cout<<testData.Lol<<" "<<GetLastError()<<"\n";
else std::cout<<"MESSAGEBOX: "<<testData.Lol<<"\n";
std::cin.ignore();
return 1;
}
So, my LIB.dll is successfully loaded using LoadLibrary()
, yet GetProcAddress()
fails with 127.
This seems to be because it's not finding my function name, but I don't see why that would fail.
Assistance is greatly appreciated! :) ~P