mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Remove NT device path calculation method as it doesn't work neither is it needed anywhere.
This commit is contained in:
3
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
3
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -52,6 +52,9 @@
|
||||
<e p="Main.cs" t="Include" />
|
||||
<e p="Options.cs" t="Include" />
|
||||
<e p="Progress.cs" t="Include" />
|
||||
<e p="Properties" t="Include">
|
||||
<e p="launchSettings.json" t="Include" />
|
||||
</e>
|
||||
<e p="Settings.StyleCop" t="Include" />
|
||||
<e p="StyleCop.Cache" t="Include" />
|
||||
<e p="bin" t="ExcludeRecursive" />
|
||||
|
||||
@@ -37,7 +37,6 @@ using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using DiscImageChef.CommonTypes.Enums;
|
||||
using DiscImageChef.CommonTypes.Interop;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
using DiscImageChef.Decoders.SCSI;
|
||||
using DiscImageChef.Decoders.SecureDigital;
|
||||
@@ -245,8 +244,6 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
}
|
||||
|
||||
string ntDevicePath = Windows.Command.GetDevicePath((SafeFileHandle)FileHandle);
|
||||
DicConsole.DebugWriteLine("Windows devices", "NT device path: {0}", ntDevicePath);
|
||||
Marshal.FreeHGlobal(descriptorPtr);
|
||||
|
||||
if(Windows.Command.IsSdhci((SafeFileHandle)FileHandle))
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
@@ -457,84 +456,6 @@ namespace DiscImageChef.Devices.Windows
|
||||
return (uint)sdn.deviceNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the internal device path for a specified handle
|
||||
/// </summary>
|
||||
/// <param name="fd">Device handle</param>
|
||||
/// <returns>Device path</returns>
|
||||
internal static string GetDevicePath(SafeFileHandle fd)
|
||||
{
|
||||
uint devNumber = GetDeviceNumber(fd);
|
||||
|
||||
if(devNumber == uint.MaxValue) return null;
|
||||
|
||||
SafeFileHandle hDevInfo = Extern.SetupDiGetClassDevs(ref Consts.GuidDevinterfaceDisk, IntPtr.Zero,
|
||||
IntPtr.Zero,
|
||||
DeviceGetClassFlags.Present |
|
||||
DeviceGetClassFlags.DeviceInterface);
|
||||
|
||||
if(hDevInfo.IsInvalid) return null;
|
||||
|
||||
uint index = 0;
|
||||
DeviceInterfaceData spdid = new DeviceInterfaceData();
|
||||
spdid.cbSize = Marshal.SizeOf(spdid);
|
||||
|
||||
while(true)
|
||||
{
|
||||
byte[] buffer = new byte[2048];
|
||||
|
||||
if(!Extern.SetupDiEnumDeviceInterfaces(hDevInfo, IntPtr.Zero, ref Consts.GuidDevinterfaceDisk, index,
|
||||
ref spdid)) break;
|
||||
|
||||
uint size = 0;
|
||||
|
||||
Extern.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref spdid, IntPtr.Zero, 0, ref size, IntPtr.Zero);
|
||||
|
||||
if(size > 0 && size < buffer.Length)
|
||||
{
|
||||
buffer[0] = (byte)(IntPtr.Size == 8
|
||||
? IntPtr.Size
|
||||
: IntPtr.Size + Marshal.SystemDefaultCharSize); // Funny...
|
||||
|
||||
IntPtr pspdidd = Marshal.AllocHGlobal(buffer.Length);
|
||||
Marshal.Copy(buffer, 0, pspdidd, buffer.Length);
|
||||
|
||||
bool result =
|
||||
Extern.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref spdid, pspdidd, size, ref size,
|
||||
IntPtr.Zero);
|
||||
|
||||
buffer = new byte[size];
|
||||
Marshal.Copy(pspdidd, buffer, 0, buffer.Length);
|
||||
Marshal.FreeHGlobal(pspdidd);
|
||||
|
||||
if(result)
|
||||
{
|
||||
string devicePath = Encoding.Unicode.GetString(buffer, 4, (int)size - 4);
|
||||
SafeFileHandle hDrive = Extern.CreateFile(devicePath, 0, FileShare.Read | FileShare.Write,
|
||||
IntPtr.Zero, FileMode.OpenExisting, 0, IntPtr.Zero);
|
||||
|
||||
if(!hDrive.IsInvalid)
|
||||
{
|
||||
uint newDeviceNumber = GetDeviceNumber(hDrive);
|
||||
|
||||
if(newDeviceNumber == devNumber)
|
||||
{
|
||||
Extern.CloseHandle(hDrive);
|
||||
return devicePath;
|
||||
}
|
||||
}
|
||||
|
||||
Extern.CloseHandle(hDrive);
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
Extern.SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the specified handle is controlled by a SFFDISK (aka SDHCI) driver
|
||||
/// </summary>
|
||||
|
||||
@@ -41,9 +41,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.Database", "D
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.Gui", "DiscImageChef.Gui\DiscImageChef.Gui.csproj", "{CF61AD81-3F98-4E7B-8F00-9957A6CDE5FA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.EntityFramework", "DiscImageChef.EntityFramework\DiscImageChef.EntityFramework.csproj", "{F73EE2BD-6009-4590-9F5A-68198CA5C0DA}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscImageChef.EntityFramework", "DiscImageChef.EntityFramework\DiscImageChef.EntityFramework.csproj", "{F73EE2BD-6009-4590-9F5A-68198CA5C0DA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(Performance) = preSolution
|
||||
HasPerformanceSessions = true
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x86 = Debug|x86
|
||||
@@ -203,14 +206,6 @@ Global
|
||||
{CF61AD81-3F98-4E7B-8F00-9957A6CDE5FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF61AD81-3F98-4E7B-8F00-9957A6CDE5FA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CF61AD81-3F98-4E7B-8F00-9957A6CDE5FA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9E4ACE1A-BA5A-4901-9DC0-71336EFA40DF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F73EE2BD-6009-4590-9F5A-68198CA5C0DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F73EE2BD-6009-4590-9F5A-68198CA5C0DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F73EE2BD-6009-4590-9F5A-68198CA5C0DA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
|
||||
Reference in New Issue
Block a user