[Refactor] Use LibraryImport instead of DllImport.

This commit is contained in:
2024-05-01 05:36:13 +01:00
parent 01116106d7
commit c2e6e12b37
23 changed files with 326 additions and 258 deletions

View File

@@ -27,6 +27,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">

View File

@@ -32,47 +32,64 @@
// ****************************************************************************/
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;
namespace Aaru.Devices.Linux;
static class Extern
static partial class Extern
{
[DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern int open(string pathname, [MarshalAs(UnmanagedType.U4)] FileFlags flags);
[LibraryImport("libc",
SetLastError = true,
StringMarshalling = StringMarshalling.Custom,
StringMarshallingCustomType = typeof(AnsiStringMarshaller))]
internal static partial int open(string pathname, [MarshalAs(UnmanagedType.U4)] FileFlags flags);
[DllImport("libc")]
internal static extern int close(int fd);
[LibraryImport("libc")]
internal static partial int close(int fd);
[DllImport("libc", EntryPoint = "ioctl", SetLastError = true)]
internal static extern int ioctlSg(int fd, LinuxIoctl request, ref SgIoHdrT value);
[LibraryImport("libc", EntryPoint = "ioctl", SetLastError = true)]
internal static partial int ioctlSg(int fd, LinuxIoctl request, ref SgIoHdrT value);
[DllImport("libc", EntryPoint = "ioctl", SetLastError = true)]
internal static extern int ioctlMmc(int fd, LinuxIoctl request, ref MmcIocCmd value);
[LibraryImport("libc", EntryPoint = "ioctl", SetLastError = true)]
internal static partial int ioctlMmc(int fd, LinuxIoctl request, ref MmcIocCmd value);
[DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern int readlink(string path, nint buf, int bufsize);
[LibraryImport("libc",
SetLastError = true,
StringMarshalling = StringMarshalling.Custom,
StringMarshallingCustomType = typeof(AnsiStringMarshaller))]
internal static partial int readlink(string path, nint buf, int bufsize);
[DllImport("libc", CharSet = CharSet.Ansi, EntryPoint = "readlink", SetLastError = true)]
internal static extern long readlink64(string path, nint buf, long bufsize);
[LibraryImport("libc",
EntryPoint = "readlink",
SetLastError = true,
StringMarshalling = StringMarshalling.Custom,
StringMarshallingCustomType = typeof(AnsiStringMarshaller))]
internal static partial long readlink64(string path, nint buf, long bufsize);
[DllImport("libudev", CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern nint udev_new();
[LibraryImport("libudev", SetLastError = true)]
internal static partial nint udev_new();
[DllImport("libudev", CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern nint udev_device_new_from_subsystem_sysname(nint udev, string subsystem, string sysname);
[LibraryImport("libudev",
SetLastError = true,
StringMarshalling = StringMarshalling.Custom,
StringMarshallingCustomType = typeof(AnsiStringMarshaller))]
internal static partial nint udev_device_new_from_subsystem_sysname(nint udev, string subsystem, string sysname);
[DllImport("libudev", CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern string udev_device_get_property_value(nint udevDevice, string key);
[LibraryImport("libudev",
SetLastError = true,
StringMarshalling = StringMarshalling.Custom,
StringMarshallingCustomType = typeof(AnsiStringMarshaller))]
internal static partial string udev_device_get_property_value(nint udevDevice, string key);
[DllImport("libc", EntryPoint = "ioctl", SetLastError = true)]
internal static extern int ioctlMmcMulti(int fd, LinuxIoctl request, nint value);
[LibraryImport("libc", EntryPoint = "ioctl", SetLastError = true)]
internal static partial int ioctlMmcMulti(int fd, LinuxIoctl request, nint value);
[DllImport("libc", SetLastError = true)]
internal static extern long lseek(int fd, long offset, SeekWhence whence);
[LibraryImport("libc", SetLastError = true)]
internal static partial long lseek(int fd, long offset, SeekWhence whence);
[DllImport("libc", SetLastError = true)]
internal static extern int read(int fd, byte[] buf, int count);
[LibraryImport("libc", SetLastError = true)]
internal static partial int read(int fd, byte[] buf, int count);
[DllImport("libc", EntryPoint = "read", SetLastError = true)]
internal static extern long read64(int fd, byte[] buf, long count);
[LibraryImport("libc", EntryPoint = "read", SetLastError = true)]
internal static partial long read64(int fd, byte[] buf, long count);
}

View File

@@ -39,85 +39,101 @@ using Microsoft.Win32.SafeHandles;
namespace Aaru.Devices.Windows;
[SuppressMessage("ReSharper", "UnusedMember.Global")]
static class Extern
static partial class Extern
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern SafeFileHandle CreateFile([MarshalAs(UnmanagedType.LPTStr)] string filename,
[MarshalAs(UnmanagedType.U4)] FileAccess access,
[MarshalAs(UnmanagedType.U4)] FileShare share,
nint securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero
[MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
[MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes,
nint templateFile);
[LibraryImport("kernel32.dll",
EntryPoint = "CreateFileW",
SetLastError = true,
StringMarshalling = StringMarshalling.Utf16)]
internal static partial SafeFileHandle CreateFile([MarshalAs(UnmanagedType.LPTStr)] string filename,
[MarshalAs(UnmanagedType.U4)] FileAccess access,
[MarshalAs(UnmanagedType.U4)] FileShare share,
nint securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero
[MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
[MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes,
nint templateFile);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref ScsiPassThroughDirectAndSenseBuffer inBuffer,
uint nInBufferSize,
ref ScsiPassThroughDirectAndSenseBuffer outBuffer,
uint nOutBufferSize, ref uint pBytesReturned, nint overlapped);
[LibraryImport("Kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool DeviceIoControlScsi(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref ScsiPassThroughDirectAndSenseBuffer inBuffer,
uint nInBufferSize,
ref ScsiPassThroughDirectAndSenseBuffer outBuffer,
uint nOutBufferSize, ref uint pBytesReturned, nint overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref AtaPassThroughDirect inBuffer, uint nInBufferSize,
ref AtaPassThroughDirect outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[LibraryImport("Kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool DeviceIoControlAta(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref AtaPassThroughDirect inBuffer, uint nInBufferSize,
ref AtaPassThroughDirect outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlStorageQuery(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref StoragePropertyQuery inBuffer, uint nInBufferSize,
nint outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[LibraryImport("Kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool DeviceIoControlStorageQuery(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref StoragePropertyQuery inBuffer, uint nInBufferSize,
nint outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref IdePassThroughDirect inBuffer, uint nInBufferSize,
ref IdePassThroughDirect outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[LibraryImport("Kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool DeviceIoControlIde(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
ref IdePassThroughDirect inBuffer, uint nInBufferSize,
ref IdePassThroughDirect outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
nint inBuffer, uint nInBufferSize,
ref StorageDeviceNumber outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[LibraryImport("Kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
nint inBuffer, uint nInBufferSize,
ref StorageDeviceNumber outBuffer, uint nOutBufferSize,
ref uint pBytesReturned, nint overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, nint inBuffer,
uint nInBufferSize, ref SffdiskQueryDeviceProtocolData outBuffer,
uint nOutBufferSize, out uint pBytesReturned, nint overlapped);
[LibraryImport("Kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, nint inBuffer,
uint nInBufferSize, ref SffdiskQueryDeviceProtocolData outBuffer,
uint nOutBufferSize, out uint pBytesReturned, nint overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, byte[] inBuffer,
uint nInBufferSize, byte[] outBuffer, uint nOutBufferSize,
out uint pBytesReturned, nint overlapped);
[LibraryImport("Kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, byte[] inBuffer,
uint nInBufferSize, byte[] outBuffer, uint nOutBufferSize,
out uint pBytesReturned, nint overlapped);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
internal static extern SafeFileHandle SetupDiGetClassDevs(ref Guid classGuid, nint enumerator, nint hwndParent,
DeviceGetClassFlags flags);
[LibraryImport("setupapi.dll", EntryPoint = "SetupDiGetClassDevsW")]
internal static partial SafeFileHandle SetupDiGetClassDevs(ref Guid classGuid, nint enumerator, nint hwndParent,
DeviceGetClassFlags flags);
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo, nint devInfo,
ref Guid interfaceClassGuid, uint memberIndex,
ref DeviceInterfaceData deviceInterfaceData);
[LibraryImport("setupapi.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo, nint devInfo,
ref Guid interfaceClassGuid, uint memberIndex,
ref DeviceInterfaceData deviceInterfaceData);
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetupDiGetDeviceInterfaceDetail(SafeFileHandle hDevInfo,
ref DeviceInterfaceData deviceInterfaceData,
nint deviceInterfaceDetailData,
uint deviceInterfaceDetailDataSize, ref uint requiredSize,
nint deviceInfoData);
[LibraryImport("setupapi.dll", EntryPoint = "SetupDiGetDeviceInterfaceDetailW", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool SetupDiGetDeviceInterfaceDetail(SafeFileHandle hDevInfo,
ref DeviceInterfaceData deviceInterfaceData,
nint deviceInterfaceDetailData,
uint deviceInterfaceDetailDataSize,
ref uint requiredSize, nint deviceInfoData);
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetupDiDestroyDeviceInfoList(SafeFileHandle hDevInfo);
[LibraryImport("setupapi.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool SetupDiDestroyDeviceInfoList(SafeFileHandle hDevInfo);
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
internal static extern bool CloseHandle(SafeFileHandle hDevice);
[LibraryImport("Kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool CloseHandle(SafeFileHandle hDevice);
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer,
MoveMethod dwMoveMethod);
[LibraryImport("Kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer,
MoveMethod dwMoveMethod);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool ReadFile(SafeFileHandle hFile, byte[] lpBuffer, uint nNumberOfBytesToRead,
out uint lpNumberOfBytesRead, nint lpOverlapped);
[LibraryImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool ReadFile(SafeFileHandle hFile, byte[] lpBuffer, uint nNumberOfBytesToRead,
out uint lpNumberOfBytesRead, nint lpOverlapped);
}

View File

@@ -1170,54 +1170,76 @@ static partial class Usb
// ********************** API Definitions ************************
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
static extern IntPtr SetupDiGetClassDevs( // 1st form using a ClassGUID
[LibraryImport("setupapi.dll", EntryPoint = "SetupDiGetClassDevsW")]
private static partial IntPtr SetupDiGetClassDevs( // 1st form using a ClassGUID
ref Guid classGuid, int enumerator, IntPtr hwndParent, int flags);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)] // 2nd form uses an Enumerator
static extern IntPtr SetupDiGetClassDevs(int classGuid, string enumerator, IntPtr hwndParent, int flags);
[LibraryImport("setupapi.dll",
EntryPoint = "SetupDiGetClassDevsW",
StringMarshalling = StringMarshalling.Utf16)] // 2nd form uses an Enumerator
private static partial IntPtr SetupDiGetClassDevs(int classGuid, string enumerator,
IntPtr hwndParent, int flags);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SetupDiEnumDeviceInterfaces(IntPtr deviceInfoSet, IntPtr deviceInfoData,
ref Guid interfaceClassGuid, int memberIndex,
ref SpDeviceInterfaceData deviceInterfaceData);
[LibraryImport("setupapi.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool SetupDiEnumDeviceInterfaces(IntPtr deviceInfoSet, IntPtr deviceInfoData,
ref Guid interfaceClassGuid, int memberIndex,
ref SpDeviceInterfaceData
deviceInterfaceData);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr deviceInfoSet,
ref SpDeviceInterfaceData deviceInterfaceData,
ref SpDeviceInterfaceDetailData deviceInterfaceDetailData,
int deviceInterfaceDetailDataSize, ref int requiredSize,
ref SpDevinfoData deviceInfoData);
[LibraryImport("setupapi.dll", EntryPoint = "SetupDiGetDeviceInterfaceDetailW", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool SetupDiGetDeviceInterfaceDetail(IntPtr deviceInfoSet,
ref SpDeviceInterfaceData
deviceInterfaceData,
ref SpDeviceInterfaceDetailData
deviceInterfaceDetailData,
int deviceInterfaceDetailDataSize,
ref int requiredSize,
ref SpDevinfoData deviceInfoData);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData,
int iProperty, ref int propertyRegDataType,
IntPtr propertyBuffer, int propertyBufferSize,
ref int requiredSize);
[LibraryImport("setupapi.dll",
EntryPoint = "SetupDiGetDeviceRegistryPropertyW",
SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool SetupDiGetDeviceRegistryProperty(
IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, int iProperty,
ref int propertyRegDataType, IntPtr propertyBuffer, int propertyBufferSize,
ref int requiredSize);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet, int memberIndex, ref SpDevinfoData deviceInfoData);
[LibraryImport("setupapi.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet, int memberIndex,
ref SpDevinfoData deviceInfoData);
[DllImport("setupapi.dll", SetLastError = true)]
static extern bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet);
[LibraryImport("setupapi.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool SetupDiGetDeviceInstanceId(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData,
StringBuilder deviceInstanceId, int deviceInstanceIdSize,
out int requiredSize);
[LibraryImport("setupapi.dll", EntryPoint = "SetupDiGetDeviceInstanceIdW", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool SetupDiGetDeviceInstanceId(
IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData, StringBuilder deviceInstanceId,
int deviceInstanceIdSize, out int requiredSize);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer, int nInBufferSize,
IntPtr lpOutBuffer, int nOutBufferSize, out int lpBytesReturned,
IntPtr lpOverlapped);
[LibraryImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool DeviceIoControl(IntPtr hDevice, int dwIoControlCode, IntPtr lpInBuffer,
int nInBufferSize, IntPtr lpOutBuffer,
int nOutBufferSize, out int lpBytesReturned,
IntPtr lpOverlapped);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode,
IntPtr lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes,
IntPtr hTemplateFile);
[LibraryImport("kernel32.dll",
EntryPoint = "CreateFileW",
SetLastError = true,
StringMarshalling = StringMarshalling.Utf16)]
private static partial IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode,
IntPtr lpSecurityAttributes, int dwCreationDisposition,
int dwFlagsAndAttributes, IntPtr hTemplateFile);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool CloseHandle(IntPtr hObject);
[LibraryImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool CloseHandle(IntPtr hObject);
#endregion
}

View File

@@ -164,11 +164,11 @@ static partial class Usb
}
}
[DllImport("setupapi.dll")]
static extern int CM_Get_Parent(out uint pdnDevInst, uint dnDevInst, int ulFlags);
[LibraryImport("setupapi.dll")]
private static partial int CM_Get_Parent(out uint pdnDevInst, uint dnDevInst, int ulFlags);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
static extern int CM_Get_Device_ID(uint dnDevInst, IntPtr buffer, int bufferLen, int ulFlags);
[LibraryImport("setupapi.dll", EntryPoint = "CM_Get_Device_IDW")]
private static partial int CM_Get_Device_ID(uint dnDevInst, IntPtr buffer, int bufferLen, int ulFlags);
/// <summary>Find a device based upon a Drive Letter</summary>
/// <param name="driveLetter">Drive letter</param>