تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] هل يمكن لى احد ان يعدل سطر فى ReadWriteMemory
#1
كود :
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.CompilerServices
Imports System
Imports System.Diagnostics
Imports System.Runtime.InteropServices

    <StandardModule> _
    Friend NotInheritable Class ReadWriteMemory
        ' Methods
        <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
        Private Shared Function OpenProcess(ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
        End Function

        Public Shared Function ReadDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, ByVal Optional nsize As Integer = 4) As Single
            Dim num As Single
            Try
                Dim address As Integer = Address
                Dim num5 As Integer = Level
                Dim i As Integer = 1
                Do While (i <= num5)
                    address = CInt(Math.Round(CDbl((ReadWriteMemory.ReadFloat(Process, address, nsize) + Offsets((i - 1))))))
                    i += 1
                Loop
                num = ReadWriteMemory.ReadFloat(Process, address, nsize)
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                ProjectData.ClearProjectError
            End Try
            Return num
        End Function

        Public Shared Function ReadDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, ByVal Optional nsize As Integer = 4) As Integer
            Dim num As Integer
            Try
                Dim address As Integer = Address
                Dim num5 As Integer = Level
                Dim i As Integer = 1
                Do While (i <= num5)
                    address = (ReadWriteMemory.ReadInteger(Process, address, nsize) + Offsets((i - 1)))
                    i += 1
                Loop
                num = ReadWriteMemory.ReadInteger(Process, address, nsize)
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                ProjectData.ClearProjectError
            End Try
            Return num
        End Function

        Public Shared Function ReadDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, ByVal Optional nsize As Integer = 4) As Long
            Dim num As Long
            Try
                Dim address As Integer = Address
                Dim num5 As Integer = Level
                Dim i As Integer = 1
                Do While (i <= num5)
                    address = (CInt(ReadWriteMemory.ReadLong(Process, address, nsize)) + Offsets((i - 1)))
                    i += 1
                Loop
                num = ReadWriteMemory.ReadLong(Process, address, nsize)
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                ProjectData.ClearProjectError
            End Try
            Return num
        End Function

        Public Shared Function ReadFloat(ByVal ProcessName As String, ByVal Address As Integer, ByVal Optional nsize As Integer = 4) As Single
            Dim num3 As Single
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length = 0) Then
            End If
            Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
            If (ptr = IntPtr.Zero) Then
            End If
            Dim lpBaseAddress As Integer = Address
            Dim lpNumberOfBytesWritten As Integer = 0
            ReadWriteMemory.ReadProcessMemory2(CInt(ptr), lpBaseAddress, num3, nsize, lpNumberOfBytesWritten)
            Return num3
        End Function

        Public Shared Function ReadInteger(ByVal ProcessName As String, ByVal Address As Integer, ByVal Optional nsize As Integer = 4) As Integer
            Dim num3 As Integer
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length = 0) Then
            End If
            Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
            If (ptr = IntPtr.Zero) Then
            End If
            Dim lpBaseAddress As Integer = Address
            Dim lpNumberOfBytesWritten As Integer = 0
            ReadWriteMemory.ReadProcessMemory1(CInt(ptr), lpBaseAddress, num3, nsize, lpNumberOfBytesWritten)
            Return num3
        End Function

        Public Shared Function ReadLong(ByVal ProcessName As String, ByVal Address As Integer, ByVal Optional nsize As Integer = 4) As Long
            Dim num3 As Long
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length = 0) Then
            End If
            Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
            If (ptr = IntPtr.Zero) Then
            End If
            Dim lpBaseAddress As Integer = Address
            Dim lpNumberOfBytesWritten As Integer = 0
            ReadWriteMemory.ReadProcessMemory3(CInt(ptr), lpBaseAddress, num3, nsize, lpNumberOfBytesWritten)
            Return num3
        End Function

        <DllImport("kernel32", EntryPoint:="ReadProcessMemory", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
        Private Shared Function ReadProcessMemory1(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
        End Function

        <DllImport("kernel32", EntryPoint:="ReadProcessMemory", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
        Private Shared Function ReadProcessMemory2(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
        End Function

        <DllImport("kernel32", EntryPoint:="ReadProcessMemory", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
        Private Shared Function ReadProcessMemory3(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long
        End Function

        Public Shared Function WriteDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Single, ByVal Level As Integer, ByVal Optional nsize As Integer = 4) As Boolean
            Dim flag As Boolean
            Try
                Dim address As Integer = Address
                Dim num3 As Integer = Level
                Dim i As Integer = 1
                Do While (i <= num3)
                    address = CInt(Math.Round(CDbl((ReadWriteMemory.ReadFloat(Process, address, nsize) + Offsets((i - 1))))))
                    i += 1
                Loop
                ReadWriteMemory.WriteFloat(Process, address, Value, nsize)
                flag = True
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                flag = False
                ProjectData.ClearProjectError
                Return flag
                ProjectData.ClearProjectError
            End Try
            Return flag
        End Function

        Public Shared Function WriteDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Integer, ByVal Level As Integer, ByVal Optional nsize As Integer = 4) As Boolean
            Dim flag As Boolean
            Try
                Dim address As Integer = Address
                Dim num3 As Integer = Level
                Dim i As Integer = 1
                Do While (i <= num3)
                    address = (ReadWriteMemory.ReadInteger(Process, address, nsize) + Offsets((i - 1)))
                    i += 1
                Loop
                ReadWriteMemory.WriteInteger(Process, address, Value, nsize)
                flag = True
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                flag = False
                ProjectData.ClearProjectError
                Return flag
                ProjectData.ClearProjectError
            End Try
            Return flag
        End Function

        Public Shared Function WriteDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Long, ByVal Level As Integer, ByVal Optional nsize As Integer = 4) As Boolean
            Dim flag As Boolean
            Try
                Dim address As Integer = Address
                Dim num3 As Integer = Level
                Dim i As Integer = 1
                Do While (i <= num3)
                    address = (CInt(ReadWriteMemory.ReadLong(Process, address, nsize)) + Offsets((i - 1)))
                    i += 1
                Loop
                ReadWriteMemory.WriteLong(Process, address, Value, nsize)
                flag = True
            Catch exception1 As Exception
                ProjectData.SetProjectError(exception1)
                Dim exception As Exception = exception1
                flag = False
                ProjectData.ClearProjectError
                Return flag
                ProjectData.ClearProjectError
            End Try
            Return flag
        End Function

        Public Shared Sub WriteFloat(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Single, ByVal Optional nsize As Integer = 4)
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length <> 0) Then
                Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
                If (ptr <> IntPtr.Zero) Then
                    Dim lpBaseAddress As Integer = Address
                    Dim lpBuffer As Single = Value
                    Dim lpNumberOfBytesWritten As Integer = 0
                    ReadWriteMemory.WriteProcessMemory2(CInt(ptr), lpBaseAddress, lpBuffer, nsize, lpNumberOfBytesWritten)
                End If
            End If
        End Sub

        Public Shared Sub WriteInteger(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Integer, ByVal Optional nsize As Integer = 4)
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length <> 0) Then
                Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
                If (ptr <> IntPtr.Zero) Then
                    Dim lpBaseAddress As Integer = Address
                    Dim lpBuffer As Integer = Value
                    Dim lpNumberOfBytesWritten As Integer = 0
                    ReadWriteMemory.WriteProcessMemory1(CInt(ptr), lpBaseAddress, lpBuffer, nsize, lpNumberOfBytesWritten)
                End If
            End If
        End Sub

        Public Shared Sub WriteLong(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Long, ByVal Optional nsize As Integer = 4)
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length <> 0) Then
                Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
                If (ptr <> IntPtr.Zero) Then
                    Dim lpBaseAddress As Integer = Address
                    Dim lpBuffer As Long = Value
                    Dim lpNumberOfBytesWritten As Integer = 0
                    ReadWriteMemory.WriteProcessMemory3(CInt(ptr), lpBaseAddress, lpBuffer, nsize, lpNumberOfBytesWritten)
                End If
            End If
        End Sub

        Public Shared Sub WriteNOPs(ByVal ProcessName As String, ByVal Address As Long, ByVal NOPNum As Integer)
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length <> 0) Then
                Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
                If (ptr <> IntPtr.Zero) Then
                    Dim num As Integer = 0
                    Dim num3 As Integer = NOPNum
                    Dim i As Integer = 1
                    Do While (i <= num3)
                        Dim lpBuffer As Integer = &H90
                        Dim lpNumberOfBytesWritten As Integer = 0
                        ReadWriteMemory.WriteProcessMemory1(CInt(ptr), (CInt(Address) + num), lpBuffer, 1, lpNumberOfBytesWritten)
                        num += 1
                        i += 1
                    Loop
                End If
            End If
        End Sub

        <DllImport("kernel32", EntryPoint:="WriteProcessMemory", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
        Private Shared Function WriteProcessMemory1(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
        End Function

        <DllImport("kernel32", EntryPoint:="WriteProcessMemory", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
        Private Shared Function WriteProcessMemory2(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
        End Function

        <DllImport("kernel32", EntryPoint:="WriteProcessMemory", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
        Private Shared Function WriteProcessMemory3(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long
        End Function

        Public Shared Sub WriteXBytes(ByVal ProcessName As String, ByVal Address As Long, ByVal Value As String)
            If ProcessName.EndsWith(".exe") Then
                ProcessName = ProcessName.Replace(".exe", "")
            End If
            Dim processesByName As Process() = Process.GetProcessesByName(ProcessName)
            If (processesByName.Length <> 0) Then
                Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
                If (ptr <> IntPtr.Zero) Then
                    Dim num As Integer = 0
                    Dim start As Integer = 1
                    Dim num5 As Integer = CInt(Math.Round(Math.Round(CDbl((CDbl(Strings.Len(Value)) / 2)))))
                    Dim i As Integer = 1
                    Do While (i <= num5)
                        Dim num4 As Byte = CByte(Math.Round(Conversion.Val(("&H" & Strings.Mid(Value, start, 2)))))
                        Dim lpBuffer As Integer = num4
                        Dim lpNumberOfBytesWritten As Integer = 0
                        ReadWriteMemory.WriteProcessMemory1(CInt(ptr), (CInt(Address) + num), lpBuffer, 1, lpNumberOfBytesWritten)
                        num4 = CByte(lpBuffer)
                        num += 1
                        start = (start + 2)
                        i += 1
                    Loop
                End If
            End If
        End Sub


        ' Fields
        Private Const PROCESS_ALL_ACCESS As Integer = &H1F0FF
    End Class
الخطء فى هذا السطر
كود :
Dim ptr As IntPtr = DirectCast(ReadWriteMemory.OpenProcess(&H1F0FF, 0, processesByName(0).Id), IntPtr)
الرد }}}
تم الشكر بواسطة:
#2
تم الحل بى تغير الكود كله الحمد الله
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  هل يمكن جعل عناوين الهيدر بشكل عمودي مصمم هاوي 2 100 أمس, 03:59 AM
آخر رد: مصمم هاوي
Exclamation [سؤال] كيف يمكن الغاء السوال عند الكتابة على ملف موجود dell 0 76 19-03-24, 01:23 AM
آخر رد: dell
  [VB.NET] كيف يمكن إخفاء ظهور الشاشة السوداء فى الـــ console AmeenRashed 2 320 15-11-23, 03:51 PM
آخر رد: justforit
  ما أسرع استضافة يمكن رفع المشروع عليها ؟ hazim1 0 200 03-10-23, 08:55 AM
آخر رد: hazim1
  كيف يمكن تأخير الـSplash Screen حتى يتم تحميل الأدوات بالكامل؟ hazim1 0 282 28-09-23, 08:23 AM
آخر رد: hazim1
  هل يمكن نسخ احتياطي لأسماء الButtons ؟ hazim1 2 258 21-09-23, 07:32 PM
آخر رد: hazim1
  هل يمكن عد الصفوف التالية للصف المُحدد في Datagridview ؟ hazim1 1 465 17-07-23, 09:04 PM
آخر رد: mrfenix93
  [SQL] كيف يمكن تعديل update أو حذف delete صف معين من جدول بدلالة رقم الصف ROW_NUMBER mmaalmesry 4 763 06-02-23, 09:42 AM
آخر رد: mmaalmesry
  [VB.NET] كيف يمكن تنفيذ امر داخل الباور شل zooz313 2 779 17-12-22, 02:25 PM
آخر رد: kebboud
  هل يمكن الاعتماد على 2 او اكثر من قاعدة البيانات لبرنامج واحد حماده ممدوح البحيرى 0 472 10-12-22, 08:56 PM
آخر رد: حماده ممدوح البحيرى

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم