2003-08-13 05:53:07 +04: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"
2005-02-10 08:09:35 +03:00
# include "pstring.h"
2003-08-13 05:53:07 +04:00
2004-08-30 09:33:49 +04:00
struct werror_code_struct {
2003-08-13 05:53:07 +04:00
const char * dos_errstr ;
WERROR werror ;
2004-08-30 09:33:49 +04:00
} ;
2003-08-13 05:53:07 +04:00
2004-08-30 09:33:49 +04:00
static const struct werror_code_struct dos_errs [ ] =
2003-08-13 05:53:07 +04:00
{
{ " WERR_OK " , WERR_OK } ,
{ " WERR_BADFILE " , WERR_BADFILE } ,
{ " WERR_ACCESS_DENIED " , WERR_ACCESS_DENIED } ,
{ " WERR_BADFID " , WERR_BADFID } ,
{ " WERR_BADFUNC " , WERR_BADFUNC } ,
2003-11-17 14:55:56 +03:00
{ " WERR_BAD_NETPATH " , WERR_BAD_NETPATH } ,
2003-08-13 05:53:07 +04:00
{ " 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 } ,
{ " WERR_INVALID_FORM_NAME " , WERR_INVALID_FORM_NAME } ,
{ " 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 } ,
2004-12-31 07:45:13 +03:00
{ " WERR_STATUS_MORE_ENTRIES " , WERR_STATUS_MORE_ENTRIES } ,
{ " WERR_NET_NAME_NOT_FOUND " , WERR_NET_NAME_NOT_FOUND } ,
2004-12-31 10:21:31 +03:00
{ " WERR_DEVICE_NOT_SHARED " , WERR_DEVICE_NOT_SHARED } ,
2003-08-13 05:53:07 +04:00
{ " 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 } ,
{ " WERR_INVALID_SECURITY_DESCRIPTOR " , WERR_INVALID_SECURITY_DESCRIPTOR } ,
2005-10-10 15:21:02 +04:00
{ " WERR_UNKNOWN_REVISION " , WERR_UNKNOWN_REVISION } ,
2005-08-23 15:40:26 +04:00
{ " WERR_REVISION_MISMATCH " , WERR_REVISION_MISMATCH } ,
2003-08-13 05:53:07 +04:00
{ " WERR_INVALID_OWNER " , WERR_INVALID_OWNER } ,
2004-11-22 17:28:09 +03:00
{ " WERR_INVALID_DOMAINNAME " , WERR_INVALID_DOMAINNAME } ,
{ " WERR_NO_SUCH_USER " , WERR_NO_SUCH_USER } ,
{ " WERR_NO_SUCH_DOMAIN " , WERR_NO_SUCH_DOMAIN } ,
{ " WERR_DS_SERVICE_BUSY " , WERR_DS_SERVICE_BUSY } ,
{ " WERR_DS_SERVICE_UNAVAILABLE " , WERR_DS_SERVICE_UNAVAILABLE } ,
{ " WERR_DS_NO_SUCH_OBJECT " , WERR_DS_NO_SUCH_OBJECT } ,
2004-10-18 19:26:16 +04:00
{ " WERR_DS_OBJ_NOT_FOUND " , WERR_DS_OBJ_NOT_FOUND } ,
2005-03-11 13:33:01 +03:00
{ " WERR_DS_DRA_INVALID_PARAMETER " , WERR_DS_DRA_INVALID_PARAMETER } ,
2004-12-13 14:37:47 +03:00
{ " WERR_DS_DRA_BAD_DN " , WERR_DS_DRA_BAD_DN } ,
{ " WERR_DS_DRA_BAD_NC " , WERR_DS_DRA_BAD_NC } ,
2005-08-26 12:42:29 +04:00
{ " WERR_DS_DRA_INTERNAL_ERROR " , WERR_DS_DRA_INTERNAL_ERROR } ,
2005-08-23 15:40:26 +04:00
{ " WERR_DS_SINGLE_VALUE_CONSTRAINT " , WERR_DS_SINGLE_VALUE_CONSTRAINT } ,
2004-12-07 12:18:56 +03:00
{ " WERR_DS_DRA_DB_ERROR " , WERR_DS_DRA_DB_ERROR } ,
2004-12-13 14:37:47 +03:00
{ " WERR_DS_DRA_NO_REPLICA " , WERR_DS_DRA_NO_REPLICA } ,
2005-03-11 13:33:01 +03:00
{ " WERR_DS_DNS_LOOKUP_FAILURE " , WERR_DS_DNS_LOOKUP_FAILURE } ,
2004-12-07 12:18:56 +03:00
{ " WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX " , WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX } ,
2004-10-29 01:00:38 +04:00
{ " WERR_GENERAL_FAILURE " , WERR_GENERAL_FAILURE } ,
{ " WERR_PRINTQ_FULL " , WERR_PRINTQ_FULL } ,
{ " WERR_NO_SPOOL_SPACE " , WERR_NO_SPOOL_SPACE } ,
{ " WERR_CAN_NOT_COMPLETE " , WERR_CAN_NOT_COMPLETE } ,
{ " WERR_SERVER_UNAVAILABLE " , WERR_SERVER_UNAVAILABLE } ,
2005-02-05 17:40:47 +03:00
{ " WERR_CLASS_NOT_REGISTERED " , WERR_CLASS_NOT_REGISTERED } ,
2005-03-17 23:28:01 +03:00
{ " WERR_NO_SHUTDOWN_IN_PROGRESS " , WERR_NO_SHUTDOWN_IN_PROGRESS } ,
{ " WERR_SHUTDOWN_ALREADY_IN_PROGRESS " , WERR_SHUTDOWN_ALREADY_IN_PROGRESS } ,
2003-08-13 05:53:07 +04:00
{ NULL , W_ERROR ( 0 ) }
} ;
2004-10-29 01:00:38 +04:00
/* DFS errors */
2003-08-13 05:53:07 +04:00
/*****************************************************************************
returns a windows error message . not amazingly helpful , but better than a number .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
const char * win_errstr ( WERROR werror )
{
static pstring msg ;
int idx = 0 ;
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 + + ;
}
2004-08-30 09:33:49 +04:00
slprintf ( msg , sizeof ( msg ) , " DOS code 0x%08x " , W_ERROR_V ( werror ) ) ;
2003-08-13 05:53:07 +04:00
return msg ;
}