New Award BIOS tool for performing SLIC Insertion/Modification

Discussion in 'MDL Projects and Applications' started by andyp, May 5, 2009.

  1. bobl7777

    bobl7777 MDL Junior Member

    Feb 23, 2011
    53
    21
    0
    Success...good to go!
     
  2. Jan1

    Jan1 MDL Novice

    May 20, 2010
    48
    257
    0
    #1022 Jan1, Mar 30, 2011
    Last edited by a moderator: Apr 20, 2017
  3. Jan1

    Jan1 MDL Novice

    May 20, 2010
    48
    257
    0
    Now it works here too. The exception only occurs if I start AwardTool in a VirtualBox VM.
    The exception was thrown immediately after I selected the original BIOS file.
     
  4. NoJuan999

    NoJuan999 Experienced SLIC Tool Operator

    Jul 31, 2009
    9,918
    1,935
    300
  5. behar

    behar MDL Novice

    Apr 1, 2011
    8
    0
    0
    On original bios all works fine. I try OEM7 (ACPITBL at End) Mod and nothing has changed.
     
  6. knoblauch

    knoblauch MDL Novice

    Oct 11, 2007
    43
    0
    0
    Gigabyte-P67A-UD4-B3
    Treid BIOS version f2, f3, f3d with Tool 1.52, all works so far, used method: FACS
    nothing else changed.

    Thanks for this great tool which saved so much time to do it manually!
     
  7. andyp

    andyp SLIC Tools Author

    Aug 8, 2008
    1,673
    2,568
    60
    #1031 andyp, Apr 11, 2011
    Last edited by a moderator: Apr 20, 2017
    (OP)
  8. draken

    draken MDL Junior Member

    Nov 21, 2008
    85
    27
    0
    Hi Andy!

    First of all, thanks for your hard work.

    I've found an interesting situation regarding 16 Mbit BIOS of Gigabyte boards.

    The BIOS is 2MB in size and the checksum is updated in two places instead of just one.

    In Official BIOS, checksum is found at 1EE000h.

    After modding the BIOS with your tool, checksum values can be found at EE000h and 1EE000h.

    It works, but it would be nice if the utility would only update the checksum at the required location.


    By the way, can you please tell me how can I calculate the MSB/LSB checksum, can't find the info anywhere on the net.
    Provided that you don't mind and it is not a secret?
     
  9. andyp

    andyp SLIC Tools Author

    Aug 8, 2008
    1,673
    2,568
    60
    #1033 andyp, Apr 27, 2011
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Could u post a link to the BIOS??

    Andy

    Code:
    Function VerifyChecksumsAward(ByRef sBIOS() As Byte, ByVal lBIOSLen As UInteger, ByVal lModulesOffset As UInteger, ByVal lDOffset As UInteger, ByVal lBBSS As UInteger, ByVal bVerbose As Boolean, ByVal bCorrectWhole As Boolean, ByVal bPreserveWhole As Boolean, ByVal bCorrectSB As Boolean, ByVal bStrict As Boolean) As Boolean
    
            Dim lSOffset, lOffset, lTemp, lBBSS64K, lChecksum, lLen As UInteger
            Dim iDiff As Integer
            Dim iStatus As MsgBoxResult
    
            VerifyChecksumsAward = False
    
            ' ** Initial variables
            lBBSS64K = (((lBBSS - (lBIOSLen - &H20000)) >> 16) And 3) ' ** 64K block found in (first =0,last =1)
            lBBSS64K <<= 16
    
            ' ** Verify modules and decompression block checksum
            lSOffset = lModulesOffset
    
            If Not bASUS And Not bCore60 Then
                If lBIOSLen <= &H40000 Or (sBIOS(lBBSS + 8) And &HF) = 0 Then
                    lOffset = (CUInt(sBIOS(lBBSS + 9)) << 8) And &HF000
                    lOffset = lBIOSLen - &H20000 + lBBSS64K + lOffset
                Else
                    lOffset = (CUInt(sBIOS(lBBSS + 7)) << 8) And &HF000
                    lOffset += (CUInt(sBIOS(lBIOSLen - &H20000 + lOffset + 11)) << 8) And &HF000
                    lTemp = (sBIOS(lBBSS + 6)) And &HF
                    lTemp = lBIOSLen - &H10000 - ((&HF - (lTemp And &HF)) << 16)
                    lOffset += lTemp
                End If
                lOffset += &HFFE
    
                lChecksum = ChecksumAdd8(sBIOS, lSOffset, lOffset - lSOffset)
                iDiff = sBIOS(lOffset)
                If lChecksum <> sBIOS(lOffset) Then
                    If bVerbose Then AddLine("Module and decompression block checksum is invalid (" & Hex(sBIOS(lOffset)) & " - Start " & Hex(lSOffset) & " Length " & Hex(lOffset - lSOffset) & ")")
                    If bCorrectWhole Then
                        If bPreserveWhole Then
                            iDiff = (sBIOS(lOffset) - CInt(lChecksum) + sBIOS(lOffset - 1)) And &HFF
                            sBIOS(lOffset - 1) = iDiff
                            iDiff = sBIOS(lOffset)
                            lChecksum = sBIOS(lOffset)
                        Else
                            sBIOS(lOffset) = lChecksum And &HFF
                        End If
                        If bVerbose Then AddLine("Module and decompression block checksum corrected (" & Hex(lChecksum) & ")")
                    Else
                        If gOptions.bIgnoreWarnings And bVerbose Then
                            iStatus = AddLine("Module and decompression block checksum is invalid", cWarning)
                            If iStatus = MsgBoxResult.No Then Exit Function
                        Else
                            If bVerbose Then AddLine("Module and decompression block checksum is invalid", cError)
                            Exit Function
                        End If
                    End If
                Else
                    If bVerbose Then AddLine("Module and decompression block checksum is valid (" & Hex(sBIOS(lOffset)) & " - Start " & Hex(lSOffset) & " Length " & Hex(lOffset - lSOffset) & ")")
                End If
    
                If bCore600 And bCorrectWhole Then
                    ' ** Next byte - decompression block checksum - is mathematically difference
                    iDiff = sBIOS(lOffset + 1) - iDiff
                    sBIOS(lOffset + 1) = (sBIOS(lOffset) + iDiff) And &HFF
                End If
            Else
                If bASUS Then
                    lOffset = (lDOffset And &HFFFFF000) + &HFFE
                    If sBIOS(lOffset) <> 0 Then
                        If bCorrectWhole Then
                            sBIOS(lOffset) = 0
                            If bVerbose Then AddLine("Module and decompression block checksum corrected (00)")
                        Else
                            If gOptions.bIgnoreWarnings And bVerbose Then
                                iStatus = AddLine("Module and decompression block checksum should be 00", cWarning)
                                If iStatus = MsgBoxResult.No Then Exit Function
                            Else
                                If bVerbose Then AddLine("Module and decompression block checksum should be 00", cError)
                                Exit Function
                            End If
                        End If
                    End If
                End If
            End If
    
            If bCore45 Or bCore60 Then
                lOffset = (lDOffset And &HFFFFF000) + &HFFF
                lSOffset = lDOffset
                lChecksum = ChecksumAdd8(sBIOS, lSOffset, lOffset - lSOffset)
                If lChecksum <> sBIOS(lOffset) Then
                    If bCorrectWhole Then
                        sBIOS(lOffset) = lChecksum And &HFF
                        If bVerbose Then AddLine("Decompression block checksum corrected (" & Hex(lChecksum) & ")")
                    Else
                        If bVerbose Then AddLine("Decompression block checksum is invalid (" & Hex(sBIOS(lOffset)) & " - Start " & Hex(lSOffset) & " Length " & Hex(lOffset - lSOffset) & ")")
                        If gOptions.bIgnoreWarnings And bVerbose Then
                            iStatus = AddLine("Decompression block checksum is invalid", cWarning)
                            If iStatus = MsgBoxResult.No Then Exit Function
                        Else
                            If bVerbose Then AddLine("Decompression block checksum is invalid", cError)
                            Exit Function
                        End If
                    End If
                Else
                    If bVerbose Then AddLine("Decompression block checksum is valid (" & Hex(sBIOS(lOffset)) & " - Start " & Hex(lSOffset) & " Length " & Hex(lOffset - lSOffset) & ")")
                End If
            End If
    
            ' ** Check extra
            If bCore600 Then
                lOffset = ConvertDWord(sBIOS(lBBSS + 6), sBIOS(lBBSS + 7), 0, 0)
                lOffset = ((lOffset And &HF) << 16) Or (lOffset And &HFFF0) ' ROR lOffset,4
                If lBIOSLen < &H100000 Then lTemp = (&H100000 - lBIOSLen) Else lTemp = 0
                If lBIOSLen > &H100000 Then lSOffset = lBIOSLen Else lSOffset = &H100000
                If lOffset >= lTemp And lOffset < lSOffset Then
                    lOffset -= lTemp
                    lTemp = ConvertDWord(sBIOS(lOffset + 10), sBIOS(lOffset + 11), 0, 0)
                    If lTemp > 2 Then
                        lTemp -= 1
                        lChecksum = ChecksumAdd8(sBIOS, lOffset, lTemp - 1)
                        If lChecksum <> sBIOS(lOffset + lTemp) Then
                            AddLine("Extra checksum invalid or not present")
                        Else
                            AddLine("Extra checksum valid")
                        End If
                    Else
                        AddLine("Extra checksum not present")
                    End If
                Else
                    AddLine("Extra checksum not present")
                End If
            End If
    
            If bCore600 Then
                ' ** Look to see if padding at the start            
                If lBIOSLen > (512 * 1024) Then
                    For iDiff = lBIOSLen To (512 * 1024) Step -(512 * 1024)
                        For lOffset = 0 To iDiff - 1
                            If sBIOS(lOffset) <> &HFF Then Exit For
                        Next
                        If lOffset = iDiff Then Exit For
                    Next
                End If
                If lOffset <> iDiff Then lOffset = 0
    
                ' ** LSB/MSB sums - makes module sum to 0
                If lBIOSLen <= &H40000 Or (sBIOS(lBBSS + 8) And &HF) = 0 Then
                    lTemp = lBBSS64K + lBIOSLen - &H20000 + ((CUInt(sBIOS(lBBSS + 19)) << 8) And &HF000)
                Else
                    lTemp = (CUInt(sBIOS(lBBSS + 18)) << 16) + (CUInt(sBIOS(lBBSS + 19)) << 8)
                End If
                lTemp += lOffset
    
                lChecksum = ChecksumSplit8(sBIOS, 0, lBIOSLen, lTemp, False)
                If lChecksum <> sBIOS(lTemp) Then
                    If bCorrectSB Then
                        sBIOS(lTemp) = lChecksum And &HFF
                        If bVerbose Then AddLine("First byte (LSB) checksum corrected (" & Hex(lChecksum) & ")")
                    Else
                        If bStrict And bVerbose Then AddLine("First byte (LSB) checksum is invalid")
                    End If
                Else
                    If bVerbose Then AddLine("First byte (LSB) checksum is valid")
                End If
    
                lChecksum = ChecksumSplit8(sBIOS, 0, lBIOSLen, lTemp + 1, True)
                If lChecksum <> sBIOS(lTemp + 1) Then
                    If bCorrectSB Then
                        sBIOS(lTemp + 1) = lChecksum And &HFF
                        If bVerbose Then AddLine("Second byte (MSB) checksum corrected (" & Hex(lChecksum) & ")")
                    Else
                        If bStrict And bVerbose Then AddLine("Second byte (MSB) checksum is invalid")
                    End If
                Else
                    If bVerbose Then AddLine("Second byte (MSB) checksum is valid")
                End If
            End If
    
            VerifyChecksumsAward = True
    
        End Function
    
    Function Checksum8(ByRef sBuffer() As Byte, ByVal lOffset As UInteger, ByVal lLen As UInteger) As UInteger
    
            Dim dChecksum As Long, lCount As UInteger
    
            dChecksum = 0
            For lCount = 0 To lLen - 1
                dChecksum += sBuffer(lOffset + lCount)
            Next lCount
            Checksum8 = CUInt((-dChecksum) And &HFF)
    
        End Function
    
        Function ChecksumAdd8(ByRef sBuffer() As Byte, ByVal lOffset As UInteger, ByVal lLen As UInteger) As UInteger
    
            Dim dChecksum As Long, lCount As UInteger
    
            dChecksum = 0
            For lCount = 0 To lLen - 1
                dChecksum += sBuffer(lOffset + lCount)
            Next lCount
            ChecksumAdd8 = CUInt(dChecksum And &HFF)
    
        End Function
    
        Function ChecksumSplit8(ByRef sBuffer() As Byte, ByVal lOffset As UInteger, ByVal lLen As UInteger, ByVal lSkip As UInteger, ByVal bMSB As Boolean) As UInteger
    
            Dim dChecksum As Long, lCount As UInteger
    
            dChecksum = 0
            For lCount = 0 To lLen - 2 Step 2
                dChecksum += sBuffer(lOffset + lCount + Math.Abs(CInt(bMSB)))
            Next lCount
            dChecksum -= sBuffer(lOffset + lSkip)
            ChecksumSplit8 = CUInt((-dChecksum) And &HFF)
    
        End Function

     
  10. Jan1

    Jan1 MDL Novice

    May 20, 2010
    48
    257
    0
    #1035 Jan1, May 14, 2011
    Last edited by a moderator: Apr 20, 2017
    Hey Andy,

    the same Exception occurs when it runs from a non-boot drive. I forgot to mention that there is another exception immediately after the program is started:
    Code:
    ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Award.frmMain.frmMain_Load(Object sender, EventArgs e)
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    I found out that both exceptions only occur when the program is run from a virtual machine. When I run the program on a real PC there are no problems.
     
  11. andyp

    andyp SLIC Tools Author

    Aug 8, 2008
    1,673
    2,568
    60
    #1036 andyp, May 15, 2011
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Thats probs why then.
    I think it might me the code it uses to determine processer type (for some of the removal routines)
    I could do a test version if u wanted
    Andy

     
  12. Serg008

    Serg008 MDL BIOS/EFI Guru

    Feb 23, 2010
    23,347
    10,321
    390
    Thanks for feedback.

    Manuf.: Other
    Mod method: 0+2 and tick "Overwrite dummy code" in Advanced