;
; usbaudio2.inf
;

[Version]
Signature="$WINDOWS NT$"
Class=MEDIA
ClassGuid={4d36e96c-e325-11ce-bfc1-08002be10318}
Provider=%MSFT%
DriverVer = 05/06/2022,10.0.22621.1
PnpLockdown=1

[DestinationDirs]
Drivers_Dir = 12

[SourceDisksNames]
1 = %DiskName%,,,""

[SourceDisksFiles]
usbaudio2.sys  = 1,,

;*****************************************
; Install Section
;*****************************************

[Manufacturer]
%MSFT%=Microsoft,NTamd64

[ControlFlags]
PreConfigureDriver=*

[Microsoft.NTamd64]
%SubClass_00.DeviceDesc%=usbaudio2_Device, USB\Class_01&SubClass_00&Prot_20
%SubClass_01.DeviceDesc%=usbaudio2_Device, USB\Class_01&SubClass_01&Prot_20
%SubClass_02.DeviceDesc%=usbaudio2_Device, USB\Class_01&SubClass_02&Prot_20
%SubClass_03.DeviceDesc%=usbaudio2_Device, USB\Class_01&SubClass_03&Prot_20

[usbaudio2_Device.NT]

Include=ks.inf,wdmaudio.inf
Needs=KS.Registration,WDMAUDIO.Registration

CopyFiles=Drivers_Dir
AddProperty=usbaudio2_Device.AddProp
AddReg=usbaudio2_Device.AddReg
PreferDeviceInfo=1

[usbaudio2_Device.AddProp]
GenericDriverInstalled,,,,1

[usbaudio2_Device.AddReg]
HKR,,Driver,,usbaudio2.sys
HKR,,CLSID,,%Proxy.CLSID%

HKR,,AssociatedFilters,,"wdmaud,redbook"

HKR,Drivers,SubClasses,,"wave,midi,mixer,aux"

HKR,Drivers\wave\wdmaud.drv,Driver,,wdmaud.drv
HKR,Drivers\midi\wdmaud.drv,Driver,,wdmaud.drv
HKR,Drivers\mixer\wdmaud.drv,Driver,,wdmaud.drv
HKR,Drivers\aux\wdmaud.drv,Driver,,wdmaud.drv

HKR,Drivers\wave\wdmaud.drv,Description,,%WdmAudioGenericDesc%
HKR,Drivers\midi\wdmaud.drv,Description,,%WdmMidiGenericDesc%
HKR,Drivers\mixer\wdmaud.drv,Description,,%WdmAudioGenericDesc%
HKR,Drivers\aux\wdmaud.drv,Description,,%WdmAudioGenericDesc%

; enable the UsePositionLock lock feature in portcls
HKR, DispatchSettings, UsePositionLock, 3, 01, 00, 00, 00


[usbaudio2_Device.NT.HW]
AddReg = usbaudio2_Device_HW.AddReg

[usbaudio2_Device_HW.AddReg]
; FILE_DEVICE_SOUND
HKR,,DeviceType,0x10001,0x0000001D
; SDDL_DEVOBJ_SYS_ALL_ADM_RWX_WORLD_RWX_RES_RWX
HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GRGWGX;;;WD)(A;;GRGWGX;;;RC)"

[Drivers_Dir]
usbaudio2.sys,,,0x0100

;-------------- Service installation
[usbaudio2_Device.NT.Services]
AddService = usbaudio2, %SPSVCINST_ASSOCSERVICE%, usbaudio2_Service_Inst, usbaudio2_Eventlog

; -------------- usbaudio2 driver install sections
[usbaudio2_Service_Inst]
DisplayName    = %usbaudio2.SVCDESC%
ServiceType    = %SERVICE_KERNEL_DRIVER%
StartType      = %SERVICE_DEMAND_START%
ErrorControl   = %SERVICE_ERROR_NORMAL%
ServiceBinary  = %12%\usbaudio2.sys

[usbaudio2_Eventlog]
AddReg = usbaudio2_Eventlog_AddReg

[usbaudio2_Eventlog_AddReg]
HKR,,EventMessageFile,%REG_EXPAND_SZ%,"%%SystemRoot%%\System32\iologmsg.dll;%%SystemRoot%%\System32\drivers\usbaudio2.sys"
HKR,,TypesSupported,%REG_DWORD%,7

;======================================================
; Interface registration
;======================================================
[usbaudio2_Device.NT.Interfaces]
AddInterface = %KSCATEGORY_AUDIO%,    %KSNAME_Topology%, usbaudio2_I_Topology
AddInterface = %KSCATEGORY_TOPOLOGY%, %KSNAME_Topology%, usbaudio2_I_Topology

AddInterface = %KSCATEGORY_AUDIO%,    %KSNAME_Wave%, usbaudio2_I_Wave
AddInterface = %KSCATEGORY_RENDER%,   %KSNAME_Wave%, usbaudio2_I_Wave
AddInterface = %KSCATEGORY_CAPTURE%,  %KSNAME_Wave%, usbaudio2_I_Wave
AddInterface = %KSCATEGORY_REALTIME%, %KSNAME_Wave%, usbaudio2_I_Wave


