X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/a5751e2d5bb140a640ecf1810f45cf7c70028ac3..e02b0bc2a713edfdf9bf183ca6561a6768483eba:/printing.c diff --git a/printing.c b/printing.c index 964f4b52..17bf6ffa 100644 --- a/printing.c +++ b/printing.c @@ -39,9 +39,13 @@ static char *printer_add_enum(int param, char *buffer, buffer = srealloc(buffer, offset+512); - if (EnumPrinters(param, NULL, ENUM_LEVEL, buffer+offset, - 512, &needed, &nprinters) == 0) - return NULL; + /* + * Exploratory call to EnumPrinters to determine how much space + * we'll need for the output. Discard the return value since it + * will almost certainly be a failure due to lack of space. + */ + EnumPrinters(param, NULL, ENUM_LEVEL, buffer+offset, 512, + &needed, &nprinters); if (needed < 512) needed = 512;