Created
November 29, 2017 06:49
-
-
Save NotAdam/389ed8173afffb58ad13431ad01067af to your computer and use it in GitHub Desktop.
ffxiv dinput8 forwarding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#define WIN32_LEAN_AND_MEAN 1 | |
#include <Windows.h> | |
static HRESULT( WINAPI *OrigDirectInput8Create )( | |
HINSTANCE hinst, | |
DWORD dwVersion, | |
REFIID riidltf, | |
LPVOID * ppvOut, | |
LPUNKNOWN punkOuter | |
); | |
extern "C" __declspec( dllexport ) HRESULT WINAPI DirectInput8Create( | |
HINSTANCE hinst, | |
DWORD dwVersion, | |
REFIID riidltf, | |
LPVOID * ppvOut, | |
LPUNKNOWN punkOuter | |
) | |
{ | |
return OrigDirectInput8Create( hinst, dwVersion, riidltf, ppvOut, punkOuter ); | |
} | |
BOOL APIENTRY DllMain( HMODULE hModule, | |
DWORD ul_reason_for_call, | |
LPVOID lpReserved | |
) | |
{ | |
switch ( ul_reason_for_call ) | |
{ | |
case DLL_PROCESS_ATTACH: | |
{ | |
char lib_path[ MAX_PATH ]; | |
GetSystemDirectoryA( lib_path, MAX_PATH ); | |
strcat_s( lib_path, "\\dinput8.dll" ); | |
auto lib = LoadLibraryA( lib_path ); | |
if ( !lib ) | |
{ | |
return FALSE; | |
} | |
*( void** ) &OrigDirectInput8Create = ( void* ) GetProcAddress( lib, "DirectInput8Create" ); | |
// ur shit | |
MessageBox( NULL, L"wew lad", L"its ya boy", NULL ); | |
break; | |
} | |
case DLL_THREAD_ATTACH: | |
case DLL_THREAD_DETACH: | |
case DLL_PROCESS_DETACH: | |
break; | |
} | |
return TRUE; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment