testprogs: rename spoolss.exe to testspoolss.exe.
[metze/samba/wip.git] / testprogs / win32 / spoolss / error.c
1 /*
2    Unix SMB/CIFS implementation.
3    test suite for spoolss rpc operations
4
5    Copyright (C) Guenther Deschner 2009
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "testspoolss.h"
22
23 const char *errstr(DWORD error)
24 {
25         static char tmp[20];
26
27         switch (error) {
28         case ERROR_FILE_NOT_FOUND:
29                 return "ERROR_FILE_NOT_FOUND";
30         case ERROR_ACCESS_DENIED:
31                 return "ERROR_ACCESS_DENIED";
32         case ERROR_INVALID_PARAMETER:
33                 return "ERROR_INVALID_PARAMETER";
34         case ERROR_INVALID_HANDLE:
35                 return "ERROR_INVALID_HANDLE";
36         case ERROR_CALL_NOT_IMPLEMENTED:
37                 return "ERROR_CALL_NOT_IMPLEMENTED";
38         case ERROR_INSUFFICIENT_BUFFER:
39                 return "ERROR_INSUFFICIENT_BUFFER";
40         case ERROR_INVALID_NAME:
41                 return "ERROR_INVALID_NAME";
42         case ERROR_INVALID_LEVEL:
43                 return "ERROR_INVALID_LEVEL";
44         case ERROR_INVALID_DATA:
45                 return "ERROR_INVALID_DATA";
46         case ERROR_MORE_DATA:
47                 return "ERROR_MORE_DATA";
48         case ERROR_NO_MORE_ITEMS:
49                 return "ERROR_NO_MORE_ITEMS";
50 #ifdef ERROR_INVALID_DATATYPE
51         case ERROR_INVALID_DATATYPE:
52                 return "ERROR_INVALID_DATATYPE";
53 #endif
54         case ERROR_INVALID_ENVIRONMENT:
55                 return "ERROR_INVALID_ENVIRONMENT";
56         case ERROR_INVALID_PRINTER_COMMAND:
57                 return "ERROR_INVALID_PRINTER_COMMAND";
58         case ERROR_PRINTER_ALREADY_EXISTS:
59                 return "ERROR_PRINTER_ALREADY_EXISTS";
60         case ERROR_INVALID_PRINTER_NAME:
61                 return "ERROR_INVALID_PRINTER_NAME";
62         case ERROR_INVALID_PRIORITY:
63                 return "ERROR_INVALID_PRIORITY";
64         case ERROR_INVALID_SEPARATOR_FILE:
65                 return "ERROR_INVALID_SEPARATOR_FILE";
66         case ERROR_UNKNOWN_PRINTPROCESSOR:
67                 return "ERROR_UNKNOWN_PRINTPROCESSOR";
68         case ERROR_UNKNOWN_PRINTER_DRIVER:
69                 return "ERROR_UNKNOWN_PRINTER_DRIVER";
70         case ERROR_UNKNOWN_PORT:
71                 return "ERROR_UNKNOWN_PORT";
72         case ERROR_PRINTER_DRIVER_ALREADY_INSTALLED:
73                 return "ERROR_PRINTER_DRIVER_ALREADY_INSTALLED";
74         case ERROR_UNKNOWN_PRINT_MONITOR:
75                 return "ERROR_UNKNOWN_PRINT_MONITOR";
76         case ERROR_PRINTER_DRIVER_IN_USE:
77                 return "ERROR_PRINTER_DRIVER_IN_USE";
78         case ERROR_SPOOL_FILE_NOT_FOUND:
79                 return "ERROR_SPOOL_FILE_NOT_FOUND";
80         case ERROR_SPL_NO_STARTDOC:
81                 return "ERROR_SPL_NO_STARTDOC";
82         case ERROR_SPL_NO_ADDJOB:
83                 return "ERROR_SPL_NO_ADDJOB";
84         case ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED:
85                 return "ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED";
86         case ERROR_PRINT_MONITOR_ALREADY_INSTALLED:
87                 return "ERROR_PRINT_MONITOR_ALREADY_INSTALLED";
88         case ERROR_INVALID_PRINT_MONITOR:
89                 return "ERROR_INVALID_PRINT_MONITOR";
90         case ERROR_PRINT_MONITOR_IN_USE:
91                 return "ERROR_PRINT_MONITOR_IN_USE";
92         case ERROR_PRINTER_HAS_JOBS_QUEUED:
93                 return "ERROR_PRINTER_HAS_JOBS_QUEUED";
94         case ERROR_PRINTER_NOT_FOUND:
95                 return "ERROR_PRINTER_NOT_FOUND";
96         case ERROR_PRINTER_DRIVER_WARNED:
97                 return "ERROR_PRINTER_DRIVER_WARNED";
98         case ERROR_PRINTER_DRIVER_BLOCKED:
99                 return "ERROR_PRINTER_DRIVER_BLOCKED";
100 #ifdef ERROR_PRINTER_DRIVER_PACKAGE_IN_USE
101         case ERROR_PRINTER_DRIVER_PACKAGE_IN_USE:
102                 return "ERROR_PRINTER_DRIVER_PACKAGE_IN_USE";
103 #endif
104 #ifdef ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND
105         case ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND:
106                 return "ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND";
107 #endif
108 #ifdef ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED
109         case ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED:
110                 return "ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED";
111 #endif
112 #ifdef ERROR_PRINT_JOB_RESTART_REQUIRED
113         case ERROR_PRINT_JOB_RESTART_REQUIRED:
114                 return "ERROR_PRINT_JOB_RESTART_REQUIRED";
115 #endif
116         case ERROR_CANCELLED:
117                 return "ERROR_CANCELLED";
118         case ERROR_NOACCESS:
119                 return "ERROR_NOACCESS";
120         case RPC_X_NULL_REF_POINTER:
121                 return "RPC_X_NULL_REF_POINTER";
122         case RPC_S_PROCNUM_OUT_OF_RANGE:
123                 return "RPC_S_PROCNUM_OUT_OF_RANGE";
124         case RPC_S_SERVER_UNAVAILABLE:
125                 return "RPC_S_SERVER_UNAVAILABLE";
126         case RPC_S_INVALID_NET_ADDR:
127                 return "RPC_S_INVALID_NET_ADDR";
128         case RPC_S_CALL_FAILED:
129                 return "RPC_S_CALL_FAILED";
130         default:
131                 break;
132         }
133
134         sprintf(tmp, "0x%08x", error);
135
136         return tmp;
137 }