Including Services in Addons and Update Packs

Discuss & post Update Pack addons here.
Post Reply
Zephyr
Posts: 118
Joined: Sun Nov 22, 2015 4:53 pm
Location: London

Including Services in Addons and Update Packs

Post by Zephyr » Wed Sep 23, 2020 3:23 pm

I have been having tremendous problems installing a service through an update pack because I cannot succeed in making the standard INF directives for services work in the INF files of addons and update packs. I could just log the registry entries for an installation, but the entries for the Security key are unique for every machine, and cannot be transferred to another machine. Here is what I have tried including entries in entries.ini to copy the driver files to their final location.

[WINUSB.NT.Services]
Addservice = WINUSB, 0x00000002, WINUSB.AddService

[WINUSB.AddService]
DisplayName = WinUsb Driver
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.SYS

This does not work in the main update pack section, during T13 or during first user start by adding an entry for RunPostSetupCommands started by a RunOnce registry entry.

I have also tried this without success:

[KB971286]
HKLM,"%SERVICES%\winusb","Type",0x10001,1
HKLM,"%SERVICES%\winusb","Start",0x10001,3
HKLM,"%SERVICES%\winusb","ErrorControl",0x10001,1
HKLM,"%SERVICES%\winusb","ImagePath",0x20000,"system32\DRIVERS\winusb.sys"
HKLM,"%SERVICES%\winusb","DisplayName",0,"WinUSB Driver"
HKLM,"%SERVICES%\winusb\Parameters\Wdf","KmdfLibraryVersion",0,"1.9"

[T13]
RunPostSetupCommands = T13.Winusb.RunCommand:1

[T13.Winusb.RunCommand]
;Security descriptors for winusb copied from another machine.
sc sdset Wdf01000 D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc sdset WudfPf D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc sdset WudfRd D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc sdset WudfSvc D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)

This does not work either:

[KB971286]
HKLM,"%SERVICES%\winusb","Type",0x10001,1
HKLM,"%SERVICES%\winusb","Start",0x10001,3
HKLM,"%SERVICES%\winusb","ErrorControl",0x10001,1
HKLM,"%SERVICES%\winusb","ImagePath",0x20000,"system32\DRIVERS\winusb.sys"
HKLM,"%SERVICES%\winusb","DisplayName",0,"WinUSB Driver"
HKLM,"%SERVICES%\winusb\Parameters\Wdf","KmdfLibraryVersion",0,"1.9"

[T13.SetRunOnce]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","Setup_qfeUpPck",,"rundll32.exe advpack.dll,LaunchINFSection qfeUpPck.inf,Logon.RunOnce"

[Logon.RunOnce]
RunPostSetupCommands = Winusb.Logon.RunOnce

[Winusb.Logon.RunOnce]
;Security descriptors for winusb copied from another machine.
sc sdset Wdf01000 D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc sdset WudfPf D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc sdset WudfRd D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc sdset WudfSvc D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)

This is what I eventually got to succeed. I created an INF file to install the service named winusb0200.inf which included sections for [DefaultInstall] and [DefaultInstall.Services], and I made entries in entries.ini to copy the driver files, security catalog and winusb0200.inf to Windows\Temp. I then included a RunOnce entry in the update pack like this:

[T13.SetRunOnce]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","!Winusb0200",0x20000,"rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 %SystemRoot%\Temp\Winusb0200.inf"

Although this works it is not ideal because it involves copying the driver files, and security catalog twice. I include my winusb0200.inf as an attachment.
Attachments
winusb0200.7z
(1.23 KiB) Downloaded 115 times
XP FOREVER!

travma
Posts: 13
Joined: Fri Feb 06, 2015 1:59 am

Re: Including Services in Addons and Update Packs

Post by travma » Mon Oct 12, 2020 8:03 am

Why in winusb0200.7z the section needs to be %SP2UPDATES% where SP3 is also exist?

Zephyr
Posts: 118
Joined: Sun Nov 22, 2015 4:53 pm
Location: London

Re: Including Services in Addons and Update Packs

Post by Zephyr » Thu Oct 15, 2020 3:47 am

travma wrote:
Mon Oct 12, 2020 8:03 am
Why in winusb0200.7z the section needs to be %SP2UPDATES% where SP3 is also exist?
For some strange reason the update winusb0200.exe registers the update in HKLM\SOFTWARE\Microsoft\Updates\Windows XP\SP2 and not in HKLM\SOFTWARE\Microsoft\Updates\Windows XP\SP3, so I have copied this scheme. Why the Windows XP key needs subkeys for SP0, SP1, SP2, SP3, SP4, and SP10 is a mystery to me. You might assume that winusb0200 was placed in under the SP2 key because it was released before SP3 was released, but this update was released in 2009.
XP FOREVER!

Zephyr
Posts: 118
Joined: Sun Nov 22, 2015 4:53 pm
Location: London

Re: Including Services in Addons and Update Packs

Post by Zephyr » Thu Oct 15, 2020 4:09 am

Hi guys,

I present what I hope is the definitive solution to including a Windows service in an addon or update pack. Basically it involves copying the drivers to their final location, the security catalog to the SVCPACK folder and installing the registry entries from an INF file that is executed by rundll32.exe at the first user start using a runonce registry entry. Here are the relevant entries in a typical update pack or addon:

ENTRIES.INI

[dosnet_files]
d1,winusb.dll
d1,winusb20.inf
d1,winusb.sys

[txtsetup_files]
winusb.dll = 100,,,,,,,2,0,0
winusb20.inf = 100,,,,,,,20,0,0,winusb0200.inf
winusb.sys = 100,,,,,,,4,0,0

[EditFile]
i386\svcpack.inf,ProductCatalogsToInstall,AddCatalog

[AddCatalog]
winusb0200.cat

UPDATEPACK.INF

[T13.AddReg]
AddReg=T13.SetRunOnce.AddReg

[T13.SetRunOnce.AddReg]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","Winusb0200",0x20000,"rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 Winusb0200.inf"

The INF file must have a DefaultInstall section for this to work. I used the Microsoft utility chkinf.exe included with the WDK 7.1 to check my INF file for errors before I could finally get this to work. I include the INF file in the attachment with this post.
Attachments
winusb20.7z
(1.08 KiB) Downloaded 22 times
XP FOREVER!

Zephyr
Posts: 118
Joined: Sun Nov 22, 2015 4:53 pm
Location: London

Re: Including Services in Addons and Update Packs

Post by Zephyr » Thu Oct 15, 2020 9:34 am

Hi guys,

I am presenting an alternative definitive solution to including a Windows service in an addon or update pack. In this approach an INF file is executed by rundll32.exe at T13 using the RunPostSetupCommands directive which enables executables to be run from an INF install.

I have replaced this:

UPDATEPACK.INF

[T13.AddReg]
AddReg=T13.SetRunOnce.AddReg

[T13.SetRunOnce.AddReg]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","Winusb0200",0x20000,"rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 Winusb0200.inf"

With this:

UPDATEPACK.INF

[T13]
RunPostSetupCommands=T13.Winusb.RunCommand:1

[T13.Winusb.RunCommand]
%11%\rundll32.exe syssetup,SetupInfObjectInstallAction DefaultInstall 128 Winusb0200.inf

Note that you have to specify the location of rundll32.exe with the variable %11% which is System32. Using these techniques I should be able to make a final revision of XPSP3_QFE_UpdatePack for Windows XP Post-SP3 including Winusb, WUDF, and KMUDF along with KB4500331.
XP FOREVER!

Post Reply