I am trying to write buffer data to a SCSI device, but when I start the deviceIoControl call, I get a Windows 183 error code. The error code indicates that the file is already exiting, but I cannot understand the error regarding the IOCTL call.
The CreateFile function went the way I was able to get the corresponding device handle, as shown below.
int devHandle = DeviceIoControlHelper.CreateFile (name of the device, DeviceIoControlHelper.GENERIC_READ | DeviceIoControlHelper.GENERIC_WRITE, DeviceIoControlHelper.FILE_SHARE_READ | DeviceIoControlHelper.FILE_SHARE_WERLEZERELETERELETELOERERELETELOERRELETELOERERELETELWELITE.WERLETERELETELOERRELETELORERELETELWELITE.WERLETERELETELOERETELE_TRELETLO.EREL.
However, when I try to write a buffer, I get an error:
dwReturned = 0; int b = DeviceIoControlHelper.DeviceIoControl( devHandle, DeviceIoControlHelper.IOCTL_SCSI_PASS_THROUGH, inpBuffer, (uint)Marshal.SizeOf(info), inpBuffer, //out pDriveLayout, (uint)Marshal.SizeOf(info), //(uint)Marshal.SizeOf(typeof(DRIVE_LAYOUT_INFORMATION_EX)), out dwReturned, IntPtr.Zero); Log.Write(Log.TraceLevel_5,"ExecuteDeviceIoControl return pass_through scsistatus = " + info.spt.ScsiStatus); if (b == 0) { int win_err = this.GetWindowsErrorCode(); Log.Write(Log.TraceLevel_5, "ExecuteDeviceIoControl failed, error = " + win_err); LogMyTrace.Write(LogMyTrace.TraceLevel_5, "ExecuteDeviceIoControl failed, error = " + win_err); this.CloseOpenHandle(devHandle); Marshal.FreeHGlobal(inpBuffer); throw new Exception("DeviceIoControl failed " + deviceName + " is '" + deviceName + "'. Windows Err is " + win_err); } The error code is 183.
Please provide some information about the causes of this error and about the soul.
I am using Windows 2008 R2 (x64) and this is the iSCSI path.