public PathDB(string drive) { mft = new CChangeJournal(drive); var root = mft.GetRootFrn(); string CurrentFolder = System.IO.Path.GetFullPath("."); //Dump(1688849860446726); var FilePath = CurrentFolder + string.Format(DBPATH, root.Key); /// Open the Database /// Connect = new PathDBDataContext(FilePath); /// Create the Database if not there are not exist if (!Connect.DatabaseExists()) { Connect.CreateDatabase(); Build(); } else { Update(); } }
public PathDBController() { mdb = new PathDB(); mft = new CChangeJournal("c:"); bool cached = mdb.Load("."); if (!cached) Build(); else { Update(); } mdb.Save("."); }
//unsafe private void GetRecords(UInt32 filter) //{ // filter = 2; // PInvokeWin32.READ_USN_JOURNAL_DATA rujd; // rujd.StartUSN = 0; // rujd.ReasonMask = filter; // rujd.BytesToWaitFor = 2000; // rujd.UsnJournalID = ujd.UsnJournalID; // IntPtr buffer = rujd; // IntPtr pData = Marshal.AllocHGlobal(sizeof(UInt64) + 0x10000); // PInvokeWin32.ZeroMemory(pData, sizeof(UInt64) + 0x10000); // uint outBytesReturned = 0; // PInvokeWin32.DeviceIoControl(_changeJournalRootHandle, PInvokeWin32.FSCTL_READ_USN_JOURNAL, out rujd, sizeof(PInvokeWin32.READ_USN_JOURNAL_DATA), pData, sizeof(UInt64) + 0x10000, out outBytesReturned, IntPtr.Zero); // PInvokeWin32.USN_RECORD usn = new PInvokeWin32.USN_RECORD(pUsnRecord); //} public static void SelfTest() { Dictionary<UInt64, FileNameAndFrn> result; CChangeJournal mft = new CChangeJournal(); StreamWriter writer = new StreamWriter("log.log"); mft.Drive = "f:"; mft.EnumerateVolume(out result, new string[] { "" }); //foreach (KeyValuePair<UInt64, FileNameAndFrn> entry in result) //{ // FileNameAndFrn file = (FileNameAndFrn)entry.Value; // writer.WriteLine(file.Name); //} foreach (var x in mft._directories) { writer.WriteLine(x.Value.Name); } writer.WriteLine("DONE"); writer.Close(); //writer.ReadKey(); }