flat assembler
Message board for the users of flat assembler.

Index > Heap > TSC barcode printer TSPL TSPL2 programming

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
hi,
anyone deal with sending command into barcode printer?

the sample code is like below,
Code:
SIZE 50 mm,25 mm
GAP 3 mm,0
DIRECTION 1
CLS
BAR 80,80,300,100
PRINT 1,1
    

the issue is, how should i send it to printer?
assume the usb printer is shared using net use into lpt2

am i going to send ascii chars to lpt2?
Post 13 Feb 2014, 04:13
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
sleepsleep,

I'm going to make some assumptions here, based on your post:

You have a printer plugged into an LPT port somewhere on your network;

You want to send a series of ASCII characters to this printer.

First add this printer to your "print spooler" / "print server" and give it a network name. Use the WritePrinter function to send the characters to the printer. The following post shows the sequence of function calls required to use WritePrinter.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd145226(v=vs.85).aspx

I've used this for years to send ASCII characters from a DOS program to Dot Matrix printers on a Windows network.

Ask more questions/supply more info.

HTH,

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 13 Feb 2014, 05:41
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
thanks a lot farrier,
will try the api later tonight, customer want to use it tomorrow =) lol,,, i must be crazy,

i hope it works,
thanks again.
Post 13 Feb 2014, 07:18
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
Code:
; -------------------------------------------------
section '.idata' import data readable
; -------------------------------------------------
library kernel32,'KERNEL32.DLL',\
        user32,'USER32.DLL',\
        msvcrt,'MSVCRT.DLL',\
        iup,'IUP.DLL',\
        spoolss,'SPOOLSS.DLL'

include 'API\KERNEL32.INC'
include 'API\USER32.INC'
include 'API\MSVCRT32.INC'
include 'iup.inc'
import spoolss,\
        OpenPrinterA,'OpenPrinterA',\
        OpenPrinterW,'OpenPrinterW',\
        ClosePrinter,'ClosePrinter',\
        StartDocPrinter,'StartDocPrinter',\
        StartPagePrinter,'StartPagePrinter',\
        WritePrinter,'WritePrinter',\
        EndPagePrinter,'EndPagePrinter',\
        EndDocPrinter,'EndDocPrinter'

api OpenPrinter
    


i only tried 1 api, OpenPrinter,

but i received the following error.

The program can't start because SPOOLSS.DLL is missing from your computer. Try reinstalling the program to fix this problem.

i confirmed that SPOOLSS.DLL is located in C:\Windows\System32
if i copy SPOOLSS.DLL to my project directory,

the error changed to
The application was unable to start correctly (0xc000007b).Click OK to close the application.


any idea?
Post 14 Feb 2014, 01:42
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
my system is windows 7 sp1 64bit,
i used dll dependency walker, it seems that spoolss.dll doesn't contained OpenPrinterA,
[code
OpenPrinter2W
OpenPrinterExW
OpenPrinterPort2W
OpenPrinterW
[/code]
but,
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162751%28v=vs.85%29.aspx

said,
Unicode and ANSI names
OpenPrinterW (Unicode) and OpenPrinterA (ANSI)

i tried using OpenPrinterW, remove the last line api, still failed. SPOOLSS.DLL is missing.
Post 14 Feb 2014, 01:50
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
it seems that,
windows 7 64bit doesn't provide spoolss.dll in syswow64 for 32bit, and my application is 32bit that will most probably try to load this dll from syswow64 directory,

maybe the solution is copy windows 7 32bit spoolss.dll into syswow64... let c.

update 09:55 AM
it seems, after teamviewer into windows 7 32bit and copy spoolss.dll into syswow64, the application would execute without error now. =)

update 10:18 AM
link with WINSPOOL.DRV will contained OpenPrinterA,
and i got valid printer handle now. =)

update 11:29 AM
successfully printed out the label,
but here the minor issues,
a) the print cache the previous image, only the second try will print the current image
b) initial print is failed, second try only succeed
Code:
docinfo         _DOC_INFO_1
docinfoname     db 'DOC',0
docinfotype     db 'RAW',0
printcode       db 'CLS',13,10
                db 'SIZE 35 mm,25 mm',13,10
                db 'GAP 3 mm,0 mm',13,10
                db 'DIRECTION 1',13,10
                db 'CLS',13,10
                db 'BARCODE 32,40,"128",120,2,0,2,2,"E92143394"',13,10
                db 'PRINT 1',0

printcodeout    dd 0

proc cbButtonPrint c, handle
;       cinvoke IupGetAttribute,[text1],<'VALUE',0>
        invoke  OpenPrinter,<'TSC',0>,printer1,NULL
          cmp   eax,0
          je    @f
          mov   [docinfo.pOutputFile],NULL
          mov   [docinfo.pDocName],docinfoname
          mov   [docinfo.pDatatype],docinfotype
        invoke  StartDocPrinter,[printer1],1,docinfo
        invoke  lstrlen,printcode
        invoke  WritePrinter,[printer1],printcode,eax,printcodeout
        invoke  EndDocPrinter,[printer1]
        invoke  ClosePrinter,[printer1]
          ret
        @@:
          ret
endp
    
Post 14 Feb 2014, 01:55
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
sleepsleep,

You're almost there!

Here is the only other thing I was stumped on for a while

For the StartDocPrinterA command

Code:
szMyDoc                         db 'My Document', 0
                                        ;This can be any name describing the Document
szRaw                           db 'raw', 0


doci                            DOC_INFO_1 <>


        mov             doci.pDocName, szMyDoc
        mov             doci.pOutputFile, NULL
        mov             doci.pDatatype, szRaw
    


invoke StartDocPrinterA, [hPrinter], 1, doci

HTH,

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 14 Feb 2014, 03:43
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
sleepsleep,

you did not include:

StartPagePrinter

EndPagePrinter

They may make a difference!

HTH,

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 14 Feb 2014, 03:50
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
hi farrier,
thanks for the reply,
=)
regarding the issues i mentioned just now,
i tried the following and it seems solve,
Code:
db 'CLS',13,'CLS',13
    

this will really clear, otherwise, barcode value changing will caused some sort of 2 barcodes overlapped, i scanned the barcode later.

farrier wrote:

StartPagePrinter
EndPagePrinter

i tried invoke them, no difference so far.

why you wrote, fasm new feature?
Code:
doci                            DOC_INFO_1 <>
    

i tried
Code:
          mov   docinfo.pOutputFile,NULL
error: invalid operand.
    
Post 14 Feb 2014, 04:13
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
sleepsleep,

Should have been:

Code:
mov   [doci.pOutputFile], NULL    


The code was copied from old MASM program code.

Glad yours is "Working"

You may not remember but, you helped me with the project I used this code in quite a while ago. The DOS program would do the same thing your printer was doing. The program would send the print job, and do nothing until the next print job was sent. Instead of printing to LPT1, I had the DOS program "print" to a text file. I wrote a utility to monitor for the creation of these text files, read the text file, use the WritePrinter program to send to the appropriate printer--we are using 3-6 printers--and then delete the text file. You helped me with the code to detect the file creation. Thanks again.

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 14 Feb 2014, 06:24
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
mine is working but with one issue, big issue,
i delivered the program to client already,

basically, the program presented one iup textbox (yah, i used iup toolkit), then user key in the barcode number, then click print button.

the issue that hasn't resolve is,
a) the print cache the previous image, only the second try will print the current image
b) initial print is failed, second try only succeed

db 'CLS',13,'CLS',13 doesn't solve the issue,
i don't think it is TSC TSPL/TSPL2 code fault, because i got roughly exact code on another program that able to print normally.

i guess the issue is more to printer initialization and the way to handle printer & printing.

btw, TSC barcode printer came with TSCLIB.DLL, to ease the development,
maybe i need to dump the dll into asm and see how it calls the WritePrinter.
Post 14 Feb 2014, 09:32
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
farrier wrote:

You may not remember but, you helped me with the project I used this code in quite a while ago. The DOS program would do the same thing your printer was doing. The program would send the print job, and do nothing until the next print job was sent. Instead of printing to LPT1, I had the DOS program "print" to a text file. I wrote a utility to monitor for the creation of these text files, read the text file, use the WritePrinter program to send to the appropriate printer--we are using 3-6 printers--and then delete the text file. You helped me with the code to detect the file creation. Thanks again.


oh really, i kinda forgot, because i usually dump ascii in heap section. =)
btw, that is one nice trick,
monitor file creation maybe with specialized naming pattern and code a monitor software to send print control code to one of 6 printers from created text file...
Post 14 Feb 2014, 09:37
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
sleepsleep,

Can you see the print job in the spooler job list? Sometimes you can tell the spooler to send the info to the printer as soon as the data is in the spooler. See if that makes a difference.

I'm surprised that the:

invoke StartPagePrinter, [printer1]
...
invoke EndPagePrinter, [printer1]

didn't force the data to print. If I think of anything else, I'll let you know. Repost the segment of your code as it is now, maybe I'll see something.

HTH,

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 14 Feb 2014, 14:56
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
farrier wrote:
Can you see the print job in the spooler job list?

yes, i saw the job, it went away after the label was printed out, or after windows sends it to printer.

here the code,
Code:
pcode1          db 'CLS',13,'SPEED 2',13,'DENSITY 8',13,'SET CUTTER OFF',13,'SET PEEL OFF',13,0
pcode2          db 'SIZE 35 mm,25 mm',13,0
pcode3          db 'GAP 3mm,0 mm',13,0
pcode4          db 'DIRECTION 1',13,0
pcode7          db 'PRINT 1,1',0

pcode6start     db 'BARCODE 32,40,"128",120,2,0,2,2,"',0
pcode6buffer    rb 0xFF
pcode6end       db '"',0
; ------------------------------
proc cbButtonPrint c, handle
; ------------------------------
        cinvoke IupGetAttribute,[text1],<'VALUE',0>
          mov   [text1addr],eax
        invoke  lstrlen,eax
          cmp   eax,0
          je    .errorEmpty

        cinvoke wsprintf,pcode6buffer,<'%s%s%s',13,0>,pcode6start,[text1addr],pcode6end
        invoke  OpenPrinter,<'TSC TTP-247',0>,printer1,NULL
          cmp   eax,0
          je    .errorInvalidPrinterName

          mov   [docinfo.pOutputFile],NULL
          mov   [docinfo.pDocName],docinfoname
          mov   [docinfo.pDatatype],docinfotype

        invoke  StartDocPrinter,[printer1],1,docinfo
        invoke  StartPagePrinter,[printer1]

        invoke  lstrlen,pcode1
          mov   [printcodeout],0
        invoke  WritePrinter,[printer1],pcode1,eax,printcodeout

        invoke  lstrlen,pcode2
          mov   [printcodeout],0
        invoke  WritePrinter,[printer1],pcode2,eax,printcodeout

        invoke  lstrlen,pcode3
          mov   [printcodeout],0
        invoke  WritePrinter,[printer1],pcode3,eax,printcodeout

        invoke  lstrlen,pcode4
          mov   [printcodeout],0
        invoke  WritePrinter,[printer1],pcode4,eax,printcodeout

        invoke  lstrlen,pcode1
          mov   [printcodeout],0
        invoke  WritePrinter,[printer1],pcode1,eax,printcodeout

        invoke  lstrlen,pcode6buffer
          mov   [printcodeout],0
        invoke  WritePrinter,[printer1],pcode6buffer,eax,printcodeout

        invoke  lstrlen,pcode7
          mov   [printcodeout],0
        invoke  WritePrinter,[printer1],pcode7,eax,printcodeout

        invoke  EndPagePrinter,[printer1]
        invoke  EndDocPrinter,[printer1]

        invoke  ClosePrinter,[printer1]
          ret
    
Post 14 Feb 2014, 18:08
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
i was thinking about the following idea,
maybe i shouldn't ClosePrinter on every print? and move ClosePrinter when application exits?
and use StartPagePrinter on next label? or StartDocPrinter?
Post 14 Feb 2014, 18:10
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Sleepsleep

Have you consulted the API?

The ability to successfully create for a platform greatly relies on the programmer carving some time reading API documentation.

You can then seek help from others if the above failed which is very rare. Wink

Always remember this:

plan, research, implement, maintain.
Post 14 Feb 2014, 23:44
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
sleepsleep,

What worked for me was:

Do everything, everytime. Even if it was just to print a 1" label to a dot matrix printer.

OpenPrinter
1 To begin a print job, call StartDocPrinter.
2 To begin each page, call StartPagePrinter.
3 To write data to a page, call WritePrinter.
4 To end each page, call EndPagePrinter.
5 Repeat 2, 3, and 4 for as many pages as necessary.
6 To end the print job, call EndDocPrinter.
ClosePrinter

I would consider a label as a page

Let me look over your code and I'll comment if I see anything

farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
Post 15 Feb 2014, 00:03
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
typedef wrote:

Have you consulted the API?

i have, but the information on this topic is quite rare.

hi farrier,
i am trying to go through the manufacturer dll,
https://board.flatassembler.net/~ultimca7/flatassembler.net/subdomains/board/topic.php?p=167265

here the sample code if using that dll with Visual Basic, basically that dll functioned as a layer and abstracted WINSPOOL.DRV exported functions.

