Source code
Source code
Globalization
Imports System.IO
Imports System.Text.RegularExpressions
Namespace Module8FC8
Public Module Module8FC8
Public Function Main(ByVal args As String()) As Integer
Dim matchFound = False
' If no argument is provided then print usage hint
If args.Length < 1 Then
Console.WriteLine("Rex98-8FC8-Patcher" + vbCrLf + "Usage:
Rex_8FC8_patcher.exe <locked bios.bin>")
Console.Write($"{Environment.NewLine}Press any key to exit...")
Console.ReadKey(True)
Return -1
End If
Console.Title = "Rex98-8FC8-Patcher"
Console.ForegroundColor = ConsoleColor.Green
Console.WriteLine("Badcaps **Dell-8FC8-Patcher**")
Console.WriteLine("@Rex98" + vbCrLf)
System.Threading.Thread.Sleep(1000)
Console.ForegroundColor = ConsoleColor.Cyan
Console.WriteLine("Pag huwat ky ga patch pa!...in file " + args(0))
' Read the provided file
Dim bytes = File.ReadAllBytes(args(0))
' Extract the file name for saving later
Dim filename As String = Path.GetFileName(args(0))
If matchFound Then
Try ' Write first pattern findings to file
File.WriteAllBytes("patched_" & filename, bytes)
matchFound = False
Catch ex As Exception
Console.WriteLine(ex)
Console.Write($"{Environment.NewLine}Pinduta bisan unsang key
para ma exit...")
Console.ReadKey(True)
Return -1
End Try
Else
Console.ForegroundColor = ConsoleColor.Red
Console.WriteLine(vbCrLf + "Wa nakita ang unang patern" + vbCrLf)
End If
Console.ForegroundColor = ConsoleColor.Cyan
Console.WriteLine(vbCrLf + "Kalma hapit na!..." + vbCrLf)
If matchFound Then
Try
File.WriteAllBytes("patched_" & filename, bytes)
Catch ex As Exception
Console.WriteLine(ex)
Console.Write($"{Environment.NewLine}Pinduta bisan unsang key
para ma exit...")
Console.ReadKey(True)
Return -1
End Try
Console.ForegroundColor = ConsoleColor.Cyan
Console.WriteLine(vbCrLf + vbCrLf + "na patched og gi saved as
patched_" + filename + vbCrLf + vbCrLf + "Don't Forget to say Thanks to Rex98 &
Techshack Cebu for this freeware.")
Console.ForegroundColor = ConsoleColor.White
Console.WriteLine(vbCrLf + "My Telegram channel link:")
Console.ForegroundColor = ConsoleColor.DarkYellow
Console.WriteLine(vbCrLf + "https://t.me/BiosUnlockingPhilippines")
Console.ForegroundColor = ConsoleColor.White
Console.ForegroundColor = ConsoleColor.White
Console.Write($"{Environment.NewLine}Pinduta bisan unsang key para
ma exit...")
Console.ReadKey(True)
Return 0
Else
Console.ForegroundColor = ConsoleColor.Red
Console.WriteLine(vbCrLf + "wa na patch...ky wa makita ang pattern"
+ vbCrLf)
Console.ForegroundColor = ConsoleColor.White
Console.Write($"{Environment.NewLine}Pinduta bisan unsang key para
ma exit...")
Console.ReadKey(True)
Return -1
End If
End Function
' Returns the offset where the searched pattern is found in source string
Private Iterator Function PatternAt(ByVal source As Byte(), ByVal pattern
As String) As IEnumerable(Of Integer)
Dim regex As New Regex(pattern)
For i = 0 To source.Length - 1
Dim source1 As Byte() =
source.Skip(i).Take(pattern.Length).ToArray()
If regex.IsMatch(ByteArrayToString(source1)) Then
Yield i
End If
If i >= &H160000 Then Exit For
Next
End Function
' Returns the offset where the Intel signature is found in source string
Private Iterator Function SignoAt(ByVal source As Byte(), ByVal pattern As
Byte()) As IEnumerable(Of Integer)
For i = 0 To source.Length - 1
If source.Skip(i).Take(pattern.Length).SequenceEqual(pattern) Then
Yield i
End If
If i >= &H1000 Then Exit For
Next
End Function
Return data
End Function
End Module
End Namespace