Backport of pre-connect Hyper-V code
[freerdp-ubuntu-pcb-backport.git] / libfreerdp-core / errinfo.c
1 /**
2  * FreeRDP: A Remote Desktop Protocol Client
3  * Error Info
4  *
5  * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include "errinfo.h"
21
22 /* Protocol-independent codes */
23
24 #define ERRINFO_RPC_INITIATED_DISCONNECT_STRING \
25                 "The disconnection was initiated by an administrative tool on the server in another session."
26
27 #define ERRINFO_RPC_INITIATED_LOGOFF_STRING \
28                 "The disconnection was due to a forced logoff initiated by an administrative tool on the server in another session."
29
30 #define ERRINFO_IDLE_TIMEOUT_STRING \
31                 "The idle session limit timer on the server has elapsed."
32
33 #define ERRINFO_LOGON_TIMEOUT_STRING \
34                 "The active session limit timer on the server has elapsed."
35
36 #define ERRINFO_DISCONNECTED_BY_OTHER_CONNECTION_STRING \
37                 "Another user connected to the server, forcing the disconnection of the current connection."
38
39 #define ERRINFO_OUT_OF_MEMORY_STRING \
40                 "The server ran out of available memory resources."
41
42 #define ERRINFO_SERVER_DENIED_CONNECTION_STRING \
43                 "The server denied the connection."
44
45 #define ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES_STRING \
46                 "The user cannot connect to the server due to insufficient access privileges."
47
48 #define ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED_STRING \
49                 "The server does not accept saved user credentials and requires that the user enter their credentials for each connection."
50
51 #define ERRINFO_RPC_INITIATED_DISCONNECT_BY_USER_STRING \
52                 "The disconnection was initiated by an administrative tool on the server running in the user's session."
53
54 /* Protocol-independent licensing codes */
55
56 #define ERRINFO_LICENSE_INTERNAL_STRING \
57                 "An internal error has occurred in the Terminal Services licensing component."
58
59 #define ERRINFO_LICENSE_NO_LICENSE_SERVER_STRING \
60                 "A Remote Desktop License Server ([MS-RDPELE] section 1.1) could not be found to provide a license."
61
62 #define ERRINFO_LICENSE_NO_LICENSE_STRING \
63                 "There are no Client Access Licenses ([MS-RDPELE] section 1.1) available for the target remote computer."
64
65 #define ERRINFO_LICENSE_BAD_CLIENT_MSG_STRING \
66                 "The remote computer received an invalid licensing message from the client."
67
68 #define ERRINFO_LICENSE_HWID_DOESNT_MATCH_LICENSE_STRING \
69                 "The Client Access License ([MS-RDPELE] section 1.1) stored by the client has been modified."
70
71 #define ERRINFO_LICENSE_BAD_CLIENT_LICENSE_STRING \
72                 "The Client Access License ([MS-RDPELE] section 1.1) stored by the client is in an invalid format."
73
74 #define ERRINFO_LICENSE_CANT_FINISH_PROTOCOL_STRING \
75                 "Network problems have caused the licensing protocol ([MS-RDPELE] section 1.3.3) to be terminated."
76
77 #define ERRINFO_LICENSE_CLIENT_ENDED_PROTOCOL_STRING \
78                 "The client prematurely ended the licensing protocol ([MS-RDPELE] section 1.3.3)."
79
80 #define ERRINFO_LICENSE_BAD_CLIENT_ENCRYPTION_STRING \
81                 "A licensing message ([MS-RDPELE] sections 2.2 and 5.1) was incorrectly encrypted."
82
83 #define ERRINFO_LICENSE_CANT_UPGRADE_LICENSE_STRING \
84                 "The Client Access License ([MS-RDPELE] section 1.1) stored by the client could not be upgraded or renewed."
85
86 #define ERRINFO_LICENSE_NO_REMOTE_CONNECTIONS_STRING \
87                 "The remote computer is not licensed to accept remote connections."
88
89 /* RDP specific codes */
90
91 #define ERRINFO_UNKNOWN_DATA_PDU_TYPE_STRING \
92                 "Unknown pduType2 field in a received Share Data Header (section 2.2.8.1.1.1.2)."
93
94 #define ERRINFO_UNKNOWN_PDU_TYPE_STRING \
95                 "Unknown pduType field in a received Share Control Header (section 2.2.8.1.1.1.1)."
96
97 #define ERRINFO_DATA_PDU_SEQUENCE_STRING \
98                 "An out-of-sequence Slow-Path Data PDU (section 2.2.8.1.1.1.1) has been received."
99
100 #define ERRINFO_CONTROL_PDU_SEQUENCE_STRING \
101                 "An out-of-sequence Slow-Path Non-Data PDU (section 2.2.8.1.1.1.1) has been received."
102
103 #define ERRINFO_INVALID_CONTROL_PDU_ACTION_STRING \
104                 "A Control PDU (sections 2.2.1.15 and 2.2.1.16) has been received with an invalid action field."
105
106 #define ERRINFO_INVALID_INPUT_PDU_TYPE_STRING \
107                 "(a) A Slow-Path Input Event (section 2.2.8.1.1.3.1.1) has been received with an invalid messageType field.\n" \
108                 "(b) A Fast-Path Input Event (section 2.2.8.1.2.2) has been received with an invalid eventCode field."
109
110 #define ERRINFO_INVALID_INPUT_PDU_MOUSE_STRING \
111                 "(a) A Slow-Path Mouse Event (section 2.2.8.1.1.3.1.1.3) or Extended Mouse Event " \
112                 "(section 2.2.8.1.1.3.1.1.4) has been received with an invalid pointerFlags field.\n" \
113                 "(b) A Fast-Path Mouse Event (section 2.2.8.1.2.2.3) or Fast-Path Extended Mouse Event " \
114                 "(section 2.2.8.1.2.2.4) has been received with an invalid pointerFlags field."
115
116 #define ERRINFO_INVALID_REFRESH_RECT_PDU_STRING \
117                 "An invalid Refresh Rect PDU (section 2.2.11.2) has been received."
118
119 #define ERRINFO_CREATE_USER_DATA_FAILED_STRING \
120                 "The server failed to construct the GCC Conference Create Response user data (section 2.2.1.4)."
121
122 #define ERRINFO_CONNECT_FAILED_STRING \
123                 "Processing during the Channel Connection phase of the RDP Connection Sequence " \
124                 "(see section 1.3.1.1 for an overview of the RDP Connection Sequence phases) has failed."
125
126 #define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_SHAREID_STRING \
127                 "A Confirm Active PDU (section 2.2.1.13.2) was received from the client with an invalid shareId field."
128
129 #define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_ORIGINATOR_STRING \
130                 "A Confirm Active PDU (section 2.2.1.13.2) was received from the client with an invalid originatorId field."
131
132 #define ERRINFO_PERSISTENT_KEY_PDU_BAD_LENGTH_STRING \
133                 "There is not enough data to process a Persistent Key List PDU (section 2.2.1.17)."
134
135 #define ERRINFO_PERSISTENT_KEY_PDU_ILLEGAL_FIRST_STRING \
136                 "A Persistent Key List PDU (section 2.2.1.17) marked as PERSIST_PDU_FIRST (0x01) was received after the reception " \
137                 "of a prior Persistent Key List PDU also marked as PERSIST_PDU_FIRST."
138
139 #define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_TOTAL_KEYS_STRING \
140                 "A Persistent Key List PDU (section 2.2.1.17) was received which specified a total number of bitmap cache entries larger than 262144."
141
142 #define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_CACHE_KEYS_STRING \
143                 "A Persistent Key List PDU (section 2.2.1.17) was received which specified an invalid total number of keys for a bitmap cache " \
144                 "(the number of entries that can be stored within each bitmap cache is specified in the Revision 1 or 2 Bitmap Cache Capability Set " \
145                 "(section 2.2.7.1.4) that is sent from client to server)."
146
147 #define ERRINFO_INPUT_PDU_BAD_LENGTH_STRING \
148                 "There is not enough data to process Input Event PDU Data (section 2.2.8.1.1.3.1) or a Fast-Path Input Event PDU (section 2.2.8.1.2)." \
149
150 #define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH_STRING \
151                 "There is not enough data to process the shareDataHeader, NumInfoBlocks, " \
152                 "Pad1, and Pad2 fields of the Bitmap Cache Error PDU Data ([MS-RDPEGDI] section 2.2.2.3.1.1)."
153
154 #define ERRINFO_SECURITY_DATA_TOO_SHORT_STRING \
155                 "(a) The dataSignature field of the Fast-Path Input Event PDU (section 2.2.8.1.2) does not contain enough data.\n" \
156                 "(b) The fipsInformation and dataSignature fields of the Fast-Path Input Event PDU (section 2.2.8.1.2) do not contain enough data."
157
158 #define ERRINFO_VCHANNEL_DATA_TOO_SHORT_STRING \
159                 "(a) There is not enough data in the Client Network Data (section 2.2.1.3.4) to read the virtual channel configuration data.\n" \
160                 "(b) There is not enough data to read a complete Channel PDU Header (section 2.2.6.1.1)."
161
162 #define ERRINFO_SHARE_DATA_TOO_SHORT_STRING \
163                 "(a) There is not enough data to process Control PDU Data (section 2.2.1.15.1).\n" \
164                 "(b) There is not enough data to read a complete Share Control Header (section 2.2.8.1.1.1.1).\n" \
165                 "(c) There is not enough data to read a complete Share Data Header (section 2.2.8.1.1.1.2) of a Slow-Path Data PDU (section 2.2.8.1.1.1.1).\n" \
166                 "(d) There is not enough data to process Font List PDU Data (section 2.2.1.18.1)."
167
168 #define ERRINFO_BAD_SUPPRESS_OUTPUT_PDU_STRING \
169                 "(a) There is not enough data to process Suppress Output PDU Data (section 2.2.11.3.1).\n" \
170                 "(b) The allowDisplayUpdates field of the Suppress Output PDU Data (section 2.2.11.3.1) is invalid."
171
172 #define ERRINFO_CONFIRM_ACTIVE_PDU_TOO_SHORT_STRING \
173                 "(a) There is not enough data to read the shareControlHeader, shareId, originatorId, lengthSourceDescriptor, " \
174                 "and lengthCombinedCapabilities fields of the Confirm Active PDU Data (section 2.2.1.13.2.1).\n" \
175                 "(b) There is not enough data to read the sourceDescriptor, numberCapabilities, pad2Octets, and capabilitySets " \
176                 "fields of the Confirm Active PDU Data (section 2.2.1.13.2.1)."
177
178 #define ERRINFO_CAPABILITY_SET_TOO_SMALL_STRING \
179                 "There is not enough data to read the capabilitySetType and the lengthCapability fields in a received Capability Set (section 2.2.1.13.1.1.1)."
180
181 #define ERRINFO_CAPABILITY_SET_TOO_LARGE_STRING \
182                 "A Capability Set (section 2.2.1.13.1.1.1) has been received with a lengthCapability " \
183                 "field that contains a value greater than the total length of the data received."
184
185 #define ERRINFO_NO_CURSOR_CACHE_STRING \
186                 "(a) Both the colorPointerCacheSize and pointerCacheSize fields in the Pointer Capability Set (section 2.2.7.1.5) are set to zero.\n" \
187                 "(b) The pointerCacheSize field in the Pointer Capability Set (section 2.2.7.1.5) is not present, and the colorPointerCacheSize field is set to zero."
188
189 #define ERRINFO_BAD_CAPABILITIES_STRING \
190                 "The capabilities received from the client in the Confirm Active PDU (section 2.2.1.13.2) were not accepted by the server."
191
192 #define ERRINFO_VIRTUAL_CHANNEL_DECOMPRESSION_STRING \
193                 "An error occurred while using the bulk compressor (section 3.1.8 and [MS-RDPEGDI] section 3.1.8) to decompress a Virtual Channel PDU (section 2.2.6.1)"
194
195 #define ERRINFO_INVALID_VC_COMPRESSION_TYPE_STRING \
196                 "An invalid bulk compression package was specified in the flags field of the Channel PDU Header (section 2.2.6.1.1)."
197
198 #define ERRINFO_INVALID_CHANNEL_ID_STRING \
199                 "An invalid MCS channel ID was specified in the mcsPdu field of the Virtual Channel PDU (section 2.2.6.1)."
200
201 #define ERRINFO_VCHANNELS_TOO_MANY_STRING \
202                 "The client requested more than the maximum allowed 31 static virtual channels in the Client Network Data (section 2.2.1.3.4)."
203
204 #define ERRINFO_REMOTEAPP_NOT_ENABLED_STRING \
205                 "The INFO_RAIL flag (0x00008000) MUST be set in the flags field of the Info Packet (section 2.2.1.11.1.1) " \
206                 "as the session on the remote server can only host remote applications."
207
208 #define ERRINFO_CACHE_CAP_NOT_SET_STRING \
209                 "The client sent a Persistent Key List PDU (section 2.2.1.17) without including the prerequisite Revision 2 Bitmap Cache " \
210                 "Capability Set (section 2.2.7.1.4.2) in the Confirm Active PDU (section 2.2.1.13.2)."
211
212 #define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH2_STRING \
213                 "The NumInfoBlocks field in the Bitmap Cache Error PDU Data is inconsistent with the amount of data in the " \
214                 "Info field ([MS-RDPEGDI] section 2.2.2.3.1.1)."
215
216 #define ERRINFO_OFFSCREEN_CACHE_ERROR_PDU_BAD_LENGTH_STRING \
217                 "There is not enough data to process an Offscreen Bitmap Cache Error PDU ([MS-RDPEGDI] section 2.2.2.3.2)."
218
219 #define ERRINFO_DRAWNINEGRID_CACHE_ERROR_PDU_BAD_LENGTH_STRING \
220                 "There is not enough data to process a DrawNineGrid Cache Error PDU ([MS-RDPEGDI] section 2.2.2.3.3)."
221
222 #define ERRINFO_GDIPLUS_PDU_BAD_LENGTH_STRING \
223                 "There is not enough data to process a GDI+ Error PDU ([MS-RDPEGDI] section 2.2.2.3.4)."
224
225 #define ERRINFO_SECURITY_DATA_TOO_SHORT2_STRING \
226                 "There is not enough data to read a Basic Security Header (section 2.2.8.1.1.2.1)."
227
228 #define ERRINFO_SECURITY_DATA_TOO_SHORT3_STRING \
229                 "There is not enough data to read a Non-FIPS Security Header (section 2.2.8.1.1.2.2) or FIPS Security Header (section 2.2.8.1.1.2.3)."
230
231 #define ERRINFO_SECURITY_DATA_TOO_SHORT4_STRING \
232                 "There is not enough data to read the basicSecurityHeader and length fields of the Security Exchange PDU Data (section 2.2.1.10.1)."
233
234 #define ERRINFO_SECURITY_DATA_TOO_SHORT5_STRING \
235                 "There is not enough data to read the CodePage, flags, cbDomain, cbUserName, cbPassword, cbAlternateShell, " \
236                 "cbWorkingDir, Domain, UserName, Password, AlternateShell, and WorkingDir fields in the Info Packet (section 2.2.1.11.1.1)."
237
238 #define ERRINFO_SECURITY_DATA_TOO_SHORT6_STRING \
239                 "There is not enough data to read the CodePage, flags, cbDomain, cbUserName, cbPassword, cbAlternateShell, " \
240                 "and cbWorkingDir fields in the Info Packet (section 2.2.1.11.1.1)."
241
242 #define ERRINFO_SECURITY_DATA_TOO_SHORT7_STRING \
243                 "There is not enough data to read the clientAddressFamily and cbClientAddress fields in the Extended Info Packet (section 2.2.1.11.1.1.1)."
244
245 #define ERRINFO_SECURITY_DATA_TOO_SHORT8_STRING \
246                 "There is not enough data to read the clientAddress field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
247
248 #define ERRINFO_SECURITY_DATA_TOO_SHORT9_STRING \
249                 "There is not enough data to read the cbClientDir field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
250
251 #define ERRINFO_SECURITY_DATA_TOO_SHORT10_STRING \
252                 "There is not enough data to read the clientDir field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
253
254 #define ERRINFO_SECURITY_DATA_TOO_SHORT11_STRING \
255                 "There is not enough data to read the clientTimeZone field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
256
257 #define ERRINFO_SECURITY_DATA_TOO_SHORT12_STRING \
258                 "There is not enough data to read the clientSessionId field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
259
260 #define ERRINFO_SECURITY_DATA_TOO_SHORT13_STRING \
261                 "There is not enough data to read the performanceFlags field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
262
263 #define ERRINFO_SECURITY_DATA_TOO_SHORT14_STRING \
264                 "There is not enough data to read the cbAutoReconnectLen field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
265
266 #define ERRINFO_SECURITY_DATA_TOO_SHORT15_STRING \
267                 "There is not enough data to read the autoReconnectCookie field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
268
269 #define ERRINFO_SECURITY_DATA_TOO_SHORT16_STRING \
270                 "The cbAutoReconnectLen field in the Extended Info Packet (section 2.2.1.11.1.1.1) contains a value " \
271                 "which is larger than the maximum allowed length of 128 bytes."
272
273 #define ERRINFO_SECURITY_DATA_TOO_SHORT17_STRING \
274                 "There is not enough data to read the clientAddressFamily and cbClientAddress fields in the Extended Info Packet (section 2.2.1.11.1.1.1)."
275
276 #define ERRINFO_SECURITY_DATA_TOO_SHORT18_STRING \
277                 "There is not enough data to read the clientAddress field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
278
279 #define ERRINFO_SECURITY_DATA_TOO_SHORT19_STRING \
280                 "There is not enough data to read the cbClientDir field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
281
282 #define ERRINFO_SECURITY_DATA_TOO_SHORT20_STRING \
283                 "There is not enough data to read the clientDir field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
284
285 #define ERRINFO_SECURITY_DATA_TOO_SHORT21_STRING \
286                 "There is not enough data to read the clientTimeZone field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
287
288 #define ERRINFO_SECURITY_DATA_TOO_SHORT22_STRING \
289                 "There is not enough data to read the clientSessionId field in the Extended Info Packet (section 2.2.1.11.1.1.1)."
290
291 #define ERRINFO_SECURITY_DATA_TOO_SHORT23_STRING \
292                 "There is not enough data to read the Client Info PDU Data (section 2.2.1.11.1)."
293
294 #define ERRINFO_BAD_MONITOR_DATA_STRING \
295                 "The monitorCount field in the Client Monitor Data (section 2.2.1.3.6) is invalid."
296
297 #define ERRINFO_VC_DECOMPRESSED_REASSEMBLE_FAILED_STRING \
298                 "The server-side decompression buffer is invalid, or the size of the decompressed VC data exceeds " \
299                 "the chunking size specified in the Virtual Channel Capability Set (section 2.2.7.1.10)."
300
301 #define ERRINFO_VC_DATA_TOO_LONG_STRING \
302                 "The size of a received Virtual Channel PDU (section 2.2.6.1) exceeds the chunking size specified " \
303                 "in the Virtual Channel Capability Set (section 2.2.7.1.10)."
304
305 #define ERRINFO_GRAPHICS_MODE_NOT_SUPPORTED_STRING \
306                 "The graphics mode requested by the client is not supported by the server."
307
308 #define ERRINFO_GRAPHICS_SUBSYSTEM_RESET_FAILED_STRING \
309                 "The server-side graphics subsystem failed to reset."
310
311 #define ERRINFO_UPDATE_SESSION_KEY_FAILED_STRING \
312                 "An attempt to update the session keys while using Standard RDP Security mechanisms (section 5.3.7) failed."
313
314 #define ERRINFO_DECRYPT_FAILED_STRING \
315                 "(a) Decryption using Standard RDP Security mechanisms (section 5.3.6) failed.\n" \
316                 "(b) Session key creation using Standard RDP Security mechanisms (section 5.3.5) failed."
317
318 #define ERRINFO_ENCRYPT_FAILED_STRING \
319                 "Encryption using Standard RDP Security mechanisms (section 5.3.6) failed."
320
321 #define ERRINFO_ENCRYPTION_PACKAGE_MISMATCH_STRING \
322                 "Failed to find a usable Encryption Method (section 5.3.2) in the encryptionMethods field of the Client Security Data (section 2.2.1.4.3)."
323
324 #define ERRINFO_DECRYPT_FAILED2_STRING \
325                 "Unencrypted data was encountered in a protocol stream which is meant to be encrypted with Standard RDP Security mechanisms (section 5.3.6)."
326
327 /* Special codes */
328 #define ERRINFO_SUCCESS_STRING "Success."
329 #define ERRINFO_NONE_STRING ""
330
331 static const ERRINFO ERRINFO_CODES[] =
332 {
333                 ERRINFO_DEFINE(SUCCESS),
334
335                 /* Protocol-independent codes */
336                 ERRINFO_DEFINE(RPC_INITIATED_DISCONNECT),
337                 ERRINFO_DEFINE(RPC_INITIATED_LOGOFF),
338                 ERRINFO_DEFINE(IDLE_TIMEOUT),
339                 ERRINFO_DEFINE(LOGON_TIMEOUT),
340                 ERRINFO_DEFINE(DISCONNECTED_BY_OTHER_CONNECTION),
341                 ERRINFO_DEFINE(OUT_OF_MEMORY),
342                 ERRINFO_DEFINE(SERVER_DENIED_CONNECTION),
343                 ERRINFO_DEFINE(SERVER_INSUFFICIENT_PRIVILEGES),
344                 ERRINFO_DEFINE(SERVER_FRESH_CREDENTIALS_REQUIRED),
345                 ERRINFO_DEFINE(RPC_INITIATED_DISCONNECT_BY_USER),
346
347                 /* Protocol-independent licensing codes */
348                 ERRINFO_DEFINE(LICENSE_INTERNAL),
349                 ERRINFO_DEFINE(LICENSE_NO_LICENSE_SERVER),
350                 ERRINFO_DEFINE(LICENSE_NO_LICENSE),
351                 ERRINFO_DEFINE(LICENSE_BAD_CLIENT_MSG),
352                 ERRINFO_DEFINE(LICENSE_HWID_DOESNT_MATCH_LICENSE),
353                 ERRINFO_DEFINE(LICENSE_BAD_CLIENT_LICENSE),
354                 ERRINFO_DEFINE(LICENSE_CANT_FINISH_PROTOCOL),
355                 ERRINFO_DEFINE(LICENSE_CLIENT_ENDED_PROTOCOL),
356                 ERRINFO_DEFINE(LICENSE_BAD_CLIENT_ENCRYPTION),
357                 ERRINFO_DEFINE(LICENSE_CANT_UPGRADE_LICENSE),
358                 ERRINFO_DEFINE(LICENSE_NO_REMOTE_CONNECTIONS),
359
360                 /* RDP specific codes */
361                 ERRINFO_DEFINE(UNKNOWN_DATA_PDU_TYPE),
362                 ERRINFO_DEFINE(UNKNOWN_PDU_TYPE),
363                 ERRINFO_DEFINE(DATA_PDU_SEQUENCE),
364                 ERRINFO_DEFINE(CONTROL_PDU_SEQUENCE),
365                 ERRINFO_DEFINE(INVALID_CONTROL_PDU_ACTION),
366                 ERRINFO_DEFINE(INVALID_INPUT_PDU_TYPE),
367                 ERRINFO_DEFINE(INVALID_INPUT_PDU_MOUSE),
368                 ERRINFO_DEFINE(INVALID_REFRESH_RECT_PDU),
369                 ERRINFO_DEFINE(CREATE_USER_DATA_FAILED),
370                 ERRINFO_DEFINE(CONNECT_FAILED),
371                 ERRINFO_DEFINE(CONFIRM_ACTIVE_HAS_WRONG_SHAREID),
372                 ERRINFO_DEFINE(CONFIRM_ACTIVE_HAS_WRONG_ORIGINATOR),
373                 ERRINFO_DEFINE(PERSISTENT_KEY_PDU_BAD_LENGTH),
374                 ERRINFO_DEFINE(PERSISTENT_KEY_PDU_ILLEGAL_FIRST),
375                 ERRINFO_DEFINE(PERSISTENT_KEY_PDU_TOO_MANY_TOTAL_KEYS),
376                 ERRINFO_DEFINE(PERSISTENT_KEY_PDU_TOO_MANY_CACHE_KEYS),
377                 ERRINFO_DEFINE(INPUT_PDU_BAD_LENGTH),
378                 ERRINFO_DEFINE(BITMAP_CACHE_ERROR_PDU_BAD_LENGTH),
379                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT),
380                 ERRINFO_DEFINE(VCHANNEL_DATA_TOO_SHORT  ),
381                 ERRINFO_DEFINE(SHARE_DATA_TOO_SHORT),
382                 ERRINFO_DEFINE(BAD_SUPPRESS_OUTPUT_PDU),
383                 ERRINFO_DEFINE(CONFIRM_ACTIVE_PDU_TOO_SHORT),
384                 ERRINFO_DEFINE(CAPABILITY_SET_TOO_SMALL),
385                 ERRINFO_DEFINE(CAPABILITY_SET_TOO_LARGE),
386                 ERRINFO_DEFINE(NO_CURSOR_CACHE),
387                 ERRINFO_DEFINE(BAD_CAPABILITIES),
388                 ERRINFO_DEFINE(VIRTUAL_CHANNEL_DECOMPRESSION),
389                 ERRINFO_DEFINE(INVALID_VC_COMPRESSION_TYPE),
390                 ERRINFO_DEFINE(INVALID_CHANNEL_ID),
391                 ERRINFO_DEFINE(VCHANNELS_TOO_MANY),
392                 ERRINFO_DEFINE(REMOTEAPP_NOT_ENABLED),
393                 ERRINFO_DEFINE(CACHE_CAP_NOT_SET),
394                 ERRINFO_DEFINE(BITMAP_CACHE_ERROR_PDU_BAD_LENGTH2),
395                 ERRINFO_DEFINE(OFFSCREEN_CACHE_ERROR_PDU_BAD_LENGTH),
396                 ERRINFO_DEFINE(DRAWNINEGRID_CACHE_ERROR_PDU_BAD_LENGTH),
397                 ERRINFO_DEFINE(GDIPLUS_PDU_BAD_LENGTH),
398                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT2),
399                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT3),
400                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT4),
401                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT5),
402                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT6),
403                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT7),
404                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT8),
405                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT9),
406                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT10),
407                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT11),
408                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT12),
409                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT13),
410                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT14),
411                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT15),
412                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT16),
413                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT17),
414                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT18),
415                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT19),
416                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT20),
417                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT21),
418                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT22),
419                 ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT23),
420                 ERRINFO_DEFINE(BAD_MONITOR_DATA),
421                 ERRINFO_DEFINE(VC_DECOMPRESSED_REASSEMBLE_FAILED),
422                 ERRINFO_DEFINE(VC_DATA_TOO_LONG),
423                 ERRINFO_DEFINE(GRAPHICS_MODE_NOT_SUPPORTED),
424                 ERRINFO_DEFINE(GRAPHICS_SUBSYSTEM_RESET_FAILED),
425                 ERRINFO_DEFINE(UPDATE_SESSION_KEY_FAILED),
426                 ERRINFO_DEFINE(DECRYPT_FAILED),
427                 ERRINFO_DEFINE(ENCRYPT_FAILED),
428                 ERRINFO_DEFINE(ENCRYPTION_PACKAGE_MISMATCH),
429                 ERRINFO_DEFINE(DECRYPT_FAILED2),
430
431                 ERRINFO_DEFINE(NONE)
432 };
433
434 void rdp_print_errinfo(uint32 code)
435 {
436         const ERRINFO* errInfo;
437
438         errInfo = &ERRINFO_CODES[0];
439
440         while (errInfo->code != ERRINFO_NONE)
441         {
442                 if (code == errInfo->code)
443                 {
444                         printf("%s (0x%08X):\n%s\n", errInfo->name, code, errInfo->info);
445                         return;
446                 }
447
448                 errInfo++;
449         }
450
451         printf("ERRINFO_UNKNOWN 0x%08X: Unknown error.\n", code);
452 }
453