All pastes #981366 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-11 19:04 UTC
rendered paste body
#include	"../Hook.h"


LONG CursorX;
LONG CursorY;

VOID GetCursorPos( )
{
	POINT Pointer;
	HWND CoD2Handle;
	WINDOWPLACEMENT WinPlace;

	// Placement Organization
	GetCursorPos( &Pointer );
	CoD2Handle = FindWindowA( 0, "Call of Duty 2 Multiplayer" );  
	GetWindowPlacement( CoD2Handle, &WinPlace );

	CursorX = Pointer.x - WinPlace.rcNormalPosition.left;
	CursorY = Pointer.y - WinPlace.rcNormalPosition.top;
}


VOID UnlockMouse( )
{
	DWORD old;
	VirtualProtect( ( void* )0x4649CF, 1, PAGE_EXECUTE_READWRITE, &old );
	*( ( BYTE* )0x4649CF ) = 0xEB;
	VirtualProtect( ( void* )0x4649CF, 1, old, &old );
}
VOID LockMouse( )
{
	BYTE patch[0x2] = {
		0x75, 0x7C
	};

	DWORD size = sizeof( patch );
	LPBYTE address = ( LPBYTE )UlongToPtr( 0x4649CF );

	DWORD pprot;
	VirtualProtect( address, size, PAGE_EXECUTE_READWRITE, &pprot );
	CopyMemory( address, patch, size );
	VirtualProtect( address, size, pprot, &pprot );
}


bool CursorOnButton( float CursorX, float CursorY, float x, float y, float width, float height )
{
	if( ( CursorX >= x )  && ( CursorX <= ( x + width ) )  &&  ( CursorY >= y )  &&  ( CursorY <= ( y + height ) ) )
	{
		return true;
	}
	else
	{
		return false;
	}
}