sxyanpeng
驱动牛犊
驱动牛犊
  • 注册日期2004-12-08
  • 最后登录2004-12-16
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2604回复:3

虔诚请教 有关打印机驱动原理流程

楼主#
更多 发布于:2004-12-09 22:14
我是 新手 想学习打印机驱动原理
希望有人 能指点 概述打印机驱动的流程图
或 简单 描述驱动过程 也好
谢谢!!!
snowStart
驱动老牛
驱动老牛
  • 注册日期2004-04-06
  • 最后登录2011-06-02
  • 粉丝0
  • 关注0
  • 积分95分
  • 威望19点
  • 贡献值177点
  • 好评度1点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2004-12-10 09:03
Typical Printing Process Scenario Using a Raw Spool File
This section illustrates the major relationships between the spooler components during the printing process by walking through the sequence of calls between components during the spooling of a raw format spool file and subsequent playback (despooling) of the file to a bidirectional printer.

The following illustration shows the sequence of calls that start with an application initiating a print request by calling GDI (labeled step 1 in the illustration) and end with the local print provider writing a spool file to the disk (step 8) and starting a background thread that will eventually initiate the despooling process (step 9). The sequence of steps in the despooling process are shown in a separate illustration.



As illustrated above, a typical printing process scenario using a raw spool file would be executed as follows

The application creates a DC and draws an object to the DC, for example a circle, and then calls GDI with a print request to a particular printer using that DC.
GDI calls the printer driver with a request for instructions on how to render the circle on that particular printer.
The printer driver returns the instructions on how to render the circle on the printer the driver is associated with. Note that all Windows 95 printer drivers are 16-bit code and communicate with 16-bit GDI.
GDI passes the print request to 32-bit GDI because the Windows 95 spooler process is 32-bit code.
GDI32 makes an interprocess call to the spooler process.
SPOOL32.EXE calls the router to route the print job to the printer specified by the application. In this example, the router sends the print job to the local print provider. Note that the router could send the job to a printer on the network through the network print provider (which is not shown in the illustration). The default Windows 95 spooler spools the network jobs locally, so they show up on the local spooler queue, even those jobs bound for a Windows NT/Windows 2000 servers. A network print job is spooled and despooled on the client machine, not the server. It is only in the relatively late step of despooling that the remote print server is actually contacted. The way Windows 95 handles network print jobs contrasts with the way they are handled by Windows NT/Windows 2000 client machines, which use RPC to call the necessary printing APIs on the print server. This way, the print job never shows up on the local spooler queue and the spooling and despooling is handled by the print spooler on the print server. On Windows 95 RPC is not used by the default print spooler. A print spooler that does use RPC is available as an option for Windows 95 client machines.
The router calls the local print provider with the print job.
If the type of print job is not direct, the local print provider spools the print job to the disk as a raw-format spool file. Note that steps 1 through 8 can be repeated many times to build a complete spool file. In step 8, the local print provider appends each piece of the print job to the spool file until the application signals that the job is complete by issuing an EndDoc function. The difference between a direct print job and a spooled print job to the local print provider is apparent in the next illustration which shows the playback of this spooled file. When the local print provider is called by the print processor (through the router) with this same print job, the job type is direct instead of spooled. That results in the job going to the printer instead of being rewritten as another spool file.
The local print provider starts a background thread that will determine the best time to start playing back the spool file to the printer. The next illustration shows the sequence of steps involved in playing back the raw spool file.
The following illustration shows the sequence of calls that start with the background thread application initiating the playback of a spooled file by calling a print processor (labeled step 10 in the illustration) and end with the local port monitor sending the print job through a port it controls to a connected printer (step 14).



As illustrated above, the sequence of calls that start with the background thread application initiating the playback of a spooled file and ending with the local port monitor sending the print job is executed as follows

The main thread determines a good time to initiate the playback of a spooled file, based on the changing state of spooler subsystem resources monitors. When it is a good time, the main thread uses a StartDoc function call to start a new thread in the print processor to playback the spooled file.
Because it is a StartDoc case, the print processor thread invokes the local print provider with a ReadPrinter function call to read part of the spool file off the disk. (Note that in this example case of a raw spool file, the print processor does not call GDI32. In the EMF spool file case, which are played back by the default print processor supplied by Microsoft, the print processor calls GDI32 to playback the metafile.)
Because it is a StartDoc case, the print processor thread invokes the language monitor (through the local print provider) with a WritePrinter function call to send the data through the physical port connected with the bidirectional printer originally specified in step 1 of this whole process. For a raw spool file, the default print processor simply passes the data through, without changing or interpreting any of the information. Note that a language monitor is invoked in this example scenario because the destination printer is a bidirectional printer. For nonbidirectional printers, a port monitor would be invoked instead of a language monitor. Note also that although this example scenario shows the language monitor and port monitor as separate components, they can be integrated into one monitor.
The language monitor calls the port monitor to send the data to the printer.
The port monitor sends the raw data through the physical port to the connected printer. Note that steps 11 through 14 are repeated until the end-of-file is reached on the spool file (or the print job is canceled). Then the playback thread is terminated.
学习,关注,交流中... [email=fengyu@163.com]Email:snowstarth@163.com[/email] [url]http://bbs.zndev.com/?a=snowStart[/url]
fslife
驱动大牛
驱动大牛
  • 注册日期2004-06-07
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分9分
  • 威望49点
  • 贡献值0点
  • 好评度20点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2004-12-10 18:08
很多书上都有的讲。送你一个图,希望有用。
在交流中学习。。。
snowStart
驱动老牛
驱动老牛
  • 注册日期2004-04-06
  • 最后登录2011-06-02
  • 粉丝0
  • 关注0
  • 积分95分
  • 威望19点
  • 贡献值177点
  • 好评度1点
  • 原创分0分
  • 专家分0分
地板#
发布于:2004-12-10 18:34
这图是怎么贴上的,俺也试一试
学习,关注,交流中... [email=fengyu@163.com]Email:snowstarth@163.com[/email] [url]http://bbs.zndev.com/?a=snowStart[/url]
游客

返回顶部