C++: Dynamic DLL Usage
Objective
Increasing functionality of malware by using external DLL files.-
To do list
Create a dll.
Import dll into an external CPP program.
Call a function from imported dll in external CPP program.
Functions
LoadLibrary: Import dll into running process.
Header: libloaderapi.h
Definition: HMODULE LoadLibraryA(LPCSTR lpLibFileName);
lpLibFileName: Path of dll file.
GetProcAddress: Retrieve the address of a function inside the dll.
Header: libloaderapi.h
Definition: FARPROC GetProcAddress(HMODULE hModule,LPCSTR lpProcName);
hModule: DLL handle.
lpProcName: Name of the function to retrieve.
Application
DLL
CPP
References
Microsoft, Using runtime dynamic linking, https://docs.microsoft.com/en-us/windows/win32/dlls/using-run-time-dynamic-linking
Microsoft, GetProcAddress, https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress
Microsoft, LoadLibrary, https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya
Last updated
Was this helpful?