[Download] TransNTFS – Managed implementation of Transactional NTFS (TxF) APIs
Posted by Gaurav Khanna on March 15, 2007
Sometime back, I had made a post regarding a native C++ class I had authored for using some of the Transactional NTFS (TxF)APIs introduced in Windows Vista.
Almost two weeks from that post, I just finished my managed implementation, TransNTFS, that enables you to use the TxF APIs from managed code. As always, Managed C++ enabled the implementation with excellent ease. It comes with complete documentation and can be downloaded from http://www.wintoolzone.com/ListDotNET.aspx?Listtype=3.
Below is an example usage of how to copy a file under a transaction:
using System; using System.Collections.Generic; using System.Text; using WinToolZone; namespace ManagedTransactionCopyDemo { class Program { static void Main(string[] args) { TransNTFS refTC = new TransNTFS(); // Init the transaction bool fSuccess = refTC.BeginTransaction(); if (fSuccess) { fSuccess = refTC.CopyFile("d:\\transcopy.pdb", "d:\\t.pdb", false); if (fSuccess) { fSuccess = refTC.Commit(); if (fSuccess) { Console.WriteLine("Copy successful!"); } else { ShowErrorAndExit("Commit failed!", refTC.LastError); } } else { ShowErrorAndExit("Copy failed!", refTC.LastError); } } else { ShowErrorAndExit("Unable to start the transaction!", refTC.LastError); } } private static void ShowErrorAndExit(string p, int p_2) { Console.WriteLine("ERROR: {0}", p); Console.WriteLine("CODE: {0}", p_2); System.Environment.Exit(1); } } }
Advertisement
[Download] TransNTFS v1.0.0.1 - support for folders, symbolic and hard links and more « CPFH… said
[...] Blocked 0 spam comments blocked byAkismet « [Download] TransNTFS – Managed implementation of Transactional NTFS (TxF) APIs Lessons in Exception Handling [...]