Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

GhostScript 8.57 for DOS (V0.00) available ! (DOSX)

posted by Michel LECLERC Homepage E-mail, France, 24.07.2007, 16:05
(edited by rr on 24.07.2007, 16:17)

Hello Japheth

> > Look at http://www.milec.com/download/GSWC_DLL.ZIP
>
> Thanks! How has your printer problem finally been solved?

It was necessary to specify 'raw' mode access for **device** 'lpt1' just after the opening of **file** 'lpt1'. Here is the source (Microsoft Visual C++ ToolKit 2003):


Test3:

#ifdef MILEC_DEBUG
    eprintf("Test n°3...\n");
#endif

    /* open 'LPT1' avec option 'OPEN_EXISTING' ('CREATE_ALWAYS' fonctionne aussi) */
    PPrinter = CreateFile("LPT1", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
    if (PPrinter == INVALID_HANDLE_VALUE) {

        eprintf("Ouverture de 'LPT1' impossible !\n");

        free(buffer);
        fclose(f);
        return FALSE;
    }

    if (Win_Mode) goto copy3;

    /* 170707: Mettre en place le mode 'RAW' */
    _asm
      {

         push ebx
         push edx

         mov  ebx, PPrinter     ; PPrinter est un HANDLE sur 32 bits. CF 'CopyFile.asm'
         mov  dx, 20h
         mov  ax, 4401h
         int  21h
         jc   error3
         xor  ax, ax
error3:
         mov  xRC, ax

         pop  edx
         pop  ebx

      }

#ifdef MILEC_DEBUG
    eprintf1("xRC: %i\n", xRC);
#endif


copy3:

    /* copy file to printer */
    while ((count = fread(buffer, 1, PRINT_BUF_SIZE, f)) != 0) {

#ifdef MILEC_DEBUG
        eprintf1("%i byte(s) read...\n", count);
#endif

        WriteFile(PPrinter, buffer, count, &written, NULL);
       
        if (written != count) {

#ifdef MILEC_DEBUG
            eprintf("Erreur écriture sur 'LPT1' !\n");
#endif

            free(buffer);
            fclose(f);
            CloseHandle(PPrinter);
            return FALSE;
        }

    }
    CloseHandle(PPrinter);


EDIT by rr: added {code} tag

 

Complete thread:

Back to the forum
Board view  Mix view
15192 Postings in 1365 Threads, 250 registered users, 16 users online (0 registered, 16 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum