Skip to content

Commit 09e061d

Browse files
committed
NTFS: LfsRestartPage: Added IsRestartPage method
1 parent 7186a9b commit 09e061d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

DiskAccessLibrary/FileSystems/NTFS/Log/Structures/LfsRestartPage.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2018 Tal Aloni <[email protected]>. All rights reserved.
1+
/* Copyright (C) 2018-2019 Tal Aloni <[email protected]>. All rights reserved.
22
*
33
* You can redistribute this program and/or modify it under the terms of
44
* the GNU Lesser Public License as published by the Free Software Foundation,
@@ -84,11 +84,6 @@ public byte[] GetBytes(int bytesPerSystemPage, bool applyUsaProtection)
8484
return buffer;
8585
}
8686

87-
public static uint GetSystemPageSize(byte[] buffer, int offset)
88-
{
89-
return LittleEndianConverter.ToUInt32(buffer, offset + 0x10);
90-
}
91-
9287
public uint SystemPageSize
9388
{
9489
get
@@ -97,6 +92,17 @@ public uint SystemPageSize
9792
}
9893
}
9994

95+
public static bool IsRestartPage(byte[] buffer, int offset)
96+
{
97+
string signature = ByteReader.ReadAnsiString(buffer, offset + 0x00, MultiSectorHeader.SignatureLength);
98+
return (signature == ValidSignature || signature == ModifiedSignature);
99+
}
100+
101+
public static uint GetSystemPageSize(byte[] buffer, int offset)
102+
{
103+
return LittleEndianConverter.ToUInt32(buffer, offset + 0x10);
104+
}
105+
100106
public static LfsRestartPage Create(long fileSize, int bytesPerSystemPage, int bytesPerLogPage, params LfsClientRecord[] clients)
101107
{
102108
LfsRestartPage restartPage = new LfsRestartPage();

0 commit comments

Comments
 (0)