Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
29 views3 pages

Message

The document contains C++ code that implements hooks for a Discord voice engine using the MinHook library. It defines functions to intercept and modify the behavior of specific functions related to audio processing. The code initializes hooks on DLL load and manages thread execution for the hooking process.

Uploaded by

coiupula1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Message

The document contains C++ code that implements hooks for a Discord voice engine using the MinHook library. It defines functions to intercept and modify the behavior of specific functions related to audio processing. The code initializes hooks on DLL load and manages thread execution for the hooking process.

Uploaded by

coiupula1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include "includes/includes.

hpp"
#include "opus/include/opus.h"
#include "XorString.h"
#include "skCrypt.hpp"
#include "offsets.hpp"
#include "other/overlay/overlay.hpp"

HMODULE(WINAPI* _LoadLibraryExWAuto) (LPCWSTR, HANDLE, DWORD) = nullptr;

void(fastcall* splittingfilterorig)(int64, unsigned int64, int64);


void(__fastcall matchedfilterorig)(int64, int64, int, int64, int64, int, int64,
int, int, int, int, char);

void splittingfilterhook(int64* a1, unsigned int64 a2, int64 a3)


{
if (a2 && a3 == 2)
return;

if ((a3 & 0xFFFFFFFFFFFFFFFEuLL) != 2)


return;

return splittingfilterorig(a1, a2, a3);


}

void matchedfilterhook(int64 a1,


int64 a2,
int a3,
int64 a4,
int64 a5,
int a6,
__int64 a7,
int a8,
int a9,
int a10,
int a11,
char a12)
{

if (a11)
a11 = 0;

if (a12)
a12 = 0;

return matchedfilterorig(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
}

int returnzero()
{
return 0;
}

extern "C" HMODULE WINAPI _LoadLibraryExWHook(LPCWSTR Module, HANDLE File, DWORD


Flags) {
if (!wcsstr(Module, L"discord_voice"))
return _LoadLibraryExWAuto(Module, File, Flags);

HMODULE VoiceEngine = _LoadLibraryExWAuto(Module, File, Flags);


if (VoiceEngine) {
{
XorS(Ad, "hook failed");
XorS(Ta, "hook failed");

if (MH_CreateHook((char)VoiceEngine + 0x863E90,
opus_encode,
0) != MH_OK) {
printf(Ad.get());
}
else {

std::thread([] {
utilities::ui::start();
}).detach();

printf(Ta.get());
}

MH_CreateHook((char)VoiceEngine + 0x46869C, returnzero, 0); // high


pass
MH_CreateHook((char)VoiceEngine + 0x2EF820, returnzero, 0); //
ProcessStream_AudioFrame
MH_CreateHook((char)VoiceEngine + 0x2EDFC0, returnzero, 0); //
ProcessStream_StreamConfig
MH_CreateHook((char)VoiceEngine + 0x2F2648, returnzero, 0); //
SendProcessedData
MH_CreateHook((char)VoiceEngine + 0x5D8750, returnzero, 0); // Clipping
Predictor
MH_CreateHook((char)VoiceEngine + 0x2E923C, splittingfilterhook,
(void**)&splittingfilterorig); // Splitting Filter
}

{
MH_EnableHook(MH_ALL_HOOKS);
}

return VoiceEngine;
}

return nullptr;
}

extern "C" void MainThread() {


{
HMODULE Kernel32 = GetModuleHandleA("kernel32.dll");
FARPROC _LoadLibraryExW = GetProcAddress(Kernel32, "LoadLibraryExW");

MH_Initialize();

MH_CreateHook(
_LoadLibraryExW,
_LoadLibraryExWHook,
reinterpret_cast<LPVOID>(&_LoadLibraryExWAuto));

MH_EnableHook(MH_ALL_HOOKS);
}
}
extern "C" BOOL APIENTRY DllMain(HMODULE Module, DWORD Reason, LPVOID Reversed)
{
if (Reason == DLL_PROCESS_ATTACH) {
std::thread([] {
MainThread();
}).detach();
}

return TRUE;
}

You might also like