Win10打印功能(组件)恢复(修复)_win10spoolsv.exe修复_^sky^的博客-程序员秘密

技术标签: 桌面运维  windows  

一、 注册表
1、控制及类
pe-sys\ControlSet001\Control\Print
pe-sys\ControlSet001\Control\Class\{1ed2bbf9-11f0-4084-b21f-ad83a8e6dcdc}
pe-sys\ControlSet001\Control\Class\{4658ee7e-f050-11d1-b6bd-00c04fa372a7}
pe-sys\ControlSet001\Control\Class\{49ce6ac8-6f86-11d2-b1e5-0080c72e74a2}
pe-sys\ControlSet001\Control\Class\{4d36e979-e325-11ce-bfc1-08002be10318}
pe-sys\ControlSet001\Control\Class\{c30ecea0-11ef-4ef9-b02e-6af81e6e65c0}
pe-sys\ControlSet001\Control\Class\{c7bc9b22-21f0-4f0d-9bb6-66c229b8cd33}
2、服务
pe-sys\ControlSet001\Services\Spooler
pe-sys\ControlSet001\Services\usbprint(注意,如果组件外置,这一项不要,系统注册表中有的话也要删除)
3、usbprint.inf安装包数据库记录(这一步不是必须)
用RegWorkshop在pe-sys\DriverDatabase位置查找usbprint.inf再导出备用

