I want to load the DLL library in C++ windows console application but I faced to bellow error:
The DLL function definition is:
#include <iostream>
#include <Windows.h>
typedef uint8_t(*FNPTR)(uint8_t*, uint8_t, uint8_t*, uint8_t);
int main()
{
HINSTANCE hInst = LoadLibrary(L"DLL.dll");
if (!hInst) {
std::cout << "\nCould Not Load Library";
return 0;
}
else {
std::cout << "\nLibrary Loaded Successfully";
}
FNPTR fn = (FNPTR)GetProcAddress(hInst, "MasterLogin");
if (!fn) {
std::cout << "\nFaliled To Load MasterLogin Function";
return 0;
}
uint8_t name[5];
uint8_t nameLen = 5;
memmove(name, "Admin", 5);
uint8_t pass[6];
memmove(pass, "123456", 6);
uint8_t passLen = 6;
uint8_t res = fn(name, nameLen, pass, passLen);
std::cout << res;
return 0;
}
User contributions licensed under CC BY-SA 3.0