# Load the WinDriver .NET DLL
using namespace Jungo.wdapi_dotnet
$wdapi_dotnet = [Reflection.Assembly]::
LoadFile($Env:WD_BASEDIR + "\lib\amd64\v4.0.30319\wdapi_dotnetXXXX.dll")
# Open WinDriver
[windrvr_decl]::WD_DriverName("YOUR_DRIVER_NAME")
[wdc_lib_decl]::WDC_DriverOpen([wdc_lib_consts]::WDC_DRV_OPEN_DEFAULT,
"YOUR_LICENSE_STRING")
#Open a device
#by default the slot will be set to 0,0,0
$slot = New-Object -TypeName "Jungo.wdapi_dotnet.WD_PCI_SLOT"
$deviceInfo = New-Object -TypeName "Jungo.wdapi_dotnet.WD_PCI_CARD_INFO"
$deviceInfo.pciSlot = $slot
[wdc_lib_decl]::WDC_PciGetDeviceInfo($deviceInfo)
#Device context will be set to NULL for simplicity of sample
$pDevCtx = $NULL
$dev = New-Object -TypeName "Jungo.wdapi_dotnet.WDC_DEVICE"
[wdc_lib_decl]::WDC_PciDeviceOpen([ref]$dev, $pDeviceInfo, $pDevCtx)
# Read from the device (or any other WinDriver API usage)
[wdc_lib_decl]::WDC_ReadAddr32($dev.hDev, 0, 0x60, 0x1)
# Cleanup
[wdc_lib_decl]::WDC_PciDeviceClose($dev.hDev)
[wdc_lib_decl]::WDC_DriverClose()