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


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [VB.NET] يرجى التعديل على الكود dubai.eig 4 76 18-01-17, 05:25 PM
آخر رد: dubai.eig
  اريد تحول الكود لفيجوال 2008 abudawoodd 6 177 15-01-17, 02:11 PM
آخر رد: abudawoodd
  تعديل الكود (ظهور مسج بوكس عند عدم وجود الاسم) Namer 10 415 04-01-17, 01:12 AM
آخر رد: Namer
  [VB.NET] هل الكود هذا صحيح dubai.eig 10 217 01-01-17, 10:15 PM
آخر رد: مساعدة
  اين اكتب هذا الكود anis_derna 3 140 28-12-16, 12:18 PM
آخر رد: thevirus
  تصحيح الكود الاتي CLARO 2 63 23-12-16, 02:12 PM
آخر رد: CLARO
  شرح الكود و الادوات المستخدمة anis_derna 1 88 20-12-16, 06:40 AM
آخر رد: silverlight
Information [VB.NET] تعديل بيسط على الكود 3asfa~mdmra 6 123 18-12-16, 04:31 AM
آخر رد: 3asfa~mdmra
  ما الخطأ فى هذا الكود ؟ what's error in my code ? twitter acount creator الماجيك مسعد 16 379 13-12-16, 01:21 AM
آخر رد: الماجيك مسعد
  [كود] تصحيح خطئ في الكود عبدالرحمن المكاوي 1 94 12-12-16, 03:23 PM
آخر رد: amgad525

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


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