Advertisement
Guest User

Untitled

a guest
Nov 13th, 2010
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Module Module1
  2.  
  3. #Region "Declarations"
  4.  
  5.     Private Declare Function OpenProcess Lib "kernel32" Alias "OpenProcess" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
  6.     Private Declare Function WriteProcessMemory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
  7.     Private Declare Function WriteFloatMemory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
  8.     Private Declare Function ReadFloat Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByRef buffer As Single, ByVal size As Int32, ByRef lpNumberOfBytesRead As Int32) As Boolean
  9.     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
  10.     Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer
  11.  
  12.     Private string1 As Long
  13.     Private string2 As Integer
  14.     Private RBuff1 As Long
  15.     Private RBuff2 As Single
  16.     Private RBuff3 As Integer
  17.  
  18. #End Region
  19.  
  20. #Region "Check Process/ReadDll"
  21.  
  22.     Private Function readdll(ByVal modulename As String)
  23.         Dim procmodule As ProcessModule
  24.         Dim constant1 As Integer
  25.         Dim constant2 As Long
  26.         Dim constant3 As Process() = Process.GetProcessesByName("iw4mp")
  27.         If constant3.Length = 0 Then
  28.             Return 0
  29.         End If
  30.         For Each procmodule In constant3(0).Modules
  31.             If modulename = procmodule.ModuleName Then
  32.                 constant1 = procmodule.BaseAddress
  33.             End If
  34.         Next
  35.         constant2 = constant1
  36.         Return constant2
  37.     End Function
  38.  
  39.     Public Function IsProcessOpen(ByVal name As String) As Boolean
  40.  
  41.         For Each clsProcess As Process In Process.GetProcesses
  42.  
  43.             If clsProcess.ProcessName.Contains(name) Then
  44.  
  45.  
  46.                 Return True
  47.  
  48.             End If
  49.         Next
  50.         ' Do nothing
  51.        Return False
  52.     End Function
  53.  
  54.  
  55. #End Region
  56.  
  57. #Region "Hacks"
  58.  
  59.     'WriteMemory
  60.    Private Function WriteMemory(ByVal Address As Integer, ByVal Value As Long, ByVal Bytes As Integer)
  61.         Dim iw4mpLookUp As Process() = Process.GetProcessesByName("iw4mp")
  62.         If iw4mpLookUp.Length = 0 Then
  63.             End
  64.         End If
  65.         Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, iw4mpLookUp(0).Id)
  66.         WriteProcessMemory(processHandle, Address, Value, Bytes, Nothing)
  67.         CloseHandle(processHandle)
  68.  
  69.         Return Nothing
  70.     End Function
  71.  
  72.     'WriteFloat
  73.    Private Function WriteFloat(ByVal Address As Integer, ByVal Value As Single)
  74.         Dim iw4mpLookUp As Process() = Process.GetProcessesByName("iw4mp")
  75.         If iw4mpLookUp.Length = 0 Then
  76.             End
  77.         End If
  78.         Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, iw4mpLookUp(0).Id)
  79.         WriteFloatMemory(processHandle, Address, Value, 4, Nothing)
  80.         CloseHandle(processHandle)
  81.  
  82.         Return Nothing
  83.     End Function
  84.  
  85.     'NOP
  86.    Private Function NOP(ByVal Address As Integer, ByVal value As Integer)
  87.         Dim iw4mpLookUp As Process() = Process.GetProcessesByName("iw4mp")
  88.         If iw4mpLookUp.Length = 0 Then
  89.             End
  90.         End If
  91.         Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, iw4mpLookUp(0).Id)
  92.         WriteProcessMemory(processHandle, Address, value, 1, Nothing)
  93.         CloseHandle(processHandle)
  94.  
  95.         Return Nothing
  96.     End Function
  97.  
  98. #End Region
  99.  
  100. #Region "Functions"
  101.  
  102.     Public Function memoryh4x(ByVal address As String, ByVal value As Long, ByVal bytes As Byte)
  103.         If IsProcessOpen("iw4mp") Then
  104.  
  105.             string1 = readdll("cshell.dll")
  106.             string2 = "&H" & Hex(string1 + address)
  107.             WriteMemory(string2, value, bytes)
  108.         End If
  109.         Return Nothing
  110.     End Function
  111.  
  112.     Public Function texth4x(ByVal address As String, ByVal value As String)
  113.         If IsProcessOpen("iw4mp") Then
  114.             Dim chars As Long
  115.             Dim num As Long
  116.             Dim text As Long
  117.             num = -1
  118.             For chars = 1 To value.Length
  119.                 num += 1
  120.                 string1 = readdll("cshell.dll")
  121.                 string2 = CInt("&H" & Hex(string1 + (CDbl(address) + num)))
  122.                 text = Asc(value.Chars(num))
  123.                 WriteMemory(string2, text, 4)
  124.             Next chars
  125.         End If
  126.         Return Nothing
  127.     End Function
  128.  
  129.     Public Function floath4x(ByVal address As String, ByVal value As Long)
  130.         If IsProcessOpen("iw4mp") Then
  131.  
  132.             string1 = readdll("cshell.dll")
  133.             string2 = "&H" & Hex(string1 + address)
  134.             WriteFloat(string2, value)
  135.         End If
  136.         Return Nothing
  137.     End Function
  138.  
  139.     Public Function noph4x(ByVal address As String, ByVal value As Long)
  140.         If IsProcessOpen("iw4mp") Then
  141.             string1 = readdll("cshell.dll")
  142.             string2 = "&H" & Hex(string1 + address)
  143.             NOP(string2, value)
  144.  
  145.  
  146.         End If
  147.         Return Nothing
  148.     End Function
  149.  
  150. #End Region
  151. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement