Rename constants for disconnect reasons

To make them easier to search for - let's match the names with the
corresponding names on the server side:

https://msdn.microsoft.com/en-us/library/cc240544.aspx
This commit is contained in:
Samuel Mannehed 2017-10-04 09:35:14 +02:00
parent 594438e5eb
commit a6a2120cf7
2 changed files with 54 additions and 50 deletions

View File

@ -540,31 +540,35 @@ enum RDP_INPUT_DEVICE
#define RDPDR_CLIENT_DISPLAY_NAME_PDU 0x00000002 #define RDPDR_CLIENT_DISPLAY_NAME_PDU 0x00000002
#define RDPDR_USER_LOGGEDON_PDU 0x00000004 #define RDPDR_USER_LOGGEDON_PDU 0x00000004
/* RDP5 disconnect PDU */ /* RDP5 disconnect PDU
#define exDiscReasonNoInfo 0x0000 *
#define exDiscReasonAPIInitiatedDisconnect 0x0001 * Named after the corresponding names on the server side:
#define exDiscReasonAPIInitiatedLogoff 0x0002 * https://msdn.microsoft.com/en-us/library/cc240544.aspx
#define exDiscReasonServerIdleTimeout 0x0003 */
#define exDiscReasonServerLogonTimeout 0x0004 #define ERRINFO_NO_INFO 0x0000
#define exDiscReasonReplacedByOtherConnection 0x0005 #define ERRINFO_RPC_INITIATED_DISCONNECT 0x0001
#define exDiscReasonOutOfMemory 0x0006 #define ERRINFO_RPC_INITIATED_LOGOFF 0x0002
#define exDiscReasonServerDeniedConnection 0x0007 #define ERRINFO_IDLE_TIMEOUT 0x0003
#define exDiscReasonServerDeniedConnectionFips 0x0008 #define ERRINFO_LOGON_TIMEOUT 0x0004
#define exDiscReasonServerInsufficientPrivileges 0x0009 #define ERRINFO_DISCONNECTED_BY_OTHERCONNECTION 0x0005
#define exDiscReasonServerFreshCredentialsRequired 0x000a #define ERRINFO_OUT_OF_MEMORY 0x0006
#define exDiscReasonRPCInitiatedDisconnectByUser 0x000b #define ERRINFO_SERVER_DENIED_CONNECTION 0x0007
#define exDiscReasonByUser 0x000c #define ERRINFO_SERVER_DENIED_CONNECTION_FIPS 0x0008
#define exDiscReasonLicenseInternal 0x0100 #define ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES 0x0009
#define exDiscReasonLicenseNoLicenseServer 0x0101 #define ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED 0x000a
#define exDiscReasonLicenseNoLicense 0x0102 #define ERRINFO_RPC_INITIATED_DISCONNECT_BYUSER 0x000b
#define exDiscReasonLicenseErrClientMsg 0x0103 #define ERRINFO_LOGOFF_BYUSER 0x000c
#define exDiscReasonLicenseHwidDoesntMatchLicense 0x0104 #define ERRINFO_LICENSE_INTERNAL 0x0100
#define exDiscReasonLicenseErrClientLicense 0x0105 #define ERRINFO_LICENSE_NO_LICENSE_SERVER 0x0101
#define exDiscReasonLicenseCantFinishProtocol 0x0106 #define ERRINFO_LICENSE_NO_LICENSE 0x0102
#define exDiscReasonLicenseClientEndedProtocol 0x0107 #define ERRINFO_LICENSE_BAD_CLIENT_MSG 0x0103
#define exDiscReasonLicenseErrClientEncryption 0x0108 #define ERRINFO_LICENSE_HWID_DOESNT_MATCH_LICENSE 0x0104
#define exDiscReasonLicenseCantUpgradeLicense 0x0109 #define ERRINFO_LICENSE_BAD_CLIENT_LICENSE 0x0105
#define exDiscReasonLicenseNoRemoteConnections 0x010a #define ERRINFO_LICENSE_CANT_FINISH_PROTOCOL 0x0106
#define ERRINFO_LICENSE_CLIENT_ENDED_PROTOCOL 0x0107
#define ERRINFO_LICENSE_BAD_CLIENT_ENCRYPTION 0x0108
#define ERRINFO_LICENSE_CANT_UPGRADE_LICENSE 0x0109
#define ERRINFO_LICENSE_NO_REMOTE_CONNECTIONS 0x010a
/* SeamlessRDP constants */ /* SeamlessRDP constants */
#define SEAMLESSRDP_NOTYETMAPPED -1 #define SEAMLESSRDP_NOTYETMAPPED -1

View File

@ -266,7 +266,7 @@ handle_disconnect_reason(RD_BOOL deactivated, uint16 reason)
switch (reason) switch (reason)
{ {
case exDiscReasonNoInfo: case ERRINFO_NO_INFO:
text = "No information available"; text = "No information available";
if (deactivated) if (deactivated)
retval = EX_OK; retval = EX_OK;
@ -274,117 +274,117 @@ handle_disconnect_reason(RD_BOOL deactivated, uint16 reason)
retval = EXRD_UNKNOWN; retval = EXRD_UNKNOWN;
break; break;
case exDiscReasonAPIInitiatedDisconnect: case ERRINFO_RPC_INITIATED_DISCONNECT:
text = "Server initiated disconnect"; text = "Server initiated disconnect";
retval = EXRD_API_DISCONNECT; retval = EXRD_API_DISCONNECT;
break; break;
case exDiscReasonAPIInitiatedLogoff: case ERRINFO_RPC_INITIATED_LOGOFF:
text = "Server initiated logoff"; text = "Server initiated logoff";
retval = EXRD_API_LOGOFF; retval = EXRD_API_LOGOFF;
break; break;
case exDiscReasonServerIdleTimeout: case ERRINFO_IDLE_TIMEOUT:
text = "Server idle timeout reached"; text = "Server idle timeout reached";
retval = EXRD_IDLE_TIMEOUT; retval = EXRD_IDLE_TIMEOUT;
break; break;
case exDiscReasonServerLogonTimeout: case ERRINFO_LOGON_TIMEOUT:
text = "Server logon timeout reached"; text = "Server logon timeout reached";
retval = EXRD_LOGON_TIMEOUT; retval = EXRD_LOGON_TIMEOUT;
break; break;
case exDiscReasonReplacedByOtherConnection: case ERRINFO_DISCONNECTED_BY_OTHERCONNECTION:
text = "The session was replaced"; text = "The session was replaced";
retval = EXRD_REPLACED; retval = EXRD_REPLACED;
break; break;
case exDiscReasonOutOfMemory: case ERRINFO_OUT_OF_MEMORY:
text = "The server is out of memory"; text = "The server is out of memory";
retval = EXRD_OUT_OF_MEM; retval = EXRD_OUT_OF_MEM;
break; break;
case exDiscReasonServerDeniedConnection: case ERRINFO_SERVER_DENIED_CONNECTION:
text = "The server denied the connection"; text = "The server denied the connection";
retval = EXRD_DENIED; retval = EXRD_DENIED;
break; break;
case exDiscReasonServerDeniedConnectionFips: case ERRINFO_SERVER_DENIED_CONNECTION_FIPS:
text = "The server denied the connection for security reason"; text = "The server denied the connection for security reason";
retval = EXRD_DENIED_FIPS; retval = EXRD_DENIED_FIPS;
break; break;
case exDiscReasonServerInsufficientPrivileges: case ERRINFO_SERVER_INSUFFICIENT_PRIVILEGES:
text = "The user cannot connect to the server due to insufficient access privileges."; text = "The user cannot connect to the server due to insufficient access privileges.";
retval = EXRD_INSUFFICIENT_PRIVILEGES; retval = EXRD_INSUFFICIENT_PRIVILEGES;
break; break;
case exDiscReasonServerFreshCredentialsRequired: case ERRINFO_SERVER_FRESH_CREDENTIALS_REQUIRED:
text = "The server does not accept saved user credentials and requires that the user enter their credentials for each connection."; text = "The server does not accept saved user credentials and requires that the user enter their credentials for each connection.";
retval = EXRD_FRESH_CREDENTIALS_REQUIRED; retval = EXRD_FRESH_CREDENTIALS_REQUIRED;
break; break;
case exDiscReasonRPCInitiatedDisconnectByUser: case ERRINFO_RPC_INITIATED_DISCONNECT_BYUSER:
text = "Disconnect initiated by administration tool"; text = "Disconnect initiated by administration tool";
retval = EXRD_RPC_DISCONNECT_BY_USER; retval = EXRD_RPC_DISCONNECT_BY_USER;
break; break;
case exDiscReasonByUser: case ERRINFO_LOGOFF_BYUSER:
text = "Disconnect initiated by user"; text = "Disconnect initiated by user";
retval = EXRD_DISCONNECT_BY_USER; retval = EXRD_DISCONNECT_BY_USER;
break; break;
case exDiscReasonLicenseInternal: case ERRINFO_LICENSE_INTERNAL:
text = "Internal licensing error"; text = "Internal licensing error";
retval = EXRD_LIC_INTERNAL; retval = EXRD_LIC_INTERNAL;
break; break;
case exDiscReasonLicenseNoLicenseServer: case ERRINFO_LICENSE_NO_LICENSE_SERVER:
text = "No license server available"; text = "No license server available";
retval = EXRD_LIC_NOSERVER; retval = EXRD_LIC_NOSERVER;
break; break;
case exDiscReasonLicenseNoLicense: case ERRINFO_LICENSE_NO_LICENSE:
text = "No valid license available"; text = "No valid license available";
retval = EXRD_LIC_NOLICENSE; retval = EXRD_LIC_NOLICENSE;
break; break;
case exDiscReasonLicenseErrClientMsg: case ERRINFO_LICENSE_BAD_CLIENT_MSG:
text = "Invalid licensing message"; text = "Invalid licensing message";
retval = EXRD_LIC_MSG; retval = EXRD_LIC_MSG;
break; break;
case exDiscReasonLicenseHwidDoesntMatchLicense: case ERRINFO_LICENSE_HWID_DOESNT_MATCH_LICENSE:
text = "Hardware id doesn't match software license"; text = "Hardware id doesn't match software license";
retval = EXRD_LIC_HWID; retval = EXRD_LIC_HWID;
break; break;
case exDiscReasonLicenseErrClientLicense: case ERRINFO_LICENSE_BAD_CLIENT_LICENSE:
text = "Client license error"; text = "Client license error";
retval = EXRD_LIC_CLIENT; retval = EXRD_LIC_CLIENT;
break; break;
case exDiscReasonLicenseCantFinishProtocol: case ERRINFO_LICENSE_CANT_FINISH_PROTOCOL:
text = "Network error during licensing protocol"; text = "Network error during licensing protocol";
retval = EXRD_LIC_NET; retval = EXRD_LIC_NET;
break; break;
case exDiscReasonLicenseClientEndedProtocol: case ERRINFO_LICENSE_CLIENT_ENDED_PROTOCOL:
text = "Licensing protocol was not completed"; text = "Licensing protocol was not completed";
retval = EXRD_LIC_PROTO; retval = EXRD_LIC_PROTO;
break; break;
case exDiscReasonLicenseErrClientEncryption: case ERRINFO_LICENSE_BAD_CLIENT_ENCRYPTION:
text = "Incorrect client license encryption"; text = "Incorrect client license encryption";
retval = EXRD_LIC_ENC; retval = EXRD_LIC_ENC;
break; break;
case exDiscReasonLicenseCantUpgradeLicense: case ERRINFO_LICENSE_CANT_UPGRADE_LICENSE:
text = "Can't upgrade license"; text = "Can't upgrade license";
retval = EXRD_LIC_UPGRADE; retval = EXRD_LIC_UPGRADE;
break; break;
case exDiscReasonLicenseNoRemoteConnections: case ERRINFO_LICENSE_NO_REMOTE_CONNECTIONS:
text = "The server is not licensed to accept remote connections"; text = "The server is not licensed to accept remote connections";
retval = EXRD_LIC_NOREMOTE; retval = EXRD_LIC_NOREMOTE;
break; break;
@ -400,7 +400,7 @@ handle_disconnect_reason(RD_BOOL deactivated, uint16 reason)
} }
retval = EXRD_UNKNOWN; retval = EXRD_UNKNOWN;
} }
if (reason != exDiscReasonNoInfo) if (reason != ERRINFO_NO_INFO)
fprintf(stderr, "disconnect: %s.\n", text); fprintf(stderr, "disconnect: %s.\n", text);
return retval; return retval;