[HELP] Source Code for Visual Basic

Posts 1–15 of 17 · Page 1 of 2
[HELP] Source Code for Visual Basic
Hey there members of MPGH, I wanted to start coding some hacks by myself for Call Of Duty: Ghosts. The problem is I am not the best with Visual Basic so I am requesting Simple Source Code for Visual Basic so I can get started coding for the community of MPGH. Thanks in advance.

¬Rob
Code:
			Class CC
	Private Shared ProcName As String = ""
	Private Shared pHandle As IntPtr = IntPtr.Zero
	<System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError := True)> _
	Private Shared Function WriteProcessMemory(hProcess As IntPtr, lpBaseAddress As IntPtr, lpBuffer As Byte(), nSize As Integer, ByRef lpNumberOfBytesWritten As IntPtr) As Boolean
	End Function
	<System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError := True)> _
	Private Shared Function ReadProcessMemory(hProcess As IntPtr, lpBaseAddress As IntPtr, <System.Runtime.InteropServices.Out> lpBuffer As Byte(), dwSize As Integer, ByRef lpNumberOfBytesRead As IntPtr) As Boolean
	End Function

	Public Shared Property ProcessName() As String
		Get
			Return ProcName
		End Get
		Set
			If System.Diagnostics.Process.GetProcessesByName(value).Length <> 0 Then
				pHandle = System.Diagnostics.Process.GetProcessesByName(value)(0).Handle
				ProcName = value
			Else
				System.Windows.Forms.MessageBox.Show(value & vbLf & vbLf & "      Not Found!", "Error:" & value, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.[Error])
				ProcName = ""
			End If
		End Set
	End Property

	Public Class Write
		Public Shared Sub _Int16(Address As Int64, Value As Int16)
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				WriteProcessMemory(pHandle, New IntPtr(Address), BitConverter.GetBytes(Value), sizeof(Int16), retByt)
			End If
		End Sub
		Public Shared Sub _Int32(Address As Int64, Value As Int32)
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				WriteProcessMemory(pHandle, New IntPtr(Address), BitConverter.GetBytes(Value), sizeof(Int32), retByt)
			End If
		End Sub
		Public Shared Sub _Int64(Address As Int64, Value As Int64)
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				WriteProcessMemory(pHandle, New IntPtr(Address), BitConverter.GetBytes(Value), sizeof(Int64), retByt)
			End If
		End Sub
		Public Shared Sub _Float(Address As Int64, Float As [Single])
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				WriteProcessMemory(pHandle, New IntPtr(Address), BitConverter.GetBytes(Float), sizeof([Single]), retByt)
			End If
		End Sub
		Public Shared Sub _String(Address As Int64, Value As [String])
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				WriteProcessMemory(pHandle, New IntPtr(Address), ASCIIEncoding.ASCII.GetBytes(Value), sizeof(Int64), retByt)
			End If
		End Sub
		Public Shared Sub _Bytes(Address As Int64, Value As [Byte]())
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				WriteProcessMemory(pHandle, New IntPtr(Address), Value, Value.Length, retByt)
			End If
		End Sub
	End Class
	Public Class Read
		Public Shared Function _Int16(Address As Int64) As Int16
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				Dim buffer As [Byte]() = New [Byte](sizeof(Int16) - 1) {}
				ReadProcessMemory(pHandle, New IntPtr(Address), buffer, sizeof(Int16), retByt)
				Return BitConverter.ToInt16(buffer, 0)
			Else
				Return 0
			End If
		End Function
		Public Shared Function _Int32(Address As Int64) As Int32
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				Dim buffer As [Byte]() = New [Byte](sizeof(Int32) - 1) {}
				ReadProcessMemory(pHandle, New IntPtr(Address), buffer, sizeof(Int32), retByt)
				Return BitConverter.ToInt32(buffer, 0)
			Else
				Return 0
			End If
		End Function
		Public Shared Function _Int64(Address As Int64) As Int64
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				Dim buffer As [Byte]() = New [Byte](sizeof(Int64) - 1) {}
				ReadProcessMemory(pHandle, New IntPtr(Address), buffer, sizeof(Int64), retByt)
				Return BitConverter.ToInt64(buffer, 0)
			Else
				Return 0
			End If
		End Function
		Public Shared Function _Float(Address As Int64) As [Single]
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				Dim buffer As [Byte]() = New [Byte](sizeof([Single]) - 1) {}
				ReadProcessMemory(pHandle, New IntPtr(Address), buffer, sizeof([Single]), retByt)
				Return BitConverter.ToSingle(buffer, 0)
			Else
				Return 0
			End If
		End Function
		Public Shared Function _String(Address As Int64, _Length As Int32) As [String]
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				Dim buffer As [Byte]() = New [Byte](_Length - 1) {}
				ReadProcessMemory(pHandle, New IntPtr(Address), buffer, _Length, retByt)
				Return ASCIIEncoding.ASCII.GetString(buffer)
			Else
				Return ""
			End If
		End Function
		Public Shared Function _Bytes(Address As Int64, _Size As Int32) As [Byte]()
			If System.Diagnostics.Process.GetProcessesByName(ProcName).Length <> 0 Then
				Dim retByt As IntPtr
				Dim buffer As [Byte]() = New [Byte](_Size - 1) {}
				ReadProcessMemory(pHandle, New IntPtr(Address), buffer, _Size, retByt)
				Return buffer
			Else
				Return New Byte(-1) {}
			End If
		End Function
	End Class
End Class
Jorndel's Ghosts mem class in VB.Net.
Thanks, Lovroman lets see if I can figure out what to do with this
Quote Originally Posted by robater View Post
Thanks, Lovroman lets see if I can figure out what to do with this
let me explain!
Under you public class write:
Dim you name or anything as new trainer (trainer is the name of the class!)
then click on you button for example and write:

