Giter Site home page Giter Site logo

kiero's Introduction

kiero


Universal graphical hook for a D3D9-D3D12, OpenGL and Vulkan based games

Requirement

Windows SDK (For D3D9/D3D10/D3D11/OpenGL hook)

DirectX SDK (For D3D9/D3D10/D3D11 hook)

Vulkan SDK (For Vulkan hook)

MinHook (For kiero::bind function)

Example

To start, go to the kiero.h and select the desired hooks

// Example for D3D9 hook
#define KIERO_INCLUDE_D3D9   1 // 1 if you need D3D9 hook
#define KIERO_INCLUDE_D3D10  0 // 1 if you need D3D10 hook
#define KIERO_INCLUDE_D3D11  0 // 1 if you need D3D11 hook
#define KIERO_INCLUDE_D3D12  0 // 1 if you need D3D12 hook
#define KIERO_INCLUDE_OPENGL 0 // 1 if you need OpenGL hook
#define KIERO_INCLUDE_VULKAN 0 // 1 if you need Vulkan hook

Then proceed to the main work

// Example for D3D9 hook

// Include required libraries
#include "kiero.h"
#include <d3d9.h>
#include <Windows.h>

// Create the type of function that we will hook
typedef long(__stdcall* EndScene)(LPDIRECT3DDEVICE9);
static EndScene oEndScene = NULL;

// Declare the detour function
long __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
{
  // ... Your magic here ...
  
  // static bool init = false;
  // if (!init)
  // {
  //  MessageBox(0, "Boom! It's works!", "Kiero", MB_OK);
  //  init = true;
  // }
  
  return oEndScene(pDevice);
}

int kieroExampleThread()
{
  if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success)
  // or
  if (kiero::init(kiero::RenderType::Auto) == kiero::Status::Success)
  {
    // define KIERO_USE_MINHOOK must be 1
    // the index of the required function can be found in the METHODSTABLE.txt
    kiero::bind(42, (void**)&oEndScene, hkEndScene);
    
    // If you just need to get the function address you can use the kiero::getMethodsTable function
    oEndScene = (EndScene)kiero::getMethodsTable()[42];
  }

  return 0;
}

BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID)
{
  DisableThreadLibraryCalls(hInstance);

  switch (fdwReason)
  {
    case DLL_PROCESS_ATTACH:
      CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)kieroExampleThread, NULL, 0, NULL);
      break;
  }

  return TRUE;
}

License

MIT License

Copyright (c) 2014-2021 Rebzzel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

kiero's People

Contributors

jonashouben avatar rebzzel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kiero's Issues

i have a skill issue

well its like
kiero::init(kiero::RenderType::D3D11);
👇
kiero::bind(8, (void**)&oEndScene, hkEndScene);
👇
kiero::shutdown();
👇
kiero::init(kiero::RenderType::D3D11);
👇
kiero::bind(8, (void**)&oEndScene, hkEndScene);
the last bind will not work for some reason, and i tried on d3d12, things still happen, what can i do

Add support for hooking multiple rendering types

For an universal graphic hooking library it would be nice if we can hook multiple instead of just one rendering type. Kiero checks for libraries and address already. We could get rid of specifying the rendering type, just check for all loaded libraries and addresses. And let us hook them if we want to.

Example:

int success = kiero::init();
if (kiero::isInitialized(kiero::RenderType::D3D9))
{
    kiero::bind(kiero::RenderType::D3D9, 16, (void**)&oReset, hkReset);
}

if (kiero::isInitialized(kiero::RenderType::D3D10))
{
    kiero::bind(kiero::RenderType::D3D10, 8, (void**)&oPresent, hkPresent);
}

Reason is that several games have loaded multiple rendering libraries even if they currently don't use them. For example RDR2 has loaded Vulcan and DX12. With the example above we can write one library that works no matter which rendering engine the user is currently using. While right now, we have to build one dx12 library and one vulcan library.

uint150_t is bizarre and does nothing

I'm not sure why you have typedef uint64_t uint150_t;, but the resulting type is still only a 64-bit integer, not 150-bit.
You can't define integer sizes like this

When enabling Minhook => Unresolved external symbol MH_DisableHook referenced in function

I've cloned this repo and using VS 2019 I've successfully build the project. However only when I set KIERO_USE_MINHOOK to 1, I get 4 compiling error such as unresolved external symbol MH_DisableHook referenced in function "void __cdecl kiero::shutdown(void)"

