Documentation
Here's how to use this library

Imports TrueCryptAPI

Public Module Module1

    Sub Main()
        Dim tcAPI As TrueCrypt 'TrueCrypt Managed Code API

        'First thing to do: setting the driver location (the used driver is based on the OS architecture settings.)
        TrueCrypt.Driver32bitLocation = "truecrypt.sys"
        TrueCrypt.Driver64bitLocation = "truecrypt-x64.sys"

        'New instance of API
        tcAPI = New TrueCrypt

        Dim test As New Password, opt As New MountOptions

        test.Password = "1221" 'Volume's password
        test.KeyFile.Add("Test.fch") 'Volume's keyfile
        opt.PreserveTimestamp = True 'Some mount options

        If Not tcAPI.DriverAttach() = ERRORS.SUCCESS Then 'Attach the driver
            Console.WriteLine("ERROR")
            Console.ReadLine()
        End If

        If tcAPI.MountContainer("Test.tc", "L", test, opt) Then 'Try to mount the file
            Console.WriteLine("OK")
        Else
            Console.WriteLine("Err")
        End If

        Console.ReadLine()

        If tcAPI.Dismount("L", False) Then 'Dismount the volume
            Console.WriteLine("OK")
        Else
            Console.WriteLine("Err")
        End If

        Console.ReadLine()
    End Sub
End Module

using TrueCryptAPI;

public class module1

    public static void Main()
        TrueCrypt tcAPI; //TrueCrypt Managed Code API

        //First thing to do: setting the driver location (the used driver is based on the OS architecture settings.)
        TrueCrypt.Driver32bitLocation = "truecrypt.sys";
        TrueCrypt.Driver64bitLocation = "truecrypt-x64.sys";

        //New instance of API
        tcAPI = new TrueCrypt;

        Password test = new Password;
        MountOptions opt = new MountOptions;

        test.Password = "1221"; //Volume's password
        test.KeyFile.Add("Test.fch"); //Volume's keyfile
        opt.PreserveTimestamp = true; //Some mount options

        if (tcAPI.DriverAttach() != ERRORS.SUCCESS) { //Attach the driver
            Console.WriteLine("ERROR");
            Console.ReadLine();
        }

        if (tcAPI.MountContainer("Test.tc", "L", test, opt) == true) { //Try to mount the file
            Console.WriteLine("OK");
        } else {
            Console.WriteLine("Err");
        }

        Console.ReadLine();

        if (tcAPI.Dismount("L", false) == true) { //Dismount the volume
            Console.WriteLine("OK");
        } else {
            Console.WriteLine("Err");
        }

        Console.ReadLine();
    }
}

Last edited Aug 4, 2014 at 10:33 PM by full98, version 1