Torna al Thread
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Runtime.InteropServices;
using LTR.IO.ImDisk;
using LTR.IO.ImDisk.ComInterop;
namespace SimpleUSB
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
CreateRAMDisk();
}
public void CreateRAMDisk()
{
uint deviceID = UInt32.MaxValue;
char driveLetter = ImDiskAPI.FindFreeDriveLetter();
ImDiskAPI.CreateDevice(52428800, 0, 0, 0, 0,
ImDiskFlags.DeviceTypeHD | ImDiskFlags.TypeVM,
null, //@"W:/test.iso",
false, driveLetter.ToString(), ref deviceID, IntPtr.Zero);
//ImDiskAPI.CreateMountPoint(driveLetter + @":\Device\ImDisk0", deviceID); // <== Exception: The system cannot find the path specified
//ImDiskAPI.CreateMountPoint(driveLetter, deviceID); // <== Exception: The system cannot find the path specified
ImDiskAPI.CreateMountPoint(@"C:\utentis", deviceID);
DriveManager l = new DriveManager();
l.FormatDrive_CommandLine(driveLetter, "DiscoProva", "NTFS", true, false, 4096);
}
private void button1_Click(object sender, EventArgs e)
{
ImDiskAPI.RemoveMountPoint("C://utentis");
}
}
}