Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BreakPoint _Asm Modification Game Crash #91

Closed
Jenrix opened this issue Jan 22, 2021 · 1 comment
Closed

BreakPoint _Asm Modification Game Crash #91

Jenrix opened this issue Jan 22, 2021 · 1 comment

Comments

@Jenrix
Copy link

Jenrix commented Jan 22, 2021

#include <string>
#include <cstdio>
#include <Windows.h>
#include <polyhook2/Exceptions/BreakPointHook.hpp>


std::shared_ptr<PLH::BreakPointHook> bpHook;
DWORD NodelayBaseAddress = 0x009D5447;
DWORD returnAdress = 0x009D544C;

float delay = 0.0f;
NOINLINE _declspec(naked) void NodelayASM()
{
	_asm
	{
		movss xmm0 , delay
		movss[esi + 0x58], xmm0
		jmp returnAdress
	}
}
NOINLINE void NodelayCallBack()
{
	auto protObj = bpHook->getProtectionObject();
	NodelayASM();
}

void HookFunction()
{
	bpHook = std::make_shared<PLH::BreakPointHook>(reinterpret_cast<char*>(&NodelayBaseAddress), reinterpret_cast<char*>(&NodelayCallBack));
	bpHook->hook();
}
BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		AllocConsole();
		FILE* fDummy;
		freopen_s(&fDummy, "CONOUT$", "w", stdout);
		freopen_s(&fDummy, "CONOUT$", "w", stderr);
		freopen_s(&fDummy, "CONIN$", "r", stdin);

		CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)HookFunction, NULL, 0, NULL);
	}
	return TRUE;
}

When i injecting the dll to the game its crashing i dont think its on BaseAddress or maybe im doing wrong?

@stevemk14ebr
Copy link
Owner

Hi, this is not enough information for a useful bug report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants