public void UpdateOffsets(LeagueProcess league) { byte[] data = league.Dump(); uint checksum = LeagueProcess.ExtractChecksum(data); int pmethArrayOffsetIndex = PATERN_PMETH_ARRAY.Find(data); int fileProviderListOffsetIndex = PATERN_FILE_PROVIDER_LIST.Find(data); if (pmethArrayOffsetIndex > 0 && fileProviderListOffsetIndex > 0) { this.Checksum = checksum; this.PMethArrayOffset = BitConverter.ToUInt32(data, pmethArrayOffsetIndex) - league.Base; this.FileProviderListOffset = BitConverter.ToUInt32(data, fileProviderListOffsetIndex) - league.Base; this._messageCallback?.Invoke(string.Format("Checksum: {0}", checksum)); this._messageCallback?.Invoke(string.Format("PMethArrayOffsetIndex: {0}", pmethArrayOffsetIndex)); this._messageCallback?.Invoke(string.Format("FileProviderListOffsetIndex: {0}", fileProviderListOffsetIndex)); } else { throw new IOException("Failed to update offsets!"); } }
public void UpdateOffsets(LeagueProcess league) { byte[] data = league.Dump(); uint checksum = LeagueProcess.ExtractChecksum(data); int createFileARefOffset = PAT_CreateFileA_CALL.Find(data); if (createFileARefOffset == -1) { throw new IOException("Failed to find CreateFileA reference index!"); } int createFileAOffset = BitConverter.ToInt32(data, createFileARefOffset) - (int)league.Base; int returnAddressOffset = PAT_ReturnAddress.Find(data); if (returnAddressOffset == -1) { throw new IOException("Failed to find ReturnAddress!"); } int freePointerOffsetIndex = PAT_FreePointerOffset.Find(data); if (freePointerOffsetIndex == -1) { throw new IOException("Failed to find FreePointer!"); } int freePointerOffset = BitConverter.ToInt32(data, freePointerOffsetIndex) - (int)league.Base; int freeFunctionOffset = freePointerOffsetIndex + OFF_FreeFunctionOffset; this.Checksum = checksum; this.CreateFileARefOffset = (uint)createFileARefOffset; this.CreateFileAOffset = (uint)createFileAOffset; this.ReturnAddressOffset = (uint)returnAddressOffset; this.FreePointerOffset = (uint)freePointerOffset; this.FreeFunctionOffset = (uint)freeFunctionOffset; this.PrintConfig(); }