testprogs: add win32 spoolss testsuite.
[kamenim/samba.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 "spoolss.h"
22
23 const char *errstr(DWORD error)
24 {
25         static char tmp[20];
26
27         switch (error) {
28         case ERROR_ACCESS_DENIED:
29                 return "ERROR_ACCESS_DENIED";
30         case ERROR_INVALID_PARAMETER:
31                 return "ERROR_INVALID_PARAMETER";
32         case ERROR_CALL_NOT_IMPLEMENTED:
33                 return "ERROR_CALL_NOT_IMPLEMENTED";
34         case ERROR_INSUFFICIENT_BUFFER:
35                 return "ERROR_INSUFFICIENT_BUFFER";
36         case ERROR_INVALID_NAME:
37                 return "ERROR_INVALID_NAME";
38         case ERROR_INVALID_LEVEL:
39                 return "ERROR_INVALID_LEVEL";
40         case ERROR_MORE_DATA:
41                 return "ERROR_MORE_DATA";
42 #ifdef ERROR_INVALID_DATATYPE
43         case ERROR_INVALID_DATATYPE:
44                 return "ERROR_INVALID_DATATYPE";
45 #endif
46         case ERROR_INVALID_ENVIRONMENT:
47                 return "ERROR_INVALID_ENVIRONMENT";
48         case ERROR_INVALID_PRINTER_COMMAND:
49                 return "ERROR_INVALID_PRINTER_COMMAND";
50         case ERROR_PRINTER_ALREADY_EXISTS:
51                 return "ERROR_PRINTER_ALREADY_EXISTS";
52         case ERROR_INVALID_PRINTER_NAME:
53                 return "ERROR_INVALID_PRINTER_NAME";
54         case ERROR_INVALID_PRIORITY:
55                 return "ERROR_INVALID_PRIORITY";
56         case ERROR_INVALID_SEPARATOR_FILE:
57                 return "ERROR_INVALID_SEPARATOR_FILE";
58         case ERROR_UNKNOWN_PRINTPROCESSOR:
59                 return "ERROR_UNKNOWN_PRINTPROCESSOR";
60         case ERROR_UNKNOWN_PRINTER_DRIVER:
61                 return "ERROR_UNKNOWN_PRINTER_DRIVER";
62         case ERROR_UNKNOWN_PORT:
63                 return "ERROR_UNKNOWN_PORT";
64         case ERROR_PRINTER_DRIVER_ALREADY_INSTALLED:
65                 return "ERROR_PRINTER_DRIVER_ALREADY_INSTALLED";
66         case ERROR_UNKNOWN_PRINT_MONITOR:
67                 return "ERROR_UNKNOWN_PRINT_MONITOR";
68         case ERROR_PRINTER_DRIVER_IN_USE:
69                 return "ERROR_PRINTER_DRIVER_IN_USE";
70         case ERROR_SPOOL_FILE_NOT_FOUND:
71                 return "ERROR_SPOOL_FILE_NOT_FOUND";
72         case ERROR_SPL_NO_STARTDOC:
73                 return "ERROR_SPL_NO_STARTDOC";
74         case ERROR_SPL_NO_ADDJOB:
75                 return "ERROR_SPL_NO_ADDJOB";
76         case ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED:
77                 return "ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED";
78         case ERROR_PRINT_MONITOR_ALREADY_INSTALLED:
79                 return "ERROR_PRINT_MONITOR_ALREADY_INSTALLED";
80         case ERROR_INVALID_PRINT_MONITOR:
81                 return "ERROR_INVALID_PRINT_MONITOR";
82         case ERROR_PRINT_MONITOR_IN_USE:
83                 return "ERROR_PRINT_MONITOR_IN_USE";
84         case ERROR_PRINTER_HAS_JOBS_QUEUED:
85                 return "ERROR_PRINTER_HAS_JOBS_QUEUED";
86         case ERROR_PRINTER_NOT_FOUND:
87                 return "ERROR_PRINTER_NOT_FOUND";
88         case ERROR_PRINTER_DRIVER_WARNED:
89                 return "ERROR_PRINTER_DRIVER_WARNED";
90         case ERROR_PRINTER_DRIVER_BLOCKED:
91                 return "ERROR_PRINTER_DRIVER_BLOCKED";
92 #ifdef ERROR_PRINTER_DRIVER_PACKAGE_IN_USE
93         case ERROR_PRINTER_DRIVER_PACKAGE_IN_USE:
94                 return "ERROR_PRINTER_DRIVER_PACKAGE_IN_USE";
95 #endif
96 #ifdef ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND
97         case ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND:
98                 return "ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND";
99 #endif
100 #ifdef ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED
101         case ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED:
102                 return "ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED";
103 #endif
104 #ifdef ERROR_PRINT_JOB_RESTART_REQUIRED
105         case ERROR_PRINT_JOB_RESTART_REQUIRED:
106                 return "ERROR_PRINT_JOB_RESTART_REQUIRED";
107 #endif
108         default:
109                 break;
110         }
111
112         sprintf(tmp, "0x%08x", error);
113
114         return tmp;
115 }