以上三项均从INSTALL.WIM的SYSTEM中提取。
二、 文件列表
可以分成三部分
1、 设备与打印机
Windows
│  splwow64.exe
│  
├─inf
│      c_pnpprinters.inf
│      c_printer.inf
│      PrintQueue.inf
│      printupg.inf
│      usbprint.inf
│      
├─PrintDialog(注:整个目录,但似乎没什么用)
│          
└─System32
    │  AppMon.dll
    │  bidispl.dll
    │  compstui.dll
    │  DafPrintProvider.dll
    │  defaultdevicemanager.dll
    │  defaultprinterprovider.dll
    │  DevDispItemProvider.dll
    │  DeveloperOptionsSettingsHandlers.dll
    │  deviceassociation.dll
    │  DeviceCenter.dll
    │  DeviceDisplayStatusManager.dll
    │  DeviceDriverRetrievalClient.dll
    │  DeviceEject.exe
    │  DeviceElementSource.dll
    │  DeviceEnroller.exe
    │  DeviceMetadataRetrievalClient.dll
    │  DevicePairing.dll
    │  DevicePairingFolder.dll
    │  DevicePairingProxy.dll
    │  DevicePairingWizard.exe
    │  deviceregistration.dll
    │  DeviceSetupManager.dll
    │  DeviceSetupManagerAPI.dll
    │  DeviceSetupStatusProvider.dll
    │  DevicesFlowBroker.dll
    │  DeviceUxRes.dll
    │  devinv.dll
    │  DevPropMgr.dll
    │  DevQueryBroker.dll
    │  efswrt.dll
    │  FaxPrinterInstaller.dll
    │  FdDevQuery.dll
    │  fdPnp.dll
    │  fdprint.dll
    │  fdWNet.dll
    │  fdWSD.dll
    │  findnetprinters.dll
    │  fundisc.dll
    │  fxsapi.dll
    │  FXSMON.dll
    │  FXSRESM.dll
    │  gpprnext.dll
    │  hgprint.dll
    │  icm32.dll
    │  icmui.dll
    │  inetpp.dll
    │  inetppui.dll
    │  IPPMon.dll
    │  localspl.dll
    │  localui.dll
    │  mgmtapi.dll
    │  newdev.exe
    │  ntprint.dll
    │  ntprint.exe
    │  OpcServices.dll
    │  pcl.sep
    │  print.exe
    │  PrintBrmUi.exe
    │  PrintDialogHost.exe
    │  PrintDialogs.dll
    │  printfilterpipelineprxy.dll
    │  printfilterpipelinesvc.exe
    │  PrintIsolationHost.exe
    │  PrintIsolationProxy.dll
    │  printmanagement.msc
    │  PrintPlatformConfig.dll
    │  PrintRenderAPIHost.DLL
    │  printui.dll
    │  printui.exe
    │  PrintWSDAHost.dll
    │  prncache.dll
    │  prnfldr.dll
    │  prnntfy.dll
    │  prntvpt.dll
    │  pscript.sep
    │  puiapi.dll
    │  puiobj.dll
    │  rasadhlp.dll
    │  RepCurUser.cmd
    │  ReSpooler.cmd
    │  serialui.dll
    │  spoolss.dll
    │  spoolsv.exe
    │  srclient.dll
    │  srcore.dll
    │  sysprint.sep
    │  sysprtj.sep
    │  tcpmon.ini
    │  umb.dll
    │  usbmon.dll
    │  webservices.dll
    │  win32spl.dll
    │  Windows.Devices.Printers.dll
    │  Windows.Devices.Printers.Extensions.dll
    │  Windows.Graphics.dll
    │  Windows.Graphics.Printing.3D.dll
    │  Windows.Graphics.Printing.dll
    │  Windows.Internal.Shell.Broker.dll
    │  WLIDNSP.DLL
    │  WlS0WndH.dll
    │  WSDApi.dll
    │  WSDMon.dll(1903没有了)
    │  wsdprintproxy.dll
    │  WSDScanProxy.dll
    │  XpsDocumentTargetPrint.dll
    │  XpsFilt.dll
    │  XpsGdiConverter.dll
    │  XpsPrint.dll
    │  XpsRasterService.dll
    │  XPSServiceS.DLL
    │  XPSSHHDR.dll
    │  xwizard.exe
    │  xwizards.dll
    │  xwtpdui.dll
    │  xwtpw32.dll
    │  
    ├─CatRoot
    │  └─{F750E6C3-38EE-11D1-85E5-00C04FC295EE}(注:含Print字符的cat文件,其中~zh-cn类型的都可以不要)
    │          
    ├─drivers
    │      usbprint.sys
    │      
    ├─driverstore
    │  ├─en-US
    │  │      c_dot4print.inf_loc
    │  │      c_pnpprinters.inf_loc
    │  │      c_printer.inf_loc
    │  │      c_receiptprinter.inf_loc
    │  │      
    │  ├─FileRepository
    │  │  ├─c_dot4print.inf_x86_3a482d7106e67af5
    │  │  │      c_dot4print.inf
    │  │  │      
    │  │  ├─c_pnpprinters.inf_x86_332e93a45a3e656a
    │  │  │      c_pnpprinters.inf
    │  │  │      
    │  │  ├─c_printer.inf_x86_e6ba9e11e6380557
    │  │  │      c_printer.inf
    │  │  │      
    │  │  ├─c_receiptprinter.inf_x86_f0322e57fec0dc81
    │  │  │      c_receiptprinter.inf
    │  │  │      
    │  │  ├─printqueue.inf_x86_5599cddb064d37cf
    │  │  │      printqueue.inf
    │  │  │      
    │  │  └─usbprint.inf_x86_08d44a3fd742371d
    │  │          usbprint.inf
    │  │          usbprint.sys
    │  │          
    │  └─zh-CN
    │          bthprint.inf_loc
    │          PrintQueue.inf_loc
    │          usbprint.inf_loc
    │          
    ├─spool(整个目录)
    │              
    └─zh-CN(下面对应的文件)

2、 基本驱动
Windows
├─INF
│      ntprint.inf
│      ntprint4.inf
│      tsprint.inf
│      wsdprint.inf
│      
└─System32
    ├─catroot
    │  └─{F750E6C3-38EE-11D1-85E5-00C04FC295EE}
    │          ntprint.cat
    │          ntprint4.cat
    │          
    └─DriverStore
        ├─en-US
        │      ntprint4.inf_loc
        ├─FileRepository
        │  ├─ntprint.inf_x86_ab738c05d09b470b
        │  ├─ntprint4.inf_x86_9d6305e59342bba1
        │  ├─tsprint.inf_x86_af7e87be969e4e2c
        │  └─wsdprint.inf_x86_69b253d182b5dd8c
        └─zh-CN
                ntprint.inf_loc
                tsprint.inf_loc
                WSDPrint.inf_loc
3、 系统集成的驱动
Windows
└─System32
    ├─CatRoot
  │  └─{F750E6C3-38EE-11D1-85E5-00C04FC295EE}中PRN开头的数据
      └─DriverStore
          └─FileRepository下以PRN开头的目录

三、 处理
1、 注册表导入
把上述三项注册表导入PE的system中。
2、 spoolsv.exe的破解
因为HKEY_LOCAL_MACHINE\SYSTEM\Setup\SystemSetupInProgress=0打印才能开启,但影响装显卡等其他驱动。用二进制编辑器打开spoolsv.exe,搜索Unicode编码SystemSetupInProgress,这个串随便改动其中的任何一个字母就行。(18362似乎找不到也不需要破解)
也可以用PECMD的命令PUTF %Windir%\System32\spoolsv.exe,0x2D0C,0x54来修改的一个字母,其中偏移位置先找出来。
3、 安装的核心命令:
解压上述文件到系统中
ntprint.exe
net start spooler
PnPutil.exe -i -a "%Windir%\inf\usbprint.inf”
注意,如果数据库中没登记,可以直接PECMD脚本安装:FORX @%Windir%\System32\DriverStore\FileRepository\usbprint.inf*,inf,1,exec =*drvload.exe "%inf%\usbprint.inf"


如果你的打印机系统中已经集成,则可以直接使用了,如果没有可以自备驱动到设备管理中安装,或者可以安装网络共享的打印机,因为组件已经安装好了。
以上文件列表及方法以Win10 1709 16299为蓝本。近期看1803 18362去掉了好多系统自带驱动,如我的HPM1005一体机就没有自带驱动了。

按上述的列表和注册表信息,转成WimBuilder2的批处理,

Z:\WimBuilder2\Projects\WIN10XPE\01-Components\Printer\main.bat

代码如下:

rem ==========update filesystem==========

set AddFiles_Mode=merge
;devices and printers
call AddDrivers "c_pnpprinters.inf,c_printer.inf,PrintQueue.inf,printupg.inf,usbprint.inf"

;base drivers
call AddDrivers "ntprint4.inf,ntprint.inf,ntprint4.inf,tsprint.inf,wsdprint.inf"

call AddFiles %0 :end_files
goto :end_files

\Windows\splwow64.exe
\Windows\PrintDialog

\Windows\System32\drivers\usbprint.sys
@\Windows\System32\driverstore\en-US
;devices and printers
c_dot4print.inf_loc
c_pnpprinters.inf_loc
c_printer.inf_loc
c_receiptprinter.inf_loc

;base drivers
ntprint4.inf_loc

@\Windows\System32\driverstore\%WB_PE_LANG%
;devices and printers
bthprint.inf_loc
PrintQueue.inf_loc
usbprint.inf_loc

;base drivers
ntprint.inf_loc
tsprint.inf_loc
WSDPrint.inf_loc

@\Windows\System32\catroot\{F750E6C3-38EE-11D1-85E5-00C04FC295EE}\
*Print*
ntprint.cat
ntprint4.cat
prn*.cat
@\Windows\System32\DriverStore\FileRepository\prn*.inf*

