mirror of
https://github.com/bats3c/DarkLoadLibrary
synced 2026-06-06 15:14:33 +00:00
45 lines
998 B
C
45 lines
998 B
C
#include <stdio.h>
|
|
#include <windows.h>
|
|
|
|
#include "pebutils.h"
|
|
#include "darkloadlibrary.h"
|
|
|
|
typedef DWORD (WINAPI * _ThisIsAFunction) (LPCWSTR);
|
|
|
|
VOID main()
|
|
{
|
|
GETPROCESSHEAP pGetProcessHeap = (GETPROCESSHEAP)GetFunctionAddress(IsModulePresent(L"Kernel32.dll"), "GetProcessHeap");
|
|
HEAPFREE pHeapFree = (HEAPFREE)GetFunctionAddress(IsModulePresent(L"Kernel32.dll"), "HeapFree");
|
|
|
|
PDARKMODULE DarkModule = DarkLoadLibrary(
|
|
LOAD_LOCAL_FILE,
|
|
L".\\amsi.dll",
|
|
NULL,
|
|
0,
|
|
NULL
|
|
);
|
|
|
|
if (!DarkModule->bSuccess)
|
|
{
|
|
printf("load failed: %S\n", DarkModule->ErrorMsg);
|
|
pHeapFree(pGetProcessHeap(), 0, DarkModule->ErrorMsg);
|
|
pHeapFree(pGetProcessHeap(), 0, DarkModule);
|
|
return;
|
|
}
|
|
|
|
_ThisIsAFunction ThisIsAFunction = (_ThisIsAFunction)GetFunctionAddress(
|
|
(HMODULE)DarkModule->ModuleBase,
|
|
"CallThisFunction"
|
|
);
|
|
pHeapFree(pGetProcessHeap(), 0, DarkModule);
|
|
|
|
if (!ThisIsAFunction)
|
|
{
|
|
printf("failed to find it\n");
|
|
return;
|
|
}
|
|
|
|
ThisIsAFunction(L"this is working!!!");
|
|
|
|
return;
|
|
} |