iniwf

风是温柔的,雨是伤心的,云是快乐的,月是多情的,爱是迷失的,恋是醉人的,情是难忘的,天是长久的,地是永恒的

虚拟打印的实现-安装

转自http://fxh7622.blog.51cto.com/63841/51634

通过以上几篇的说明,我想大家一定会开发自己的虚拟打印了。但是,我们开发出来的虚拟打印又如何安装到系统中呢?这次我就来写一下如何将我们编写的虚拟打印安装到系统中。
我们知道,当我们使用“开始”-》“设置”-》“打印机和传真”-》“添加打印机”会出现安装打印机向导。
当运行到“安装打印机软件”的时候,在右下角有一个“从磁盘安装”按钮。如果我们点击了这个按钮,系统会弹出一个让我们选择INI文件的界面。
好了,既然这样,我们就可以编写或者改造一个自己的打印机安装INI文件。
首先,我们去网上随便下载一个打印机驱动安装包,并将我们自己编写的genprint.dll拷入。然后编写我们的INI文件。(以下是我写好的一个INI文件,我使用的是一款HP的打印机驱动)。
 
 
;Hewlett-Packard LaserJet combined printer driver INF file for Windows XP and 2000
;
Copyright Hewlett-Packard 2001
;
 List of supported printers, manufacturers
[Version] 
Signature
="$Windows NT$"
Provider
=%虚拟打印%
ClassGUID
={4D36E979-E325-11CE-BFC1-08002BE10318}
Class
=Printer
DriverVer
=1/18/2002,02.00.12.02 
; Manufacturer section.
;
;
 This section lists all of the manufacturers
;
 that we will display in the Dialog box
[Manufacturer]
%虚拟打印%
=DefaultInstall

;
;
 MS Driver Core installs
;
;
 These sections are used by Printer OEMs to install MS provided drivers
;
 Installer Sections
;
;
 These sections control file installation, and reference all files that
;
 need to be copied. The section name will be assumed to be the driver
;
 file, unless there is an explicit DriverFile section listed.
;
;
 Note: Pulling HPLJ4.GPD via Needs= directive to get pcl5eres.dll from XP 
;
       drivers.cab file due to XP defect whereby this file wasn't listed
;
       This also takes care of pjlmon.dll, ttfsub.gpd, UNIDRV sections
;
       but unavoidably brings with it the unneeded hplj4.gpd file. 
;
       
;
   In the case of the LJ4 install does Needs=HPLJ4.GPD overwrite the 
;
   just copied newer version of hplj4.gpd??? In this case perhaps, use
;
   Needs=HPLJ4L.GPD to avoid this issue? 
;
;
 Phase II GPDs
[DefaultInstall]
"虚拟打印机"                 = HPLJ4L.GPD.XP        ,Hewlett-PackardLaserC029,HP_LaserJet_4L
;Hewlett-PackardLaserC029是设备的ID
;
;
 XP
;
Old CopyFiles statement before use of Includes= & Needs= 
;
CopyFiles=HPPRPROC,UI,RENDER,@HPLJ4.GPD,@hpc02.ini,RES_COMMON,HELP,UNIDRV,PJLMON.DLL,@TTFSUB.GPD
[HPLJ4L.GPD.XP]
CopyFiles
=HPPRPROC,@HPLJ4L.GPD,@hpcstr02.dll
Include
=NTPRINT.INF
Needs
=HPLJ4.GPD
DataSection
=HP_UNIDRV_BIDI_DATA
DataFile
=HPLJ4L.GPD
PrintProcessor
=%PRINT_PROCESSOR%

; Copy Sections
;
;
 Lists of files that are actually copied. These sections are referenced
;
 from the installer sections, above. Only create a section if it contains
;
 two or more files (if we only copy a single file, identify it in the
;
 installer section, using the @filename notation) or if it's a color
;
 profile (since the DestinationDirs can only handle sections, and not
;
 individual files).

[RES_COMMON]
pcl5eres.dll
hpcstr02.dll

[HPPRPROC]
genprint.dll
,,,0x00000020

;
;
 Data Sections
;
[HP_UNIDRV_DATA]
DriverFile
=UNIDRV.DLL
ConfigFile
=UNIDRVUI.DLL
HelpFile
=UNIDRV.HLP
; Data section that attaches PJLMON as the driver Lang Monitor
[HP_UNIDRV_BIDI_DATA]
DriverFile
=UNIDRV.DLL
ConfigFile
=UNIDRVUI.DLL
HelpFile
=UNIDRV.HLP
LanguageMonitor
=%PJL_MONITOR%

;
;
 Call SetupSetDirectoryId with 66000 to set the target directory at runtime
;
 (depending on which environment drivers are getting installed)
;
[DestinationDirs]
DefaultDestDir
=66000
HPPRPROC
=66001
PJLMON.DLL
=66002
;
;
 Control Flags
;
[ControlFlags]
ExcludeFromSelect 
= HWP20D0, HWP21A0, HWP2140, HWP20F0
;
;
  Source Disk Section
;
  This was added to enable Web Point&Print.
;
  All files added to this must also be added to Layout.INF
;
[SourceDisksNames]
1=%DiskID1%,,,""
[SourceDisksFiles]
;
;
 MS Files
;
PCL5ERES.DLL = 1
UNIDRV.DLL   
= 1
UNIRES.DLL   
= 1
UNIDRVUI.DLL 
= 1
STDNAMES.GPD 
= 1
UNIDRV.HLP   
= 1
TTFSUB.GPD   
= 1
;
;
 Phase II
;
HPCUI02.DLL  = 1
HPCRD02.DLL  
= 1
HPCFNT02.DLL 
= 1
HPCSTR02.DLL 
= 1
genprint.dll  
= 1
HPCLJX02.HLP 
= 1
HPC02.INI    
= 1
HPOEMUI.DLL  
= 1
HPCMBOX.INI  
= 1
HPLJ4L.GPD   
= 1
;
;
 Localizable Strings
;
[Strings]
PrinterClassName
="Printers"
DiskID1
="虚拟打印安装盘"
PJL_MONITOR
="PJL Language Monitor,PJLMON.DLL"
;PRINT_PROCESSOR="HPPRN02,hpprn02.dll"
PRINT_PROCESSOR="Vprint,genprint.dll"
虚拟打印
="虚拟打印"

这样就写好了一个打印机的安装INI文件。当你使用这个虚拟打印打印东西的时候,系统就会调用我们的genprint.dll,但是如何调用Print_Dll.dll和SetPrint.dll呢?我想只要有编写DLL经验的朋友都知道,将这两个Dll放到系统的SYSTEM32目录下,就可以被我们的genprint.dll来进行调用了。
 
好了至此,我将如何编写一个虚拟打印的完整过程都已经写出来了。希望对编写虚拟打印的朋友有一点帮助。
 
        
          
本文出自 “狗窝” 博客,请务必保留此出处http://fxh7622.blog.51cto.com/
63841/51634

本文出自 51CTO.COM技术博客 

posted on 2009-03-18 15:07 iniwf 阅读(2992) 评论(10)  编辑 收藏 引用 所属分类: 驱动

评论

# re: 虚拟打印的实现-安装 2009-03-24 15:35 James Wang

在安装INF文件之前,是需要选择一个端口的,如何选择端口?随便选一个吗?  回复  更多评论   

# re: 虚拟打印的实现-安装 2009-03-24 20:26 iniwf

有问题可以自己先尝试解决,不行再问  回复  更多评论   

# re: 虚拟打印的实现-安装 2010-06-18 01:04 DOREENHahn26

That's known that cash can make people autonomous. But what to do when somebody doesn't have money? The one way is to get the <a href="http://lowest-rate-loans.com">loans</a> and just secured loan.   回复  更多评论   

# re: 虚拟打印的实现-安装 2010-07-30 03:20 humanities essays

Every man in the world has to read through your good enough thought close to this good post to accomplish the great quality research papers or just middle east essay paper.   回复  更多评论   

# re: 虚拟打印的实现-安装 2010-10-07 13:55 essays papers online

Correctly written online term paper could give you a possibility to get good grade. Nevertheless, customized essays composing will use some free time. Thence it will be practicable to purchase essays to preclude that.   回复  更多评论   

# re: 虚拟打印的实现-安装 2012-07-01 16:12 custom essays

Are you looking for best assignment writing services? Press over here "qualityessay.com" and buy essay from the trustworthy organisation.  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

统计

常用链接

留言簿(2)

随笔分类

随笔档案

收藏夹

IT技术

积分与排名

最新评论

阅读排行榜

评论排行榜