charanroaxz / d2r-offline Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
İ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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.