@\Windows\System32\
AppMon.dll,bidispl.dll,compstui.dll,DafPrintProvider.dll,defaultdevicemanager.dll,defaultprinterprovider.dll
DevDispItemProvider.dll,DeveloperOptionsSettingsHandlers.dll,deviceassociation.dll
DeviceCenter.dll,DeviceDisplayStatusManager.dll,DeviceDriverRetrievalClient.dll
DeviceEject.exe,DeviceElementSource.dll,DeviceEnroller.exe,DeviceMetadataRetrievalClient.dll
DevicePairing.dll,DevicePairingFolder.dll,DevicePairingProxy.dll,DevicePairingWizard.exe
deviceregistration.dll,DeviceSetupManager.dll,DeviceSetupManagerAPI.dll,DeviceSetupStatusProvider.dll
DevicesFlowBroker.dll,DeviceUxRes.dll,devinv.dll,DevPropMgr.dll,DevQueryBroker.dll,efswrt.dll
FaxPrinterInstaller.dll,FdDevQuery.dll,fdPnp.dll,fdprint.dll,fdWNet.dll,fdWSD.dll,findnetprinters.dll
fundisc.dll,fxsapi.dll,FXSMON.dll,FXSRESM.dll,gpprnext.dll,hgprint.dll,icm32.dll,icmui.dll
inetpp.dll,inetppui.dll,IPPMon.dll,localspl.dll,localui.dll,mgmtapi.dll
newdev.exe,ntprint.dll,ntprint.exe,OpcServices.dll,pcl.sep,print.exe
PrintBrmUi.exe,PrintDialogHost.exe,PrintDialogs.dll,printfilterpipelineprxy.dll,printfilterpipelinesvc.exe
PrintIsolationHost.exe,PrintIsolationProxy.dll,printmanagement.msc,PrintPlatformConfig.dll,PrintRenderAPIHost.DLL
printui.dll,printui.exe,PrintWSDAHost.dll,prncache.dll,prnfldr.dll,prnntfy.dll,prntvpt.dll,pscript.sep
puiapi.dll,puiobj.dll,rasadhlp.dll,RepCurUser.cmd,ReSpooler.cmd,serialui.dll,spoolss.dll,spoolsv.exe,srclient.dll
srcore.dll,sysprint.sep,sysprtj.sep,tcpmon.ini,umb.dll,usbmon.dll,webservices.dll,win32spl.dll
Windows.Devices.Printers.dll,Windows.Devices.Printers.Extensions.dll
Windows.Graphics.dll,Windows.Graphics.Printing.3D.dll,Windows.Graphics.Printing.dll
Windows.Internal.Shell.Broker.dll,WLIDNSP.DLL,WlS0WndH.dll,WSDApi.dll,WSDMon.dll,wsdprintproxy.dll,WSDScanProxy.dll
XpsDocumentTargetPrint.dll,XpsFilt.dll,XpsGdiConverter.dll,XpsPrint.dll,XpsRasterService.dll,XPSServiceS.DLL,XPSSHHDR.dll
xwizard.exe,xwizards.dll,xwtpdui.dll,xwtpw32.dll
:end_files

call DoAddFiles

rem ==========update registry==========

call RegCopy SYSTEM\ControlSet001\Control\Print
call RegCopy SYSTEM\ControlSet001\Control\Class\{1ed2bbf9-11f0-4084-b21f-ad83a8e6dcdc}
call RegCopy SYSTEM\ControlSet001\Control\Class\{4658ee7e-f050-11d1-b6bd-00c04fa372a7}
call RegCopy SYSTEM\ControlSet001\Control\Class\{49ce6ac8-6f86-11d2-b1e5-0080c72e74a2}
call RegCopy SYSTEM\ControlSet001\Control\Class\{4d36e979-e325-11ce-bfc1-08002be10318}
call RegCopy SYSTEM\ControlSet001\Control\Class\{c30ecea0-11ef-4ef9-b02e-6af81e6e65c0}
call RegCopy SYSTEM\ControlSet001\Control\Class\{c7bc9b22-21f0-4f0d-9bb6-66c229b8cd33}

rem add services
call RegCopyEx Services Spooler

rem remove usbprint if this is additional component
call RegCopyEx Services usbprint

rem update spoolsv.exe binary
binmay.exe -u "%X_SYS%\spoolsv.exe" -s u:SystemSetupInProgress -r u:DisableSpoolsvInWinPE
fc /b "%X_SYS%\spoolsv.exe.org" "%X_SYS%\spoolsv.exe"
del /f /q "%X_SYS%\spoolsv.exe.org"

rem EnablePrintFeature
md "%X%\PEMaterial"
if 1==1 (
  echo ntprint.exe
  echo net start spooler
  echo PnPutil.exe -i -a "%%Windir%%\inf\usbprint.inf"
)>"%X%\PEMaterial\EnablePrintFeature.bat"
rem call link "%X%\PEMaterial\EnablePrintFeature.bat" "%X_Desktop%\EnablePrintFeature.lnk"
 

注意:从1903开始,需要加多如下这条注册表项:

Z:\WimBuilder2\Projects\WIN10XPE\01-Components\Devices and Printers\last.bat添加

reg add "HKEY_LOCAL_MACHINE\tmp_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Notifications\Data" /v 41960B29A3BC0C75 /t REG_BINARY /d 0100000001000000 /f

经测试,并不是记事本不能打印,而是新的记事本可能默认使用雅黑字体,所以打印时出现参数错误。同时使用word有的文件也不能打印,发现也是用了非宋体。这些都是使用精简字体引起。

 

有时点打印时,打印机不提示也不动,空白文档,打印机可以打,再输几个字也可以打。至此怀疑是字体的问题,马上打开原文件,使用的是等线体,全选改宋体就可以打印。又把内核换原版字体,再试记事本也可以打了。

最后,关于打印时出现 “参数错误” 的问题,有时点打印时,打印机不提示也不动,这些都是使用精简字体引起,打印功能不能使用精简字体。切记一定要保持系统的字体是完整的!

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/CS41806516/article/details/122403430

智能推荐

android APP 启动传入参数_goldxclub的博客-程序员秘密

android  APP  启动传入参数adb shell am start -n com.ledon.ledongym/.activity.StartActivity --es way "second"com.ledon.ledongym     com.ledon.ledongym.activity.StartActivity     参数 way   值 seco

java开发工具排名_排名前16的Java工具类_约翰·波拿巴的博客-程序员秘密

在Java中,工具类定义了一组公共方法,这篇文章将介绍Java中使用最频繁及最通用的Java工具类。以下工具类、方法按使用流行度排名,参考数据来源于Github上随机选取的5万个开源项目源码。一. org.apache.commons.io.IOUtilscloseQuietly:关闭一个IO流、socket、或者selector且不抛出异常,通常放在finally块toString:转换IO流、...

Android移动应用技术打地鼠小游戏(简单App实现)——学习成果_设计一个打地鼠游戏app。_然小九的博客-程序员秘密

Android学习成果之打地鼠小游戏打地鼠小游戏界面下面展示一下我的打地鼠界面打地鼠小游戏界面这款打地鼠小游戏是我学习了各种网课、还有老师上课讲的内容、和一部分大佬的博客,然后加入了自己的一些东西,最后做出来的。做出来之后非常开心,虽然页面很简单,很容易实现,但是也学习到了许多东西,成就感满满!(图片是我从小红书上找的)下面展示一下我的打地鼠界面使用的开发工具为:Android studio...

Jquery 禁用浏览器的 后退和前进按钮_weixin_30521161的博客-程序员秘密

