diff options
Diffstat (limited to 'windows/utils/make_spr_sw_abort_winerror.c')
-rw-r--r-- | windows/utils/make_spr_sw_abort_winerror.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/windows/utils/make_spr_sw_abort_winerror.c b/windows/utils/make_spr_sw_abort_winerror.c new file mode 100644 index 00000000..b05ef61f --- /dev/null +++ b/windows/utils/make_spr_sw_abort_winerror.c @@ -0,0 +1,22 @@ +/* + * Constructor function for a SeatPromptResult of the 'software abort' + * category, whose error message includes the translation of an OS + * error code. + */ + +#include "putty.h" + +static void spr_winerror_errfn(SeatPromptResult spr, BinarySink *bs) +{ + put_fmt(bs, "%s: %s", spr.errdata_lit, win_strerror(spr.errdata_u)); +} + +SeatPromptResult make_spr_sw_abort_winerror(const char *prefix, DWORD error) +{ + SeatPromptResult spr; + spr.kind = SPRK_SW_ABORT; + spr.errfn = spr_winerror_errfn; + spr.errdata_lit = prefix; + spr.errdata_u = error; + return spr; +} |