 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 12:34 am Post subject: [VB6] how to write to a certain memorry address? |
|
|
well my question:
how to write to a certain memorry address?
my +rep is ready to be spent on a working source.
but i almost g2g to school so plz pm me if i forget to +rep
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 7:41 am Post subject: |
|
|
if it worx +rep
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Tue Mar 11, 2008 7:43 am Post subject: |
|
|
| haxory' wrote: | | if it worx +rep |
Of course it's going to.
_________________
| haxory' wrote: | can't VB do anything??
windows is programmed using VB right? correct me if im wrong.
so all things in windows you have like the start menu is a windows form too. |
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 7:49 am Post subject: |
|
|
is this vb6???
(the link you posted)
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Tue Mar 11, 2008 7:57 am Post subject: |
|
|
| haxory' wrote: | is this vb6???
(the link you posted) |
Are you serious?
_________________
| haxory' wrote: | can't VB do anything??
windows is programmed using VB right? correct me if im wrong.
so all things in windows you have like the start menu is a windows form too. |
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 8:07 am Post subject: |
|
|
yes sorry for being noob.
i suck at evrything exept makinf vb trainers and the basics
thats why i ask for help and not help DX
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Tue Mar 11, 2008 8:09 am Post subject: |
|
|
| haxory' wrote: | yes sorry for being noob.
i suck at evrything exept makinf vb trainers and the basics
thats why i ask for help and not help DX |
WriteProcessMemory is an API. Use Google to find pre-made code.
_________________
| haxory' wrote: | can't VB do anything??
windows is programmed using VB right? correct me if im wrong.
so all things in windows you have like the start menu is a windows form too. |
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 8:10 am Post subject: |
|
|
thx yer awesome
edit: no premade code to find
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
madmunky Newbie cheater
Reputation: 0
Joined: 08 Mar 2008 Posts: 21
|
Posted: Tue Mar 11, 2008 10:39 am Post subject: |
|
|
Will be interested in the answer to this also soon, designing my Interface at the moment but next step is the coding.
Also interested if this is going to work on VB2008
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 10:50 am Post subject: |
|
|
i just want to make a trainer i have my addresses and i only need to edit it
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
madmunky Newbie cheater
Reputation: 0
Joined: 08 Mar 2008 Posts: 21
|
Posted: Tue Mar 11, 2008 11:15 am Post subject: |
|
|
| Code: | Public Class NameSpooferPro
'These are our functions.
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) 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 CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Const PROCESS_ALL_ACCESS = &H1F0FFF
'They use the DLL files to use a function. Such as CloseHandle uses kernel32.dll to use the function "CloseHandle".
'**** Warcraft III code explanation ****'
'Warcraft III color codes always start with |C. To end a color you use |R. To Jump to a new line you use |N.
'The color is an ARGB color, converted to hex.
'ARGB = Alpha Red, Green, Blue, you usually ignore the alpha, in our case, we will.
'Red, Green, Blue are a number 0 - 255.
'Example, White in ARGB form is 255255255 (For every 3 digits, its a new number.)
'To convert it to a warcraft iii color, (Hex Color) you do |C, then Hex(ARGB COLOR HERE).
'It will convert your ARGB color to hexadecimal format. So if your argb color is 255255255 then the hexadecimal color is FFFFFFFF.
'So white is |CFFFFFFFF.
'**** End of explanation ****'
'If one of those trackbars are scrolled, then it will run the code below.
Private Sub TrackBars_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBarRED.Scroll, TrackBarGREEN.Scroll, TrackBarBLUE.Scroll
'This sets the background color of the button to the new color.
ColorPreview.BackColor = Color.FromArgb(TrackBarRED.Value, TrackBarGREEN.Value, TrackBarBLUE.Value)
'This will set the RED, GREEN, BLUE labels to the trackbars new value.
RED.Text = TrackBarRED.Value
GREEN.Text = TrackBarGREEN.Value
BLUE.Text = TrackBarBLUE.Value
'This sets the buttons text to the hex color code.
ColorPreview.Text = Hex(ColorPreview.BackColor.ToArgb)
'This takes the forecolor (or the text color) and makes it the inverted color of the background color. So if the background color is black, then the text color will be white.
ColorPreview.ForeColor = Color.FromArgb(255 - RED.Text, 255 - GREEN.Text, 255 - BLUE.Text)
End Sub
Private Sub StartColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartColor.Click
'The function Len() counts the number of characters in the specified string.
'We want to make sure that the textbox doesnt have more than 15 characters in it, if it does then when we go to write the new name, warcraft will get an error.
'So what we do is we count the number of characters in the NewName TextBox, and we add "|C" and the 8 digit hex color code to it.
'If the number of characters are less than or equal to 15, then we go ahead and do the code below.
If Len(NewName.Text & "|C" & Hex(ColorPreview.BackColor.ToArgb)) <= 15 Then
'This adds "|C" and the 8 digit hex color to the NewName TextBox.
NewName.Text &= "|C" & Hex(ColorPreview.BackColor.ToArgb)
End If
End Sub
Private Sub EndColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EndColor.Click
'This will count the characters in NewName.Text textbox and add "|R" to it. If its less than or equal to it will do the code below.
If Len(NewName.Text & "|R") <= 15 Then
'This adds "|R" to the textbox.
NewName.Text &= "|R"
End If
End Sub
Private Sub NextLine_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextLine.Click
'You can take a guess on what this does. If you really dont know what it does, refer to the 2 subs above.
If Len(NewName.Text & "|N") <= 15 Then
NewName.Text &= "|N"
End If
End Sub
Private Sub SaveSettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveSettings.Click
'Calls the sub "WriteName"
WriteName()
End Sub
Private Sub ColorPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorPreview.Click
'This creates a new color dialog box, then opens it.
Dim CD As New ColorDialog
CD.FullOpen = True
'This part shows the dialog box, and if the user presses OK then it sets all textboxes, trackbars, and colors to what they should be.
If CD.ShowDialog = Windows.Forms.DialogResult.OK Then
'Sets the button's text, forecolor, and backcolor to what they should be.
ColorPreview.Text = Hex(CD.Color.ToArgb)
ColorPreview.ForeColor = Color.FromArgb(255 - CD.Color.R, 255 - CD.Color.G, 255 - CD.Color.B)
ColorPreview.BackColor = CD.Color
'Sets the RED, GREEN, BLUE textboxes to the new color's RGB code.
RED.Text = CD.Color.R
GREEN.Text = CD.Color.G
BLUE.Text = CD.Color.B
'Sets the trackbars to the new color's RGB code.
TrackBarRED.Value = CD.Color.R
TrackBarGREEN.Value = CD.Color.G
TrackBarBLUE.Value = CD.Color.B
End If
End Sub
Private Sub NotifyIcon_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon.MouseDoubleClick
'If you double click on the icon in the system tray, (notify icon), it will do whats below.
'Shows the form.
Me.Show()
'Makes sure its minimized.
Me.WindowState = FormWindowState.Normal
'Removes the system tray icon (notify icon)
NotifyIcon.Visible = False
End Sub
Private Sub NameSpooferPro_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
'If the user resizes the application (minimize, maximize, resize, ect), it checks if it is minimized.
'If it is minimized, it does whats below.
If Me.WindowState = FormWindowState.Minimized Then
'Hides the application
Me.Hide()
'Shows the system tray icon.
NotifyIcon.Visible = True
End If
'If its being resized, but not minimized, it gets the name of the warcraft 3 user, that way you dont have to refresh... or wait 10 seconds for it to come up.
GetName()
End Sub
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
'The timer is set at invervals, when ever the timer hits the interval, it will trigger the code below.
'Our interval is 5000 milliseconds or 5 seconds.
'This gets the name of the warcraft 3 user.
GetName()
End Sub
Private Sub NameSpooferPro_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'When the application is started, it will get the name of the warcraft 3 user.
GetName()
End Sub
Public Sub WriteName()
'Try
'Catch ex As Exception
'End Try
'That means it will try to do the function, if it cant and gets an error it will do whats below of 'Catch ex As Exception'
'In our case, we want to message box the exception.
Try
'We declare Address as an integer (or number(s)), and vBuffer as Long.
'A Long is for longer integers. Integers can only store a maximum number. Longs can store much more.
Dim Address As Integer, vBuffer As Long
'We declare enc as an ASCIIEncoding. We use this to translate vBuffer into characters (or readable letters).
Dim enc As New System.Text.ASCIIEncoding
'Now we retreive the process for Warcraft III. (war3.exe)
Dim myProcesses As Process() = Process.GetProcessesByName("war3")
'If Warcraft III isnt running, then the length of it would be 0.
If myProcesses.Length = 0 Then
'So if it is 0 (or isnt running), we need to let the user know that isnt running.
'We do this by making the label "Status" say that Warcraft III isnt running.
Status.Text = "Warcraft III is not running."
'Then, we dont want to keep going or we will get an arithmatic overflow, so we have to exit the sub.
Exit Sub
End If
'Now since Warcraft III is running, we need to make sure we can access the process.
'We use processHandle and open the process of Warcaft III for reading and writing.
Dim processHandle As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcesses(0).Id)
'If we cant access the process, then processHandle will equal IntPtr.Zero (0)
If processHandle = IntPtr.Zero Then
'Now if we cant access the process, we need to let the user know. We do this by changing the status label's text.
Status.Text = "Failed to open Warcraft III process."
Exit Sub
End If
'Since we know that we can always find "3RAW 0" (ROC) or "PX3W 0" (TFT) at an offset that ends with HEX 2D4 or DEC 724.
'We need to start reading at HEX 2D4 or DEC 724.
'If we dont read either of those values, we need to increase the Address by DEC 65536 or HEX 10000.
'We keep doing this (looping) until we reach one of those values, and then the code tells us to 'Exit Do' which means we will exit the loop, now that we have our value.
Address = 724
'Do
'Loop
'That does the functions inbetween it until the user uses Exit Do.
Do
'We are going to use ReadProcessMemory(process, offet (or where we can find those values, vBuffer (returns what it has read), Length to read, Byte Written)
'We use processHandle (war3.exe), the Address starts at HEX 2D4 or DEC 724 and increases by DEC 65536 or HEX 10000 until it reads the correct value, we are reading 4 bytes since 3RAW 0 and PX3W 0 converted to a 4 byte integer is DEC 1463898675 or DEC 1462982736.
ReadProcessMemory(processHandle, Address, vBuffer, 4, 0)
'Now that we have ReadProcessMemory at the certain Address, we need to make sure its the right Address.
'We do this by checking if vBuffer is equal to 3RAW 0 or PX3W 0 in a 4 byte integer.
If vBuffer = 1463898675 Then
'If it is 3RAW 0 then we need to change our icon to ROC icon.
Me.Icon = My.Resources.ROC
'And the system tray icon..
NotifyIcon.Icon = My.Resources.ROC
'Now we need to subtract HEX 20 or DEC 32 from the address, because thats how far back our name location starts.
'So HEX 2D4 or DEC 724 - HEX 20 or DEC 32 is where our name location is located.
Address -= 32
'Now we dont want to keep reading memory until we reach the end (which will give you the arithmatic overflow)
'So we Exit the loop with Exit Do.
Exit Do
ElseIf vBuffer = 1462982736 Then
'If vBuffer isnt 3RAW 0, we still have a chance of the user using TFT, so we check if it is PX3W 0.
'If it is... Then we need to change our icon to TFT.
Me.Icon = My.Resources.TFT
NotifyIcon.Icon = My.Resources.TFT
'And subtract HEX 20 ir DEC 32 from the Address, that way we get our name location (offset).
Address -= 32
'We dont want to keep looping, so we Exit the loop with Exit Do.
Exit Do
Else
'If we still dont have the right address (or offset) then we need to add HEX 10000 or DEC 65536 to it until we finally get the right Address.
Address += 65536
'If we never get the right address, then the user is probully not logged into Battle.net, or he changed the value of 3RAW 0 or P3XW 0.
End If
Loop
'Now that we have our name offset, we need to write the new name at the offset.
'We do this by taking each letter of the new name textbox and adding it at the Address of the name.
'Since we are only writing 1 byte, that means we will have to add 1 to the Address each time, so we arent overwriting our last byte at the same exact offset.
'We do this by starting at 0 (i), and looping until i = the number of characters in the new name textbox - 1.
'We start at 0 because we dont want to add 1 to the name address right off the bat, or else you would have the old character of your last name, at the very front of your new name.
'We subtrasct 1 from the new name textbox because we dont need to write a blank offset to the end of the address. Thats why we have the 'For i As Integer = Len(newName.Text)'
For i As Integer = 0 To Len(NewName.Text) - 1
'This will write the new name at the address.
'Asc converts the String (which is the new name, newname.text textbox) to an integer.
'Mid(Str As String, Start As Integer, Length As Integer) will return the one letter from the String inputted.
WriteProcessMemory(processHandle, Address + i, Asc(Mid(NewName.Text, i + 1, 1)), 1, 0)
Next
'Now we need to null the left over bytes. The number of left over bytes is equal to 14 - the number of characters in the new name textbox.
'So we start our loop where we left off (above) and we do it until we reach 14.
For i As Integer = Len(NewName.Text) To 14
'We add i to the Address (that way we are writing at the right address (or offset).
'We are writing 0 (null), the length of it is 1, and the number of bytes written is 0.
WriteProcessMemory(processHandle, Address + i, 0, 1, 0)
Next
'Since we have gotten this far, we have done all those functions successfully.
'So we change the CurrentName textbox to the new name.
CurrentName.Text = NewName.Text
'And we let the user know that Warcraft III is still running.
Status.Text = "Warcraft III is running."
'So we dont get any errors when playing Warcraft III, we need to close the process from our reading and writing.
CloseHandle(processHandle)
Catch ex As Exception
'If we ever happen to get an error, we will catch the error as an exception, then let the user know by making the status label's text equal to the error. (exception.message)
Status.Text = ex.Message
'Then we need to exit the sub so we dont get any more errors.
Exit Sub
End Try
End Sub
Public Sub GetName()
'From here too where I put END, is where its the same as above.
Try
Dim Address As Integer, vBuffer As Long
Dim enc As New System.Text.ASCIIEncoding
Dim myProcesses As Process() = Process.GetProcessesByName("war3")
If myProcesses.Length = 0 Then
Status.Text = "Warcraft III is not running."
Exit Sub
End If
Dim processHandle As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, myProcesses(0).Id)
If processHandle = IntPtr.Zero Then
Status.Text = "Failed to open Warcraft III process."
Exit Sub
End If
Address = 724
Do
ReadProcessMemory(processHandle, Address, vBuffer, 4, 0)
If vBuffer = 1463898675 Then
Me.Icon = My.Resources.ROC
NotifyIcon.Icon = My.Resources.ROC
Address -= 32
Exit Do
ElseIf vBuffer = 1462982736 Then
Me.Icon = My.Resources.TFT
NotifyIcon.Icon = My.Resources.TFT
Address -= 32
Exit Do
Else
Address += 65536
End If
Loop
'END
'Below this is what has changed from WriteName.
'We declare ret as a Byte Array. We declare it as an array by putting () after Byte.
Dim ret As Byte() = Nothing
'We make sure that the CurrentName textbox is nothing. That way when we are converting the integer to a string, we arent &='ing onto the textbox.
CurrentName.Text = ""
'We are now going to start our loop, increase the Address by 1 each time, and read the process memory.
For i As Integer = 0 To 15
'Read the memory.
ReadProcessMemory(processHandle, Address + i, vBuffer, 1, 0)
'Now we need to take vBuffer and get the bytes from it.
ret = BitConverter.GetBytes(vBuffer)
'Then convert ret to a readable string.
'Then we add the new string to the Current Name textbox.
CurrentName.Text &= System.Text.Encoding.ASCII.GetString(ret).Replace("RAW", "")
Next
'Then we close the process so warcraft III doesnt get any errors.
CloseHandle(processHandle)
'Then we need to let the user know that Warcraft III is running fine.
Status.Text = "Warcraft III is running."
Catch ex As Exception
'If we happen to get any errors, we will set the status label's text to the exceptions (error) (ex.message).
Status.Text = ex.Message
'Then we need to exit the sub so we dont get any more errors.
Exit Sub
End Try
End Sub
End Class |
I found the above code on another website hopefully it will help.
It seems most people here only know how to do trainers in other languages and VB only really gets used for Flash trainers
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 12:07 pm Post subject: |
|
|
yes thats the case with me too
but ima make a trainer for a bad protected game
edit: it is full of errors
45 errors in total
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel
Last edited by Haxory' on Tue Mar 11, 2008 12:13 pm; edited 1 time in total |
|
| Back to top |
|
 |
madmunky Newbie cheater
Reputation: 0
Joined: 08 Mar 2008 Posts: 21
|
Posted: Tue Mar 11, 2008 12:09 pm Post subject: |
|
|
Keep us updated will be good to know if you get it working then you can help me
from the above code it looks like its all possible
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Tue Mar 11, 2008 12:16 pm Post subject: |
|
|
well if it works ill tell you
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
|
|
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
|
|