Skip to content

Commit 492bf9b

Browse files
authored
Merge pull request FreeRDP#11636 from akallabeth/scard
[utils,smartcard] better logging and error checks
2 parents d2395d2 + 6b80a2d commit 492bf9b

File tree

7 files changed

+863
-643
lines changed

7 files changed

+863
-643
lines changed

include/freerdp/utils/rdpdr_utils.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ extern "C"
5151
FREERDP_API const char* rdpdr_cap_type_string(UINT16 capability);
5252

5353
FREERDP_API LONG scard_log_status_error(const char* tag, const char* what, LONG status);
54+
55+
/** @brief log a smartcard related issue with a wLog
56+
*
57+
* @param log The logger to use
58+
* @param what The module affected
59+
* @param status The status to log
60+
*
61+
* @return The \ref status logged
62+
* @since version 3.16.0
63+
*/
64+
FREERDP_API LONG scard_log_status_error_wlog(wLog* log, const char* what, LONG status);
5465
FREERDP_API const char* scard_get_ioctl_string(UINT32 ioControlCode, BOOL funcName);
5566

5667
FREERDP_API BOOL rdpdr_write_iocompletion_header(wStream* out, UINT32 DeviceId,

libfreerdp/utils/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(${MODULE_PREFIX}_SRCS
3232
gfx.c
3333
drdynvc.c
3434
smartcard_operations.c
35+
smartcard_pack.h
3536
smartcard_pack.c
3637
smartcard_call.c
3738
stopwatch.c

libfreerdp/utils/rdpdr_utils.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
#include <freerdp/log.h>
3030

3131
LONG scard_log_status_error(const char* tag, const char* what, LONG status)
32+
{
33+
wLog* log = WLog_Get(tag);
34+
return scard_log_status_error_wlog(log, what, status);
35+
}
36+
37+
LONG scard_log_status_error_wlog(wLog* log, const char* what, LONG status)
3238
{
3339
if (status != SCARD_S_SUCCESS)
3440
{
@@ -44,7 +50,7 @@ LONG scard_log_status_error(const char* tag, const char* what, LONG status)
4450
default:
4551
break;
4652
}
47-
WLog_Print(WLog_Get(tag), level, "%s failed with error %s [%" PRId32 "]", what,
53+
WLog_Print(log, level, "%s failed with error %s [%" PRId32 "]", what,
4854
SCardGetErrorString(status), status);
4955
}
5056
return status;

0 commit comments

Comments
 (0)