# Synthetic provider manifests and shared native writer boundary; no Windows changes. $ErrorActionPreference='Stop' $repo=Split-Path $PSScriptRoot -Parent Import-Module (Join-Path $repo 'modules/EventLogSettings.psm1') -Force Import-Module (Join-Path $repo 'modules/NativeProviders.psm1') -Force Import-Module (Join-Path $repo 'modules/NativeChannelAccess.psm1') -Force . (Join-Path $repo 'scripts/Configuration.ps1') . (Join-Path $repo 'scripts/NativeChannelConfiguration.ps1') . (Join-Path $repo 'scripts/NativeProviderPacks.ps1') $script:ScriptRoot=$repo $script:count=0;$script:cleanup=@() function Assert($Value,$Message) { if (-not $Value) {throw $Message};$script:count++ } function Throws($Action,$Message) { $failed=$false;try {& $Action | Out-Null}catch {$failed=$true};Assert $failed $Message } function Reset { $script:f=@{} $script:catalog=Get-WelaProviderPackCatalog $script:f=@{States=@{};Writes=@();Role='Client';Build=26100;Service='Running';Type='Operational';TemplateMode='good';NativeFailure='';Prompt='Y';PromptSchemaDrift=$false;ProviderReads=0;DriftAt=0} foreach($pack in $catalog.packs){$f.States[$pack.channel]=[pscustomobject]@{Name=$pack.channel;State='Disabled';IsEnabled=$false;MaximumSizeInBytes=[long]1048576;LogMode='Retain';SecurityDescriptor='unchanged';ProviderNames=@($pack.provider);MetadataErrors=@{};Error=$null}} $script:backup=Join-Path ([IO.Path]::GetTempPath()) ('wela-packs-'+[guid]::NewGuid().ToString('N'));$script:cleanup+=,$backup } function Get-WelaHostContext { if($f.Role -eq 'Unknown'){throw 'denied'};[pscustomobject]@{Role=$f.Role;Build=$f.Build} } function Get-WelaNativeService { param($Name) [pscustomobject]@{Name=$Name;State=$f.Service;Error=$null} } function Get-WelaNativeChannel { param($Name) $f.States[$Name].PSObject.Copy() } function Get-FileHash { param($LiteralPath,$Algorithm) if(($f.BadPin -eq 'corpus' -and $LiteralPath -like '*security_rules.json') -or ($f.BadPin -eq 'rule' -and $LiteralPath -like '*.yml')){return [pscustomobject]@{Hash=('0'*64)}} Microsoft.PowerShell.Utility\Get-FileHash -LiteralPath $LiteralPath -Algorithm $Algorithm } function Test-WelaChannelDescriptorEqual {param($First,$Second) $First -ceq $Second} function Get-WelaChannelAccessPlan {param($SecurityDescriptor) [pscustomobject]@{State='GrantRequired';ProposedDescriptor='must-not-write';Diagnostic='Fixture only';EffectiveReadAccess='Not tested'}} function Get-WinEvent { param($ListLog,$ListProvider,$ErrorAction) if($ListLog){$p=@($catalog.packs|Where-Object channel -eq $ListLog)[0];return [pscustomobject]@{LogName=$ListLog;LogType=$f.Type;ProviderNames=@($p.provider)}} $f.ProviderReads++ if($f.DriftAt -eq $f.ProviderReads){$f.TemplateMode='missing'} if($f.TemplateMode -eq 'denied'){throw 'Provider access denied'} $p=@($catalog.packs|Where-Object provider -eq $ListProvider)[0] $events=@() foreach($e in $p.events){ $template='' if($f.TemplateMode -eq 'missing'){$template='