Solved OSHGUI D3D8 injection

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Icew0lf

Software Ninjaneer
Dank Tier VIP
Fleep Tier Donator
Aug 20, 2013
603
17,558
43
hey community!

is anyone experianced with the OSHGui?
i just compiled the .lib and sample projects and everything works fine, but im struggling to create a basic menu via DLL injection since the sample projects are exe files creating test 3D3 environments. i want to inject in a D3D8 game..

C++:
/*	Direct3D8 Device */
#define NOMINMAX
#include <windows.h>
#include "main.h"
#include "d3d8.h"
#include <OSHGui.hpp>
#include "Input/WindowsMessage.hpp"
#include "Drawing/Direct3D8/Direct3D8Renderer.hpp"

#define D3DHOOK_TEXTURES //comment this to disable texture hooking

using namespace OSHGui;
using namespace OSHGui::Drawing;

FontPtr font;
//Application &app;

HRESULT CD3DManager::Initialize()
{
	/*
	initialize Resources such as textures 
	(managed and unmanaged [D3DPOOL]), 
	vertex buffers, and other D3D rendering resources
	...
	m_pD3Ddev->CreateTexture(..., ..., &m_pD3Dtexture);
	*/

	std::unique_ptr<Direct3D8Renderer> renderer(new Direct3D8Renderer(m_pD3Ddev));

	Application::Initialize(std::move(renderer));

	auto &app = Application::Instance();

	//3. create a font which will be used by the OSHGui
	font = FontManager::LoadFont("Arial", 8.0f, false); //Arial, 8PT, no anti-aliasing
	app.SetDefaultFont(font);

	//4. create our form
	auto form = std::make_shared<Form>();
	form->SetText("Test");

	//5. set this form as our mainform
	app.Run(form);

	//optional: enable the OSHGui drawing
	app.Enable();

	//optional: register a Hotkey with which we can toggle the OSHGui drawing
	app.RegisterHotkey(Hotkey(Key::Insert, []
	{
		Application::Instance().Toggle();
	}));

	return S_OK;
}

HRESULT APIENTRY hkIDirect3DDevice8::EndScene(void)
{
	auto &renderer = Application::Instance().GetRenderer();

	//1. let our renderer begin its work
	renderer.BeginRendering();

	//2. render the OSHGui
	Application::Instance().Render();

	//3. end the rendering
	renderer.EndRendering();

	return m_pD3Ddev->EndScene();
}
my DLLMain:
C++:
bool WINAPI DllMain(HMODULE hDll, DWORD dwReason, PVOID pvReserved)
{
	if(dwReason == DLL_PROCESS_ATTACH)
	{
		DisableThreadLibraryCalls(hDll);

		GetModuleFileName(hDll, dlldir, 512);
		for(int i = strlen(dlldir); i > 0; i--) { if(dlldir[i] == '\\') { dlldir[i+1] = 0; break; } }


		HMODULE hMod = LoadLibrary("d3d8.dll");		
	
		oDirect3DCreate8 = (tDirect3DCreate8)DetourFunc(
			(BYTE*)GetProcAddress(hMod, "Direct3DCreate8"),
			(BYTE*)hkDirect3DCreate8, 
			5);

		return true;
	}

	else if(dwReason == DLL_PROCESS_DETACH)
	{
		
	}

    return false;
}
i have the oshgui files and the sdk in my includes, the sdk and .lib from osh i compiled in my libraryincludes.
oshgui.lib is also linked as additional dependencys.

it compiles fine but the testwindow from the gui dont show up and the game also dont crash, it just nothing happens.
if you can point me in the right direction i would be glad..thanks.

best regards
 
Last edited:

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
I'm probably not the best to be answering this question but I saw you had no replies, idk if you ever got it working or not but I was just looking and...
I see you're hooking Direct3DCreate function, a shot in the dark here, and you probably know this already but you're using auto-inject to inject the dll correct?
Cause D3DCreate is only called once and yada yada you gotta hook it before it's called and I'm sure you know this but thought I should mention it in case it just slipped your mind or something.
If it's not that, then I'm out this bitch and wish you the best of luck! lol!
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods