Marcus Meissner : winspool.drv: Check return value of EnumPrintersA.

Alexandre Julliard julliard at winehq.org
Thu Dec 2 16:30:53 CST 2010


Module: wine
Branch: stable
Commit: 61a19597ff3c506014d36a16295b41841275dc53
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=61a19597ff3c506014d36a16295b41841275dc53

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Sun Oct 24 11:09:42 2010 +0100

winspool.drv: Check return value of EnumPrintersA.
(cherry picked from commit c7f158824f41f37168222cb09a12c385d98315c3)

---

 dlls/winspool.drv/info.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 8c6486b..407bb2e 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -1010,8 +1010,7 @@ void WINSPOOL_LoadSystemPrinters(void)
        printers AddPrinter takes a while.  So we'll tag all printers that
        were automatically added last time around, if they still exist
        we'll leave them be otherwise we'll delete them. */
-    EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, NULL, 0, &needed, &num);
-    if(needed) {
+    if (EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, NULL, 0, &needed, &num) && needed) {
         PRINTER_INFO_5A* pi = HeapAlloc(GetProcessHeap(), 0, needed);
         if(EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 5, (LPBYTE)pi, needed, &needed, &num)) {
             for(i = 0; i < num; i++) {




More information about the wine-cvs mailing list