none
Unable to detect filter drivers in WHCK 2.0 using powershell RRS feed

  • Question

  • Hello there, I'm trying to automate the testing process. I'm unable to detect the filter drivers/ software devices as targets in WHCK using powershell. I could detect Systems as targets using "productInstanceObj.FindTargetFromSystem()" method, but this is not what I need, I want to test software devices (.sys files). Please help me detecting those, and how to use those with the product instance? Please provide a short algorithm if possible.

    Thanks in advance.

    Wednesday, October 10, 2012 6:26 AM

Answers

  • For software devices, aka "Filter drivers" are a targets special type of target.

    For these types of targets, the Name of the target is the filename of the driver, e.g. "FOO.SYS" and the Key is the SHA/SHA32 hash of the driver. For consistency's sake this is computed by the OS API CryptCatAdminCalcHashFromFileHandle(). This api is used because it is the same one that is used for both signing and certificate/trust testing.

    so, assuming that your driver is named "FOO.SYS", and you are looking at a specific machine "$Machine" it would be

              $TargetData = $Machine.GetTargets() | where { $_.Name -eq "FOO.SYS }

    if you don't have a specific machine ready, and need to look through all of the targets in from the PI's machine pool

              $ProductInstance.MachinePool.GetMachines() | where {$_.OSPlatform -eq $ProductInstance.OSPlatform } | foreach {

                             #$_ is a machine

                            $TargetData =$_.GetTargets() | where { $_.Name -eq "FOO.SYS }

                            $ProductInstance.CreateTarget($TargetData)

                            }

    Wednesday, October 10, 2012 4:53 PM
  • Features are objects, and have properties such as Name, FullName, Description, etc.

    you can get a list of all of the features by using the ProjectManager.GetFeatures() method.

    So to find the feature with the full name "Filter.Driver.FileSystem" you would use something like

    $feature = $Project.GetFeatures() | where { $_.FullName -eq "Filter.Driver.FileSystem" }
    
    write-host Adding feature $feature.FullName - $feature.Description to Target $target.Name
    $Target.AddFeature($feature)


    Friday, October 12, 2012 6:01 PM

All replies

  • For software devices, aka "Filter drivers" are a targets special type of target.

    For these types of targets, the Name of the target is the filename of the driver, e.g. "FOO.SYS" and the Key is the SHA/SHA32 hash of the driver. For consistency's sake this is computed by the OS API CryptCatAdminCalcHashFromFileHandle(). This api is used because it is the same one that is used for both signing and certificate/trust testing.

    so, assuming that your driver is named "FOO.SYS", and you are looking at a specific machine "$Machine" it would be

              $TargetData = $Machine.GetTargets() | where { $_.Name -eq "FOO.SYS }

    if you don't have a specific machine ready, and need to look through all of the targets in from the PI's machine pool

              $ProductInstance.MachinePool.GetMachines() | where {$_.OSPlatform -eq $ProductInstance.OSPlatform } | foreach {

                             #$_ is a machine

                            $TargetData =$_.GetTargets() | where { $_.Name -eq "FOO.SYS }

                            $ProductInstance.CreateTarget($TargetData)

                            }

    Wednesday, October 10, 2012 4:53 PM
  • Hey jeff, Thank you so much for the information. :)

    I'll try it and if anything goes wrong again, I'll post here about the same.

    Thursday, October 11, 2012 6:11 AM
  • Hi Jeff, I want to select some features of selected target, I'm using "$target.AddFeature()" method, passing parameter[microsoft.windows.hardware.kit.objectmodel.feature]::Feature_Name e.g. [microsoft.windows.hardware.kit.objectmodel.feature]::FileSystem, but it is not working. AddFeature() method requires object of Feature class as a parameter, how do I initialize the Feature object for particular feature, say FileSystem feature?
    Friday, October 12, 2012 7:45 AM
  • Features are objects, and have properties such as Name, FullName, Description, etc.

    you can get a list of all of the features by using the ProjectManager.GetFeatures() method.

    So to find the feature with the full name "Filter.Driver.FileSystem" you would use something like

    $feature = $Project.GetFeatures() | where { $_.FullName -eq "Filter.Driver.FileSystem" }
    
    write-host Adding feature $feature.FullName - $feature.Description to Target $target.Name
    $Target.AddFeature($feature)


    Friday, October 12, 2012 6:01 PM
  • Thank you, Jeff! :)

    Monday, October 15, 2012 6:06 PM