In my VS project I've added minhook include folder to the include path directories:
<IncludePath>C:\kiero\minhook\include;$(IncludePath)</IncludePath>

Any idea what I'm doing wrong?

Dx11 Present hook spikes GPU usage

First of all thank you very much for your library. I use to do the same around ~6-8 years ago and forgot most of it, writing my own base seems overkill for my tiny project, so I happily use yours.

It works as expected and had a nice start, however I just found out that it spikes my GPU usage up to 25% higher than without the hook. Currently I'm trying to figure out why because I've never experienced it before.

Back then I've used a Findpattern/Detours way for CS:Source, and the detour functions used to be rather small. Looking into Minhook I see a lot of instructions there.

So my current guess lies on Minhook. But I would also expect I did something really wrong.

I've tested it out on this sample Dx11 application:
https://www.3dgep.com/introduction-to-directx-11/ (Binary on the bottom)

And to save time, used this injector:
https://github.com/DarthTon/Xenos/

Running the application results in a typical usage of ~38-41% CPU / ~50-52% GPU on a i5-4690/1080GTX.

With a running hook that just calls back the original function I have a result of around:
40-43% CPU (which is neglible) and up to 78% GPU.

I've removed most of my own code out of my sample:
https://pastebin.com/bq4YnJH9

I've found out that switching from __stdcall to __fastcall seems to improve performance just a bit, Compiling in release mode does not.

I'm currently tinkering with a different hooking mechanism and different types of diagnostic. Time to open up IDA again.
But maybe you have some input on how to improve the performance. Maybe me guesses are plain wrong. I wouldn't be surprised at all.

Thanks in advance!

/Edit:

After switching the library to Detours 4.0 (https://github.com/microsoft/Detours) I was able to bring the CPU back down to constant 38%, the GPU now stays pretty smooth at ~66% so that's something.
Still don't understand the problem at all. It's not like your library mines Bitcoin. I seem to miss something very fundamental.

making http requests on a seaprate thread

I want to make http requests using libcurl and use the data I get back to display it using ImGUI. When I do this, it just hangs the entire application. Is there a best practice for this?

upgrading problem

I'm using an old version of kiero I don't know how to switch it to the new version. Can you help me?

Present oPresent;
HWND window = NULL;
WNDPROC oWndProc;
ID3D11Device* pDevice = NULL;
ID3D11DeviceContext* pContext = NULL;
ID3D11RenderTargetView* mainRenderTargetView;

void InitImGui()
{
try
{
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags = ImGuiConfigFlags_NoMouseCursorChange;
ImGui_ImplWin32_Init(window);
ImGui_ImplDX11_Init(pDevice, pContext);
} //
catch (...) {}
}

LRESULT WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {

try
{
	if (true && ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam))
		return true;

	return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
}
catch (...) { return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam); }

}

bool init = false;
HRESULT hkPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
{
try
{
if (!init)
{
if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&pDevice)))
{
pDevice->GetImmediateContext(&pContext);
DXGI_SWAP_CHAIN_DESC sd;
pSwapChain->GetDesc(&sd);

			window = sd.OutputWindow;

			ID3D11Texture2D* pBackBuffer;
			pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
			if (pBackBuffer != 0x0) // pbackbuffer 0x0'e eşit olmaması lazım yoksa render fonksiyonu çalışmaz
				// oyuzden önce kontrol etmen lazım
				pDevice->CreateRenderTargetView(pBackBuffer, NULL, &mainRenderTargetView); // this crashes
			pBackBuffer->Release(); // de

			oWndProc = (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)WndProc);
			InitImGui();
			init = true;
		}
		else
		{
			return oPresent(pSwapChain, SyncInterval, Flags);
		}
	}
	
			pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
	ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
	return oPresent(pSwapChain, SyncInterval, Flags);
}
catch (...) { return oPresent(pSwapChain, SyncInterval, Flags); }


DWORD WINAPI GUI::MainThread()

{
try
{
std::cout << "Trying to hook overlay" << std::endl;
//bool init_hook = false;
while (true)
{
if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success)
{
kiero::bind(8, (void**)&oPresent, hkPresent);
//init_hook = true;
break;
}
else
{
std::cout << "Code returned from overlay" << kiero::init(kiero::RenderType::D3D11) << std::endl;
break;
}
}
}
catch (...) { MessageBoxA(NULL, "Overlay Crashed", "X", MB_OK); }

