Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[VB.NET] MemoryWrite (float)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
synapsehome
How do I cheat?
Reputation: 0

Joined: 13 Jul 2011
Posts: 7

PostPosted: Sat Jul 16, 2011 3:18 am    Post subject: [VB.NET] MemoryWrite (float) Reply with quote

Sry me abount stupid question, but i cant write float value, this is my source:
Declare:
Code:
 Const PAGE_READWRITE = &H4&
    Const PROCESS_ALL_ACCESS = &H1F0FFF
    Private Declare Function GetWindowThreadProcessId Lib "User32" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Integer
    Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
    Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
    Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Integer
    Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Private Declare Function VirtualProtectEx Lib "kernel32" (ByVal hProcess As Integer, ByRef lpAddress As Object, ByVal dwSize As Integer, ByVal flNewProtect As Integer, ByRef lpflOldProtect As Integer) As Integer
    Dim Address(0 To 1) As Integer
   Dim sBuffer(0 To 1) As Double
    Dim convert(0 To 1) As Integer
    Dim byte_array0 As Byte() = Nothing


And Button.Click:
Code:
Dim myProcesses As Process() = Process.GetProcessesByName("hl2")
        Dim processHandle As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcesses(0).Id)
        Address(0) = 010547D8
        byte_array0 = BitConverter.GetBytes(vBuffer(0))
        convert(0) = BitConverter.ToInt32(byte_array0, 0)
        vBuffer(0) = "0,03"
        VirtualProtectEx(processHandle, Address(0), 4, PAGE_READWRITE, 0)
        WriteProcessMemory(processHandle, Address(0), vBuffer(0), 4, 0)

It doesnt work! Rolling Eyes
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Sat Jul 16, 2011 9:17 am    Post subject: Reply with quote

You shouldnt need any of those api's besides
WriteProcessMemory
ReadProcessMemory

For button click, well haha i wont say anything but it should look a little more like
Dim myProcesses As Process() = Process.GetProcessesByName("hl2")
Dim byte_array0 As Byte() = BitConverter.GetBytes(0.03F)
WriteProcessMemory(myProcesses(0).Handle, &H10547D8, byte_array0, byte_array0.Length, 0)

No guarantee this code is gonna work for you. Never tested

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites