;/*++
;
;Copyright (c) 2014-2025 Red Hat Inc.
;
;
;Module Name:
;    viorng.inf
;
;Abstract:
;
;Installation Notes:
;    Step by step driver installation wiki:
;        https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/Driver-installation
;
;--*/

[Version]
Signature       = "$WINDOWS NT$"
Class           = System
ClassGuid       = {4d36e97d-e325-11ce-bfc1-08002be10318}
Provider        = %VENDOR%
CatalogFile     = viorng.cat
PnpLockdown     = 1
DriverVer = 02/18/2026,100.103.104.29700

;
; Bcrypt always looking for provider DLL at system32 directory
; Check that provider works fine on both client and server windows
; before moving VirtRng_Provider_CopyFiles destination
; Related documentation
; https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/ns-bcrypt-crypt_image_reg
; pszImage - A pointer to a null-terminated Unicode string that contains only the file name of the provider module.
;
[DestinationDirs]
DefaultDestDir = 12
VirtRng_Provider_CopyFiles = 11

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

[SourceDisksFiles]
viorng.sys = 1,,
viorngum.dll = 1

; ---------------
; Install Section
; ---------------

[Manufacturer]
%VENDOR% = Standard,NTx86.10.0

[Standard.NTx86.10.0]
%VirtRng.DeviceDesc% = VirtRng_Device, PCI\VEN_1AF4&DEV_1005&SUBSYS_00041AF4&REV_00, PCI\VEN_1AF4&DEV_1005
%VirtRng.DeviceDesc% = VirtRng_Device, PCI\VEN_1AF4&DEV_1044&SUBSYS_11001AF4&REV_01, PCI\VEN_1AF4&DEV_1044

[VirtRng_Device.NT]
CopyFiles = VirtRng_CopyFiles
CopyFiles = VirtRng_Provider_CopyFiles
AddReg = VirtRng_Provider_AddReg

[VirtRng_Device.NT.HW]
AddReg = VirtRng_AddReg

[VirtRng_CopyFiles]
viorng.sys

[VirtRng_AddReg]
HKR,Interrupt Management,,0x00000010
HKR,Interrupt Management\MessageSignaledInterruptProperties,,0x00000010
HKR,Interrupt Management\MessageSignaledInterruptProperties,MSISupported,0x00010001,1
HKR,Interrupt Management\MessageSignaledInterruptProperties,MessageNumberLimit,0x00010001,1

; --------------------
; Service Installation
; --------------------

[VirtRng_Device.NT.Services]
AddService = VirtRng,0x00000002,VirtRng_Service_Install

[VirtRng_Service_Install]
DisplayName    = %VirtRng.Service%
ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
StartType      = 3               ; SERVICE_DEMAND_START
ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
ServiceBinary  = %12%\viorng.sys
LoadOrderGroup = Extended Base
AddReg         = DmaRemappingCompatible.Reg

[DmaRemappingCompatible.Reg]
HKR,Parameters,DmaRemappingCompatible,0x00010001,1

; -------------------------
; RNG Provider Installation
; -------------------------

[VirtRng_Provider_CopyFiles]
viorngum.dll

[VirtRng_Provider_AddReg]
HKLM,SYSTEM\CurrentControlSet\Control\Cryptography\Providers\%PROVIDER_NAME%\UM,Image,,viorngum.dll
HKLM,SYSTEM\CurrentControlSet\Control\Cryptography\Providers\%PROVIDER_NAME%\UM\00000006,Flags,%REG_DWORD%,0x00000001
HKLM,SYSTEM\CurrentControlSet\Control\Cryptography\Providers\%PROVIDER_NAME%\UM\00000006,Functions,%REG_MULTI_SZ%,RNG
HKLM,SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\Default\00000006\RNG,Providers,%REG_MULTI_SZ_APPEND%,%PROVIDER_NAME%


[VirtRng_Device.NT.Wdf]
KmdfService = VirtRng, VirtRng_wdfsect

[VirtRng_wdfsect]
KmdfLibraryVersion = 1.15

[Strings]
VENDOR              = "Red Hat, Inc."
DiskName            = "VirtIO RNG Installation Disk"
VirtRng.DeviceDesc  = "VirtIO RNG Device"
VirtRng.Service     = "VirtIO RNG Service"
REG_DWORD           = 0x00010001
REG_MULTI_SZ        = 0x00010000
REG_MULTI_SZ_APPEND = 0x00010008
PROVIDER_NAME       = "QEMU VirtIO RNG Provider"
