Код:
#include "includes.h"
#ifdef _WIN64
#define GWL_WNDPROC GWLP_WNDPROC
#endif
extern
LRESULT
ImGui_ImplWin32_WndProcHandler
(
HWND hWnd
,
UINT msg
,
WPARAM wParam
,
LPARAM lParam
)
;
typedef
long
(
__stdcall
*
EndScene
)
(
LPDIRECT3DDEVICE9
)
;
static
EndScene oEndScene
=
NULL
;
LPDIRECT3DDEVICE9 pDevice
=
nullptr
;
WNDPROC oWndProc
;
static
HWND window
=
NULL
;
void
InitImGui
(
LPDIRECT3DDEVICE9 pDevice
)
{
ImGui
::
CreateContext
(
)
;
ImGuiIO
&
io
=
ImGui
::
GetIO
(
)
;
io
.
Fonts
->
AddFontFromFileTTF
(
(
"C:\\Windows\\Fonts\\Arial.ttf"
)
,
20
,
NULL
,
io
.
Fonts
->
GetGlyphRangesCyrillic
(
)
)
;
io
.
ConfigFlags
=
ImGuiConfigFlags_NoMouseCursorChange
;
ImGui_ImplWin32_Init
(
window
)
;
ImGui_ImplDX9_Init
(
pDevice
)
;
}
bool
init
=
false
;
bool
openmenu
=
false
;
long
__stdcall
hkEndScene
(
LPDIRECT3DDEVICE9 pDevice
)
{
// Unhook
if
(
GetAsyncKeyState
(
VK_END
)
)
{
kiero
::
shutdown
(
)
;
}
// Open Menu
if
(
GetAsyncKeyState
(
VK_HOME
)
&
1
)
{
openmenu
=
!
openmenu
;
}
if
(
openmenu
)
{
ImGui_ImplDX9_NewFrame
(
)
;
ImGui_ImplWin32_NewFrame
(
)
;
ImGui
::
NewFrame
(
)
;
auto
flags
=
ImGuiConfigFlags_NoMouseCursorChange
|
ImGuiWindowFlags_NoCollapse
|
ImGuiWindowFlags_NoTitleBar
|
ImGuiWindowFlags_NoScrollbar
|
ImGuiWindowFlags_NoResize
|
ImGuiWindowFlags_AlwaysAutoResize
;
static
int
ttab
;
ImGui
::
Begin
(
(
"DarwinTap"
)
,
nullptr
,
flags
)
;
if
(
ImGui
::
Button
(
(
u8
"Аимбот"
)
,
ImVec2
(
100.f
,
0.f
)
)
)
{
ttab
=
1
;
}
ImGui
::
SameLine
(
0.f
,
2.f
)
;
if
(
ImGui
::
Button
(
(
u8
"Визуалы"
)
,
ImVec2
(
100.f
,
0.f
)
)
)
{
ttab
=
2
;
}
ImGui
::
SameLine
(
0.f
,
2.f
)
;
if
(
ImGui
::
Button
(
(
u8
"Другое"
)
,
ImVec2
(
100.f
,
0.f
)
)
)
{
ttab
=
3
;
}
ImGui
::
SameLine
(
0.f
,
2.f
)
;
if
(
ImGui
::
Button
(
(
u8
"Цвета"
)
,
ImVec2
(
100.f
,
0.f
)
)
)
{
ttab
=
4
;
}
ImGui
::
End
(
)
;
ImGui
::
EndFrame
(
)
;
ImGui
::
Render
(
)
;
ImGui_ImplDX9_RenderDrawData
(
ImGui
::
GetDrawData
(
)
)
;
}
return
oEndScene
(
pDevice
)
;
}
LRESULT __stdcall
WndProc
(
const
HWND hWnd
,
UINT uMsg
,
WPARAM wParam
,
LPARAM lParam
)
{
if
(
true
&&
ImGui_ImplWin32_WndProcHandler
(
hWnd
,
uMsg
,
wParam
,
lParam
)
)
return
true
;
return
CallWindowProc
(
oWndProc
,
hWnd
,
uMsg
,
wParam
,
lParam
)
;
}
BOOL CALLBACK
EnumWindowsCallback
(
HWND handle
,
LPARAM lParam
)
{
DWORD wndProcId
;
GetWindowThreadProcessId
(
handle
,
&
wndProcId
)
;
if
(
GetCurrentProcessId
(
)
!=
wndProcId
)
return
TRUE
;
// skip to next window
window
=
handle
;
return
FALSE
;
// window found abort search
}
HWND
GetProcessWindow
(
)
{
window
=
NULL
;
EnumWindows
(
EnumWindowsCallback
,
NULL
)
;
return
window
;
}
DWORD WINAPI
MainThread
(
LPVOID lpReserved
)
{
bool
attached
=
false
;
do
{
if
(
kiero
::
init
(
kiero
::
RenderType
::
D3D9
)
==
kiero
::
Status
::
Success
)
{
kiero
::
bind
(
42
,
(
void
*
*
)
&
oEndScene
,
hkEndScene
)
;
do
window
=
GetProcessWindow
(
)
;
while
(
window
==
NULL
)
;
oWndProc
=
(
WNDPROC
)
SetWindowLongPtr
(
window
,
GWL_WNDPROC
,
(
LONG_PTR
)
WndProc
)
;
attached
=
true
;
}
}
while
(
!
attached
)
;
return
TRUE
;
}
BOOL WINAPI
DllMain
(
HMODULE hMod
,
DWORD dwReason
,
LPVOID lpReserved
)
{
switch
(
dwReason
)
{
case
DLL_PROCESS_ATTACH
:
DisableThreadLibraryCalls
(
hMod
)
;
CreateThread
(
nullptr
,
0
,
MainThread
,
hMod
,
0
,
nullptr
)
;
break
;
case
DLL_PROCESS_DETACH
:
kiero
::
shutdown
(
)
;
break
;
}
return
TRUE
;
}