تقييم الموضوع :
  • 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
تم الحل بى تغير الكود كله الحمد الله
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  كيف يمكن تصدير ascx كملف dll justforit 1 134 06-12-25, 12:33 AM
آخر رد: salamandal
  كيف يمكن تحريك الفورم بأستخدام زر heem1986 2 587 30-03-25, 01:58 AM
آخر رد: heem1986
  كيف يمكن تحويل ملف تنفيذى الى فيجوال بيسك 2010 walkady 2 781 07-02-25, 07:57 PM
آخر رد: الورد2
  كيف يمكن أشاء أسكربت لقاعدة بيانات sql heem1986 3 414 29-10-24, 08:37 PM
آخر رد: aliday03
  أسرع طريقة يمكن بها نقل جدول Table من قاعدة بيانات على النت إلى أخرى محلية mmaalmesry 2 593 19-10-24, 09:26 PM
آخر رد: mmaalmesry
  كيف يمكن اضافة عناصر للكومبوبوكس اثناء تشغيل البرنامج عن طريق المستخدم haithammoftah 3 2,160 30-09-24, 12:52 AM
آخر رد: asmarsou
  ماهيه المواقع التي يمكن رفع ملفاتك عليها مدفوعه او مجانيه .. ackore 0 250 15-08-24, 11:49 PM
آخر رد: ackore
  هل يمكن جعل عناوين الهيدر بشكل عمودي مصمم هاوي 2 561 16-04-24, 03:59 AM
آخر رد: مصمم هاوي
Exclamation [سؤال] كيف يمكن الغاء السوال عند الكتابة على ملف موجود dell 0 305 19-03-24, 01:23 AM
آخر رد: dell
  [VB.NET] كيف يمكن إخفاء ظهور الشاشة السوداء فى الـــ console AmeenRashed 2 639 15-11-23, 03:51 PM
آخر رد: justforit

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


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