HelpInternal not working

Posts 1–13 of 13 · Page 1 of 1
Internal not working
I am working on an internal right now. It's not finished, it's messy and pasted, but it compiles and with no errors. When I inject, nothing happens. So I commented out some of the lines in the starting function. When I do this, the console shows up, and then the game crashes.

Code:
void Initialize()
	{
		Indexes::Init();
		Modules::InitModules();
		Interfaces::InitInterfaces();
		Utilities::OpenConsole("CoBRa");
		NetVar.RetrieveClasses();
This is run when the DLL is injected. When I inject normally, the console does not open. When I comment InitModules and InitInterfaces, the console opens and my game crashes. Any help would be appreciated.
Quote Originally Posted by KappaMang View Post
I am working on an internal right now. It's not finished, it's messy and pasted, but it compiles and with no errors. When I inject, nothing happens. So I commented out some of the lines in the starting function. When I do this, the console shows up, and then the game crashes.

Code:
void Initialize()
	{
		Indexes::Init();
		Modules::InitModules();
		Interfaces::InitInterfaces();
		Utilities::OpenConsole("CoBRa");
		NetVar.RetrieveClasses();
This is run when the DLL is injected. When I inject normally, the console does not open. When I comment InitModules and InitInterfaces, the console opens and my game crashes. Any help would be appreciated.
did ya hook interfaces/ and call menu func?
Quote Originally Posted by WildAssassinz View Post
did ya hook interfaces/ and call menu func?
Yes, "Interfaces::InitInterfaces();" should be hooking interfaces unless that's something else. The menu comes later on in the function.

Code:
void Initialize()
	{
		Indexes::Init();
		Modules::InitModules();
		Interfaces::InitInterfaces();
		Utilities::OpenConsole(XorStr("CoBRa"));
		NetVar.RetrieveClasses();

		//Finds the D3D9 Device pointer
		auto dwDevice = **(uint32_t**)(Utilities::FindSignature(XorStr("shaderapidx9.dll"), XorStr("A1 ? ? ? ? 50 8B 08 FF 51 0C")) + 1);

		//Create the virtual table hooks
		g_pD3DDevice9Hook = make_unique<VFTableHook>((PPDWORD)dwDevice, true);
		g_pClientModeHook = make_unique<VFTableHook>((PPDWORD)Interfaces::ClientMode, true);
		g_pMatSurfaceHook = make_unique<VFTableHook>((PPDWORD)Interfaces::Surface, true);

		//Find CSGO main window
		while (!(g_hWindow = FindWindowA(XorStr("Valve001"), NULL))) Sleep(200);

		//Replace the WindowProc with our own to capture user input
		if (g_hWindow)
			g_pOldWindowProc = (WNDPROC)SetWindowLongPtr(g_hWindow, GWLP_WNDPROC, (LONG_PTR)Hooked_WndProc);

		g_fnOriginalReset =      g_pD3DDevice9Hook->Hook(16, Hooked_Reset);                      //Hooks IDirect3DDevice9::EndScene
		g_fnOriginalEndScene =   g_pD3DDevice9Hook->Hook(42, Hooked_EndScene);                   //Hooks IDirect3DDevice9::Reset

		g_fnOriginalPlaySound =  g_pMatSurfaceHook->Hook(82, (PlaySound_t)Hooked_PlaySound);     //Hooks ISurface::PlaySound
		g_fnOriginalCreateMove = g_pClientModeHook->Hook(24, (CreateMove_t)Hooked_CreateMove);   //Hooks IClientMode::CreateMove
	}
Most of which comes from MarkHC's source. I think the problem is in InitInterfaces because when I comment that it crashes with the console (so Module and Index inits run fine), but when I comment InitModules it crashes without the console (so it must be crashing inside of the initinterfaces because Modules aren't initialized.) But when nothing is commented, it doesn't crash, but no console opens.
Quote Originally Posted by KappaMang View Post
Yes, "Interfaces::InitInterfaces();" should be hooking interfaces unless that's something else. The menu comes later on in the function.

Code:
void Initialize()
	{
		Indexes::Init();
		Modules::InitModules();
		Interfaces::InitInterfaces();
		Utilities::OpenConsole(XorStr("CoBRa"));
		NetVar.RetrieveClasses();

		//Finds the D3D9 Device pointer
		auto dwDevice = **(uint32_t**)(Utilities::FindSignature(XorStr("shaderapidx9.dll"), XorStr("A1 ? ? ? ? 50 8B 08 FF 51 0C")) + 1);

		//Create the virtual table hooks
		g_pD3DDevice9Hook = make_unique<VFTableHook>((PPDWORD)dwDevice, true);
		g_pClientModeHook = make_unique<VFTableHook>((PPDWORD)Interfaces::ClientMode, true);
		g_pMatSurfaceHook = make_unique<VFTableHook>((PPDWORD)Interfaces::Surface, true);

		//Find CSGO main window
		while (!(g_hWindow = FindWindowA(XorStr("Valve001"), NULL))) Sleep(200);

		//Replace the WindowProc with our own to capture user input
		if (g_hWindow)
			g_pOldWindowProc = (WNDPROC)SetWindowLongPtr(g_hWindow, GWLP_WNDPROC, (LONG_PTR)Hooked_WndProc);

		g_fnOriginalReset =      g_pD3DDevice9Hook->Hook(16, Hooked_Reset);                      //Hooks IDirect3DDevice9::EndScene
		g_fnOriginalEndScene =   g_pD3DDevice9Hook->Hook(42, Hooked_EndScene);                   //Hooks IDirect3DDevice9::Reset

		g_fnOriginalPlaySound =  g_pMatSurfaceHook->Hook(82, (PlaySound_t)Hooked_PlaySound);     //Hooks ISurface::PlaySound
		g_fnOriginalCreateMove = g_pClientModeHook->Hook(24, (CreateMove_t)Hooked_CreateMove);   //Hooks IClientMode::CreateMove
	}
Most of which comes from MarkHC's source. I think the problem is in InitInterfaces because when I comment that it crashes with the console (so Module and Index inits run fine), but when I comment InitModules it crashes without the console (so it must be crashing inside of the initinterfaces because Modules aren't initialized.) But when nothing is commented, it doesn't crash, but no console opens.
can i see your init interfaces?
Quote Originally Posted by WildAssassinz View Post
can i see your init interfaces?
Code:
void Interfaces::InitFactories()
{
	Interfaces::ClientFactory = Interfaces::GetFactory(Modules::Client);
	Interfaces::EngineFactory = Interfaces::GetFactory(Modules::Engine);
	Interfaces::VGUI2Factory = Interfaces::GetFactory(Modules::VGUI2);
	Interfaces::VGUISurfaceFactory = Interfaces::GetFactory(Modules::VGUISurface);
	Interfaces::MatFactory = Interfaces::GetFactory(Modules::Material);
	Interfaces::PhysFactory = Interfaces::GetFactory(Modules::VPhysics);
	Interfaces::StdFactory = Interfaces::GetFactory(Modules::Stdlib);
}

void Interfaces::InitInterfaces()
{
	Interfaces::InitFactories();
	Interfaces::Client = (IBaseClientDLL*)Interfaces::ClientFactory((char*)Utilities::FindTextPattern(XorStr("client.dll"), XorStr("VClient0")), NULL);
	Interfaces::Engine = (IVEngineClient*)Interfaces::EngineFactory((char*)Utilities::FindTextPattern(XorStr("engine.dll"), XorStr("VEngineClient0")), NULL);
	Interfaces::Panels = (IPanel*)Interfaces::VGUI2Factory((char*)Utilities::FindTextPattern(XorStr("vgui2.dll"), XorStr("VGUI_Panel0")), NULL);
	Interfaces::Surface = (ISurface*)Interfaces::VGUISurfaceFactory((char*)Utilities::FindTextPattern(XorStr("vguimatsurface.dll"), XorStr("VGUI_Surface0")), NULL);
	Interfaces::EntList = (IClientEntityList*)Interfaces::ClientFactory((char*)Utilities::FindTextPattern(XorStr("client.dll"), XorStr("VClientEntityList0")), NULL);
	Interfaces::DebugOverlay = (IVDebugOverlay*)Interfaces::EngineFactory((char*)Utilities::FindTextPattern(XorStr("engine.dll"), XorStr("VDebugOverlay0")), NULL);
	Interfaces::Prediction = (DWORD*)Interfaces::ClientFactory((char*)Utilities::FindTextPattern(XorStr("client.dll"), XorStr("VClientPrediction0")), NULL);
	Interfaces::MaterialSystem = (CMaterialSystem*)Interfaces::MatFactory((char*)Utilities::FindTextPattern(XorStr("materialsystem.dll"), XorStr("VMaterialSystem0")), NULL);
	Interfaces::RenderView = (CVRenderView*)Interfaces::EngineFactory((char*)Utilities::FindTextPattern(XorStr("engine.dll"), XorStr("VEngineRenderView0")), NULL);
	Interfaces::ModelRender = (IVModelRender*)Interfaces::EngineFactory((char*)Utilities::FindTextPattern(XorStr("engine.dll"), XorStr("VEngineModel0")), NULL);
	Interfaces::ModelInfo = (CModelInfo*)Interfaces::EngineFactory((char*)Utilities::FindTextPattern(XorStr("engine.dll"), XorStr("VModelInfoClient0")), NULL);
	Interfaces::Trace = (IEngineTrace*)Interfaces::EngineFactory((char*)Utilities::FindTextPattern(XorStr("engine.dll"), XorStr("EngineTraceClient0")), NULL);
	Interfaces::PhysProps = (IPhysicsSurfaceProps*)Interfaces::PhysFactory((char*)Utilities::FindTextPattern(XorStr("vphysics.dll"), XorStr("VPhysicsSurfaceProps0")), NULL);
	Interfaces::CVar = (ICVar*)Interfaces::StdFactory((char*)Utilities::FindTextPattern(XorStr("stdlib.dll"), XorStr("VEngineCvar00")), NULL);

	// Get ClientMode Pointer
	DWORD* ppClientMode;
	ppClientMode = nullptr; // before "scripts/vgui_screens.txt"
	DWORD p = Utilities::FindSignature("client.dll", "8B 35 ? ? ? ? 85 FF 74 73");
	if (p)
	{
		ppClientMode = **(DWORD***)(p + 2);
		Interfaces::ClientMode = ppClientMode;
	}

	auto uAddress = Utilities::FindSignature(XorStr("client.dll"), XorStr("A1 ? ? ? ? 5F 8B 40 10"));
	uint32_t g_dwGlobalVarsBase = *(uint32_t*)(uAddress + 0x1);
	Interfaces::Globals = *(CGlobalVarsBase**)(g_dwGlobalVarsBase);

	

	Utilities::Log(XorStr("Interfaces Ready"));
}
I noticed that the initinterfaces uses the log function, so I put the open console before the initinterfaces, but it still does not work. Also, it never logs,so it has to be freezing at InitFactories or somewhere else.
After some debugging and editing the initinterfaces, I found that it stops working when I try to get the interface.
update:
I've got it working up until the VFTableHooks.
it stops here
Code:
uint32_t CalculateLength()
		{
			uint32_t dwIndex = 0;
			if (!m_pOriginalVMTable) return 0;
			for (dwIndex = 0; m_pOriginalVMTable[dwIndex]; dwIndex++) {
				if (IsBadCodePtr((FARPROC)m_pOriginalVMTable[dwIndex])) {  //THIS LINE
					break; 
				}
			}
			return dwIndex;
		}
