Added function WTSErrorToString to get a string from an error code.

This commit is contained in:
Armin Novak 2015-01-20 11:03:21 +01:00
parent 1c227350bd
commit 5075aec5a2
2 changed files with 73 additions and 0 deletions

View File

@ -1357,6 +1357,7 @@ extern "C" {
#endif
WINPR_API BOOL WTSRegisterWtsApiFunctionTable(PWtsApiFunctionTable table);
WINPR_API const CHAR* WTSErrorToString(UINT error);
#ifdef __cplusplus
}

View File

@ -555,6 +555,78 @@ DWORD WINAPI WTSGetActiveConsoleSessionId(void)
#endif
const CHAR* WTSErrorToString(UINT error)
{
switch(error)
{
case CHANNEL_RC_OK:
return "CHANNEL_RC_OK";
case CHANNEL_RC_ALREADY_INITIALIZED:
return "CHANNEL_RC_ALREADY_INITIALIZED";
case CHANNEL_RC_NOT_INITIALIZED:
return "CHANNEL_RC_NOT_INITIALIZED";
case CHANNEL_RC_ALREADY_CONNECTED:
return "CHANNEL_RC_ALREADY_CONNECTED";
case CHANNEL_RC_NOT_CONNECTED:
return "CHANNEL_RC_NOT_CONNECTED";
case CHANNEL_RC_TOO_MANY_CHANNELS:
return "CHANNEL_RC_TOO_MANY_CHANNELS";
case CHANNEL_RC_BAD_CHANNEL:
return "CHANNEL_RC_BAD_CHANNEL";
case CHANNEL_RC_BAD_CHANNEL_HANDLE:
return "CHANNEL_RC_BAD_CHANNEL_HANDLE";
case CHANNEL_RC_NO_BUFFER:
return "CHANNEL_RC_NO_BUFFER";
case CHANNEL_RC_BAD_INIT_HANDLE:
return "CHANNEL_RC_BAD_INIT_HANDLE";
case CHANNEL_RC_NOT_OPEN:
return "CHANNEL_RC_NOT_OPEN";
case CHANNEL_RC_BAD_PROC:
return "CHANNEL_RC_BAD_PROC";
case CHANNEL_RC_NO_MEMORY:
return "CHANNEL_RC_NO_MEMORY";
case CHANNEL_RC_UNKNOWN_CHANNEL_NAME:
return "CHANNEL_RC_UNKNOWN_CHANNEL_NAME";
case CHANNEL_RC_ALREADY_OPEN:
return "CHANNEL_RC_ALREADY_OPEN";
case CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY:
return "CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY";
case CHANNEL_RC_NULL_DATA:
return "CHANNEL_RC_NULL_DATA";
case CHANNEL_RC_ZERO_LENGTH:
return "CHANNEL_RC_ZERO_LENGTH";
case CHANNEL_RC_INVALID_INSTANCE:
return "CHANNEL_RC_INVALID_INSTANCE";
case CHANNEL_RC_UNSUPPORTED_VERSION:
return "CHANNEL_RC_UNSUPPORTED_VERSION";
case CHANNEL_RC_INITIALIZATION_ERROR:
return "CHANNEL_RC_INITIALIZATION_ERROR";
default:
return "UNKNOWN";
}
}
BOOL WTSRegisterWtsApiFunctionTable(PWtsApiFunctionTable table)
{
g_WtsApi = table;