return TRUE;

}

BOOL WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hMod);
CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)Core::Init, hMod, 0, nullptr);
break;
case DLL_PROCESS_DETACH:
kiero::shutdown();
break;
}

return TRUE;

}

I don't know how to translate this into a new kiero.

hook windows dwm

I think hook windows DWM, but I can't find DirectX related dynamic library in DWM. DirectX exists in dwmcore.dll loaded by DWM. What can I do to use this library

Support for D3D9EX

Hello!

Firstly, thank you for making this library!
I am using this library for quite some time now, and I noticed that a game that I'm trying to hook to is using D3D9Ex instead of D3D9.

Hooking this game through D3D9 works just fine, but the game calls D3D9Ex's PresentEx instead of D3D9's Present, which is causing weird issues with imgui and my code.

I have written a basic implementation of this over at my fork based on your d3d9 code, and I am actively using this code in my personal projects.

This code does work and function correctly (I am now able to hook PresentEx), but the reason why I have not created a pull request is because I am having a conflicted standpoint: is it more correct to add it as an "extension" to D3D9, or as it's own separate RenderType?

I would love to discuss this for code review, and hopefully add it to this repository.
Thank you!

D3D_FEATURE_LEVEL

Hi, nice hook. Just one thing, in kiero.cpp:

This will make d3d11 drawindexed hook fail:
const D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_11_0 };

With this d3d11 hooks work fine:
D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1 };

Not sure why, did not look much into it.

Linker errors

Hey i got some linker errors from that win32Imgui impl
ImGui_Hook

Can u say me pls how to fix that ?

bug

d3d9_impl.cpp
void impl::d3d9::init()
assert
Debug work only

Wrong ID for SetTexture on d3d9

On the index table, SetTexture is supposed to be 65 on d3d9, but the actual function there points to SetTexture_FP

image

The actual address is in a different table
image

Any clues what could be causing this?

Having an issue with CreateDXGIFactory

I added a few debug logging to get the actual HRESULT when attempting to call CreateDXGIFactory during initialization. The modules are found perfectly fine, and apparently the function is CreateDXGIFactory is also found correctly.

However, when attempting to call in this block:

IDXGIFactory* factory;  
HRESULT result = ((long(__stdcall*)(const IID&, void**))(CreateDXGIFactory))(__uuidof(IDXGIFactory), (void**)&factory);
if (result < 0)
{
    ::DestroyWindow(window);
    ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
    return Status::IDXGIFactoryFailed;
}

I found it was returning the following error:

DXGI_ERROR_INVALID_CALL 0x887A0001
The application provided invalid parameter data; this must be debugged and fixed before the application is released.

I have done a bit of searching, but for some reason I can't determine the root cause. Any help or tips would be appreciated?

kiero::init crashing game, even when using example code

Tried writing my own code for a DX11 hook with kiero, it crashed on line 322 of kiero.cpp in kiero::init(). Memory Access Violation.

So I downloaded https://github.com/rdbo/ImGui-DirectX-11-Kiero-Hook and compiled + injected it into my process. Crashed again, same line, same error.

Exception thrown at 0x2E741A8C in Among Us.exe: 0xC0000005: Access violation executing location 0x2E741A8C.

This is the line it crashes on, any ideas?

if (((long(__stdcall*)(
	IDXGIAdapter*,
	D3D_DRIVER_TYPE,
	HMODULE,
	UINT,
	const D3D_FEATURE_LEVEL*,
	UINT,
	UINT,
	const DXGI_SWAP_CHAIN_DESC*,
	IDXGISwapChain**,
	ID3D11Device**,
	D3D_FEATURE_LEVEL*,
	ID3D11DeviceContext**))(D3D11CreateDeviceAndSwapChain))(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, featureLevels, 1, D3D11_SDK_VERSION, &swapChainDesc, &swapChain, &device, &featureLevel, &context) < 0)
{
	::DestroyWindow(window);
	::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
	return Status::UnknownError;
}

Program I'm trying to hook is Among Us

fix example??

Was using the example to try stuff and things didn't work,
had to change this line

