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


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [VB.NET] هل يمكن الاستغناء عن التايمر واستخدام شئ بديل يكون افضل ؟ !! الماجيك مسعد 7 91 منذ 50 دقيقة مضت
آخر رد: silverlight
  هل يمكن انشاء صفحة متصفح Mohamed20 2 133 20-11-16, 12:38 AM
آخر رد: myalsailamy
  كيف يمكن اضافة مجموعة حقول الي datagridview والتعديل عليها مباشرتا dark1459 2 71 15-11-16, 10:30 PM
آخر رد: السرور
  كيف يمكن عمل هذا الترتيب rabeh.ram 10 203 15-11-16, 03:11 AM
آخر رد: rabeh.ram
  [سؤال] هل يمكن عرض عناصر الكومبوبوكس عن طريق الكود ؟؟؟؟؟؟؟؟؟؟؟؟ thevirus 1 100 10-11-16, 06:25 PM
آخر رد: أبو عمر
  [VB.NET] سؤال كيف يمكن معرفة التغير في قاعدة البيانات وليد الزنتاني 2 114 10-11-16, 01:20 AM
آخر رد: وليد الزنتاني
  هل يمكن ان تتصل بقاعدة بيانات SQL من دون سيرفر اي اتصال مباشر مثل Access thevirus 4 115 09-11-16, 07:10 PM
آخر رد: thevirus
  كيف يمكن الذهاب لصف جديد فى الداتا جريد فيو walkady 0 69 06-11-16, 11:31 PM
آخر رد: walkady
  [اقتراح] يمكن ان اصنع لكم برنامج تريدونه احمد م. 14 2,448 28-10-16, 06:39 PM
آخر رد: sambro
  هل يمكن عرض صفحة اكسل داخل نموذج فيجوال بيسيك 2010 walkady 4 158 18-10-16, 07:52 PM
آخر رد: sayedf1

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


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