GetProcAddress() scheitern, Fehler 127

Hier ist mein DLL-code:

#include <Windows.h>
#include <iostream>

int sysLol(char *arg);

int sysLol(char *arg)
{
   std::cout<<arg<<"\n";
   return 1;
}

Und hier ist mein code für die Anwendung:

#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, meine LIB.dll wird erfolgreich geladen LoadLibrary() noch GetProcAddress() schlägt mit 127.
Dies scheint zu sein, weil es nicht die Feststellung meiner Funktion name, aber ich sehe nicht, warum das scheitern würden.

Hilfe wird sehr geschätzt! 🙂
~P

InformationsquelleAutor Moon | 2014-09-16

Schreibe einen Kommentar