kiero::bind(42, (void**)&oEndScene, hkEndScene);
to
kiero::bind(42, (void**)&oEndScene, &hkEndScene);
idk maybe its just me lol

Is this a problem ?

in readme file :

  if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success)                     // 1
  // or
  if (kiero::init(kiero::RenderType::Auto) == kiero::Status::Success)                      // 2
  {
    // define KIERO_USE_MINHOOK must be 1
    // the index of the required function can be found in the METHODSTABLE.txt
    kiero::bind(42, (void**)&oEndScene, hkEndScene);
    
    // If you just need to get the function address you can use the kiero::getMethodsTable function
    oEndScene = (EndScene)kiero::getMethodsTable()[42];
  }

the execution flow will go through the 1 condition, then it will skip the 2 body, am I right?
So, the hook can not be done.
It should be:

  if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success ||                   // 1
      kiero::init(kiero::RenderType::Auto) == kiero::Status::Success)                      // 2
  {
    // define KIERO_USE_MINHOOK must be 1
    // the index of the required function can be found in the METHODSTABLE.txt
    kiero::bind(42, (void**)&oEndScene, hkEndScene);
    
    // If you just need to get the function address you can use the kiero::getMethodsTable function
    oEndScene = (EndScene)kiero::getMethodsTable()[42];
  }

So that whatever we choose, d3d9 or auto, it will always complete the hook.
Am I right?
BTW, thnx for your project, I love the code.

offer project

hi mate really nice project sorry to write this here, but can I have your discord id to offer freelance projects? or if you can add me on discord : lifesoulmmkiy#6045
thank you and sorry again to write this here.

DX11HOOK

Do you have The Dx11 VTable Hook ImGui
My Code is all right, but it doesn't respond~
S2C@)GSOG0E3D$SX~QL_4%O

D3D Create device error

Xenos Injector Native Inject:
direct3D9->CreateDevice runs forever and does not create a device.
D3D11 error while creating the device.

Xenos Injector Manul Map:
Error: 0xC0000138

The OpenGL hook works fine in both cases, so it is unlikely that the bug is somewhere else

METHODSTABLE.txt multiple methods defined, no way to differentiate

I'm creating an issue since I was not able to find any contact information for the author.
For the project I am currently working on I need to hook each and every one of the D3D11 methods.
My problem now is that there are some functions (e.g. SetPrivateData), provided by different interfaces (e.g. Device, DeviceChild,...).
How can i know which hook function needs which interface as an input parameter?

To clarify:

#define D3D11_METHODS \
	X(3, HRESULT, SetPrivateDataDevice, ID3D11Device*, pDevice, REFGUID, guid, UINT, DataSize, const void*, pData) \
	X(4, HRESULT, SetPrivateDataInterfaceDevice, ID3D11Device*, pDevice, REFGUID, guid) \
	X(5, HRESULT, GetPrivateDataDevice, ID3D11Device*, pDevice, REFGUID, guid, UINT*, pDataSize, void*, pData)\
	X(6, HRESULT, GetParent, IDXGIObject*, pObject, REFIID, riid, void**, pParent)

This is how i hook every single function. It's a macro that is expanded by the compiler, since every hook is identical.
I cannot define this macro for the functions with multiple entries in the METHODSTABLE.txt without trial and error. Do I just need to try and see which one is correct?

kiero init failed with d3d11

I try to hook Present function with detours, so first I want to get the original Present function with kiero, and it init failed because the D3D11CreateDeviceAndSwapChain return error in D3D11, anyone can resolve my question?

Unsolved External Symbol

Issue #15 had the same error but I don't know what he means by "forgot to add the include and bin folders to the project using the buttons in vs2019" I added kiero.h, kiero.cpp, the whole impl folder, and minhook.h, in include directories. I dont know what im missing or need to do.

Can't unload

So, I've gotten Kiero to hook d3d11 like intended. But, when i try to unload, it just crashes.

void Remove(HWND hWindow)
{
	SetWindowLongPtr(hWindow, GWLP_WNDPROC, (LONG_PTR)oWndProc);
}

void hook_dx11()
{
	if (kiero::init(kiero::RenderType::D3D11) == kiero::Status::Success)
		assert(kiero::bind(8, (void**)&phookD3D11Present, PresentHook) == kiero::Status::Success);
}

