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


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  هل يمكن التعامل مع من متصلين مع الشبكة الخاصة بى؟ الماجيك مسعد 4 137 09-03-17, 01:05 AM
آخر رد: الماجيك مسعد
  كيف يمكن تقريب الكسر العشري لاقرب رقم فى داتا جريد فيو السيد الجوهري 1 123 28-01-17, 06:34 PM
آخر رد: ابو ليلى
  كيف يمكن تثبيت رقم داخل مربع النص والنموذج فى وضع العرض السيد الجوهري 5 217 28-01-17, 02:25 AM
آخر رد: السيد الجوهري
  كيف يمكن تحريك مربعات النص على التقرير السيد الجوهري 3 163 27-01-17, 11:29 PM
آخر رد: السيد الجوهري
  كيف يمكن جعل ListView تظهر فيها الملفات CLARO 1 122 22-12-16, 06:11 PM
آخر رد: silverlight
  كيف يمكن اخفاء حقل من كريستال ريبور السيد الجوهري 0 114 18-12-16, 04:38 PM
آخر رد: السيد الجوهري
  لأساتذتي من أهل الخبرة هل يمكن فتح ملف برقم صفحة معينة kofa 11 535 16-12-16, 05:47 AM
آخر رد: zinom
  [اقتراح] يمكن ان اصنع لكم برنامج تريدونه احمد م. 16 2,873 11-12-16, 07:08 AM
آخر رد: hassan
  [VB.NET] هل يمكن الاستغناء عن التايمر واستخدام شئ بديل يكون افضل ؟ !! الماجيك مسعد 7 377 08-12-16, 06:58 AM
آخر رد: silverlight
  هل يمكن انشاء صفحة متصفح Mohamed20 2 219 20-11-16, 12:38 AM
آخر رد: myalsailamy

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


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