20-CreateDLL
Standard DLL syntax-> https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain
visual studio -> new project -> search for dll and select
if you don't use dll one, and use empty project then make sure configuration type is set to DLL, - Solution explorer ctrl+alt+L
right click on RandomDLL and properties.
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include <windows.h>
BOOL WINAPI DllMain(
HINSTANCE hModule, // handle to DLL module
DWORD Reason, // reason for calling function
LPVOID lpvReserved) // reserved
{
switch (Reason) {
case DLL_PROCESS_ATTACH:
MessageBoxW(NULL, L"HEY", L"hacker alert!", MB_ICONQUESTION | MB_OK);
break;
}
return TRUE;
}
Build -> build solution.
rundll32.exe .\DllInjection.dll,DllMain