Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a Virtual Disk Mount Point
    primarykey
    data
    text
    <p>I have used the ImDisk library with the .NET wrapper to create a Virtual Disk in my C# application. However, after I create the device, I apparently need to create a Mount Point as well for the device to actually show as a Drive Letter. I don't completely understand what is supposed to be supplied for it to create a Mount Point, but I believe this pertains more to Virtual devices than the library.</p> <p>My Function:</p> <pre><code>public bool CreateRAMDisk() { // Create Empty RAM Disk char driveLetter = ImDiskAPI.FindFreeDriveLetter(); ImDiskAPI.CreateDevice(52428800, 0, 0, 0, 0, ImDiskFlags.DeviceTypeHD | ImDiskFlags.TypeVM, null, false, driveLetter.ToString(), ref deviceID, IntPtr.Zero); string mountPoint = driveLetter + @":\Device\ImDisk0"; ImDiskAPI.CreateMountPoint(mountPoint, deviceID); // Format the Drive for NTFS if (FormatDrive(driveLetter.ToString(), "NTFS", true, 4096, "", false)) { </code></pre> <p>CreateMountPoint Definition:</p> <pre><code> public static void CreateMountPoint(string Directory, uint DeviceNumber); // // Summary: // Creates a mount point for an ImDisk virtual disk on an empty subdirectory // on an NTFS volume. // // Parameters: // Directory: // Path to an empty subdirectory on an NTFS volume // // DeviceNumber: // Device number of an existing ImDisk virtual disk </code></pre> <p><em><strong>UPDATE</em></strong></p> <p>FormatDrive Function:</p> <pre><code>public static bool FormatDrive(string driveLetter, string fileSystem, bool quickFormat, int clusterSize, string label, bool enableCompression) { driveLetter = driveLetter + ":"; if (driveLetter.Length != 2 || driveLetter[1] != ':'|| !char.IsLetter(driveLetter[0])) { return false; } //query and format given drive ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"select * from Win32_Volume WHERE DriveLetter = '" + driveLetter + "'"); foreach (ManagementObject vi in searcher.Get()) { vi.InvokeMethod( "Format", new object[] {fileSystem, quickFormat, clusterSize, label, enableCompression} ); } return true; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload