Results 1 to 4 of 4
  1. #1
    Lovroman's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    9,430
    Reputation
    611
    Thanks
    9,722
    My Mood
    Cheerful

    Master's Module Game Not Found Fix

    Hey guys!
    Few minutes ago I realized I forgot to add fix for hack creators that use master's module.
    Here is it:


    Code:
    Option Strict On
    
    Imports System.Runtime.InteropServices
    Imports System.Text
    
    Public Module MasterModule
        <DllImport("kernel32.dll")> _
        Private Function OpenProcess(ByVal dwDesiredAccess As UInteger, <MarshalAs(UnmanagedType.Bool)> ByVal bInheritHandle As Boolean, ByVal dwProcessId As Integer) As IntPtr
        End Function
    
        <DllImport("kernel32.dll", SetLastError:=True)> _
        Private Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As IntPtr, <Out()> ByRef lpNumberOfBytesWritten As IntPtr) As Boolean
        End Function
    
        <DllImport("kernel32.dll", SetLastError:=True)> _
        Private Function ReadProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, <Out()> ByVal lpBuffer() As Byte, ByVal dwSize As IntPtr, ByRef lpNumberOfBytesRead As IntPtr) As Boolean
        End Function
    
        <DllImport("kernel32.dll", SetLastError:=True)> _
        Private Function CloseHandle(ByVal hObject As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
        End Function
    
        Private Const PROCESS_VM_WRITE As UInteger = &H20
        Private Const PROCESS_VM_READ As UInteger = &H10
        Private Const PROCESS_VM_OPERATION As UInteger = &H8
        Private Const TargetProcessWindowName As String = "MPGH"
        Private ProcessHandle As IntPtr = IntPtr.Zero
        Private LastKnownPID As Integer = -1
    
        Public Function ReadMemory(Of T)(ByVal address As Integer) As T
            Return ReadMemory(Of T)(address, 0, False)
        End Function
    
        Public Function ReadMemory(ByVal address As Integer, ByVal length As Integer) As Byte()
            Return ReadMemory(Of Byte())(address, length, False)
        End Function
    
        Private Function ProcessIDExists(ByVal pID As Integer) As Boolean
            Dim ProcList As Process() = Process.GetProcesses()
            For Each proc As Process In ProcList
                If proc.MainWindowTitle.Contains(TargetProcessWindowName) Then
                    If proc.Id = pID Then Return True
                End If
            Next
            Return False
        End Function
    
        Public Function UpdateProcessHandle() As Boolean
            If LastKnownPID = -1 OrElse Not ProcessIDExists(LastKnownPID) Then
                If ProcessHandle <> IntPtr.Zero Then CloseHandle(ProcessHandle)
                Dim ProcList As Process() = Process.GetProcesses()
                For Each proc As Process In ProcList
                    If proc.MainWindowTitle.Contains(TargetProcessWindowName) Then
                        LastKnownPID = proc.Id
                        ProcessHandle = OpenProcess(PROCESS_VM_READ Or PROCESS_VM_WRITE Or PROCESS_VM_OPERATION, False, proc.Id)
                        If ProcessHandle = IntPtr.Zero Then Return False
                    End If
                Next
            End If
            Return True
        End Function
    
        Public Function ReadMemory(Of T)(ByVal address As Integer, ByVal length As Integer, ByVal unicodeString As Boolean) As T
            Dim buffer() As Byte
            If GetType(T) Is GetType(String) Then
                If unicodeString Then buffer = New Byte(length * 2 - 1) {} Else buffer = New Byte(length - 1) {}
            ElseIf GetType(T) Is GetType(Byte()) Then
                buffer = New Byte(length - 1) {}
            Else
                buffer = New Byte(Marshal.SizeOf(GetType(T)) - 1) {}
            End If
            If Not UpdateProcessHandle() Then Return Nothing
            Dim success As Boolean = ReadProcessMemory(ProcessHandle, New IntPtr(address), buffer, New IntPtr(buffer.Length), IntPtr.Zero)
            If Not success Then Return Nothing
            If GetType(T) Is GetType(Byte()) Then Return CType(CType(buffer, Object), T)
            If GetType(T) Is GetType(String) Then
                If unicodeString Then Return CType(CType(Encoding.Unicode.GetString(buffer), Object), T)
                Return CType(CType(Encoding.ASCII.GetString(buffer), Object), T)
            End If
            Dim gcHandle As GCHandle = gcHandle.Alloc(buffer, GCHandleType.Pinned)
            Dim returnObject As T
            returnObject = CType(Marshal.PtrToStructure(gcHandle.AddrOfPinnedObject, GetType(T)), T)
            gcHandle.Free()
            Return returnObject
        End Function
    
        Private Function GetObjectBytes(ByVal value As Object) As Byte()
            If value.GetType() Is GetType(Byte()) Then Return CType(value, Byte())
            Dim buffer(Marshal.SizeOf(value) - 1) As Byte
            Dim ptr As IntPtr = Marshal.AllocHGlobal(buffer.Length)
            Marshal.StructureToPtr(value, ptr, True)
            Marshal.Copy(ptr, buffer, 0, buffer.Length)
            Marshal.FreeHGlobal(ptr)
            Return buffer
        End Function
    
        Public Function WriteMemory(ByVal address As Integer, ByVal value As Object) As Boolean
            Return WriteMemory(address, value, False)
        End Function
    
        Public Function WriteMemory(ByVal address As Integer, ByVal value As Object, ByVal unicode As Boolean) As Boolean
            If Not UpdateProcessHandle() Then Return False
            Dim buffer() As Byte
            If TypeOf value Is String Then
                If unicode Then buffer = Encoding.Unicode.GetBytes(value.ToString()) Else buffer = Encoding.ASCII.GetBytes(value.ToString())
            Else
                buffer = GetObjectBytes(value)
            End If
            Dim result As Boolean = WriteProcessMemory(ProcessHandle, New IntPtr(address), buffer, New IntPtr(buffer.Length), IntPtr.Zero)
            Return result
        End Function
    End Module

    You have to change TargetProcessWindowName, rest is same.
    Thanks goes to @master131 for Module.
    Usage remains same, except you have to modify TargetProcessWindowName var(with Window Title/Name).
    You don't have to use full window name, eg. you can use just: Black Ops 2 instead of Call Of Duty: Black Ops 2
    Last edited by Lovroman; 07-19-2013 at 12:18 AM.

  2. The Following User Says Thank You to Lovroman For This Useful Post:

    3leven (07-18-2013)

  3. #2
    3leven's Avatar
    Join Date
    Apr 2012
    Gender
    male
    Location
    Lurking in the shadows
    Posts
    748
    Reputation
    59
    Thanks
    1,517
    My Mood
    Angelic
    Woohoo!

  4. The Following User Says Thank You to 3leven For This Useful Post:

    Lovroman (07-18-2013)

  5. #3
    Lovroman's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    9,430
    Reputation
    611
    Thanks
    9,722
    My Mood
    Cheerful
    Quote Originally Posted by 3leven View Post
    Woohoo!
    Now you have to remake all of your hacks Test it.

  6. #4
    3leven's Avatar
    Join Date
    Apr 2012
    Gender
    male
    Location
    Lurking in the shadows
    Posts
    748
    Reputation
    59
    Thanks
    1,517
    My Mood
    Angelic
    Quote Originally Posted by Lovroman View Post
    Now you have to remake all of your hacks Test it.
    Woohoooooo, can't wait for remake all of that! "Thank" you very much!

  7. The Following User Says Thank You to 3leven For This Useful Post:

    Lovroman (07-18-2013)

Similar Threads

  1. [Info] [CODERS ONLY] Fix for game not found
    By Lovroman in forum Call of Duty Black Ops 2 Private Server Hacks
    Replies: 3
    Last Post: 07-15-2013, 01:23 PM
  2. [Help Request] "NGM.txt file is not found, please reinstall game"
    By ISteffy in forum Vindictus Help
    Replies: 1
    Last Post: 11-26-2011, 05:43 AM
  3. GAMING KEYBOARD NOT WORKING FIX
    By kkratos1 in forum Combat Arms Help
    Replies: 6
    Last Post: 01-15-2011, 08:12 AM
  4. Replies: 5
    Last Post: 08-04-2007, 06:38 AM
  5. Rescource Trainer not found
    By mikelmao in forum WarRock - International Hacks
    Replies: 5
    Last Post: 07-09-2007, 06:01 PM