ex coper.processhandle("iw6mp64_ship)
coper.writelong or string blabla(address (&H),l value) donE!
I'd suggest instead of going with vb you take c# instead, leans more towards other languages (c++ etc) and has the same and more capabilities then vb and is as easy to learn.

http://www.mpgh.net/forum/723-call-d...k-project.html

Here's a simple complete project done in c# (VS 2012) with a simple mem hack (squad points) and includes the mem class which you need for mem manipulation.

The address is outdated but can be found in a CE table here on the forum.

If you really only want VB then you can use the project and this c# to vb converter (works visa versa too)
http://www.developerfusion.com/tools.../vb-to-csharp/
Learn C++, it's kind of like C# and VB.net put together, but you can do much more .
Quote Originally Posted by ImMalkah View Post
Learn C++, it's kind of like C# and VB.net put together, but you can do much more .
I.... what....seriously??!!?? You don't even master c# let alone c++ seriously...

I'm not giving into the temptation there, too easy..




@robater please ignore the post above... C++ is way more advanced and doesn't have the "safety" of c# (which works in the .net environment)

I doubt you got much coding experience and that you want to start with basic cheat coding which is memory manipulation and this is done easier in c# (or vb as you said.) and you'll get easy access to windows forms etc.

If you later want to immerse yourself in the world of wallhacks, ESP's, Aimbots etc you can still do them in c# (as Master did) but usually the more advanced stuff is done in c++

I strongly suggest going for c# and if you still are eager to learn more and have a decent knowledge of the language you can go a step further and go after c++ (which has more or less the same syntax and structure then c#)
Thanks for the support, Distiny. I will start on coding some memory manipulation (Or I'll try). Just one quick question, I am going to use Russian Razor's cheat table. For example one of the addresses for Weapon in 1st Loadout and Player 1 is iw6mp64_ship.exe+44BEEF2, Would the address be 44BEEF2?
Quote Originally Posted by distiny View Post
I.... what....seriously??!!?? You don't even master c# let alone c++ seriously...

I'm not giving into the temptation there, too easy..




@robater please ignore the post above... C++ is way more advanced and doesn't have the "safety" of c# (which works in the .net environment)

I doubt you got much coding experience and that you want to start with basic cheat coding which is memory manipulation and this is done easier in c# (or vb as you said.) and you'll get easy access to windows forms etc.

If you later want to immerse yourself in the world of wallhacks, ESP's, Aimbots etc you can still do them in c# (as Master did) but usually the more advanced stuff is done in c++

I strongly suggest going for c# and if you still are eager to learn more and have a decent knowledge of the language you can go a step further and go after c++ (which has more or less the same syntax and structure then c#)
I was speaking to my teacher that I will have next semester he's had much more experience than you and he's been coding for IBM alone for over 25 years. He said that the basics of C++ is very similar to C# and VB.net. Therefore I'd rather believe someone with much more experience.
Quote Originally Posted by ImMalkah View Post
He said that the basics of C++ is very similar to C# and VB.net.
Similar != mix of two languages.
Quote Originally Posted by robater View Post
Thanks for the support, Distiny. I will start on coding some memory manipulation (Or I'll try). Just one quick question, I am going to use Russian Razor's cheat table. For example one of the addresses for Weapon in 1st Loadout and Player 1 is iw6mp64_ship.exe+44BEEF2, Would the address be 44BEEF2?
No, you have to add iw64mp_ship.exe's base address to 44BEEF2 , that's the real address. (Add address manually in Cheat Engine, it will automatically add base address to 44BEEF2).
Quote Originally Posted by ImMalkah View Post
I was speaking to my teacher that I will have next semester he's had much more experience than you and he's been coding for IBM alone for over 25 years. He said that the basics of C++ is very similar to C# and VB.net. Therefore I'd rather believe someone with much more experience.
So your teacher codes hacks ?

OT:VB works just as fine as C#, I've made hacks in both and they worked equally good. Just advance at your own pace, as you feel comfortable.
Quote Originally Posted by Lovroman View Post


Similar != mix of two languages.
I meant similar to both.
Quote Originally Posted by Horror View Post

So your teacher codes hacks ?

OT:VB works just as fine as C#, I've made hacks in both and they worked equally good. Just advance at your own pace, as you feel comfortable.
What does coding hacks have to do with what I said? I simply stated the fact that my teacher said the two languages are similar to C++.
@ImMalkah Similar, yes true, vb and c# combined together, your quote, no, not by a long shot. If your teacher said exactly that he's "coding" a wooden shack in his sandbox lol

@Horror yea vb is almost the same as c#, it's mainly the syntax that differs, I said that in the first post. I encouraged c# since the syntax leans more towards other languages then VB's

Quote Originally Posted by robater View Post
Thanks for the support, Distiny. I will start on coding some memory manipulation (Or I'll try). Just one quick question, I am going to use Russian Razor's cheat table. For example one of the addresses for Weapon in 1st Loadout and Player 1 is iw6mp64_ship.exe+44BEEF2, Would the address be 44BEEF2?
As lovroman explained, iw6mp64_ship.exe is the base address, in this case it's 0x140000000 (it's static aka it doesn't change)
You can find it by adding iw6mp64_ship.exe as an address in CE manually or by looking at the code while debugging or disassembling.

so iw6mp64_ship.exe+44BEEF2 is in fact 0x140000000 + 0x44BEEF2 = 0x1444BEEF2

Remember these are hexadecimal(0123456789ABCDEF) values and not decimal (0123456789).
Posts 1–15 of 17 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?