2002-03-17 09:04:15 +03:00
/*
* Unix SMB / CIFS implementation .
* DOS error routines
* Copyright ( C ) Tim Potter 2002.
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
/* DOS error codes. please read doserr.h */
# include "includes.h"
typedef const struct
{
2003-01-03 11:28:12 +03:00
const char * dos_errstr ;
2002-03-17 09:04:15 +03:00
WERROR werror ;
} werror_code_struct ;
werror_code_struct dos_errs [ ] =
{
{ " WERR_OK " , WERR_OK } ,
2005-03-24 19:11:23 +03:00
{ " WERR_GENERAL_FAILURE " , WERR_GENERAL_FAILURE } ,
2002-03-17 09:04:15 +03:00
{ " WERR_BADFILE " , WERR_BADFILE } ,
{ " WERR_ACCESS_DENIED " , WERR_ACCESS_DENIED } ,
{ " WERR_BADFID " , WERR_BADFID } ,
{ " WERR_BADFUNC " , WERR_BADFUNC } ,
{ " WERR_INSUFFICIENT_BUFFER " , WERR_INSUFFICIENT_BUFFER } ,
{ " WERR_NO_SUCH_SHARE " , WERR_NO_SUCH_SHARE } ,
{ " WERR_ALREADY_EXISTS " , WERR_ALREADY_EXISTS } ,
{ " WERR_INVALID_PARAM " , WERR_INVALID_PARAM } ,
{ " WERR_NOT_SUPPORTED " , WERR_NOT_SUPPORTED } ,
{ " WERR_BAD_PASSWORD " , WERR_BAD_PASSWORD } ,
{ " WERR_NOMEM " , WERR_NOMEM } ,
{ " WERR_INVALID_NAME " , WERR_INVALID_NAME } ,
{ " WERR_UNKNOWN_LEVEL " , WERR_UNKNOWN_LEVEL } ,
{ " WERR_OBJECT_PATH_INVALID " , WERR_OBJECT_PATH_INVALID } ,
{ " WERR_NO_MORE_ITEMS " , WERR_NO_MORE_ITEMS } ,
{ " WERR_MORE_DATA " , WERR_MORE_DATA } ,
{ " WERR_UNKNOWN_PRINTER_DRIVER " , WERR_UNKNOWN_PRINTER_DRIVER } ,
{ " WERR_INVALID_PRINTER_NAME " , WERR_INVALID_PRINTER_NAME } ,
{ " WERR_PRINTER_ALREADY_EXISTS " , WERR_PRINTER_ALREADY_EXISTS } ,
{ " WERR_INVALID_DATATYPE " , WERR_INVALID_DATATYPE } ,
{ " WERR_INVALID_ENVIRONMENT " , WERR_INVALID_ENVIRONMENT } ,
2002-04-09 09:11:34 +04:00
{ " WERR_INVALID_FORM_NAME " , WERR_INVALID_FORM_NAME } ,
2002-03-17 09:04:15 +03:00
{ " WERR_INVALID_FORM_SIZE " , WERR_INVALID_FORM_SIZE } ,
{ " WERR_BUF_TOO_SMALL " , WERR_BUF_TOO_SMALL } ,
{ " WERR_JOB_NOT_FOUND " , WERR_JOB_NOT_FOUND } ,
{ " WERR_DEST_NOT_FOUND " , WERR_DEST_NOT_FOUND } ,
{ " WERR_NOT_LOCAL_DOMAIN " , WERR_NOT_LOCAL_DOMAIN } ,
{ " WERR_PRINTER_DRIVER_IN_USE " , WERR_PRINTER_DRIVER_IN_USE } ,
{ " WERR_STATUS_MORE_ENTRIES " , WERR_STATUS_MORE_ENTRIES } ,
{ " WERR_DFS_NO_SUCH_VOL " , WERR_DFS_NO_SUCH_VOL } ,
{ " WERR_DFS_NO_SUCH_SHARE " , WERR_DFS_NO_SUCH_SHARE } ,
{ " WERR_DFS_NO_SUCH_SERVER " , WERR_DFS_NO_SUCH_SERVER } ,
{ " WERR_DFS_INTERNAL_ERROR " , WERR_DFS_INTERNAL_ERROR } ,
{ " WERR_DFS_CANT_CREATE_JUNCT " , WERR_DFS_CANT_CREATE_JUNCT } ,
2005-10-11 22:42:25 +04:00
{ " WERR_MACHINE_LOCKED " , WERR_MACHINE_LOCKED } ,
2006-10-07 09:23:56 +04:00
{ " WERR_NO_LOGON_SERVERS " , WERR_NO_LOGON_SERVERS } ,
2007-03-01 05:43:33 +03:00
{ " WERR_LOGON_FAILURE " , WERR_LOGON_FAILURE } ,
2006-10-07 09:23:56 +04:00
{ " WERR_NO_SUCH_DOMAIN " , WERR_NO_SUCH_DOMAIN } ,
2002-04-24 09:45:04 +04:00
{ " WERR_INVALID_SECURITY_DESCRIPTOR " , WERR_INVALID_SECURITY_DESCRIPTOR } ,
2002-05-07 10:18:50 +04:00
{ " WERR_INVALID_OWNER " , WERR_INVALID_OWNER } ,
2003-04-15 10:55:42 +04:00
{ " WERR_SERVER_UNAVAILABLE " , WERR_SERVER_UNAVAILABLE } ,
2004-10-13 05:40:35 +04:00
{ " WERR_IO_PENDING " , WERR_IO_PENDING } ,
2005-03-25 03:38:30 +03:00
{ " WERR_INVALID_SERVICE_CONTROL " , WERR_INVALID_SERVICE_CONTROL } ,
2005-06-15 16:43:36 +04:00
{ " WERR_NET_NAME_NOT_FOUND " , WERR_NET_NAME_NOT_FOUND } ,
2005-07-02 02:24:00 +04:00
{ " WERR_REG_CORRUPT " , WERR_REG_CORRUPT } ,
{ " WERR_REG_IO_FAILURE " , WERR_REG_IO_FAILURE } ,
{ " WERR_REG_FILE_INVALID " , WERR_REG_FILE_INVALID } ,
2005-12-11 07:21:34 +03:00
{ " WERR_SERVICE_DISABLED " , WERR_SERVICE_DISABLED } ,
2002-03-17 09:04:15 +03:00
{ NULL , W_ERROR ( 0 ) }
} ;
/*****************************************************************************
2007-03-01 05:43:33 +03:00
Returns a DOS error message . not amazingly helpful , but better than a number .
2002-03-17 09:04:15 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-03-01 05:43:33 +03:00
2003-01-03 11:28:12 +03:00
const char * dos_errstr ( WERROR werror )
2002-03-17 09:04:15 +03:00
{
static pstring msg ;
int idx = 0 ;
slprintf ( msg , sizeof ( msg ) , " DOS code 0x%08x " , W_ERROR_V ( werror ) ) ;
while ( dos_errs [ idx ] . dos_errstr ! = NULL ) {
if ( W_ERROR_V ( dos_errs [ idx ] . werror ) = =
W_ERROR_V ( werror ) )
return dos_errs [ idx ] . dos_errstr ;
idx + + ;
}
return msg ;
}