使用js,Jquery 禁用浏览器的back 和 next 按钮:有时为了防治用户乱了访问顺序,不得不禁掉浏览器的前进后退按钮。 jQuery(document).ready(function () { if (window.history && window.history.pushState) { ...

数据库原理及其应用-触发器操作(创建一个能进行自动补货操作的触发器)_是阿杜呀的博客-程序员秘密

文章目录前言一、触发器是什么?二、触发器的分类三、模拟案例总结前言数据库原理及其应用也同样的经过漫长的学习过后完成,当然很感谢老师的精彩讲解,这次主要是对于这10周学习数据库的一个总结,从开学到现在我也是更着老师从最开始数据库的原理一直到数据库的应用一路走到最后,想想还是有很多知识还是比较陌生。可能自己没有理解到吧,今天我就照着最后一次的数据库原理的课程之后遗留的一个问题来讲述吧。主要是关于触发器的操作。一、触发器是什么?触发器是一种特殊的存储过程,它不同于存储过程。触发器是SQL Server

php基础语法——循环语句_php循环语句_处处有明的博客-程序员秘密

八、循环语句1、while 循环while (条件为真) { 要执行的代码;}2、do...while 循环do { 要执行的代码;} while (条件为真);3、for 循环for (init counter; test counter; increment counter) { code to be executed;}<?php...

随便推点

内存性能测试工具-程序员秘密

与CPU的重要性类似,内存也是一个计算机系统中最基本、最重要的组件,因为任何应用程序的执行都需要用到内存。将内存密集型的应用程序分别在非虚拟化的原生系统和KVM客户机中运行,然后根据它们的运行效率就可以粗略评估KVM的内存虚拟化性能。对于内存的性能测试,可以选择CPU性能测试工具提到的SPECjbb2015、SysBench、内核编译等基准测试(因为它们同时也是内存密集型的测试),还可以选择LMbench、Memtest86+、STREAM等测试工具。下面简单介绍几种内存性能测试工具。1. LMbench

hexo博客_weixin_34040079的博客-程序员秘密

一劳永逸的搞定 flex 布局寻根溯源话布局 一切都始于这样一个问题:怎样通过 CSS 简单而优雅的实现水平、垂直同时居中。记得刚开始学习 CSS 的时候,看到 float 属性不由得感觉眼前一亮,顺理成章的联想到 Word 文档排版中用到的的左对齐、右对齐和居中对齐,然而很快就失望的发现 CSS 中并不存…读书笔记 - 你不知道的 ...

迅雷专用链接原理及转换_weixin_30822451的博客-程序员秘密

对于迅雷专用链接不用我去解释相信大家都明白(别告诉我你不懂~汗),现在就链接的编码原理及转换详细说明一下,明白以后就可以用迅雷下载快车、旋风专用地址的软件啦。首先要明白Base64编码是怎么一回事,不懂的先去百度一下再回来。 Base64编码是一种加密算法,Email的原始信息就是由Base64编码构成的。 而这些专用链接都是通过Base64编码加工转换而成的。迅雷专用地址例子:thund...

Java Scanner类的介绍及使用_为什么要创建一个scanner类型_hellosc01的博客-程序员秘密

什么是Scanner类scanner的中文翻译是扫描仪。顾名思义,Scanner类可以生成一个解析基本类型和字符串的简单文本扫描仪。Scanner类的简单使用步骤1 查看类并导入类//该类需要import导入后使用java.util.Scanner:2 查看构造方法// 构造一个新的Scanner,它生成的值是从指定的输入流扫描的public Scanner(InputStream source);3 查看成员方法// 将输入信息的下一个标记扫描为一个int值public int

LarduinoISP for LGT8FX8D SWD通信协议源码简析_arduino swd_刀口的博客-程序员秘密

LGT8FX8D/P系列的CPU可以指令级兼容avr芯片,引脚定义也相近.从avr的程序移植到LGT8FX8D/P只需作少量的修改,性价比高,应用广泛.要将程序写入空片,其flash烧写方式与avr并不一样,需要专门的调试下载器.使用说明在LarduinoISP for LGT8FX8D公开了份代码,其中实现了通过SWD接口实现LGT8FX8D的读写.我们通过阅读这份代码来看看通过SWD通信方...

hdoj_longyuan20102011的博客-程序员秘密

#include int team[505][505];int degree[505];int N,M;int main(){ while(scanf("%d%d",&N,&M)!=EOF) { int i,j; //初始化 for(i=1;i<=N;i++) { degree[i]=0; for(j=1;j<=N;j++)

推荐文章

热门文章

相关标签