Code:
Private Sub Command1_Click()
Call openport(“TSC CLEVER TTP-243”)
„Call openport(\\server\TTP243”)  „Open network printer.
„Call openport(“LPT1”) „Open LPT1 port directly.
„Call openport(“USB”) „Open USB port directly.
Call setup("100", "100", "3", "10", "0", "0", "0")
Call clearbuffer
Call printerfont("10", "10", "4", "0", "1", "1", "TEST PRINTOUT")
Call barcode("10", "80", "39", "96", "1", "0", "2", "4", "0987654321")
Call sendcommand("BAR 400,200,300,100")
Call sendcommand("BOX 10,300,300,300,5")
Call windowsfont(10, 10, 80,0,2, 0, "arial", "Arial font 80 pt")
Call printlabel("1", "2")
Call closeport
End Sub
    


i got some great desire to see how they abstract and steps to call WINSPOOL.DRV apis.. =)
Post 15 Feb 2014, 02:05
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
i think i might just found some magic tricks, =) running ollydebug v2.01 over dll.

here some interesting one
Code:
call setup
=======
...
10001546  |>  51            PUSH ECX                                 ; /<%s> => [ARG.2]
10001547  |.  50            PUSH EAX                                 ; |<%s> => [ARG.1]
10001548  |.  68 48D20010   PUSH OFFSET 1000D248                     ; |Format = "SIZE %s mm,%s mm"
1000154D  |.  8D4424 1C     LEA EAX,[LOCAL.25]                       ; |
10001551  |.  6A 64         PUSH 64                                  ; |Arg2 = 64
10001553  |.  50            PUSH EAX                                 ; |Arg1 => OFFSET LOCAL.25
10001554  |.  E8 0F160000   CALL 10002B68                            ; \TSCLIB.10002B68
10001559  |.  83C4 14       ADD ESP,14
1000155C  |.  8D4C24 10     LEA ECX,[LOCAL.25]
10001560  |.  51            PUSH ECX                                 ; /Arg1 => OFFSET LOCAL.25
10001561  |.  E8 BAFEFFFF   CALL sendcommand                         ; \TSCLIB.sendcommand
10001566  |.  56            PUSH ESI                                 ; /<%s>
10001567  |.  68 3CD20010   PUSH OFFSET 1000D23C                     ; |Format = "SPEED %s"
1000156C  |.  8D5424 18     LEA EDX,[LOCAL.25]                       ; |
10001570  |.  6A 64         PUSH 64                                  ; |Arg2 = 64
10001572  |.  52            PUSH EDX                                 ; |Arg1 => OFFSET LOCAL.25
10001573  |.  E8 F0150000   CALL 10002B68                            ; \TSCLIB.10002B68
10001578  |.  83C4 10       ADD ESP,10
1000157B  |.  8D4424 10     LEA EAX,[LOCAL.25]
1000157F  |.  50            PUSH EAX                                 ; /Arg1 => OFFSET LOCAL.25
10001580  |.  E8 9BFEFFFF   CALL sendcommand                         ; \TSCLIB.sendcommand
10001585  |.  57            PUSH EDI                                 ; /<%s>
10001586  |.  68 30D20010   PUSH OFFSET 1000D230                     ; |Format = "DENSITY %s"
1000158B  |.  8D4C24 18     LEA ECX,[LOCAL.25]                       ; |
1000158F  |.  6A 64         PUSH 64                                  ; |Arg2 = 64
10001591  |.  51            PUSH ECX                                 ; |Arg1 => OFFSET LOCAL.25
10001592  |.  E8 D1150000   CALL 10002B68                            ; \TSCLIB.10002B68
10001597  |.  83C4 10       ADD ESP,10
1000159A  |.  8D5424 10     LEA EDX,[LOCAL.25]
1000159E  |.  52            PUSH EDX                                 ; /Arg1 => OFFSET LOCAL.25
1000159F  |.  E8 7CFEFFFF   CALL sendcommand                         ; \TSCLIB.sendcommand
100015A4  |.  8B8424 8C0000 MOV EAX,DWORD PTR SS:[ARG.5]
100015AB  |.  8038 31       CMP BYTE PTR DS:[EAX],31
100015AE  |.  B8 28D20010   MOV EAX,OFFSET 1000D228                  ; ASCII "BLINE"
100015B3  |.  74 05         JE SHORT 100015BA
100015B5  |.  B8 24D20010   MOV EAX,OFFSET 1000D224                  ; ASCII "GAP"
100015BA  |>  55            PUSH EBP                                 ; /<%s> => [ARG.7]
100015BB  |.  53            PUSH EBX                                 ; |<%s>
100015BC  |.  50            PUSH EAX                                 ; |<%s>
100015BD  |.  68 14D20010   PUSH OFFSET 1000D214                     ; |Format = "%s %s mm,%s mm"
100015C2  |.  8D4C24 20     LEA ECX,[LOCAL.25]                       ; |
100015C6  |.  6A 64         PUSH 64                                  ; |Arg2 = 64
100015C8  |.  51            PUSH ECX                                 ; |Arg1 => OFFSET LOCAL.25
100015C9  |.  E8 9A150000   CALL 10002B68                            ; \TSCLIB.10002B68
100015CE  |.  83C4 18       ADD ESP,18
100015D1  |.  8D5424 10     LEA EDX,[LOCAL.25]
100015D5  |.  52            PUSH EDX                                 ; /Arg1 => OFFSET LOCAL.25
100015D6  |.  E8 45FEFFFF   CALL sendcommand                         ; \TSCLIB.sendcommand
100015DB  |.  8B4C24 74     MOV ECX,DWORD PTR SS:[LOCAL.0]
...
    
