Windows IOCTL bool is reversed.

This commit is contained in:
2017-09-06 20:46:56 +01:00
parent a99c302da1
commit 258c33d61e
7 changed files with 15 additions and 13 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -358,6 +358,11 @@ namespace DiscImageChef.Devices
if(ATAID.HasValue) if(ATAID.HasValue)
serial = ATAID.Value.SerialNumber; serial = ATAID.Value.SerialNumber;
} }
else
{
lastError = 0;
error = false;
}
} }
if((scsiSense && (usb || firewire)) || manufacturer == "ATA") if((scsiSense && (usb || firewire)) || manufacturer == "ATA")

View File

@@ -81,7 +81,7 @@ namespace DiscImageChef.Devices.Windows
Marshal.Copy(buffer, 0, sptd_sb.sptd.DataBuffer, buffer.Length); Marshal.Copy(buffer, 0, sptd_sb.sptd.DataBuffer, buffer.Length);
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
bool hasError = Extern.DeviceIoControlScsi(fd, WindowsIoctl.IOCTL_SCSI_PASS_THROUGH_DIRECT, ref sptd_sb, (uint)Marshal.SizeOf(sptd_sb), ref sptd_sb, bool hasError = !Extern.DeviceIoControlScsi(fd, WindowsIoctl.IOCTL_SCSI_PASS_THROUGH_DIRECT, ref sptd_sb, (uint)Marshal.SizeOf(sptd_sb), ref sptd_sb,
(uint)Marshal.SizeOf(sptd_sb), ref k, IntPtr.Zero); (uint)Marshal.SizeOf(sptd_sb), ref k, IntPtr.Zero);
DateTime end = DateTime.Now; DateTime end = DateTime.Now;
@@ -154,7 +154,7 @@ namespace DiscImageChef.Devices.Windows
Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length); Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length);
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
sense = Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd, (uint)Marshal.SizeOf(aptd), ref aptd, sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd, (uint)Marshal.SizeOf(aptd), ref aptd,
(uint)Marshal.SizeOf(aptd), ref k, IntPtr.Zero); (uint)Marshal.SizeOf(aptd), ref k, IntPtr.Zero);
DateTime end = DateTime.Now; DateTime end = DateTime.Now;
@@ -231,7 +231,7 @@ namespace DiscImageChef.Devices.Windows
Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length); Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length);
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
sense = Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd, (uint)Marshal.SizeOf(aptd), ref aptd, sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd, (uint)Marshal.SizeOf(aptd), ref aptd,
(uint)Marshal.SizeOf(aptd), ref k, IntPtr.Zero); (uint)Marshal.SizeOf(aptd), ref k, IntPtr.Zero);
DateTime end = DateTime.Now; DateTime end = DateTime.Now;
@@ -315,7 +315,7 @@ namespace DiscImageChef.Devices.Windows
Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length); Marshal.Copy(buffer, 0, aptd.DataBuffer, buffer.Length);
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
sense = Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd, (uint)Marshal.SizeOf(aptd), ref aptd, sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd, (uint)Marshal.SizeOf(aptd), ref aptd,
(uint)Marshal.SizeOf(aptd), ref k, IntPtr.Zero); (uint)Marshal.SizeOf(aptd), ref k, IntPtr.Zero);
DateTime end = DateTime.Now; DateTime end = DateTime.Now;

View File

@@ -100,7 +100,7 @@ namespace DiscImageChef.Devices.Windows
uint returned = 0; uint returned = 0;
int error = 0; int error = 0;
bool hasError = Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IOCTL_STORAGE_QUERY_PROPERTY, ref query, (uint)Marshal.SizeOf(query), descriptorPtr, 1000, ref returned, IntPtr.Zero); bool hasError = !Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IOCTL_STORAGE_QUERY_PROPERTY, ref query, (uint)Marshal.SizeOf(query), descriptorPtr, 1000, ref returned, IntPtr.Zero);
if (hasError) if (hasError)
error = Marshal.GetLastWin32Error(); error = Marshal.GetLastWin32Error();

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -170,13 +170,7 @@
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="Checksums\" />
<Folder Include="Filters\" />
<Folder Include="Filesystems\" />
<Folder Include="Devices\" />
<Folder Include="Partitions\" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj"> <ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj">
<Project>{CC48B324-A532-4A45-87A6-6F91F7141E8D}</Project> <Project>{CC48B324-A532-4A45-87A6-6F91F7141E8D}</Project>
@@ -211,6 +205,9 @@
<Name>DiscImageChef.Core</Name> <Name>DiscImageChef.Core</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions> <ProjectExtensions>
<MonoDevelop> <MonoDevelop>