OldSchoolHack

Register / Login English

[Hilfe]MW2 - Injector

icon Thread: [Hilfe]MW2 - Injector

Join Date: Sep 2010

Posts: 7


Ich bin noch ein Anfänger im Coden und deshalb will ich mal klein anfangen.
Ich möchte nämlich gerne einen Injector für MW2 machen.
Dazu brauche ich aber Hilfe, denn ich habe schon den Code, aber dieser funktioniert nicht.
Design ist auch schon fertig, weil ich benutze VB 2008 EE.
TEXT Code:
  1.  
  2. Public Class Form1
  3.  
  4. Private TargetProcessHandle As Integer
  5. Private pfnStartAddr As Integer
  6. Private pszLibFileRemote As String
  7. Private TargetBufferSize As Integer
  8.  
  9. Public Const PROCESS_VM_READ = &H10
  10. Public Const TH32CS_SNAPPROCESS = &H2
  11. Public Const MEM_COMMIT = 4096
  12. Public Const PAGE_READWRITE = 4
  13. Public Const PROCESS_CREATE_THREAD = (&H2)
  14. Public Const PROCESS_VM_OPERATION = (&H8)
  15. Public Const PROCESS_VM_WRITE = (&H20)
  16.  
  17. Public Declare Function ReadProcessMemory Lib "kernel32" ( _
  18. ByVal hProcess As Integer, _
  19. ByVal lpBaseAddress As Integer, _
  20. ByVal lpBuffer As String, _
  21. ByVal nSize As Integer, _
  22. ByRef lpNumberOfBytesWritten As Integer) As Integer
  23.  
  24. Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" ( _
  25. ByVal lpLibFileName As String) As Integer
  26.  
  27. Public Declare Function VirtualAllocEx Lib "kernel32" ( _
  28. ByVal hProcess As Integer, _
  29. ByVal lpAddress As Integer, _
  30. ByVal dwSize As Integer, _
  31. ByVal flAllocationType As Integer, _
  32. ByVal flProtect As Integer) As Integer
  33.  
  34. Public Declare Function WriteProcessMemory Lib "kernel32" ( _
  35. ByVal hProcess As Integer, _
  36. ByVal lpBaseAddress As Integer, _
  37. ByVal lpBuffer As String, _
  38. ByVal nSize As Integer, _
  39. ByRef lpNumberOfBytesWritten As Integer) As Integer
  40.  
  41. Public Declare Function GetProcAddress Lib "kernel32" ( _
  42. ByVal hModule As Integer, ByVal lpProcName As String) As Integer
  43.  
  44. Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" ( _
  45. ByVal lpModuleName As String) As Integer
  46.  
  47. Public Declare Function CreateRemoteThread Lib "kernel32" ( _
  48. ByVal hProcess As Integer, _
  49. ByVal lpThreadAttributes As Integer, _
  50. ByVal dwStackSize As Integer, _
  51. ByVal lpStartAddress As Integer, _
  52. ByVal lpParameter As Integer, _
  53. ByVal dwCreationFlags As Integer, _
  54. ByRef lpThreadId As Integer) As Integer
  55.  
  56. Public Declare Function OpenProcess Lib "kernel32" ( _
  57. ByVal dwDesiredAccess As Integer, _
  58. ByVal bInheritHandle As Integer, _
  59. ByVal dwProcessId As Integer) As Integer
  60.  
  61. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
  62. ByVal lpClassName As String, _
  63. ByVal lpWindowName As String) As Integer
  64.  
  65. Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" ( _
  66. ByVal hObject As Integer) As Integer
  67.  
  68.  
  69. Dim ExeName As String = IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)
  70. Private Sub Inject()
  71. On Error GoTo 1 ' If error occurs, app will close without any error messages
  72. Timer1.Stop()
  73. Dim TargetProcess As Process() = Process.GetProcessesByName("Modern Warfare 2")
  74. TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
  75. pszLibFileRemote = Application.StartupPath & "" + ExeName + ".dll"
  76. pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
  77. TargetBufferSize = 1 + Len(pszLibFileRemote)
  78. Dim Rtn As Integer
  79. Dim LoadLibParamAdr As Integer
  80. LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
  81. Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
  82. CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
  83. CloseHandle(TargetProcessHandle)
  84. 1: Me.Close()
  85. End Sub
  86. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  87. If IO.File.Exists(Application.StartupPath & "" + ExeName + ".dll") Then
  88. Dim TargetProcess As Process() = Process.GetProcessesByName("HSUpdate")
  89. If TargetProcess.Length = 0 Then
  90. Me.TextBox1.Text = ("Waiting for iw4mp.exe")
  91. Me.TextBox2.Text = ("Let´s Hack")
  92. Else
  93. Timer1.Stop()
  94. Me.TextBox1.Text = "Done..."
  95. Call Inject()
  96. End If
  97. Else
  98. Me.TextBox1.Text = ("" + ExeName + ".dll not found")
  99. Me.TextBox2.Text = ("Rename the .dll To " + "" + ExeName)
  100. End If
  101. End Sub
  102. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  103. Timer1.Interval = 50
  104. Timer1.Start()
  105. End Sub

Kann mir da jemand helfen?