From 19aa929e985e46c99459f254b52577fd5429d7f9 Mon Sep 17 00:00:00 2001 From: Bluzume <39113159+KuromeSan@users.noreply.github.com> Date: Fri, 12 Feb 2021 21:11:30 +1300 Subject: [PATCH] Add files via upload --- DontTouchMyFlash/FlashPwner.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DontTouchMyFlash/FlashPwner.cs b/DontTouchMyFlash/FlashPwner.cs index c4664c6..5391186 100644 --- a/DontTouchMyFlash/FlashPwner.cs +++ b/DontTouchMyFlash/FlashPwner.cs @@ -211,13 +211,15 @@ namespace DontTouchMyFlash { byte[] projBytes = File.ReadAllBytes(path); byte[] getUrlPattern = new byte[] { 0xF4, 0xE8, 0xBE, 0xFE, 0xFF, 0xFF }; - + byte[] nops = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; Int64 getUrlLocation = GetPositionAfterMatch(projBytes, getUrlPattern); + if (getUrlLocation == -1) + return; + FileStream fs = File.OpenWrite(path); fs.Seek(getUrlLocation+1, SeekOrigin.Begin); - for (int i = 0; i < 5; i++) - fs.WriteByte((byte)0x90); // NOP + fs.Write(nops, 0x00, nops.Length); fs.Close(); }