HMODULE WINAPI LoadLibraryAHooked(const decltype(LoadLibraryAHook)& hook, _In_ LPCSTR lpLibFileName) {
HMODULE libraryHandle = hook.get_trampoline()(_In_ lpLibFileName);
if (libraryHandle == NULL)
return libraryHandle;
MessageBoxA(NULL, lpLibFileName, "LOAD LIB", MB_OK); // дебагер1337
if (lpLibFileName == "MoonLoader.asi") {
setURLDownloadToFileAHook(libraryHandle);
LoadLibraryAHook.remove();
}
return libraryHandle;
}
void initializePlugin() {
HMODULE moonHandle = GetModuleHandleA("MoonLoader.asi");
if (moonHandle != NULL) {
setURLDownloadToFileAHook(moonHandle);
} else {
HMODULE kernelHandle = GetModuleHandleA("kernel32.dll");
if (kernelHandle != NULL) {
LPVOID pvLoadLibrary = GetProcAddress(kernelHandle, "LoadLibraryA");
if (pvLoadLibrary != NULL) {
LoadLibraryAHook.set_dest(pvLoadLibrary);
LoadLibraryAHook.set_cb(&LoadLibraryAHooked);
LoadLibraryAHook.install();
}
}
}
}