void remove_dx11()
{
	kiero::unbind(8);

	g_pd3dDevice->Release();
	g_pd3dContext->Release();

	ImGui_ImplWin32_Shutdown();
	ImGui_ImplDX11_Shutdown();
	ImGui::DestroyContext();

	Remove(FindWindow(NULL, L"Call of Duty®: Black Ops II - Multiplayer"));
}

void Thread(HMODULE module)
{
	hook_dx11();

	while (true)
	{
		if (GetAsyncKeyState(VK_DELETE) & 0x8000)
			break;
	}

	remove_dx11();

	FreeConsole();
	FreeLibraryAndExitThread(module, NULL);
}

[DX11] Hook DirectX

Alright, so basically I'm trying to hook into DirectX into a unity game right,

and no work.

It doesn't crash, it says the method is working, and it does nothing.

(Trying to add ImGui)

CreateGui:

    void gui::CreateGui()
    {
		kiero::Status::Enum st = kiero::init(kiero::RenderType::D3D11);
		if (st == kiero::Status::Enum::Success)
        {
			if (kiero::bind(8, (void**)&oPresent, hkPresent11) == kiero::Status::Success)
				std::cout << "Binded to DirectX\n";
			else
				std::cout << "Failed to bind to DirectX\n";
        }
		else
		{
			const char* f;
			switch (st)
			{
			case kiero::Status::AlreadyInitializedError:
				f = "already done";
				break;
			case kiero::Status::ModuleNotFoundError:
				f = "module aint found";
				break;
			case kiero::Status::NotInitializedError:
				f = "no init";
				break;
			case kiero::Status::NotSupportedError:
				f = "no support";
				break;
			case kiero::Status::UnknownError:
				f = "idkfk";
				break;
			}
			std::cout << "Failed to load Hooking Lib. Status: " << st << "\n";
		}
    }

Hook:

long __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
{
	static bool init = false;

	if (!init)
	{
		DXGI_SWAP_CHAIN_DESC desc;
		pSwapChain->GetDesc(&desc);

		ID3D11Device* device;
		pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&device);

		ID3D11DeviceContext* context;
		device->GetImmediateContext(&context);

		ImGui::CreateContext();
		ImGui_ImplWin32_Init(desc.OutputWindow);
		ImGui_ImplDX11_Init(device, context);

		init = true;
	}

	ImGui::ShowAboutWindow();

	return oPresent(pSwapChain, SyncInterval, Flags);
}

Thanks.

[D3D9] Full screen hook not working

Hello. I am hooking Reset and Present like this but it does not seem to work when the game is in full screen.

#define KIERO_USE_MINHOOK    1
	if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success)
	{
		kiero::bind(16, (void**)&context::reset_original, context::reset_hook);

		kiero::bind(17, (void**)&context::present_original, context::present_hook);
	}

Present never gets called, but it works fine in borderless / windowed mode.
The game's name is Rocket League.
Thanks in advance.

OpenGL

How do I make this work with OpenGL 3 ?
idk why OpenGL 3 method table doesn't contain wglSwapBuffers
help

custom argument to hkPresent

Hi, sorry for this noob question
I just started to work with c++ and kiero today, so I dont know anything

I want to know its possible to pass extra argument to hkPresent?
curently its look like this in d3d11_impl.cpp

long __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
{
    //some code
}

its possible to pass some extra argument to it?
so lets say in main.cpp we have impl::d3d11::init(1);, and in d3d11_impl.cpp void impl::d3d11::init(int arg)
how can i pass it to

assert(kiero::bind(8, (void**)&oPresent, hkPresent11) == kiero::Status::Success);

and get it in __stdcall hkPresent11?
and one other time sorry for noob question

windows 10

i dont understand why is not working.

i compile it and follow ur readme demo
but when i inject nothing happen .. should i install something else?

i had

vstudio 2017 / dx sdk june 2010 .. complete c++ redist

problem about kiero::bind

