Anmeldungsdatum: Jan 2011
Beiträge: 3
|
hey community!
i have a question oshgui related please. 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..
TEXT Code: /* 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:
TEXT Code: 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 == '\\') { 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. also added cpp's/header from \Drawing\Direct3D8 to my project.
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.
i tried to solve it with the DLL example code from here but it seems its for an older oshgui version: [Source] Beispielcode für eine Hack-DLL
best regards
|