function InjectModuleA(const hProcess: THandle;
lpFullDLLName: PAnsiChar): BOOL; stdcall;
function InjectModuleW(const hProcess: THandle;
lpFullDLLName: PWChar): BOOL; stdcall;
- Injects a library (DLL) into the specified target process
- Arg1 process handle or special system-wide flags (ALL_PROCESSES, RUNNING_PROCESSES, NEW_PROCESSES)
- Arg2 fully qualified path to the library (DLL) to be injected into the target process
var
bResult: BOOL;
begin
bResult := InjectModuleW(GetCurrentProcess(), PWChar('C:\DLL.dll'));
if (bResult) then
ShowMessage('DLL injected successfully!')
else
ShowMessage('Failed to inject DLL!');
end;