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