I examined your bat and cmd files. It seemed a very hard work to me to port them into XPE.
Would you please help?
enable printing support you just need do 3 things,
1). add require system files (extract from install.wim)
2). update registry (reg add or reg import *.reg)
3). set X:\Windows\System32\spool\PRINTERS folder's ACL to everyone
4). [optional]Create a shortcut to start printer service.
1). In WimBuilder2 is like:
call AddFiles %0 :end_files
goto :end_files
\Windows\splwow64.exe
\Windows\PrintDialog
\Windows\Inf\prn*.inf
\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
@\Windows\System32\
;Windows Photo Viewer needs them too
spool\
coloradapterclient.dll,efswrt.dll,icm32.dll,mscms.dll,photowiz.dll,shimgvw.dll
DafPrintProvider.dll
DevDispItemProvider.dll,DeveloperOptionsSettingsHandlers.dll,deviceassociation.dll
DeviceCenter.dll,DeviceDisplayStatusManager.dll
...
:end_files
It is very clear to me what need to extract from install.wim. (Is this hard to understand? just file list for me.)
If you ask me How to extract files from install.wim, there are lots XPE script in XPE project, you just copy them.
WIN10XPE\Projects\Win10XPE\Features\Audio.Script[Process]
Echo,"Processing %ScriptTitle%..."
Run,%ScriptFile%,AddFiles
[AddFiles]
If,ExistFile,%ScriptDir%\Audio_AddFiles.txt,ExtractListFiles,%ScriptDir%\Audio_AddFiles.txt
If,%SourceBuild%,Bigger,18300,ExtractSectionFiles,%ScriptFile%,Audio_1903_AddFiles
[Audio_1903_AddFiles]
\Windows\System32\SysFxUI.dll
\Windows\System32\WMALFXGFXDSP.dll
Is this hard to create Printer.Script?
[Process]
Echo,"Processing %ScriptTitle%..."
Run,%ScriptFile%,AddFiles
[AddFiles]
ExtractSectionFiles,%ScriptFile%,Printer_AddFiles
[Printer_AddFiles]
\Windows\splwow64.exe
\Windows\PrintDialog
\Windows\Inf\prn*.inf
\Windows\System32\DafPrintProvider.dll
\Windows\System32\DevDispItemProvider.dll
\Windows\System32\DeveloperOptionsSettingsHandlers.dll
\Windows\System32\deviceassociation.dll
\Windows\System32\xxx.dll
\Windows\System32\yyy.dll
\Windows\System32\aaa.dll
\Windows\System32\zzz.dll
...
2).About updating registry
In WimBuilder2 is like:
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}
rem add services
call RegCopyEx Services Spooler
rem remove usbprint if this is additional component
call RegCopyEx Services usbprint
rem avoid error: "the printer driver is not compatible with a policy on your computer which disable NT4.0 driver"
reg add "HKLM\Tmp_Software\Policies\Microsoft\Windows NT\Printers" /v KmPrintersAreBlocked /t REG_DWORD /d 0 /f
rem register WNF_DEP_OOBE_COMPLETE notification for v1903 and later
if %VER[3]% GTR 18300 (
reg add "HKLM\tmp_SOFTWARE\Microsoft\Windows NT\CurrentVersion\Notifications\Data" /v 41960B29A3BC0C75 /t REG_BINARY /d 0100000001000000 /f
)
If you ask me How to update registry in XPE, there are lots XPE script in XPE project, you just copy them.
Also see WIN10XPE\Projects\Win10XPE\Features\Audio.ScriptRegCopyKey,HKLM,"Tmp_Software\Microsoft\Windows NT\CurrentVersion\MCI Extensions"
RegCopyKey,HKLM,"Tmp_Software\Microsoft\Windows NT\CurrentVersion\MCI32"
//In WinRE.wim RegCopyKey,HKLM,"Tmp_Software\Microsoft\Windows NT\CurrentVersion\Multimedia"
// Sound Volume Bar
RegWrite,HKLM,0x4,Tmp_Software\Microsoft\Windows NT\CurrentVersion\MTCUVC,EnableMtcUvc,0
// Associate .mp3 with mpg123.exe
RegWrite,HKLM,0x1,Tmp_Software\Classes\.mp3,,mpg123
3). set X:\Windows\System32\spool\PRINTERS folder's ACL to everyoneIn WimBuilder2 is like:
rem ; V1709
SetACL.exe -on "%X_SYS%\spool\PRINTERS" -ot file -actn ace -ace "n:Everyone;p:full;s:y"
I think you can call Execute in XPE script, or there is a FileACL macro for this.
4). Shortcut
_printer.bat
call LinkToDesktop -paramlist "#{@printui.dll,12007}.lnk" "[[X:\%opt[loader.PEMaterial]%\EnablePrintFeature.bat]], '', 'shell32.dll', 16"
WimBuilder2's LinkToDesktop can create shortcut with system dll's string resource, make the name in the language of Windows PE's language.
WIN10XPE's AddShortcut macro don't have the ability, you can simply make it to "EnablePrinter.lnk".
It seemed a very hard work to me to port them into XPE.
I can't understand which part is hard for you. all the steps have a lots of well sample codes in XPE project.