FreeRDP
errinfo.c
1 
20 #include <freerdp/config.h>
21 
22 #include <stdio.h>
23 
24 #include <freerdp/log.h>
25 
26 #include "errinfo.h"
27 
28 #define TAG FREERDP_TAG("core")
29 
30 #define ERRINFO_DEFINE(_code, category) \
31  { \
32  ERRINFO_##_code, "ERRINFO_" #_code, ERRINFO_##_code##_STRING, category \
33  }
34 
35 /* Protocol-independent codes */
36 
37 #define ERRINFO_RPC_INITIATED_DISCONNECT_STRING \
38  "The disconnection was initiated by an administrative tool on the server in another session."
39 
40 #define ERRINFO_RPC_INITIATED_LOGOFF_STRING \
41  "The disconnection was due to a forced logoff initiated by an administrative tool on the " \
42  "server in another session."
43 
44 #define ERRINFO_IDLE_TIMEOUT_STRING "The idle session limit timer on the server has elapsed."
45 
46 #define ERRINFO_LOGON_TIMEOUT_STRING "The active session limit timer on the server has elapsed."
47 
48 #define ERRINFO_DISCONNECTED_BY_OTHER_CONNECTION_STRING \
49  "Another user connected to the server, forcing the disconnection of the current connection."
50 
51 #define ERRINFO_OUT_OF_MEMORY_STRING "The server ran out of available memory resources."
52 
53 #define ERRINFO_SERVER_DENIED_CONNECTION_STRING "The server denied the connection."
54 
55 #define ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES_STRING \
56  "The user cannot connect to the server due to insufficient access privileges."
57 
58 #define ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED_STRING \
59  "The server does not accept saved user credentials and requires that the user enter their " \
60  "credentials for each connection."
61 
62 #define ERRINFO_RPC_INITIATED_DISCONNECT_BY_USER_STRING \
63  "The disconnection was initiated by an administrative tool on the server running in the " \
64  "user's session."
65 
66 #define ERRINFO_LOGOFF_BY_USER_STRING \
67  "The disconnection was initiated by the user logging off their session on the server."
68 
69 #define ERRINFO_CLOSE_STACK_ON_DRIVER_NOT_READY_STRING \
70  "The display driver in the remote session did not report any status within the time allotted " \
71  "for startup."
72 
73 #define ERRINFO_SERVER_DWM_CRASH_STRING \
74  "The DWM process running in the remote session terminated unexpectedly."
75 
76 #define ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE_STRING \
77  "The display driver in the remote session was unable to complete all the tasks required for " \
78  "startup."
79 
80 #define ERRINFO_CLOSE_STACK_ON_DRIVER_IFACE_FAILURE_STRING \
81  "The display driver in the remote session started up successfully, but due to internal " \
82  "failures was not usable by the remoting stack."
83 
84 #define ERRINFO_SERVER_WINLOGON_CRASH_STRING \
85  "The Winlogon process running in the remote session terminated unexpectedly."
86 
87 #define ERRINFO_SERVER_CSRSS_CRASH_STRING \
88  "The CSRSS process running in the remote session terminated unexpectedly."
89 
90 /* Protocol-independent codes generated by the Connection Broker */
91 
92 #define ERRINFO_CB_DESTINATION_NOT_FOUND_STRING "The target endpoint could not be found."
93 
94 #define ERRINFO_CB_LOADING_DESTINATION_STRING \
95  "The target endpoint to which the client is being redirected is disconnecting from the " \
96  "Connection Broker."
97 
98 #define ERRINFO_CB_REDIRECTING_TO_DESTINATION_STRING \
99  "An error occurred while the connection was being redirected to the target endpoint."
100 
101 #define ERRINFO_CB_SESSION_ONLINE_VM_WAKE_STRING \
102  "An error occurred while the target endpoint (a virtual machine) was being awakened."
103 
104 #define ERRINFO_CB_SESSION_ONLINE_VM_BOOT_STRING \
105  "An error occurred while the target endpoint (a virtual machine) was being started."
106 
107 #define ERRINFO_CB_SESSION_ONLINE_VM_NO_DNS_STRING \
108  "The IP address of the target endpoint (a virtual machine) cannot be determined."
109 
110 #define ERRINFO_CB_DESTINATION_POOL_NOT_FREE_STRING \
111  "There are no available endpoints in the pool managed by the Connection Broker."
112 
113 #define ERRINFO_CB_CONNECTION_CANCELLED_STRING "Processing of the connection has been cancelled."
114 
115 #define ERRINFO_CB_CONNECTION_ERROR_INVALID_SETTINGS_STRING \
116  "The settings contained in the routingToken field of the X.224 Connection Request PDU " \
117  "(section 2.2.1.1) cannot be validated."
118 
119 #define ERRINFO_CB_SESSION_ONLINE_VM_BOOT_TIMEOUT_STRING \
120  "A time-out occurred while the target endpoint (a virtual machine) was being started."
121 
122 #define ERRINFO_CB_SESSION_ONLINE_VM_SESSMON_FAILED_STRING \
123  "A session monitoring error occurred while the target endpoint (a virtual machine) was being " \
124  "started."
125 
126 /* Protocol-independent licensing codes */
127 
128 #define ERRINFO_LICENSE_INTERNAL_STRING \
129  "An internal error has occurred in the Terminal Services licensing component."
130 
131 #define ERRINFO_LICENSE_NO_LICENSE_SERVER_STRING \
132  "A Remote Desktop License Server ([MS-RDPELE] section 1.1) could not be found to provide a " \
133  "license."
134 
135 #define ERRINFO_LICENSE_NO_LICENSE_STRING \
136  "There are no Client Access Licenses ([MS-RDPELE] section 1.1) available for the target " \
137  "remote computer."
138 
139 #define ERRINFO_LICENSE_BAD_CLIENT_MSG_STRING \
140  "The remote computer received an invalid licensing message from the client."
141 
142 #define ERRINFO_LICENSE_HWID_DOESNT_MATCH_LICENSE_STRING \
143  "The Client Access License ([MS-RDPELE] section 1.1) stored by the client has been modified."
144 
145 #define ERRINFO_LICENSE_BAD_CLIENT_LICENSE_STRING \
146  "The Client Access License ([MS-RDPELE] section 1.1) stored by the client is in an invalid " \
147  "format."
148 
149 #define ERRINFO_LICENSE_CANT_FINISH_PROTOCOL_STRING \
150  "Network problems have caused the licensing protocol ([MS-RDPELE] section 1.3.3) to be " \
151  "terminated."
152 
153 #define ERRINFO_LICENSE_CLIENT_ENDED_PROTOCOL_STRING \
154  "The client prematurely ended the licensing protocol ([MS-RDPELE] section 1.3.3)."
155 
156 #define ERRINFO_LICENSE_BAD_CLIENT_ENCRYPTION_STRING \
157  "A licensing message ([MS-RDPELE] sections 2.2 and 5.1) was incorrectly encrypted."
158 
159 #define ERRINFO_LICENSE_CANT_UPGRADE_LICENSE_STRING \
160  "The Client Access License ([MS-RDPELE] section 1.1) stored by the client could not be " \
161  "upgraded or renewed."
162 
163 #define ERRINFO_LICENSE_NO_REMOTE_CONNECTIONS_STRING \
164  "The remote computer is not licensed to accept remote connections."
165 
166 /* RDP specific codes */
167 
168 #define ERRINFO_UNKNOWN_DATA_PDU_TYPE_STRING \
169  "Unknown pduType2 field in a received Share Data Header (section 2.2.8.1.1.1.2)."
170 
171 #define ERRINFO_UNKNOWN_PDU_TYPE_STRING \
172  "Unknown pduType field in a received Share Control Header (section 2.2.8.1.1.1.1)."
173 
174 #define ERRINFO_DATA_PDU_SEQUENCE_STRING \
175  "An out-of-sequence Slow-Path Data PDU (section 2.2.8.1.1.1.1) has been received."
176 
177 #define ERRINFO_CONTROL_PDU_SEQUENCE_STRING \
178  "An out-of-sequence Slow-Path Non-Data PDU (section 2.2.8.1.1.1.1) has been received."
179 
180 #define ERRINFO_INVALID_CONTROL_PDU_ACTION_STRING \
181  "A Control PDU (sections 2.2.1.15 and 2.2.1.16) has been received with an invalid action " \
182  "field."
183 
184 #define ERRINFO_INVALID_INPUT_PDU_TYPE_STRING \
185  "(a) A Slow-Path Input Event (section 2.2.8.1.1.3.1.1) has been received with an invalid " \
186  "messageType field.\n" \
187  "(b) A Fast-Path Input Event (section 2.2.8.1.2.2) has been received with an invalid " \
188  "eventCode field."
189 
190 #define ERRINFO_INVALID_INPUT_PDU_MOUSE_STRING \
191  "(a) A Slow-Path Mouse Event (section 2.2.8.1.1.3.1.1.3) or Extended Mouse Event " \
192  "(section 2.2.8.1.1.3.1.1.4) has been received with an invalid pointerFlags field.\n" \
193  "(b) A Fast-Path Mouse Event (section 2.2.8.1.2.2.3) or Fast-Path Extended Mouse Event " \
194  "(section 2.2.8.1.2.2.4) has been received with an invalid pointerFlags field."
195 
196 #define ERRINFO_INVALID_REFRESH_RECT_PDU_STRING \
197  "An invalid Refresh Rect PDU (section 2.2.11.2) has been received."
198 
199 #define ERRINFO_CREATE_USER_DATA_FAILED_STRING \
200  "The server failed to construct the GCC Conference Create Response user data (section " \
201  "2.2.1.4)."
202 
203 #define ERRINFO_CONNECT_FAILED_STRING \
204  "Processing during the Channel Connection phase of the RDP Connection Sequence " \
205  "(see section 1.3.1.1 for an overview of the RDP Connection Sequence phases) has failed."
206 
207 #define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_SHAREID_STRING \
208  "A Confirm Active PDU (section 2.2.1.13.2) was received from the client with an invalid " \
209  "shareId field."
210 
211 #define ERRINFO_CONFIRM_ACTIVE_HAS_WRONG_ORIGINATOR_STRING \
212  "A Confirm Active PDU (section 2.2.1.13.2) was received from the client with an invalid " \
213  "originatorId field."
214 
215 #define ERRINFO_PERSISTENT_KEY_PDU_BAD_LENGTH_STRING \
216  "There is not enough data to process a Persistent Key List PDU (section 2.2.1.17)."
217 
218 #define ERRINFO_PERSISTENT_KEY_PDU_ILLEGAL_FIRST_STRING \
219  "A Persistent Key List PDU (section 2.2.1.17) marked as PERSIST_PDU_FIRST (0x01) was " \
220  "received after the reception " \
221  "of a prior Persistent Key List PDU also marked as PERSIST_PDU_FIRST."
222 
223 #define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_TOTAL_KEYS_STRING \
224  "A Persistent Key List PDU (section 2.2.1.17) was received which specified a total number of " \
225  "bitmap cache entries larger than 262144."
226 
227 #define ERRINFO_PERSISTENT_KEY_PDU_TOO_MANY_CACHE_KEYS_STRING \
228  "A Persistent Key List PDU (section 2.2.1.17) was received which specified an invalid total " \
229  "number of keys for a bitmap cache " \
230  "(the number of entries that can be stored within each bitmap cache is specified in the " \
231  "Revision 1 or 2 Bitmap Cache Capability Set " \
232  "(section 2.2.7.1.4) that is sent from client to server)."
233 
234 #define ERRINFO_INPUT_PDU_BAD_LENGTH_STRING \
235  "There is not enough data to process Input Event PDU Data (section 2.2.8.1.1.3.1) or a " \
236  "Fast-Path Input Event PDU (section 2.2.8.1.2)."
237 
238 #define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH_STRING \
239  "There is not enough data to process the shareDataHeader, NumInfoBlocks, " \
240  "Pad1, and Pad2 fields of the Bitmap Cache Error PDU Data ([MS-RDPEGDI] section 2.2.2.3.1.1)."
241 
242 #define ERRINFO_SECURITY_DATA_TOO_SHORT_STRING \
243  "(a) The dataSignature field of the Fast-Path Input Event PDU (section 2.2.8.1.2) does not " \
244  "contain enough data.\n" \
245  "(b) The fipsInformation and dataSignature fields of the Fast-Path Input Event PDU (section " \
246  "2.2.8.1.2) do not contain enough data."
247 
248 #define ERRINFO_VCHANNEL_DATA_TOO_SHORT_STRING \
249  "(a) There is not enough data in the Client Network Data (section 2.2.1.3.4) to read the " \
250  "virtual channel configuration data.\n" \
251  "(b) There is not enough data to read a complete Channel PDU Header (section 2.2.6.1.1)."
252 
253 #define ERRINFO_SHARE_DATA_TOO_SHORT_STRING \
254  "(a) There is not enough data to process Control PDU Data (section 2.2.1.15.1).\n" \
255  "(b) There is not enough data to read a complete Share Control Header (section " \
256  "2.2.8.1.1.1.1).\n" \
257  "(c) There is not enough data to read a complete Share Data Header (section 2.2.8.1.1.1.2) " \
258  "of a Slow-Path Data PDU (section 2.2.8.1.1.1.1).\n" \
259  "(d) There is not enough data to process Font List PDU Data (section 2.2.1.18.1)."
260 
261 #define ERRINFO_BAD_SUPPRESS_OUTPUT_PDU_STRING \
262  "(a) There is not enough data to process Suppress Output PDU Data (section 2.2.11.3.1).\n" \
263  "(b) The allowDisplayUpdates field of the Suppress Output PDU Data (section 2.2.11.3.1) is " \
264  "invalid."
265 
266 #define ERRINFO_CONFIRM_ACTIVE_PDU_TOO_SHORT_STRING \
267  "(a) There is not enough data to read the shareControlHeader, shareId, originatorId, " \
268  "lengthSourceDescriptor, " \
269  "and lengthCombinedCapabilities fields of the Confirm Active PDU Data (section " \
270  "2.2.1.13.2.1).\n" \
271  "(b) There is not enough data to read the sourceDescriptor, numberCapabilities, pad2Octets, " \
272  "and capabilitySets " \
273  "fields of the Confirm Active PDU Data (section 2.2.1.13.2.1)."
274 
275 #define ERRINFO_CAPABILITY_SET_TOO_SMALL_STRING \
276  "There is not enough data to read the capabilitySetType and the lengthCapability fields in a " \
277  "received Capability Set (section 2.2.1.13.1.1.1)."
278 
279 #define ERRINFO_CAPABILITY_SET_TOO_LARGE_STRING \
280  "A Capability Set (section 2.2.1.13.1.1.1) has been received with a lengthCapability " \
281  "field that contains a value greater than the total length of the data received."
282 
283 #define ERRINFO_NO_CURSOR_CACHE_STRING \
284  "(a) Both the colorPointerCacheSize and pointerCacheSize fields in the Pointer Capability " \
285  "Set (section 2.2.7.1.5) are set to zero.\n" \
286  "(b) The pointerCacheSize field in the Pointer Capability Set (section 2.2.7.1.5) is not " \
287  "present, and the colorPointerCacheSize field is set to zero."
288 
289 #define ERRINFO_BAD_CAPABILITIES_STRING \
290  "The capabilities received from the client in the Confirm Active PDU (section 2.2.1.13.2) " \
291  "were not accepted by the server."
292 
293 #define ERRINFO_VIRTUAL_CHANNEL_DECOMPRESSION_STRING \
294  "An error occurred while using the bulk compressor (section 3.1.8 and [MS-RDPEGDI] section " \
295  "3.1.8) to decompress a Virtual Channel PDU (section 2.2.6.1)"
296 
297 #define ERRINFO_INVALID_VC_COMPRESSION_TYPE_STRING \
298  "An invalid bulk compression package was specified in the flags field of the Channel PDU " \
299  "Header (section 2.2.6.1.1)."
300 
301 #define ERRINFO_INVALID_CHANNEL_ID_STRING \
302  "An invalid MCS channel ID was specified in the mcsPdu field of the Virtual Channel PDU " \
303  "(section 2.2.6.1)."
304 
305 #define ERRINFO_VCHANNELS_TOO_MANY_STRING \
306  "The client requested more than the maximum allowed 31 static virtual channels in the Client " \
307  "Network Data (section 2.2.1.3.4)."
308 
309 #define ERRINFO_REMOTEAPP_NOT_ENABLED_STRING \
310  "The INFO_RAIL flag (0x00008000) MUST be set in the flags field of the Info Packet (section " \
311  "2.2.1.11.1.1) " \
312  "as the session on the remote server can only host remote applications."
313 
314 #define ERRINFO_CACHE_CAP_NOT_SET_STRING \
315  "The client sent a Persistent Key List PDU (section 2.2.1.17) without including the " \
316  "prerequisite Revision 2 Bitmap Cache " \
317  "Capability Set (section 2.2.7.1.4.2) in the Confirm Active PDU (section 2.2.1.13.2)."
318 
319 #define ERRINFO_BITMAP_CACHE_ERROR_PDU_BAD_LENGTH2_STRING \
320  "The NumInfoBlocks field in the Bitmap Cache Error PDU Data is inconsistent with the amount " \
321  "of data in the " \
322  "Info field ([MS-RDPEGDI] section 2.2.2.3.1.1)."
323 
324 #define ERRINFO_OFFSCREEN_CACHE_ERROR_PDU_BAD_LENGTH_STRING \
325  "There is not enough data to process an Offscreen Bitmap Cache Error PDU ([MS-RDPEGDI] " \
326  "section 2.2.2.3.2)."
327 
328 #define ERRINFO_DRAWNINEGRID_CACHE_ERROR_PDU_BAD_LENGTH_STRING \
329  "There is not enough data to process a DrawNineGrid Cache Error PDU ([MS-RDPEGDI] section " \
330  "2.2.2.3.3)."
331 
332 #define ERRINFO_GDIPLUS_PDU_BAD_LENGTH_STRING \
333  "There is not enough data to process a GDI+ Error PDU ([MS-RDPEGDI] section 2.2.2.3.4)."
334 
335 #define ERRINFO_SECURITY_DATA_TOO_SHORT2_STRING \
336  "There is not enough data to read a Basic Security Header (section 2.2.8.1.1.2.1)."
337 
338 #define ERRINFO_SECURITY_DATA_TOO_SHORT3_STRING \
339  "There is not enough data to read a Non-FIPS Security Header (section 2.2.8.1.1.2.2) or FIPS " \
340  "Security Header (section 2.2.8.1.1.2.3)."
341 
342 #define ERRINFO_SECURITY_DATA_TOO_SHORT4_STRING \
343  "There is not enough data to read the basicSecurityHeader and length fields of the Security " \
344  "Exchange PDU Data (section 2.2.1.10.1)."
345 
346 #define ERRINFO_SECURITY_DATA_TOO_SHORT5_STRING \
347  "There is not enough data to read the CodePage, flags, cbDomain, cbUserName, cbPassword, " \
348  "cbAlternateShell, " \
349  "cbWorkingDir, Domain, UserName, Password, AlternateShell, and WorkingDir fields in the Info " \
350  "Packet (section 2.2.1.11.1.1)."
351 
352 #define ERRINFO_SECURITY_DATA_TOO_SHORT6_STRING \
353  "There is not enough data to read the CodePage, flags, cbDomain, cbUserName, cbPassword, " \
354  "cbAlternateShell, " \
355  "and cbWorkingDir fields in the Info Packet (section 2.2.1.11.1.1)."
356 
357 #define ERRINFO_SECURITY_DATA_TOO_SHORT7_STRING \
358  "There is not enough data to read the clientAddressFamily and cbClientAddress fields in the " \
359  "Extended Info Packet (section 2.2.1.11.1.1.1)."
360 
361 #define ERRINFO_SECURITY_DATA_TOO_SHORT8_STRING \
362  "There is not enough data to read the clientAddress field in the Extended Info Packet " \
363  "(section 2.2.1.11.1.1.1)."
364 
365 #define ERRINFO_SECURITY_DATA_TOO_SHORT9_STRING \
366  "There is not enough data to read the cbClientDir field in the Extended Info Packet (section " \
367  "2.2.1.11.1.1.1)."
368 
369 #define ERRINFO_SECURITY_DATA_TOO_SHORT10_STRING \
370  "There is not enough data to read the clientDir field in the Extended Info Packet (section " \
371  "2.2.1.11.1.1.1)."
372 
373 #define ERRINFO_SECURITY_DATA_TOO_SHORT11_STRING \
374  "There is not enough data to read the clientTimeZone field in the Extended Info Packet " \
375  "(section 2.2.1.11.1.1.1)."
376 
377 #define ERRINFO_SECURITY_DATA_TOO_SHORT12_STRING \
378  "There is not enough data to read the clientSessionId field in the Extended Info Packet " \
379  "(section 2.2.1.11.1.1.1)."
380 
381 #define ERRINFO_SECURITY_DATA_TOO_SHORT13_STRING \
382  "There is not enough data to read the performanceFlags field in the Extended Info Packet " \
383  "(section 2.2.1.11.1.1.1)."
384 
385 #define ERRINFO_SECURITY_DATA_TOO_SHORT14_STRING \
386  "There is not enough data to read the cbAutoReconnectLen field in the Extended Info Packet " \
387  "(section 2.2.1.11.1.1.1)."
388 
389 #define ERRINFO_SECURITY_DATA_TOO_SHORT15_STRING \
390  "There is not enough data to read the autoReconnectCookie field in the Extended Info Packet " \
391  "(section 2.2.1.11.1.1.1)."
392 
393 #define ERRINFO_SECURITY_DATA_TOO_SHORT16_STRING \
394  "The cbAutoReconnectLen field in the Extended Info Packet (section 2.2.1.11.1.1.1) contains " \
395  "a value " \
396  "which is larger than the maximum allowed length of 128 bytes."
397 
398 #define ERRINFO_SECURITY_DATA_TOO_SHORT17_STRING \
399  "There is not enough data to read the clientAddressFamily and cbClientAddress fields in the " \
400  "Extended Info Packet (section 2.2.1.11.1.1.1)."
401 
402 #define ERRINFO_SECURITY_DATA_TOO_SHORT18_STRING \
403  "There is not enough data to read the clientAddress field in the Extended Info Packet " \
404  "(section 2.2.1.11.1.1.1)."
405 
406 #define ERRINFO_SECURITY_DATA_TOO_SHORT19_STRING \
407  "There is not enough data to read the cbClientDir field in the Extended Info Packet (section " \
408  "2.2.1.11.1.1.1)."
409 
410 #define ERRINFO_SECURITY_DATA_TOO_SHORT20_STRING \
411  "There is not enough data to read the clientDir field in the Extended Info Packet (section " \
412  "2.2.1.11.1.1.1)."
413 
414 #define ERRINFO_SECURITY_DATA_TOO_SHORT21_STRING \
415  "There is not enough data to read the clientTimeZone field in the Extended Info Packet " \
416  "(section 2.2.1.11.1.1.1)."
417 
418 #define ERRINFO_SECURITY_DATA_TOO_SHORT22_STRING \
419  "There is not enough data to read the clientSessionId field in the Extended Info Packet " \
420  "(section 2.2.1.11.1.1.1)."
421 
422 #define ERRINFO_SECURITY_DATA_TOO_SHORT23_STRING \
423  "There is not enough data to read the Client Info PDU Data (section 2.2.1.11.1)."
424 
425 #define ERRINFO_BAD_MONITOR_DATA_STRING \
426  "The monitorCount field in the Client Monitor Data (section 2.2.1.3.6) is invalid."
427 
428 #define ERRINFO_VC_DECOMPRESSED_REASSEMBLE_FAILED_STRING \
429  "The server-side decompression buffer is invalid, or the size of the decompressed VC data " \
430  "exceeds " \
431  "the chunking size specified in the Virtual Channel Capability Set (section 2.2.7.1.10)."
432 
433 #define ERRINFO_VC_DATA_TOO_LONG_STRING \
434  "The size of a received Virtual Channel PDU (section 2.2.6.1) exceeds the chunking size " \
435  "specified " \
436  "in the Virtual Channel Capability Set (section 2.2.7.1.10)."
437 
438 #define ERRINFO_BAD_FRAME_ACK_DATA_STRING \
439  "There is not enough data to read a TS_FRAME_ACKNOWLEDGE_PDU ([MS-RDPRFX] section 2.2.3.1)."
440 
441 #define ERRINFO_GRAPHICS_MODE_NOT_SUPPORTED_STRING \
442  "The graphics mode requested by the client is not supported by the server."
443 
444 #define ERRINFO_GRAPHICS_SUBSYSTEM_RESET_FAILED_STRING \
445  "The server-side graphics subsystem failed to reset."
446 
447 #define ERRINFO_GRAPHICS_SUBSYSTEM_FAILED_STRING \
448  "The server-side graphics subsystem is in an error state and unable to continue graphics " \
449  "encoding."
450 
451 #define ERRINFO_TIMEZONE_KEY_NAME_LENGTH_TOO_SHORT_STRING \
452  "There is not enough data to read the cbDynamicDSTTimeZoneKeyName field in the Extended Info " \
453  "Packet (section 2.2.1.11.1.1.1)."
454 
455 #define ERRINFO_TIMEZONE_KEY_NAME_LENGTH_TOO_LONG_STRING \
456  "The length reported in the cbDynamicDSTTimeZoneKeyName field of the Extended Info Packet " \
457  "(section 2.2.1.11.1.1.1) is too long."
458 
459 #define ERRINFO_DYNAMIC_DST_DISABLED_FIELD_MISSING_STRING \
460  "The dynamicDaylightTimeDisabled field is not present in the Extended Info Packet (section " \
461  "2.2.1.11.1.1.1)."
462 
463 #define ERRINFO_VC_DECODING_ERROR_STRING \
464  "An error occurred when processing dynamic virtual channel data ([MS-RDPEDYC] section 3.3.5)."
465 
466 #define ERRINFO_VIRTUALDESKTOPTOOLARGE_STRING \
467  "The width or height of the virtual desktop defined by the monitor layout in the Client " \
468  "Monitor Data " \
469  "(section 2.2.1.3.6) is larger than the maximum allowed value of 32,766."
470 
471 #define ERRINFO_MONITORGEOMETRYVALIDATIONFAILED_STRING \
472  "The monitor geometry defined by the Client Monitor Data (section 2.2.1.3.6) is invalid."
473 
474 #define ERRINFO_INVALIDMONITORCOUNT_STRING \
475  "The monitorCount field in the Client Monitor Data(section 2.2.1.3.6) is too large."
476 
477 #define ERRINFO_UPDATE_SESSION_KEY_FAILED_STRING \
478  "An attempt to update the session keys while using Standard RDP Security mechanisms (section " \
479  "5.3.7) failed."
480 
481 #define ERRINFO_DECRYPT_FAILED_STRING \
482  "(a) Decryption using Standard RDP Security mechanisms (section 5.3.6) failed.\n" \
483  "(b) Session key creation using Standard RDP Security mechanisms (section 5.3.5) failed."
484 
485 #define ERRINFO_ENCRYPT_FAILED_STRING \
486  "Encryption using Standard RDP Security mechanisms (section 5.3.6) failed."
487 
488 #define ERRINFO_ENCRYPTION_PACKAGE_MISMATCH_STRING \
489  "Failed to find a usable Encryption Method (section 5.3.2) in the encryptionMethods field of " \
490  "the Client Security Data (section 2.2.1.4.3)."
491 
492 #define ERRINFO_DECRYPT_FAILED2_STRING \
493  "Unencrypted data was encountered in a protocol stream which is meant to be encrypted with " \
494  "Standard RDP Security mechanisms (section 5.3.6)."
495 
496 #define ERRINFO_PEER_DISCONNECTED_STRING "The peer connection was lost."
497 
498 /* Special codes */
499 #define ERRINFO_SUCCESS_STRING "Success."
500 #define ERRINFO_NONE_STRING ""
501 
502 static const ERRINFO ERRINFO_CODES[] = {
503  ERRINFO_DEFINE(SUCCESS, CAT_NONE),
504 
505  /* Protocol-independent codes */
506  ERRINFO_DEFINE(RPC_INITIATED_DISCONNECT, CAT_ADMIN),
507  ERRINFO_DEFINE(RPC_INITIATED_LOGOFF, CAT_ADMIN), ERRINFO_DEFINE(IDLE_TIMEOUT, CAT_ADMIN),
508  ERRINFO_DEFINE(LOGON_TIMEOUT, CAT_ADMIN),
509  ERRINFO_DEFINE(DISCONNECTED_BY_OTHER_CONNECTION, CAT_USE),
510  ERRINFO_DEFINE(OUT_OF_MEMORY, CAT_ADMIN), ERRINFO_DEFINE(SERVER_DENIED_CONNECTION, CAT_ADMIN),
511  ERRINFO_DEFINE(SERVER_INSUFFICIENT_PRIVILEGES, CAT_ADMIN),
512  ERRINFO_DEFINE(SERVER_FRESH_CREDENTIALS_REQUIRED, CAT_ADMIN),
513  ERRINFO_DEFINE(RPC_INITIATED_DISCONNECT_BY_USER, CAT_ADMIN),
514  ERRINFO_DEFINE(LOGOFF_BY_USER, CAT_USE),
515  ERRINFO_DEFINE(CLOSE_STACK_ON_DRIVER_NOT_READY, CAT_SERVER),
516  ERRINFO_DEFINE(SERVER_DWM_CRASH, CAT_SERVER),
517  ERRINFO_DEFINE(CLOSE_STACK_ON_DRIVER_FAILURE, CAT_SERVER),
518  ERRINFO_DEFINE(CLOSE_STACK_ON_DRIVER_IFACE_FAILURE, CAT_SERVER),
519  ERRINFO_DEFINE(SERVER_WINLOGON_CRASH, CAT_SERVER),
520  ERRINFO_DEFINE(SERVER_CSRSS_CRASH, CAT_SERVER),
521 
522  /* Protocol-independent licensing codes */
523  ERRINFO_DEFINE(LICENSE_INTERNAL, CAT_LICENSING),
524  ERRINFO_DEFINE(LICENSE_NO_LICENSE_SERVER, CAT_LICENSING),
525  ERRINFO_DEFINE(LICENSE_NO_LICENSE, CAT_LICENSING),
526  ERRINFO_DEFINE(LICENSE_BAD_CLIENT_MSG, CAT_LICENSING),
527  ERRINFO_DEFINE(LICENSE_HWID_DOESNT_MATCH_LICENSE, CAT_LICENSING),
528  ERRINFO_DEFINE(LICENSE_BAD_CLIENT_LICENSE, CAT_LICENSING),
529  ERRINFO_DEFINE(LICENSE_CANT_FINISH_PROTOCOL, CAT_LICENSING),
530  ERRINFO_DEFINE(LICENSE_CLIENT_ENDED_PROTOCOL, CAT_LICENSING),
531  ERRINFO_DEFINE(LICENSE_BAD_CLIENT_ENCRYPTION, CAT_LICENSING),
532  ERRINFO_DEFINE(LICENSE_CANT_UPGRADE_LICENSE, CAT_LICENSING),
533  ERRINFO_DEFINE(LICENSE_NO_REMOTE_CONNECTIONS, CAT_LICENSING),
534 
535  /* Protocol-independent codes generated by the Connection Broker */
536  ERRINFO_DEFINE(CB_DESTINATION_NOT_FOUND, CAT_BROKER),
537  ERRINFO_DEFINE(CB_LOADING_DESTINATION, CAT_BROKER),
538  ERRINFO_DEFINE(CB_REDIRECTING_TO_DESTINATION, CAT_BROKER),
539  ERRINFO_DEFINE(CB_SESSION_ONLINE_VM_WAKE, CAT_BROKER),
540  ERRINFO_DEFINE(CB_SESSION_ONLINE_VM_BOOT, CAT_BROKER),
541  ERRINFO_DEFINE(CB_SESSION_ONLINE_VM_NO_DNS, CAT_BROKER),
542  ERRINFO_DEFINE(CB_DESTINATION_POOL_NOT_FREE, CAT_BROKER),
543  ERRINFO_DEFINE(CB_CONNECTION_CANCELLED, CAT_BROKER),
544  ERRINFO_DEFINE(CB_CONNECTION_ERROR_INVALID_SETTINGS, CAT_BROKER),
545  ERRINFO_DEFINE(CB_SESSION_ONLINE_VM_BOOT_TIMEOUT, CAT_BROKER),
546  ERRINFO_DEFINE(CB_SESSION_ONLINE_VM_SESSMON_FAILED, CAT_BROKER),
547 
548  /* RDP specific codes */
549  ERRINFO_DEFINE(UNKNOWN_DATA_PDU_TYPE, CAT_PROTOCOL),
550  ERRINFO_DEFINE(UNKNOWN_PDU_TYPE, CAT_PROTOCOL), ERRINFO_DEFINE(DATA_PDU_SEQUENCE, CAT_PROTOCOL),
551  ERRINFO_DEFINE(CONTROL_PDU_SEQUENCE, CAT_PROTOCOL),
552  ERRINFO_DEFINE(INVALID_CONTROL_PDU_ACTION, CAT_PROTOCOL),
553  ERRINFO_DEFINE(INVALID_INPUT_PDU_TYPE, CAT_PROTOCOL),
554  ERRINFO_DEFINE(INVALID_INPUT_PDU_MOUSE, CAT_PROTOCOL),
555  ERRINFO_DEFINE(INVALID_REFRESH_RECT_PDU, CAT_PROTOCOL),
556  ERRINFO_DEFINE(CREATE_USER_DATA_FAILED, CAT_PROTOCOL), ERRINFO_DEFINE(CONNECT_FAILED, CAT_USE),
557  ERRINFO_DEFINE(CONFIRM_ACTIVE_HAS_WRONG_SHAREID, CAT_PROTOCOL),
558  ERRINFO_DEFINE(CONFIRM_ACTIVE_HAS_WRONG_ORIGINATOR, CAT_PROTOCOL),
559  ERRINFO_DEFINE(PERSISTENT_KEY_PDU_BAD_LENGTH, CAT_PROTOCOL),
560  ERRINFO_DEFINE(PERSISTENT_KEY_PDU_ILLEGAL_FIRST, CAT_PROTOCOL),
561  ERRINFO_DEFINE(PERSISTENT_KEY_PDU_TOO_MANY_TOTAL_KEYS, CAT_PROTOCOL),
562  ERRINFO_DEFINE(PERSISTENT_KEY_PDU_TOO_MANY_CACHE_KEYS, CAT_PROTOCOL),
563  ERRINFO_DEFINE(INPUT_PDU_BAD_LENGTH, CAT_PROTOCOL),
564  ERRINFO_DEFINE(BITMAP_CACHE_ERROR_PDU_BAD_LENGTH, CAT_PROTOCOL),
565  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT, CAT_PROTOCOL),
566  ERRINFO_DEFINE(VCHANNEL_DATA_TOO_SHORT, CAT_PROTOCOL),
567  ERRINFO_DEFINE(SHARE_DATA_TOO_SHORT, CAT_PROTOCOL),
568  ERRINFO_DEFINE(BAD_SUPPRESS_OUTPUT_PDU, CAT_PROTOCOL),
569  ERRINFO_DEFINE(CONFIRM_ACTIVE_PDU_TOO_SHORT, CAT_PROTOCOL),
570  ERRINFO_DEFINE(CAPABILITY_SET_TOO_SMALL, CAT_PROTOCOL),
571  ERRINFO_DEFINE(CAPABILITY_SET_TOO_LARGE, CAT_PROTOCOL),
572  ERRINFO_DEFINE(NO_CURSOR_CACHE, CAT_PROTOCOL), ERRINFO_DEFINE(BAD_CAPABILITIES, CAT_PROTOCOL),
573  ERRINFO_DEFINE(VIRTUAL_CHANNEL_DECOMPRESSION, CAT_PROTOCOL),
574  ERRINFO_DEFINE(INVALID_VC_COMPRESSION_TYPE, CAT_PROTOCOL),
575  ERRINFO_DEFINE(INVALID_CHANNEL_ID, CAT_PROTOCOL),
576  ERRINFO_DEFINE(VCHANNELS_TOO_MANY, CAT_PROTOCOL),
577  ERRINFO_DEFINE(REMOTEAPP_NOT_ENABLED, CAT_ADMIN),
578  ERRINFO_DEFINE(CACHE_CAP_NOT_SET, CAT_PROTOCOL),
579  ERRINFO_DEFINE(BITMAP_CACHE_ERROR_PDU_BAD_LENGTH2, CAT_PROTOCOL),
580  ERRINFO_DEFINE(OFFSCREEN_CACHE_ERROR_PDU_BAD_LENGTH, CAT_PROTOCOL),
581  ERRINFO_DEFINE(DRAWNINEGRID_CACHE_ERROR_PDU_BAD_LENGTH, CAT_PROTOCOL),
582  ERRINFO_DEFINE(GDIPLUS_PDU_BAD_LENGTH, CAT_PROTOCOL),
583  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT2, CAT_PROTOCOL),
584  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT3, CAT_PROTOCOL),
585  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT4, CAT_PROTOCOL),
586  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT5, CAT_PROTOCOL),
587  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT6, CAT_PROTOCOL),
588  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT7, CAT_PROTOCOL),
589  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT8, CAT_PROTOCOL),
590  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT9, CAT_PROTOCOL),
591  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT10, CAT_PROTOCOL),
592  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT11, CAT_PROTOCOL),
593  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT12, CAT_PROTOCOL),
594  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT13, CAT_PROTOCOL),
595  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT14, CAT_PROTOCOL),
596  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT15, CAT_PROTOCOL),
597  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT16, CAT_PROTOCOL),
598  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT17, CAT_PROTOCOL),
599  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT18, CAT_PROTOCOL),
600  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT19, CAT_PROTOCOL),
601  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT20, CAT_PROTOCOL),
602  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT21, CAT_PROTOCOL),
603  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT22, CAT_PROTOCOL),
604  ERRINFO_DEFINE(SECURITY_DATA_TOO_SHORT23, CAT_PROTOCOL),
605  ERRINFO_DEFINE(BAD_MONITOR_DATA, CAT_PROTOCOL),
606  ERRINFO_DEFINE(VC_DECOMPRESSED_REASSEMBLE_FAILED, CAT_PROTOCOL),
607  ERRINFO_DEFINE(VC_DATA_TOO_LONG, CAT_PROTOCOL),
608  ERRINFO_DEFINE(BAD_FRAME_ACK_DATA, CAT_PROTOCOL),
609  ERRINFO_DEFINE(GRAPHICS_MODE_NOT_SUPPORTED, CAT_SERVER),
610  ERRINFO_DEFINE(GRAPHICS_SUBSYSTEM_RESET_FAILED, CAT_SERVER),
611  ERRINFO_DEFINE(GRAPHICS_SUBSYSTEM_FAILED, CAT_SERVER),
612  ERRINFO_DEFINE(TIMEZONE_KEY_NAME_LENGTH_TOO_SHORT, CAT_PROTOCOL),
613  ERRINFO_DEFINE(TIMEZONE_KEY_NAME_LENGTH_TOO_LONG, CAT_PROTOCOL),
614  ERRINFO_DEFINE(DYNAMIC_DST_DISABLED_FIELD_MISSING, CAT_PROTOCOL),
615  ERRINFO_DEFINE(VC_DECODING_ERROR, CAT_PROTOCOL),
616  ERRINFO_DEFINE(VIRTUALDESKTOPTOOLARGE, CAT_SERVER),
617  ERRINFO_DEFINE(MONITORGEOMETRYVALIDATIONFAILED, CAT_PROTOCOL),
618  ERRINFO_DEFINE(INVALIDMONITORCOUNT, CAT_PROTOCOL),
619  ERRINFO_DEFINE(UPDATE_SESSION_KEY_FAILED, CAT_PROTOCOL),
620  ERRINFO_DEFINE(DECRYPT_FAILED, CAT_PROTOCOL), ERRINFO_DEFINE(ENCRYPT_FAILED, CAT_PROTOCOL),
621  ERRINFO_DEFINE(ENCRYPTION_PACKAGE_MISMATCH, CAT_PROTOCOL),
622  ERRINFO_DEFINE(DECRYPT_FAILED2, CAT_PROTOCOL), ERRINFO_DEFINE(PEER_DISCONNECTED, CAT_USE),
623 
624  ERRINFO_DEFINE(NONE, CAT_NONE)
625 };
626 
627 const char* freerdp_get_error_info_string(UINT32 code)
628 {
629  const ERRINFO* errInfo = NULL;
630  errInfo = &ERRINFO_CODES[0];
631 
632  while (errInfo->code != ERRINFO_NONE)
633  {
634  if (code == errInfo->code)
635  {
636  return errInfo->info;
637  }
638 
639  errInfo++;
640  }
641 
642  return "Unknown error.";
643 }
644 
645 const char* freerdp_get_error_info_category(UINT32 code)
646 {
647  const ERRINFO* errInfo = NULL;
648  errInfo = &ERRINFO_CODES[0];
649 
650  while (errInfo->code != ERRINFO_NONE)
651  {
652  if (code == errInfo->code)
653  {
654  return errInfo->category;
655  }
656 
657  errInfo++;
658  }
659 
660  return "ERRINFO_UNKNOWN";
661 }
662 
663 const char* freerdp_get_error_info_name(UINT32 code)
664 {
665  const ERRINFO* errInfo = NULL;
666  errInfo = &ERRINFO_CODES[0];
667 
668  while (errInfo->code != ERRINFO_NONE)
669  {
670  if (code == errInfo->code)
671  {
672  return errInfo->name;
673  }
674 
675  errInfo++;
676  }
677 
678  return "ERRINFO_UNKNOWN";
679 }
680 
681 void rdp_print_errinfo(UINT32 code)
682 {
683  const ERRINFO* errInfo = NULL;
684  errInfo = &ERRINFO_CODES[0];
685 
686  while (errInfo->code != ERRINFO_NONE)
687  {
688  if (code == errInfo->code)
689  {
690  WLog_INFO(TAG, "%s (0x%08" PRIX32 "):%s", errInfo->name, code, errInfo->info);
691  return;
692  }
693 
694  errInfo++;
695  }
696 
697  WLog_ERR(TAG, "ERRINFO_UNKNOWN 0x%08" PRIX32 ": Unknown error.", code);
698 }