]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Include error code if printer failed to open.
authorToni Wilen <twilen@winuae.net>
Sun, 3 Mar 2024 17:01:10 +0000 (19:01 +0200)
committerToni Wilen <twilen@winuae.net>
Sun, 3 Mar 2024 17:01:10 +0000 (19:01 +0200)
od-win32/parser.cpp

index d5b17b1ade6d141bbbfe186247eae7392c08b96c..d18da23dc70aba1457a7fb59eb43e56040ea3a68 100644 (file)
@@ -495,6 +495,7 @@ static void openprinter (void)
 {
        DOC_INFO_1 DocInfo;
        static int first;
+       DWORD error = 0;
 
        closeprinter ();
        if (!currprefs.prtname[0])
@@ -514,6 +515,7 @@ static void openprinter (void)
                        DocInfo.pDatatype = (currprefs.parallel_matrix_emulation || currprefs.parallel_postscript_detection) ? _T("TEXT") : _T("RAW");
                        // Inform the spooler the document is beginning.
                        if ((dwJob = StartDocPrinter (hPrt, 1, (LPBYTE)&DocInfo)) == 0) {
+                               error = GetLastError();
                                ClosePrinter (hPrt );
                                hPrt = INVALID_HANDLE_VALUE;
                        } else if (StartPagePrinter (hPrt)) {
@@ -526,7 +528,7 @@ static void openprinter (void)
        if (hPrt != INVALID_HANDLE_VALUE) {
                write_log (_T("PRINTER: Opening printer \"%s\" with handle 0x%x.\n"), currprefs.prtname, hPrt);
        } else if (*currprefs.prtname) {
-               write_log (_T("PRINTER: ERROR - Couldn't open printer \"%s\" for output.\n"), currprefs.prtname);
+               write_log (_T("PRINTER: ERROR - Couldn't open printer \"%s\" for output. Error %08x\n"), currprefs.prtname, error);
        }
 }