[usbaudio2_I_Topology]
AddReg = usbaudio2_I_Topology_AddReg

[usbaudio2_I_Topology_AddReg]
HKR,,CLSID,,%Proxy.CLSID%
HKR,,FriendlyName,,%DefaultFriendlyName_Topo%

; MSEP
HKR,"MSEP\0",%PKEY_AudioEndpoint_Association%,,%KSNODETYPE_ANY%
HKR,"MSEP\0",%PKEY_AudioEndpoint_Supports_EventDriven_Mode%,%REG_DWORD%,0x1

; MSFX
HKR,"MSFX\0",%PKEY_FX_Association%,,%KSNODETYPE_ANY%

HKR,"MSFX\0",%PKEY_ItemNameDisplay%,,%FX_FriendlyName%

HKR,"MSFX\0",%PKEY_SFX_ProcessingModes_Supported_For_Streaming%,%REG_MULTI_SZ%,%AUDIO_SIGNALPROCESSINGMODE_DEFAULT%
HKR,"MSFX\0",%PKEY_MFX_ProcessingModes_Supported_For_Streaming%,%REG_MULTI_SZ%,%AUDIO_SIGNALPROCESSINGMODE_DEFAULT%


[usbaudio2_I_Wave]
AddReg = usbaudio2_I_Wave_AddReg

[usbaudio2_I_Wave_AddReg]
HKR,,CLSID,,%Proxy.CLSID%
HKR,,FriendlyName,,%DefaultFriendlyName_Wave%

;======================================================
; COMMON
;======================================================
[Strings]

;Localizable
MSFT = "Microsoft"; {Placeholder="Microsoft"}
DeviceDesc = "USB Audio 2.0"; {Placeholder="USB"}
DiskName = "USB Audio 2.0 Installation Disk"; {Placeholder="USB"}
usbaudio2.SVCDESC = "USB Audio 2.0 Service"; {Placeholder="USB"}

SubClass_00.DeviceDesc = "USB Audio 2.0"; {Placeholder="USB"}
SubClass_01.DeviceDesc = "USB Audio 2.0"; {Placeholder="USB"}
SubClass_02.DeviceDesc = "USB Audio 2.0"; {Placeholder="USB"}
SubClass_03.DeviceDesc = "USB Audio 2.0"; {Placeholder="USB"}

WdmAudioGenericDesc="USB Audio Device"; {Placeholder="USB"}
WdmMidiGenericDesc="USB MIDI Device"; {Placeholder="USB"}

FX_FriendlyName  = "Microsoft Audio Home Theater Effects"

; Default friendly names. Will be overwritten with USB Product string, if available.
DefaultFriendlyName_Topo = "USB Audio Class 2 Device"; {Placeholder="USB"}
DefaultFriendlyName_Wave = "USB Audio Class 2 Device"; {Placeholder="USB"}

;Non-Localizable
SPSVCINST_ASSOCSERVICE = 0x00000002
SERVICE_KERNEL_DRIVER  = 0x00000001
SERVICE_DEMAND_START   = 0x00000003
SERVICE_ERROR_NORMAL   = 0x00000001

REG_SZ         = 0x00000000
REG_MULTI_SZ   = 0x00010000
REG_EXPAND_SZ  = 0x00020000
REG_BINARY     = 0x00000001
REG_DWORD      = 0x00010001

Proxy.CLSID = "{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_AUDIO = "{6994AD04-93EF-11D0-A3CC-00A0C9223196}"
KSCATEGORY_RENDER = "{65E8773E-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_CAPTURE = "{65E8773D-8F56-11D0-A3B9-00A0C9223196}"
KSCATEGORY_REALTIME ="{EB115FFC-10C8-4964-831D-6DCB02E6F23F}"
KSCATEGORY_TOPOLOGY = "{DDA54A40-1E4C-11D1-A050-405705C10000}"

KSNODETYPE_ANY = "{00000000-0000-0000-0000-000000000000}"

PKEY_AudioEndpoint_Association               = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},2"
PKEY_AudioEndpoint_Supports_EventDriven_Mode = "{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F0E},7"

PKEY_FX_Association         = "{D04E05A6-594B-4FB6-A80D-01AF5EED7D1D},0"
PKEY_FX_FriendlyName        = "{D04E05A6-594B-4fb6-A80D-01AF5EED7D1D},4"
PKEY_ItemNameDisplay        = "{B725F130-47EF-101A-A5F1-02608C9EEBAC},10"

PKEY_SFX_ProcessingModes_Supported_For_Streaming = "{D3993A3F-99C2-4402-B5EC-A92A0367664B},5"
PKEY_MFX_ProcessingModes_Supported_For_Streaming = "{D3993A3F-99C2-4402-B5EC-A92A0367664B},6"

AUDIO_SIGNALPROCESSINGMODE_DEFAULT = "{C18E2F7E-933D-4965-B7D1-1EEF228D2AF3}"

; These names MUST match the subdevice names used in the code, see sTopoDeviceName and sWaveDeviceName
KSNAME_Topology="msft_topo"
KSNAME_Wave="msft_wave"