the kiero::bind(..) function is defined as follow:
void kiero::bind(uint16_t _index, void* _original, void* _function)
{
// TODO: Need own detour function

#ifdef KIERO_USE_MINHOOK
if (g_renderType > 0)
{
MH_CreateHook((void*)g_methodsTable[_index], _function, &_original);
MH_EnableHook((void*)g_methodsTable[_index]);
}
#endif
}
but it just change the Formal parameters instead of actual parameters.
so the call like kiero::bind(42, oEndScene, hkEndScene) do not work and can casue process crash.
I change it as follow:
//void kiero::bind(uint16_t _index, void* _original, void* _function)
void kiero::bind(uint16_t _index, void** _original, void* _function)
{
// TODO: Need own detour function

#ifdef KIERO_USE_MINHOOK
if (g_renderType > 0)
{
//MH_CreateHook((void*)g_methodsTable[_index], _function, &_original);
MH_CreateHook((void*)g_methodsTable[_index], _function, _original);
MH_EnableHook((void*)g_methodsTable[_index]);

}

#endif
}
and the call kiero::bind(42, (void**)&g_oEndScene, hkEndScene) works well.

How to Compile the Code?

So from the read me provided with this repo, I understand you have to write your hook depending on what you want to do.

What I don't understand is; after writing it, how do you compile the code? I don't know what to do from there.

Also, I get this error upon start-up:

CMake Error at C:\Users\User Name\Source\Repos\kiero\examples\imgui\imgui\examples\example_glfw_vulkan\CMakeLists.txt:23 (add_subdirectory):
  add_subdirectory given source "../../../glfw" which is not an existing
  directory.	imgui_example_glfw_vulkan	C:\Users\User Name\Source\Repos\kiero\examples\imgui\imgui\examples\example_glfw_vulkan\CMakeLists.txt	23	

I did some study on CMake, and I understand that it is a utility for helping to build the project. In the CMakeLists.txt file, are you supposed to provide the address to the .cpp file containing your hooking functionality?

If anyone can lead me in the right direction, that would be great. Thank you.

Input

How do you allow the input to the imgui for directx11?

CREATE_SUSPENDED inject

If I start a process by CREATE_SUSPENDED mode and inject a dll. Then when should I call init() function?

Can't ALT-TAB out of full-screen process when hooked

Context:
I am using DX9 + imGUI + kiero + DLL injection.
Also, I have implemented the recommended hkReset hook for when the context resets/changes resolution/enters/exits full-screen.

This issue is broken into two parts:

  1. If you inject the DLL & bind methods when the DirectX process is full-screen, the imGUI interface doesn't appear. However, if you inject the module when in windowed mode, then maximise or enter full-screen mode, the interface appears as expected.

  2. When the DLL is injected and the DirectX process is in full-screen, you cannot ALT-TAB or use the Windows key to exit the process. ALT-TAB allows you to select a target window, but does not change focus to that new application.

Please let me know what additional data you may need, thanks.

Add more comment please

I'm trying to understand how to use your stuff properly as it seems to be very powerful, but I don't understand your example...

What's needed in your base cpp file to make it work ? How does bind work and what do you need to do to make it work ? Etc...

I think you should add more comments in the example.

Thanks !

Unresolved External Symbols

Hey yall, when trying to use the example code i keep getting

LNK2001	Unresolved External Symbol ""enum kiero::Status::Enum __cdecl kiero::init(enum kiero::RenderType::Enum)" (?init@kiero@@YA?AW4Enum@Status@1@W42RenderType@1@@Z)"

LNK2001	Unresolved External Symbol ""enum kiero::Status::Enum __cdecl kiero::bind(unsigned short,void * *,void *)" (?bind@kiero@@YA?AW4Enum@Status@1@GPEAPEAXPEAX@Z)"

LNK2001	Unresolved External Symbol ""unsigned __int64 * __cdecl kiero::getMethodsTable(void)" (?getMethodsTable@kiero@@YAPEA_KXZ)"	

im using VS2019 and i added the 64 and 32 bit minhook .lib files to the linker in my project. Im guessing this is because i gotta add the .dll files somewhere?

Screen goes black when trying to minimize game

I've hooked ImGui window in GTA SA (DirectX9). Everything works fine but whenever I try to alt-tab out of the game the screen goes black. Then if I return to the game everything works fine.

This is my present hook, https://pastebin.com/YhSnx0NL

I read something similar about it here.
I tried using the same reset as well but the same thing,
https://pastebin.com/ehCWZGYh

I've tried to test which might be causing this issue and seems like something in keiro::init()?

Examples only work if compiled in Debug mode

I tried to use your examples, but if compiled in Release mode hkEndScene never gets called, because you youse assert in the init functions. A "How to setup"-Part in the Readme would be a very good idea i think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.