but only for the Interface hooks; it works fine for the D3D hook.
Quote Originally Posted by KappaMang View Post
update:
I've got it working up until the VFTableHooks.
it stops here
Code:
uint32_t CalculateLength()
		{
			uint32_t dwIndex = 0;
			if (!m_pOriginalVMTable) return 0;
			for (dwIndex = 0; m_pOriginalVMTable[dwIndex]; dwIndex++) {
				if (IsBadCodePtr((FARPROC)m_pOriginalVMTable[dwIndex])) {  //THIS LINE
					break; 
				}
			}
			return dwIndex;
		}
but only for the Interface hooks; it works fine for the D3D hook.
DID YA HOOK UR INTERFACES?
Quote Originally Posted by Epik View Post


DID YA HOOK UR INTERFACES?
Yes?
Code:
                g_pD3DDevice9Hook.Initialise((DWORD*)dwDevice);
		g_pClientModeHook.Initialise((DWORD*)Interfaces::ClientMode());
		g_pMatSurfaceHook.Initialise((DWORD*)Interfaces::Surface());

		g_fnOriginalReset = (Reset_t)g_pD3DDevice9Hook.HookMethod((DWORD)&Hooked_Reset, 16);
		g_fnOriginalEndScene = (EndScene_t)g_pD3DDevice9Hook.HookMethod((DWORD)&Hooked_Reset, 42);

		g_fnOriginalPlaySound = (PlaySound_t)g_pMatSurfaceHook.HookMethod((DWORD)&Hooked_PlaySound, 82);
		g_fnOriginalCreateMove = (CreateMove_t)g_pClientModeHook.HookMethod((DWORD)&Hooked_CreateMove, 24);
My program now gets through all my breakpoints but it crashes afterwards if I go into csgo. Sorry if I sound nooby I'm just trying to learn what does and does not work
Now I'm confused because my createmove hook never runs.
Quote Originally Posted by antep2727 View Post
brainless paste gj
Ik it's paste I'm trying to understand it
/bump, I really want to learn and understand internals. I'm not even getting errors from the code it just doesn't hook but obviously the hooks should work if they come from working sources.
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us