Re: TAPE 5/5: add implementation of kernel tape functions #2
Hans Leidekker wrote:
+static DWORD set_error_from_status( NTSTATUS status ) +{ + DWORD error; + + switch (status) + { + case STATUS_SUCCESS: error = ERROR_SUCCESS; break; + case STATUS_DISK_FULL: error = ERROR_END_OF_MEDIA; break; + case STATUS_DEVICE_NOT_READY: error = ERROR_NO_MEDIA_IN_DRIVE; break; + case STATUS_ACCESS_DENIED: error = ERROR_WRITE_PROTECT; break; + case STATUS_DEVICE_BUSY: error = ERROR_BUSY; break; + case STATUS_INVALID_PARAMETER: error = ERROR_INVALID_PARAMETER; break; + case STATUS_NOT_SUPPORTED: + case STATUS_UNSUCCESSFUL: + default: error = ERROR_NOT_SUPPORTED; break; + } + + SetLastError( error ); + return error; +}
You're duplicating RtlNtStatusToDosError. -- Rob Shearman
On Thursday 26 January 2006 20:37, Robert Shearman wrote:
You're duplicating RtlNtStatusToDosError.
Not completely. STATUS_DISK_FULL (translated from ENOSPC) for example is mapped to ERROR_DISK_FULL by RtlNtStatusToDosError whereas I am mapping it to ERROR_END_OF_MEDIA which I think is more appropriate in the context of tapes. But the conversion is lossy already (Unix error -> NT status -> Win32 error), so I don't care too much. I'll send a patch that uses RtlNtStatusToDosError so Alexandre can choose. -Hans
Hans Leidekker <hans(a)it.vu.nl> writes:
Not completely. STATUS_DISK_FULL (translated from ENOSPC) for example is mapped to ERROR_DISK_FULL by RtlNtStatusToDosError whereas I am mapping it to ERROR_END_OF_MEDIA which I think is more appropriate in the context of tapes.
Then the ntdll code should have returned STATUS_END_OF_MEDIA. You don't have to use the standard errno conversion in ntdll if you can return more appropriate status codes. -- Alexandre Julliard julliard(a)winehq.org
participants (3)
-
Alexandre Julliard -
Hans Leidekker -
Robert Shearman