libfreerdp-core: export function to retrieve error info from static entry table
This commit is contained in:
parent
1d2bedd95d
commit
d8cdac44f1
@ -20,6 +20,10 @@
|
|||||||
#ifndef FREERDP_ERROR_H
|
#ifndef FREERDP_ERROR_H
|
||||||
#define FREERDP_ERROR_H
|
#define FREERDP_ERROR_H
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
|
#include <freerdp/api.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -128,6 +132,9 @@ extern "C" {
|
|||||||
#define ERRINFO_SUCCESS 0x00000000
|
#define ERRINFO_SUCCESS 0x00000000
|
||||||
#define ERRINFO_NONE 0xFFFFFFFF
|
#define ERRINFO_NONE 0xFFFFFFFF
|
||||||
|
|
||||||
|
FREERDP_API const char* freerdp_get_error_info_string(UINT32 code);
|
||||||
|
FREERDP_API const char* freerdp_get_error_info_name(UINT32 code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This static variable holds an error code if the return value from connect is FALSE.
|
* This static variable holds an error code if the return value from connect is FALSE.
|
||||||
* This variable is always set to 0 in the beginning of the connect sequence.
|
* This variable is always set to 0 in the beginning of the connect sequence.
|
||||||
|
@ -443,6 +443,44 @@ static const ERRINFO ERRINFO_CODES[] =
|
|||||||
ERRINFO_DEFINE(NONE)
|
ERRINFO_DEFINE(NONE)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* freerdp_get_error_info_string(UINT32 code)
|
||||||
|
{
|
||||||
|
const ERRINFO* errInfo;
|
||||||
|
|
||||||
|
errInfo = &ERRINFO_CODES[0];
|
||||||
|
|
||||||
|
while (errInfo->code != ERRINFO_NONE)
|
||||||
|
{
|
||||||
|
if (code == errInfo->code)
|
||||||
|
{
|
||||||
|
return errInfo->info;
|
||||||
|
}
|
||||||
|
|
||||||
|
errInfo++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Unknown error.";
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* freerdp_get_error_info_name(UINT32 code)
|
||||||
|
{
|
||||||
|
const ERRINFO* errInfo;
|
||||||
|
|
||||||
|
errInfo = &ERRINFO_CODES[0];
|
||||||
|
|
||||||
|
while (errInfo->code != ERRINFO_NONE)
|
||||||
|
{
|
||||||
|
if (code == errInfo->code)
|
||||||
|
{
|
||||||
|
return errInfo->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
errInfo++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "ERRINFO_UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
void rdp_print_errinfo(UINT32 code)
|
void rdp_print_errinfo(UINT32 code)
|
||||||
{
|
{
|
||||||
const ERRINFO* errInfo;
|
const ERRINFO* errInfo;
|
||||||
|
Loading…
Reference in New Issue
Block a user