Giter Site home page Giter Site logo

d2r-offline's Issues

Hello.

İm work on KnightOnline. İ edit your code for knightonline. Remapping succes no error but game is crashing. "unable to start correctly 0x00???" here is code.

ConsolePrint("Waiting for 'KnightOnLine.exe' process..."); int KO_PID = 0; IntPtr bAdress = IntPtr.Zero; while (KO_PID == 0) { Process[] processlist = Process.GetProcesses(); foreach (Process p in processlist) { if (p.ProcessName == "KnightOnLine") { KO_PID = p.Id; bAdress = p.MainModule.BaseAddress; } } } ConsolePrint("'KnightOnLine.exe' found."); IntPtr hProcess = OpenProcess(ProcessAccessFlags.PROCESS_ALL_ACCESS, false, KO_PID); ConsolePrint("Opening process..."); ConsolePrint(bAdress.ToString()); if (hProcess == IntPtr.Zero) { ConsolePrint("Failed on OpenProcess. Handle is invalid.", ConsoleColor.Red); ConsolePrint("Press any key to exit...", ConsoleColor.Yellow); Console.ReadKey(); return; } ConsolePrint("Suspending process..."); NtSuspendProcess(hProcess); ConsolePrint("Process suspended"); IntPtr regionBase = (IntPtr)0x00C70000; IntPtr regionSize = (IntPtr)0x00010000; ConsolePrint("Remapping process.."); bool ok = RemapMemoryRegion(hProcess, regionBase, regionSize.ToInt32(), MemoryProtectionConstraints.PAGE_EXECUTE_READWRITE); ConsolePrint(ok.ToString()); ConsolePrint("Resuming process.."); NtResumeProcess(hProcess); CloseHandle(hProcess); ConsolePrint("Done!", ConsoleColor.Green); ConsolePrint("Press any key to exit...", ConsoleColor.Yellow); Console.ReadKey();

Here is Remap function ;

` public static bool RemapMemoryRegion(IntPtr processHandle, IntPtr baseAddress, int regionSize, MemoryProtectionConstraints mapProtection)
{
IntPtr addr = VirtualAllocEx(processHandle, IntPtr.Zero, regionSize, MemoryAllocationType.MEM_COMMIT | MemoryAllocationType.MEM_RESERVE, mapProtection);
if (addr == IntPtr.Zero)
return false;

        IntPtr copyBuf = VirtualAlloc(IntPtr.Zero, regionSize, MemoryAllocationType.MEM_COMMIT | MemoryAllocationType.MEM_RESERVE, mapProtection);
        IntPtr copyBufEx = VirtualAllocEx(processHandle, IntPtr.Zero, regionSize, MemoryAllocationType.MEM_COMMIT | MemoryAllocationType.MEM_RESERVE, MemoryProtectionConstraints.PAGE_EXECUTE_READWRITE);
        byte[] copyBuf2 = new byte[regionSize];

        if (!ReadProcessMemory(processHandle, baseAddress, copyBuf, regionSize, out IntPtr bytes))
            return false;

        if (!ReadProcessMemory(processHandle, baseAddress, copyBuf2, regionSize, out bytes))
            return false;

        IntPtr sectionHandle = default;
        long sectionMaxSize = regionSize;

        Ntstatus status = NtCreateSection(ref sectionHandle, AccessMask.SECTION_ALL_ACCESS, IntPtr.Zero, ref sectionMaxSize, MemoryProtectionConstraints.PAGE_EXECUTE_READWRITE, SectionProtectionConstraints.SEC_COMMIT, IntPtr.Zero);

        if (status != Ntstatus.STATUS_SUCCESS)
            return false;

        status = NtUnmapViewOfSection(processHandle, baseAddress);


        if (status != Ntstatus.STATUS_SUCCESS)
            return false;

        IntPtr viewBase = baseAddress;
        long sectionOffset = default;
        uint viewSize = 0;
        status = NtMapViewOfSection(sectionHandle,
                                           processHandle,
                                           ref viewBase,
                                           UIntPtr.Zero,
                                           regionSize,
                                           ref sectionOffset,
                                           ref viewSize,
                                           2,
                                           0,
                                           MemoryProtectionConstraints.PAGE_EXECUTE_READWRITE);

        if (status != Ntstatus.STATUS_SUCCESS)
            return false;

        if (!WriteProcessMemory(processHandle, viewBase, copyBuf, (int)viewSize, out bytes))
            return false;

        if (!WriteProcessMemory(processHandle, copyBufEx, copyBuf, (int)viewSize, out bytes))
            return false;

        if (!VirtualFree(copyBuf, 0, MemFree.MEM_RELEASE))
            return false;

        return true;
    }

`

İ have c++ same system its ok its working 0x00C70000,0x0010000 0x40 its ok but when i go with c# this error looking at me. İm noob. Pls help me bro. Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.