Exemple #1
0
        public void SetLastEntry(ulong committedTransactionID, ulong pendingTransactionID)
        {
            if (m_logEntries.Count > 0)
            {
                m_logEntries.RemoveAt(m_logEntries.Count - 1);
            }
            KernelUpdateLogEntry entry = new KernelUpdateLogEntry();

            entry.Status = KernelUpdateLogEntryStatus.Commit;
            entry.CommittedTransactionID = committedTransactionID;
            entry.PendingTransactionID   = pendingTransactionID;
            m_logEntries.Add(entry);
        }
Exemple #2
0
        private List <KernelUpdateLogEntry> m_logEntries = new List <KernelUpdateLogEntry>(); // PendingTransactionID, CommitTransactionID

        public KernelUpdateLogPage(byte[] buffer)
        {
            Signature            = ByteReader.ReadAnsiString(buffer, 0x00, 4);
            UnknownTransactionID = BigEndianConverter.ToUInt64(buffer, 0x04);
            SequenceNumber       = BigEndianConverter.ToUInt32(buffer, 0x0C);
            NumberOfPages        = BigEndianConverter.ToUInt32(buffer, 0x10);
            PageIndex            = BigEndianConverter.ToUInt32(buffer, 0x14);

            // Note: for the first KLog, the most recent entry is at the top
            m_logEntries.Clear();

            int offset = 0x18;

            while (offset < buffer.Length - 24) // room of one more entry
            {
                KernelUpdateLogEntryStatus status = (KernelUpdateLogEntryStatus)buffer[offset];
                offset += 1;
                if (status != KernelUpdateLogEntryStatus.NotExist)
                {
                    KernelUpdateLogEntry entry = new KernelUpdateLogEntry();
                    entry.Status = status;
                    entry.CommittedTransactionID = BigEndianConverter.ToUInt64(buffer, offset);
                    offset += 8;
                    entry.PendingTransactionID = BigEndianConverter.ToUInt64(buffer, offset);
                    offset += 8;
                    entry.RecoverySequenceNumber = BigEndianConverter.ToUInt32(buffer, offset);
                    offset += 4;
                    m_logEntries.Add(entry);
                    offset += 3; // padding to align to 4-byte boundary
                }
                else
                {
                    break;
                }
            }
        }