Notes
Notes - notes.io |
Header: base.cpp
Aciklama: C/C++ dili ile yazilmistir.
******************************************************************************/
#include <windows.h>
#include <stdio.h>
#include <fstream>
#include "cDetours.h"
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
/******************************************************************************/
#define HOOK(func,addy) o##func = (t##func)CreateDetour((DWORD)hk##func,(DWORD)addy,Detour_Type_0xB8,7)//Quick Hook using CreateDetour *********
#define UNHOOK(func,addy) o##func = (t##func)CreateDetour((DWORD)o##func,(DWORD)addy,Detour_Type_0xB8,7)//Quick Unook using CreateDetour *********
/********************************************************************************/
typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 pDevice);
tEndScene oEndScene = NULL;
typedef HRESULT (WINAPI* tDrawIndexedPrimitive)(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
tDrawIndexedPrimitive oDrawIndexedPrimitive = NULL;
typedef HRESULT(WINAPI* tReset)(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
tReset oReset = NULL;
/********************************************************************************/
LPDIRECT3DDEVICE9 npDevice;
LPD3DXLINE g_pLine = NULL;
D3DVIEWPORT9 g_ViewPort;
LPDIRECT3DVERTEXBUFFER9 Stream_Data;
UINT Offset = 0;
UINT Stride = 0;
bool WallHack = true;
bool chams = true;
int m_stride;
LPDIRECT3DDEVICE9 g_pDevice = 0;
int b = 0;
LPDIRECT3DTEXTURE9 g_Blue = NULL;
const BYTE Blue [60] =
{
0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00
};
LPDIRECT3DTEXTURE9 g_Oren = NULL;
const BYTE oren[ 58 ] = {
0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0xFF, 0x00
};
LPDIRECT3DTEXTURE9 g_Muda = NULL;
const BYTE muda[60] =
{
0x42, 0x4D, 0x3C, 0x00,0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x00,
0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01,0x00,
0x00, 0x00, 0x01, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x12, 0x0B, 0x00, 0x00,
0x12, 0x0B, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x80, 0x00, 0x00, 0x00, 0x00
};
void ReFont(LPDIRECT3DDEVICE9 pDevice)
{
if (g_pDevice != pDevice)
{
g_pDevice = pDevice;
}
}
PBYTE HookVTableFunction( PDWORD* dwVTable, PBYTE dwHook, INT Index )
{
DWORD dwOld = 0;
PBYTE pOrig = ((PBYTE)(*dwVTable)[Index]);
(*dwVTable)[Index] = (DWORD)dwHook;
return pOrig;
}
HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
{
while(!npDevice) {
npDevice = pDevice;
}
if(g_Oren == NULL) D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&oren, sizeof(oren), &g_Oren);
if(g_Blue == NULL) D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&Blue, sizeof(Blue), &g_Blue);
if(g_Muda == NULL) D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&muda, sizeof(muda), &g_Muda);
if(g_pLine == NULL) D3DXCreateLine(pDevice, &g_pLine);
pDevice->GetViewport(&g_ViewPort);
if(g_Blue == NULL) D3DXCrea[Maaf Saya Kasar]xtureFromFileInMemory(pDevice, (LPCVOID)&Blue, sizeof(Blue), &g_Blue);
if(g_pLine != NULL){
}
return oEndScene(pDevice);
}
HRESULT WINAPI hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE PrimType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
if(pDevice->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK)
Stream_Data->Release();
if(WallHack)
{
if(m_stride==52)
{
DWORD dwOldZEnable;
pDevice-> GetRenderState (D3DRS_ZENABLE, & dwOldZEnable);
pDevice-> SetRenderState (D3DRS_ZENABLE, D3DZB_FALSE);
oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
}
if(chams)
{
if(m_stride==44)
{
DWORD dwOldZEnable;
pDevice-> GetRenderState (D3DRS_ZENABLE, & dwOldZEnable);
pDevice-> SetRenderState (D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
pDevice->SetTexture( 0, g_Oren);
oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
pDevice-> SetRenderState (D3DRS_ZENABLE, dwOldZEnable);
}
}
return oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
HRESULT WINAPI hkReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
if( g_pLine )
g_pLine->OnLostDevice();
HRESULT iReturnValue = oReset(pDevice, pPresentationParameters);
if(iReturnValue == D3D_OK) {
if( g_pLine )
g_pLine->OnResetDevice();
}
HRESULT hRet = oReset(pDevice, pPresentationParameters);
return iReturnValue;
}
/********************************************************************************/
DWORD CreateDetour(DWORD dwThread,DWORD dwAdress,DWORD dwType,DWORD dwSize)
{
DWORD dwDetour,dwProtect,i;
if (dwAdress&&dwThread&&dwSize>= dwSize)
{
dwDetour = (DWORD)VirtualAlloc(0,dwSize+dwSize,0x1000,0x40);
if (dwDetour&&VirtualProtect((VOID*)dwAdress,dwSize,0x40,&dwProtect))
{
for (i=0;i<dwSize;i++)
{
*(BYTE*)(dwDetour+i)=*(BYTE*)(dwAdress+i);
}
switch (dwType)
{
case Detour_Type_0xE9:
{
*(BYTE*)(dwDetour+dwSize+0)=0xE9;
*(DWORD*)(dwDetour+dwSize+1)=(dwAdress-dwDetour-dwSize);
*(BYTE*)(dwAdress+0)=0xE9;
*(DWORD*)(dwAdress+1)=(dwThread-dwAdress-dwSize);
}
break;
case Detour_Type_0xB8:
{
*(BYTE*)(dwDetour+dwSize+0)=0xB8;
*(DWORD*)(dwDetour+dwSize+1)=(dwAdress+dwSize);
*(WORD*)(dwDetour+dwSize+5)=0xE0FF;
*(BYTE*)(dwAdress+0)=0xB8;
*(DWORD*)(dwAdress+1)=(dwThread);
*(WORD*)(dwAdress+5)=0xE0FF;
}
break;
case Detour_Type_0x68:
{
*(BYTE*)(dwDetour+dwSize+0)=0x68;
*(DWORD*)(dwDetour+dwSize+1)=(dwAdress+dwSize);
*(WORD*)(dwDetour+dwSize+5)=0xC3;
*(BYTE*)(dwAdress+0)=0x68;
*(DWORD*)(dwAdress+1)=(dwThread);
*(WORD*)(dwAdress+5)=0xC3;
}
break;
}
VirtualProtect((VOID*)dwAdress,dwSize,dwProtect,&dwProtect);
VirtualProtect((VOID*)dwDetour,dwSize+dwSize,0x20,&dwProtect);
return dwDetour;
}
}
Sleep(15);
return (0);
}
//------------------------- [ Hook ]-------------------------//
BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
{
if(dwReason == DLL_PROCESS_ATTACH){
Beep(100,1000);
CreateThread(0, 0, LoopFunction, 0, 0, 0);
}
return TRUE;
}
[/b]
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team