mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Unnecessary whitespace removal.
This commit is contained in:
@@ -571,7 +571,7 @@ namespace DiscImageChef.Devices
|
||||
|
||||
#region Commands defined on ATA/ATAPI-8 rev. 3f
|
||||
/// <summary>
|
||||
/// Sends a Non Volatile Cache subcommand. <see cref="AtaNonVolatileCacheSubCommands"/>
|
||||
/// Sends a Non Volatile Cache subcommand. <see cref="AtaNonVolatileCacheSubCommands"/>
|
||||
/// </summary>
|
||||
NonVolatileCacheCommand = 0xB6,
|
||||
/// <summary>
|
||||
@@ -735,7 +735,7 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
#region Commands defined on ATA/ATAPI-6 rev. 3b
|
||||
/// <summary>
|
||||
/// Disables any change made by <see cref="Set"/>
|
||||
/// Disables any change made by <see cref="Set"/>
|
||||
/// </summary>
|
||||
Restore = 0xC0,
|
||||
/// <summary>
|
||||
@@ -778,7 +778,7 @@ namespace DiscImageChef.Devices
|
||||
/// </summary>
|
||||
SetPassword = 0x01,
|
||||
/// <summary>
|
||||
/// Disables <see cref="Lock"/>
|
||||
/// Disables <see cref="Lock"/>
|
||||
/// </summary>
|
||||
UnLock = 0x03,
|
||||
#endregion Commands defined on ATA/ATAPI-6 rev. 3b
|
||||
@@ -814,7 +814,7 @@ namespace DiscImageChef.Devices
|
||||
RemoveLbaFromNvCache = 0x11,
|
||||
/// <summary>
|
||||
/// Disables the Non Volatile Cache Power Mode
|
||||
/// <see cref="SetNvCachePowerMode"/>
|
||||
/// <see cref="SetNvCachePowerMode"/>
|
||||
/// </summary>
|
||||
ReturnFromNvCachePowerMode = 0x01,
|
||||
/// <summary>
|
||||
@@ -1059,7 +1059,7 @@ namespace DiscImageChef.Devices
|
||||
/// </summary>
|
||||
WriteDiagnosticOld = 0x1B,
|
||||
/// <summary>
|
||||
/// Requests the data after completion of a <see cref="WriteDiagnostic"/>
|
||||
/// Requests the data after completion of a <see cref="WriteDiagnostic"/>
|
||||
/// ANSI X3T9.3 No. 185 (SASI)
|
||||
/// </summary>
|
||||
ReadDiagnostic = 0x1C,
|
||||
@@ -1464,12 +1464,12 @@ namespace DiscImageChef.Devices
|
||||
/// </summary>
|
||||
ReadSerialNumber = 0xAB,
|
||||
/// <summary>
|
||||
/// Receives information about a previous or current <see cref="ExtendedCopy"/>
|
||||
/// Receives information about a previous or current <see cref="ExtendedCopy"/>
|
||||
/// SPC-2 rev. 20
|
||||
/// </summary>
|
||||
ReceiveCopyResults = 0x84,
|
||||
/// <summary>
|
||||
/// Requests the data after completion of a <see cref="SendDiagnostic"/>
|
||||
/// Requests the data after completion of a <see cref="SendDiagnostic"/>
|
||||
/// ECMA-111 (SCSI-1)
|
||||
/// </summary>
|
||||
ReceiveDiagnostic = SasiCommands.ReadDiagnostic,
|
||||
@@ -1525,7 +1525,7 @@ namespace DiscImageChef.Devices
|
||||
ServiceActionIn = 0x9E,
|
||||
/// <summary>
|
||||
/// Extended commands
|
||||
/// SPC-4
|
||||
/// SPC-4
|
||||
/// </summary>
|
||||
ServiceActionOut = 0x9F,
|
||||
/// <summary>
|
||||
@@ -2276,7 +2276,7 @@ namespace DiscImageChef.Devices
|
||||
/// </summary>
|
||||
ReportVolumeTypesSupported = 0x44,
|
||||
/// <summary>
|
||||
/// Gets the results of <see cref="SendVolumeTag"/>
|
||||
/// Gets the results of <see cref="SendVolumeTag"/>
|
||||
/// SCSI-2 X3T9.2/375R rev. 10l
|
||||
/// </summary>
|
||||
RequestVolumeElementAddress = 0xB5,
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
struct CcbScsiio
|
||||
{
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>Ptr to mapping info</summary>
|
||||
public IntPtr req_map;
|
||||
@@ -233,7 +233,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
struct CcbScsiio64
|
||||
{
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>Ptr to mapping info</summary>
|
||||
public IntPtr req_map;
|
||||
@@ -280,7 +280,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
struct CcbAtaio
|
||||
{
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>ATA command register set</summary>
|
||||
public AtaCmd cmd;
|
||||
@@ -443,7 +443,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
struct CcbNvmeio
|
||||
{
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>NVME command, per NVME standard</summary>
|
||||
public NvmeCommand cmd;
|
||||
@@ -578,12 +578,12 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public uint io_ocr;
|
||||
|
||||
/// <summary>
|
||||
/// Card CID -- raw
|
||||
/// Card CID -- raw
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] card_cid;
|
||||
|
||||
/// <summary>
|
||||
/// Card CID -- parsed
|
||||
/// Card CID -- parsed
|
||||
/// </summary>
|
||||
public MmcCid cid;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,13 +38,13 @@ using System.Runtime.InteropServices;
|
||||
namespace DiscImageChef.Devices.Windows
|
||||
{
|
||||
//
|
||||
// A place for "higher level" related functions
|
||||
// You might not want to keep these in the USB class... your choice
|
||||
// A place for "higher level" related functions
|
||||
// You might not want to keep these in the USB class... your choice
|
||||
//
|
||||
partial class Usb
|
||||
{
|
||||
//
|
||||
// Get a list of all connected devices
|
||||
// Get a list of all connected devices
|
||||
//
|
||||
static internal List<UsbDevice> GetConnectedDevices()
|
||||
{
|
||||
@@ -55,7 +55,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
return devList;
|
||||
}
|
||||
|
||||
// private routine for enumerating a hub
|
||||
// private routine for enumerating a hub
|
||||
static void ListHub(UsbHub hub, List<UsbDevice> devList)
|
||||
{
|
||||
foreach(UsbPort port in hub.GetPorts())
|
||||
@@ -64,7 +64,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
}
|
||||
|
||||
//
|
||||
// Find a device based upon it's DriverKeyName
|
||||
// Find a device based upon it's DriverKeyName
|
||||
//
|
||||
static internal UsbDevice FindDeviceByDriverKeyName(string driverKeyName)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
return foundDevice;
|
||||
}
|
||||
|
||||
// private routine for enumerating a hub
|
||||
// private routine for enumerating a hub
|
||||
static void SearchHubDriverKeyName(UsbHub hub, ref UsbDevice foundDevice, string driverKeyName)
|
||||
{
|
||||
foreach(UsbPort port in hub.GetPorts())
|
||||
@@ -97,7 +97,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
}
|
||||
|
||||
//
|
||||
// Find a device based upon it's Instance ID
|
||||
// Find a device based upon it's Instance ID
|
||||
//
|
||||
static internal UsbDevice FindDeviceByInstanceId(string instanceId)
|
||||
{
|
||||
@@ -112,7 +112,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
return foundDevice;
|
||||
}
|
||||
|
||||
// private routine for enumerating a hub
|
||||
// private routine for enumerating a hub
|
||||
static void SearchHubInstanceId(UsbHub hub, ref UsbDevice foundDevice, string instanceId)
|
||||
{
|
||||
foreach(UsbPort port in hub.GetPorts())
|
||||
@@ -134,11 +134,11 @@ namespace DiscImageChef.Devices.Windows
|
||||
internal const string GuidDevinterfaceCdrom = "53f56308-b6bf-11d0-94f2-00a0c91efb8b";
|
||||
internal const string GuidDevinterfaceFloppy = "53f56311-b6bf-11d0-94f2-00a0c91efb8b";
|
||||
|
||||
//typedef struct _STORAGE_DEVICE_NUMBER {
|
||||
// DEVICE_TYPE DeviceType;
|
||||
// ULONG DeviceNumber;
|
||||
// ULONG PartitionNumber;
|
||||
//} STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
|
||||
//typedef struct _STORAGE_DEVICE_NUMBER {
|
||||
// DEVICE_TYPE DeviceType;
|
||||
// ULONG DeviceNumber;
|
||||
// ULONG PartitionNumber;
|
||||
//} STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct StorageDeviceNumber
|
||||
{
|
||||
@@ -147,34 +147,34 @@ namespace DiscImageChef.Devices.Windows
|
||||
internal int PartitionNumber;
|
||||
}
|
||||
|
||||
//CMAPI CONFIGRET WINAPI CM_Get_Parent(
|
||||
// OUT PDEVINST pdnDevInst,
|
||||
// IN DEVINST dnDevInst,
|
||||
// IN ULONG ulFlags
|
||||
//);
|
||||
//CMAPI CONFIGRET WINAPI CM_Get_Parent(
|
||||
// OUT PDEVINST pdnDevInst,
|
||||
// IN DEVINST dnDevInst,
|
||||
// IN ULONG ulFlags
|
||||
//);
|
||||
[DllImport("setupapi.dll")]
|
||||
static extern int CM_Get_Parent(out IntPtr pdnDevInst, IntPtr dnDevInst, int ulFlags);
|
||||
|
||||
//CMAPI CONFIGRET WINAPI CM_Get_Device_ID(
|
||||
// IN DEVINST dnDevInst,
|
||||
// OUT PTCHAR Buffer,
|
||||
// IN ULONG BufferLen,
|
||||
// IN ULONG ulFlags
|
||||
//);
|
||||
//CMAPI CONFIGRET WINAPI CM_Get_Device_ID(
|
||||
// IN DEVINST dnDevInst,
|
||||
// OUT PTCHAR Buffer,
|
||||
// IN ULONG BufferLen,
|
||||
// IN ULONG ulFlags
|
||||
//);
|
||||
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
|
||||
static extern int CM_Get_Device_ID(IntPtr dnDevInst, IntPtr buffer, int bufferLen, int ulFlags);
|
||||
|
||||
//
|
||||
// Find a device based upon a Drive Letter
|
||||
// Find a device based upon a Drive Letter
|
||||
//
|
||||
static internal UsbDevice FindDriveLetter(string driveLetter, string deviceGuid)
|
||||
{
|
||||
UsbDevice foundDevice = null;
|
||||
string instanceId = "";
|
||||
|
||||
// We start by getting the unique DeviceNumber of the given
|
||||
// DriveLetter. We'll use this later to find a matching
|
||||
// DevicePath "symbolic name"
|
||||
// We start by getting the unique DeviceNumber of the given
|
||||
// DriveLetter. We'll use this later to find a matching
|
||||
// DevicePath "symbolic name"
|
||||
int devNum = GetDeviceNumber(@"\\.\" + driveLetter.TrimEnd('\\'));
|
||||
if(devNum < 0) return null;
|
||||
|
||||
@@ -186,9 +186,9 @@ namespace DiscImageChef.Devices.Windows
|
||||
UsbDevice foundDevice = null;
|
||||
string instanceId = "";
|
||||
|
||||
// We start by getting the unique DeviceNumber of the given
|
||||
// DriveLetter. We'll use this later to find a matching
|
||||
// DevicePath "symbolic name"
|
||||
// We start by getting the unique DeviceNumber of the given
|
||||
// DriveLetter. We'll use this later to find a matching
|
||||
// DevicePath "symbolic name"
|
||||
int devNum = GetDeviceNumber(drivePath);
|
||||
if(devNum < 0) return null;
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
}
|
||||
|
||||
//
|
||||
// Find a device based upon a Drive Letter
|
||||
// Find a device based upon a Drive Letter
|
||||
//
|
||||
static internal UsbDevice FindDeviceNumber(int devNum, string deviceGuid)
|
||||
{
|
||||
@@ -205,8 +205,8 @@ namespace DiscImageChef.Devices.Windows
|
||||
|
||||
Guid diskGuid = new Guid(deviceGuid);
|
||||
|
||||
// We start at the "root" of the device tree and look for all
|
||||
// devices that match the interface GUID of a disk
|
||||
// We start at the "root" of the device tree and look for all
|
||||
// devices that match the interface GUID of a disk
|
||||
IntPtr h = SetupDiGetClassDevs(ref diskGuid, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
|
||||
if(h.ToInt32() != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
@@ -214,34 +214,34 @@ namespace DiscImageChef.Devices.Windows
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
// create a Device Interface Data structure
|
||||
// create a Device Interface Data structure
|
||||
SpDeviceInterfaceData dia = new SpDeviceInterfaceData();
|
||||
dia.cbSize = Marshal.SizeOf(dia);
|
||||
|
||||
// start the enumeration
|
||||
// start the enumeration
|
||||
success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref diskGuid, i, ref dia);
|
||||
if(success)
|
||||
{
|
||||
// build a DevInfo Data structure
|
||||
// build a DevInfo Data structure
|
||||
SpDevinfoData da = new SpDevinfoData();
|
||||
da.cbSize = Marshal.SizeOf(da);
|
||||
|
||||
// build a Device Interface Detail Data structure
|
||||
// build a Device Interface Detail Data structure
|
||||
SpDeviceInterfaceDetailData didd = new SpDeviceInterfaceDetailData();
|
||||
didd.cbSize = 4 + Marshal.SystemDefaultCharSize; // trust me :)
|
||||
didd.cbSize = 4 + Marshal.SystemDefaultCharSize; // trust me :)
|
||||
|
||||
// now we can get some more detailed information
|
||||
// now we can get some more detailed information
|
||||
int nRequiredSize = 0;
|
||||
int nBytes = BUFFER_SIZE;
|
||||
if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, nBytes, ref nRequiredSize, ref da))
|
||||
if(GetDeviceNumber(didd.DevicePath) == devNum)
|
||||
{
|
||||
// current InstanceID is at the "USBSTOR" level, so we
|
||||
// need up "move up" one level to get to the "USB" level
|
||||
// current InstanceID is at the "USBSTOR" level, so we
|
||||
// need up "move up" one level to get to the "USB" level
|
||||
IntPtr ptrPrevious;
|
||||
CM_Get_Parent(out ptrPrevious, da.DevInst, 0);
|
||||
|
||||
// Now we get the InstanceID of the USB level device
|
||||
// Now we get the InstanceID of the USB level device
|
||||
IntPtr ptrInstanceBuf = Marshal.AllocHGlobal(nBytes);
|
||||
CM_Get_Device_ID(ptrPrevious, ptrInstanceBuf, nBytes, 0);
|
||||
instanceId = Marshal.PtrToStringAuto(ptrInstanceBuf);
|
||||
@@ -258,12 +258,12 @@ namespace DiscImageChef.Devices.Windows
|
||||
SetupDiDestroyDeviceInfoList(h);
|
||||
}
|
||||
|
||||
// Did we find an InterfaceID of a USB device?
|
||||
// Did we find an InterfaceID of a USB device?
|
||||
if(instanceId.StartsWith("USB\\")) foundDevice = FindDeviceByInstanceId(instanceId);
|
||||
return foundDevice;
|
||||
}
|
||||
|
||||
// return a unique device number for the given device path
|
||||
// return a unique device number for the given device path
|
||||
static int GetDeviceNumber(string devicePath)
|
||||
{
|
||||
int ans = -1;
|
||||
@@ -280,8 +280,8 @@ namespace DiscImageChef.Devices.Windows
|
||||
IntPtr.Zero))
|
||||
{
|
||||
sdn = (StorageDeviceNumber)Marshal.PtrToStructure(ptrSdn, typeof(StorageDeviceNumber));
|
||||
// just my way of combining the relevant parts of the
|
||||
// STORAGE_DEVICE_NUMBER into a single number
|
||||
// just my way of combining the relevant parts of the
|
||||
// STORAGE_DEVICE_NUMBER into a single number
|
||||
ans = (sdn.DeviceType << 8) + sdn.DeviceNumber;
|
||||
}
|
||||
Marshal.FreeHGlobal(ptrSdn);
|
||||
|
||||
Reference in New Issue
Block a user