تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تصحيح هذا الكود
#1
كود :
<DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Private Shared Function ReadProcessMemory(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", 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

    Private Function Hwnd() As Object
        Throw New NotImplementedException
    End Function
    <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Private Shared Function CloseHandle(ByVal hObject As Integer) As Integer
    End Function

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

    Public Function Tibia_Hwnd() As Long
        Dim processesByName As Process() = Process.GetProcessesByName("")
        If (processesByName.Length = 0) Then
            Return 0
        End If
        Return processesByName(0).Id
    End Function
    Private Function Memory_WriteLong(ByVal Address As Integer, ByVal vBuffer As Long) As Long
        Dim num As Long
        Dim ptr As IntPtr = DirectCast(Form1.OpenProcess(&H438, 0, CInt(Me.Tibia_Hwnd)), IntPtr)
        Dim lpBuffer As Integer = CInt(vBuffer)
        Dim lpNumberOfBytesWritten As Integer = 0
        Form1.WriteProcessMemory(CInt(ptr), Address, lpBuffer, 4, lpNumberOfBytesWritten)
        vBuffer = lpBuffer
        Return vBuffer
        Form1.CloseHandle(CInt(ptr))
        Return num
    End Function

    Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        If Me.CheckBox1.Checked Then
            Me.Memory_WriteLong(&H478802, Conversions.ToLong("-1946401317"))
        Else
            Me.Memory_WriteLong(&H478802, Conversions.ToLong("-1946401319"))
        End If
    End Sub
الرد }}}}
تم الشكر بواسطة:
#2
عدلت على الكود حيث لا يوجد أخطاء في الـError List أما عن آلية عمل الكود فلم أختبرها، تركتها لك.
كود :
Imports System.Runtime.InteropServices

Public Class Form1
    Private Function Hwnd() As Object
        Throw New NotImplementedException
    End Function
    <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Private Shared Function CloseHandle(ByVal hObject As Integer) As Integer
    End Function

    <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Private Shared Function WriteProcessMemory(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.dll")> _
    Private Shared Function OpenProcess(ByVal dwDesiredAccess As ProcessAccessFlags, <MarshalAs(UnmanagedType.Bool)> ByVal bInheritHandle As Boolean, ByVal dwProcessId As Integer) As IntPtr
    End Function

    Public Function Tibia_Hwnd() As Long
        Dim processesByName As Process() = Process.GetProcessesByName("")
        If (processesByName.Length = 0) Then
            Return 0
        End If
        Return processesByName(0).Id
    End Function
    Private Function Memory_WriteLong(ByVal Address As Integer, ByVal vBuffer As Long) As Long
        Dim ptr As IntPtr = DirectCast(Form1.OpenProcess(&H438, 0, CInt(Me.Tibia_Hwnd)), IntPtr)
        Dim lpBuffer As Integer = CInt(vBuffer)
        Dim lpNumberOfBytesWritten As Integer = 0
        Form1.WriteProcessMemory(CInt(ptr), Address, lpBuffer, 4, lpNumberOfBytesWritten)
        vBuffer = lpBuffer
        Return vBuffer
        Form1.CloseHandle(CInt(ptr))
        Return Nothing
    End Function

    Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        If Me.CheckBox1.Checked Then
            Me.Memory_WriteLong(&H478802, CLng("-1946401317"))
        Else
            Me.Memory_WriteLong(&H478802, CLng("-1946401319"))
        End If
    End Sub

    <Flags()> _
    Enum ProcessAccessFlags As UInteger
        All = &H1F0FFF
        Terminate = &H1
        CreateThread = &H2
        VMOperation = &H8
        VMRead = &H10
        VMWrite = &H20
        DupHandle = &H40
        SetInformation = &H200
        QueryInformation = &H400
        Synchronize = &H100000
    End Enum
End Class
الرد }}}}
تم الشكر بواسطة:
#3
Aly El-Haddad كتب :عدلت على الكود حيث لا يوجد أخطاء في الـError List أما عن آلية عمل الكود فلم أختبرها، تركتها لك.
كود :
Imports System.Runtime.InteropServices

