Added set_win32_error() for error codes that don't have an NT status

equivalent.
This commit is contained in:
Alexandre Julliard 2003-12-10 01:12:18 +00:00
parent 36002739c7
commit d5b4232a3f
2 changed files with 5 additions and 4 deletions

View File

@ -454,16 +454,16 @@ void file_set_error(void)
case EROFS: set_error( STATUS_MEDIA_WRITE_PROTECTED ); break; case EROFS: set_error( STATUS_MEDIA_WRITE_PROTECTED ); break;
case EBUSY: set_error( STATUS_FILE_LOCK_CONFLICT ); break; case EBUSY: set_error( STATUS_FILE_LOCK_CONFLICT ); break;
case ENOENT: set_error( STATUS_NO_SUCH_FILE ); break; case ENOENT: set_error( STATUS_NO_SUCH_FILE ); break;
case EISDIR: set_error( 0xc0010000 | ERROR_CANNOT_MAKE /* FIXME */ ); break; case EISDIR: set_win32_error( ERROR_CANNOT_MAKE ); break;
case ENFILE: case ENFILE:
case EMFILE: set_error( STATUS_NO_MORE_FILES ); break; case EMFILE: set_error( STATUS_NO_MORE_FILES ); break;
case EEXIST: set_error( STATUS_OBJECT_NAME_COLLISION ); break; case EEXIST: set_error( STATUS_OBJECT_NAME_COLLISION ); break;
case EINVAL: set_error( STATUS_INVALID_PARAMETER ); break; case EINVAL: set_error( STATUS_INVALID_PARAMETER ); break;
case ESPIPE: set_error( 0xc0010000 | ERROR_SEEK /* FIXME */ ); break; case ESPIPE: set_win32_error( ERROR_SEEK ); break;
case ENOTEMPTY: set_error( STATUS_DIRECTORY_NOT_EMPTY ); break; case ENOTEMPTY: set_error( STATUS_DIRECTORY_NOT_EMPTY ); break;
case EIO: set_error( STATUS_ACCESS_VIOLATION ); break; case EIO: set_error( STATUS_ACCESS_VIOLATION ); break;
case EOVERFLOW: set_error( STATUS_INVALID_PARAMETER ); break; case EOVERFLOW: set_error( STATUS_INVALID_PARAMETER ); break;
default: perror("file_set_error"); set_error( ERROR_UNKNOWN /* FIXME */ ); break; default: perror("file_set_error"); set_win32_error( ERROR_UNKNOWN ); break;
} }
} }

View File

@ -145,6 +145,7 @@ extern unsigned int global_error; /* global error code for when no thread is cu
static inline unsigned int get_error(void) { return current ? current->error : global_error; } static inline unsigned int get_error(void) { return current ? current->error : global_error; }
static inline void set_error( unsigned int err ) { global_error = err; if (current) current->error = err; } static inline void set_error( unsigned int err ) { global_error = err; if (current) current->error = err; }
static inline void clear_error(void) { set_error(0); } static inline void clear_error(void) { set_error(0); }
static inline void set_win32_error( unsigned int err ) { set_error( 0xc0010000 | err ); }
static inline thread_id_t get_thread_id( struct thread *thread ) { return thread->id; } static inline thread_id_t get_thread_id( struct thread *thread ) { return thread->id; }