Loading and Calling DLLs Via C (Indirect)
From Hak5
This tutorial explains indirectly loading a DLL via C++ NON-MFC.
Code:
#include <windows.h>
int main()
{
typedef int (*MYPROC)(LPTSTR,LPTSTR);
HMODULE mydll;
MYPROC sayit;
mydll = LoadLibrary("FUN.DLL");
sayit = (MYPROC) GetProcAddress(mydll,"say");
(sayit) ("This is a Custom Message","Customiize yur world DUDE");
}
Ok so lets dig through this one not even hard at all I promise
typedef int (*MYPROC)(LPTSTR,LPTSTR);
creates an int type called MYPROC but has 2 LPTSTR fields required because the function inside the dll also has 2 LPTSTRs
HMODULE mydll; MYPROC sayit;
Creates a HMODULE var called mydll and creates a MYPROC varable called sayit
mydll = LoadLibrary("FUN.DLL");
Loads your DLL
sayit = (MYPROC) GetProcAddress(mydll,"say");
Search the DLL for the functions "say" if found sayit becomes say and is required by 2 string variables
(sayit) ("This is a Custom Message","Customiize yur world DUDE");
This basically says (functions)(string1,string2);