Public Class Form1
    Private Function Hwnd() As Object
        Throw New NotImplementedException
    End Function
    <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Private Shared Function CloseHandle(ByVal hObject As Integer) As Integer
    End Function

    <DllImport("kernel32", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _
    Private Shared Function WriteProcessMemory(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.dll")> _
    Private Shared Function OpenProcess(ByVal dwDesiredAccess As ProcessAccessFlags, <MarshalAs(UnmanagedType.Bool)> ByVal bInheritHandle As Boolean, ByVal dwProcessId As Integer) As IntPtr
    End Function

    Public Function Tibia_Hwnd() As Long
        Dim processesByName As Process() = Process.GetProcessesByName("")
        If (processesByName.Length = 0) Then
            Return 0
        End If
        Return processesByName(0).Id
    End Function
    Private Function Memory_WriteLong(ByVal Address As Integer, ByVal vBuffer As Long) As Long
        Dim ptr As IntPtr = DirectCast(Form1.OpenProcess(&H438, 0, CInt(Me.Tibia_Hwnd)), IntPtr)
        Dim lpBuffer As Integer = CInt(vBuffer)
        Dim lpNumberOfBytesWritten As Integer = 0
        Form1.WriteProcessMemory(CInt(ptr), Address, lpBuffer, 4, lpNumberOfBytesWritten)
        vBuffer = lpBuffer
        Return vBuffer
        Form1.CloseHandle(CInt(ptr))
        Return Nothing
    End Function

    Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        If Me.CheckBox1.Checked Then
            Me.Memory_WriteLong(&H478802, CLng("-1946401317"))
        Else
            Me.Memory_WriteLong(&H478802, CLng("-1946401319"))
        End If
    End Sub

    <Flags()> _
    Enum ProcessAccessFlags As UInteger
        All = &H1F0FFF
        Terminate = &H1
        CreateThread = &H2
        VMOperation = &H8
        VMRead = &H10
        VMWrite = &H20
        DupHandle = &H40
        SetInformation = &H200
        QueryInformation = &H400
        Synchronize = &H100000
    End Enum
End Class
جزاك الله الف خير اخى و جعله فى مزان حاسناتك
الرد }}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  ممكن شرح هذا الكود؟ rafaag777 1 89 منذ 6 ساعة مضت
آخر رد: الماجيك مسعد
  ما الخطأ فى هذا الكود ؟ what's error in my code ? twitter acount creator الماجيك مسعد 0 20 منذ 6 ساعة مضت
آخر رد: الماجيك مسعد
  حل مشكلة الكود الاتي - سهل- CLARO 3 89 02-12-16, 04:06 PM
آخر رد: ali.alfoly
  [VB.NET] تصحيح خطأ بالكود Asmaa adel 1 74 29-11-16, 06:31 PM
آخر رد: WAEL ABED
  ما هو الخطاء فى هذا الكود "كود التعديل" السيد الجوهري 1 65 26-11-16, 03:22 AM
آخر رد: أبو عمر
  [VB.NET] ربط الداتا بيز بالكريستال ريبورت عن طريق الكود thevirus 3 99 22-11-16, 02:38 PM
آخر رد: thevirus
  [VB.NET] طلب تعديل ع الكود ليصبح البرنامج جاهزاً 3asfa~mdmra 8 202 12-11-16, 02:30 AM
آخر رد: 3asfa~mdmra
  [سؤال] هل يمكن عرض عناصر الكومبوبوكس عن طريق الكود ؟؟؟؟؟؟؟؟؟؟؟؟ thevirus 1 104 10-11-16, 06:25 PM
آخر رد: أبو عمر
  كيف اضيف هذا الكود في module nabil.1710 6 128 01-11-16, 03:23 PM
آخر رد: silverlight
  كيف انقل هذا الكود منForm2 اليForm1 3asfa~mdmra 2 77 30-10-16, 01:47 PM
آخر رد: 3asfa~mdmra

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


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