public void UnsetProcess() { if (AttachmentWorker != null) { AttachmentWorker.StopScanning(); AttachmentWorker.Dispose(); } try { if (IsAttached) { UnsafeNativeMethods.CloseHandle(Instance.ProcessHandle); } } catch (Exception) { // IGNORED } finally { Constants.ProcessHandle = ProcessHandle = IntPtr.Zero; IsAttached = false; } }
public void SetProcess(ProcessModel processModel, string gameLanguage = "English", string patchVersion = "latest", bool useLocalCache = true, bool scanAllMemoryRegions = false) { ProcessModel = processModel; GameLanguage = gameLanguage; UseLocalCache = useLocalCache; UnsetProcess(); try { ProcessHandle = UnsafeNativeMethods.OpenProcess(UnsafeNativeMethods.ProcessAccessFlags.PROCESS_VM_ALL, false, (uint)ProcessModel.ProcessID); } catch (Exception) { ProcessHandle = processModel.Process.Handle; } finally { Constants.ProcessHandle = ProcessHandle; IsAttached = true; } if (IsNewInstance) { IsNewInstance = false; ActionHelper.Resolve(); StatusEffectHelper.Resolve(); ZoneHelper.Resolve(); ResolveMemoryStructures(processModel, patchVersion); } AttachmentWorker = new AttachmentWorker(); AttachmentWorker.StartScanning(processModel); SystemModules.Clear(); GetProcessModules(); Scanner.Instance.Locations.Clear(); Scanner.Instance.LoadOffsets(Signatures.Resolve(processModel, patchVersion), scanAllMemoryRegions); }
public void SetProcess(ProcessModel processModel, string gameLanguage = "English", string patchVersion = "latest", bool useLocalCache = true, bool scanAllMemoryRegions = false) { this.ProcessModel = processModel; this.GameLanguage = gameLanguage; this.UseLocalCache = useLocalCache; this.UnsetProcess(); try { this.ProcessHandle = NativeMemoryHandler.Instance.OpenProcess(this.ProcessModel.ProcessID); } catch (Exception) { this.ProcessHandle = processModel.Process.Handle; } finally { Constants.ProcessHandle = this.ProcessHandle; this.IsAttached = true; } if (this.IsNewInstance) { this.IsNewInstance = false; ActionLookup.Resolve(); StatusEffectLookup.Resolve(); ZoneLookup.Resolve(); this.ResolveMemoryStructures(processModel, patchVersion); } this.AttachmentWorker = new AttachmentWorker(); this.AttachmentWorker.StartScanning(processModel); this.SystemModules.Clear(); this.GetProcessModules(); Scanner.Instance.Locations.Clear(); Scanner.Instance.LoadOffsets(Signatures.Resolve(processModel, patchVersion), scanAllMemoryRegions); }
public async Task SetProcess(ProcessModel processModel, string gameLanguage = "English", string patchVersion = "latest", bool useLocalCache = true, bool scanAllMemoryRegions = false) { this.ProcessModel = processModel; this.GameLanguage = gameLanguage; this.UseLocalCache = useLocalCache; this.UnsetProcess(); try { this.ProcessHandle = UnsafeNativeMethods.OpenProcess(UnsafeNativeMethods.ProcessAccessFlags.PROCESS_VM_ALL, false, (uint)this.ProcessModel.ProcessID); } catch (Exception) { this.ProcessHandle = processModel.Process.Handle; } finally { Constants.ProcessHandle = this.ProcessHandle; this.IsAttached = true; } if (this.IsNewInstance) { this.IsNewInstance = false; //Parallel.Invoke(async () => await ActionLookup.Resolve(), async () => await StatusEffectLookup.Resolve(), async () => await ZoneLookup.Resolve()); Task[] taskArray = new Task[3]; taskArray[0] = Task.Factory.StartNew(async() => await ActionLookup.Resolve()); taskArray[1] = Task.Factory.StartNew(async() => await StatusEffectLookup.Resolve()); taskArray[2] = Task.Factory.StartNew(async() => await ZoneLookup.Resolve()); Task.WaitAll(taskArray); //await ActionLookup.Resolve(); //await StatusEffectLookup.Resolve(); //await ZoneLookup.Resolve(); await this.ResolveMemoryStructures(processModel, patchVersion); } this.AttachmentWorker = new AttachmentWorker(); this.AttachmentWorker.StartScanning(processModel); this.SystemModules.Clear(); this.GetProcessModules(); Scanner.Instance.Locations.Clear(); var signatures = await Signatures.Resolve(processModel, patchVersion); List <Signature> sigs = signatures as List <Signature>; sigs.Add(new Signature { Key = "INVENTORYBAGS", PointerPath = new List <long> { 0x15786f0 } }); sigs.Add(new Signature { Key = "INVENTORYSTART", PointerPath = new List <long> { 0x1c1de30 } }); Scanner.Instance.LoadOffsets(sigs, scanAllMemoryRegions); }