Post 15 Feb 2014, 20:32
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8867
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
for each sendcommand, the dll call WritePrinter twice, i wonder why.
Code:
sendcommand function
10001420  /$  833D 741F0110 CMP DWORD PTR DS:[10011F74],0            ; TSCLIB.sendcommand(guessed Arg1)
10001427  |.  75 05         JNE SHORT 1000142E
10001429  |.  33C0          XOR EAX,EAX
1000142B  |.  C2 0400       RETN 4
1000142E  |>  56            PUSH ESI
1000142F  |.  8B7424 08     MOV ESI,DWORD PTR SS:[ARG.1]
10001433  |.  56            PUSH ESI                                 ; /Src => [ARG.1]
10001434  |.  68 981F0110   PUSH OFFSET 10011F98                     ; |Dest
10001439  |.  FF15 54D00010 CALL DWORD PTR DS:[<&KERNEL32.lstrcpyA>] ; \KERNEL32.lstrcpy
1000143F  |.  8BC6          MOV EAX,ESI
10001441  |.  8D50 01       LEA EDX,[EAX+1]
10001444  |>  8A08          /MOV CL,BYTE PTR DS:[EAX]
10001446  |.  40            |INC EAX
10001447  |.  84C9          |TEST CL,CL
10001449  |.^ 75 F9         \JNZ SHORT 10001444
1000144B  |.  2BC2          SUB EAX,EDX
1000144D  |.  833D D41F0B10 CMP DWORD PTR DS:[100B1FD4],1
10001454  |.  A3 E41F0B10   MOV DWORD PTR DS:[100B1FE4],EAX
10001459  |.  75 37         JNE SHORT 10001492
1000145B  |.  68 8C1F0110   PUSH OFFSET 10011F8C                     ; /Arg4 = TSCLIB.10011F8C
10001460  |.  50            PUSH EAX                                 ; |Arg3
10001461  |.  A1 901F0110   MOV EAX,DWORD PTR DS:[10011F90]          ; |
10001466  |.  68 981F0110   PUSH OFFSET 10011F98                     ; |Arg2 = TSCLIB.10011F98
1000146B  |.  50            PUSH EAX                                 ; |Arg1 => [10011F90] = 0
1000146C  |.  E8 CF150000   CALL <JMP.&WINSPOOL_DRV.WritePrinter>    ; \WINSPOOL_DRV.WritePrinter
10001471  |.  8B0D 901F0110 MOV ECX,DWORD PTR DS:[10011F90]
10001477  |.  68 8C1F0110   PUSH OFFSET 10011F8C                     ; /Arg4 = TSCLIB.10011F8C
1000147C  |.  6A 02         PUSH 2                                   ; |Arg3 = 2
1000147E  |.  68 10D20010   PUSH OFFSET 1000D210                     ; |Arg2 = ASCII "
"
10001483  |.  51            PUSH ECX                                 ; |Arg1 => [10011F90] = 0
10001484  |.  E8 B7150000   CALL <JMP.&WINSPOOL_DRV.WritePrinter>    ; \WINSPOOL_DRV.WritePrinter
10001489  |.  B8 01000000   MOV EAX,1
1000148E  |.  5E            POP ESI
1000148F  |.  C2 0400       RETN 4
    
Post 15 Feb 2014, 20:34
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.