Programm fuer 64Bit umschreiben ?

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von Kevko.

    Programm fuer 64Bit umschreiben ?

    Hallo,
    weis vieleich einer von euch wie ich ein Programm zu einer 64bit anwedung umschreibe ?
    Mein Code sieht bis jetzt so aus:

    VB.NET-Quellcode

    1. Public Class Form1
    2. Private TargetProcessHandle As Integer
    3. Private pfnStartAddr As Integer
    4. Private pszLibFileRemote As String
    5. Private TargetBufferSize As Integer
    6. Public Const PROCESS_VM_READ = &H10
    7. Public Const TH32CS_SNAPPROCESS = &H2
    8. Public Const MEM_COMMIT = 4096
    9. Public Const PAGE_READWRITE = 4
    10. Public Const PROCESS_CREATE_THREAD = (&H2)
    11. Public Const PROCESS_VM_OPERATION = (&H8)
    12. Public Const PROCESS_VM_WRITE = (&H20)
    13. Public Declare Function ReadProcessMemory Lib "kernel32" ( _
    14. ByVal hProcess As Integer, _
    15. ByVal lpBaseAddress As Integer, _
    16. ByVal lpBuffer As String, _
    17. ByVal nSize As Integer, _
    18. ByRef lpNumberOfBytesWritten As Integer) As Integer
    19. Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" ( _
    20. ByVal lpLibFileName As String) As Integer
    21. Public Declare Function VirtualAllocEx Lib "kernel32" ( _
    22. ByVal hProcess As Integer, _
    23. ByVal lpAddress As Integer, _
    24. ByVal dwSize As Integer, _
    25. ByVal flAllocationType As Integer, _
    26. ByVal flProtect As Integer) As Integer
    27. Public Declare Function WriteProcessMemory Lib "kernel32" ( _
    28. ByVal hProcess As Integer, _
    29. ByVal lpBaseAddress As Integer, _
    30. ByVal lpBuffer As String, _
    31. ByVal nSize As Integer, _
    32. ByRef lpNumberOfBytesWritten As Integer) As Integer
    33. Public Declare Function GetProcAddress Lib "kernel32" ( _
    34. ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    35. Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" ( _
    36. ByVal lpModuleName As String) As Integer
    37. Public Declare Function CreateRemoteThread Lib "kernel32" ( _
    38. ByVal hProcess As Integer, _
    39. ByVal lpThreadAttributes As Integer, _
    40. ByVal dwStackSize As Integer, _
    41. ByVal lpStartAddress As Integer, _
    42. ByVal lpParameter As Integer, _
    43. ByVal dwCreationFlags As Integer, _
    44. ByRef lpThreadId As Integer) As Integer
    45. Public Declare Function OpenProcess Lib "kernel32" ( _
    46. ByVal dwDesiredAccess As Integer, _
    47. ByVal bInheritHandle As Integer, _
    48. ByVal dwProcessId As Integer) As Integer
    49. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    50. ByVal lpClassName As String, _
    51. ByVal lpWindowName As String) As Integer
    52. Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" ( _
    53. ByVal hObject As Integer) As Integer
    54. Dim ExeName As String = IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)
    55. Private Sub Inject()
    56. On Error GoTo 1 ' If error occurs, app will close without any error messages
    57. Timer1.Stop()
    58. Dim TargetProcess As Process() = Process.GetProcessesByName("WarRock")
    59. TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
    60. pszLibFileRemote = Application.StartupPath & "\" + ExeName + ".dll"
    61. pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
    62. TargetBufferSize = 1 + Len(pszLibFileRemote)
    63. Dim Rtn As Integer
    64. Dim LoadLibParamAdr As Integer
    65. LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
    66. Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
    67. CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
    68. CloseHandle(TargetProcessHandle)
    69. 1: Me.Close()
    70. End Sub
    71. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    72. If IO.File.Exists(Application.StartupPath & "\" + ExeName + ".dll") Then
    73. Dim TargetProcess As Process() = Process.GetProcessesByName("HSUpdate")
    74. If TargetProcess.Length = 0 Then
    75. Me.TextBox1.Text = ("Waiting for Warrock.exe")
    76. Me.TextBox2.Text = ("Let´s Hack")
    77. Else
    78. Timer1.Stop()
    79. Me.TextBox1.Text = "Done..."
    80. Call Inject()
    81. End If
    82. Else
    83. Me.TextBox1.Text = ("" + ExeName + ".dll not found")
    84. Me.TextBox2.Text = ("Rename the .dll To " + "" + ExeName)
    85. End If
    86. End Sub
    87. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    88. Timer1.Interval = 50
    89. Timer1.Start()
    90. End Sub
    91. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    92. Me.Close()
    93. End Sub
    94. End Class

    Nur meine Anwendung geht NICHT auf meinen 64bit System aber auf meinem 32 Bit System.
    Kann mir einer Helfen ?( ?
    Ja das dachte ich auch, nur Funktioniert es auf 32bit Systemem Prima - habs getestet - nur aber auf 64bit System tus sich da gar nix.

    Zur Info:
    Das Programm sollte eine .dll in ein anderes Programm "Injecten / Einfuegen" nur unter 64bit funktionierts halt nicht.