mft function rewrite

This commit is contained in:
2022-03-09 13:42:01 +08:00
parent db9e96e4ed
commit 426a959d0d
6 changed files with 116 additions and 54 deletions
+2 -4
View File
@@ -5,7 +5,6 @@ import (
"b612.me/wincmd/ntfs/fragment"
"bytes"
"fmt"
"github.com/t9t/gomft/mft"
"io"
"os"
"runtime"
@@ -13,7 +12,6 @@ import (
const supportedOemId = "NTFS "
const isWin = runtime.GOOS == "windows"
func GetMFTFileBytes(volume string) ([]byte, error) {
@@ -85,12 +83,12 @@ func GetMFTFile(volume string) (io.Reader, int64, error) {
return nil, 0, fmt.Errorf("Unable to read $MFT record: %v\n", err)
}
record, err := mft.ParseRecord(mftData)
record, err := ParseRecord(mftData)
if err != nil {
return nil, 0, fmt.Errorf("Unable to parse $MFT record: %v\n", err)
}
dataAttributes := record.FindAttributes(mft.AttributeTypeData)
dataAttributes := record.FindAttributes(AttributeTypeData)
if len(dataAttributes) == 0 {
return nil, 0, fmt.Errorf("No $DATA attribute found in $MFT record\n")
}