using System; using PcaUsa.Rawether; using PcaUsa.Ndis; using System.Collections; // Copyright And Configuration Management ---------------------------------- // // Rawether.NET Adapter Enumeration Sample Application - EnumTest.cs // // Rawether.NET for Windows // // Copyright (c) 2003-2004, Printing Communications Associates, Inc. (PCAUSA) // // Thomas F. Divine // 4201 Brunswick Court // Smyrna, Georgia 30080 USA // (770) 432-4580 // tdivine@pcausa.com // // End --------------------------------------------------------------------- namespace PcaUsa.EnumTest { /// /// Rawether.NET C# adapter enumeration sample application. /// class EnumTest { ///////////////////////////////////////////////////////////////////////////// #region DisplayGeneralStatistics Function /// /// Make NDIS queries and display AdapterObject general statistics. /// /// Specifies the adapter to be queried. /// These are various queries from the OID_GEN_XYZ family. Here we use the /// QueryInformation function, which provides a simple interface for fetching /// non-critical numeric values. The function is called in the "quiet mode" by specifying /// a default value. This overloaded version of QueryInformation makes the query and /// catches I/O and NDIS exceptions. If an exception is encountered default value is silently /// returned. static void DisplayGeneralStatistics( AdapterObject adapterObject ) { Console.WriteLine( "*****************************************" ); Console.WriteLine( "Adapter General Statistics" ); // For this simple console sample application make a list of statistics OIDs to // query and then query each OID OID in the list in a loop. All statistic OID return // values are fetched as Uint32 - although Uint64 could be used if desired. // // The loop displays the OID using ToString, so it is not "pretty" but easy to implement. // Build list of statistics OIDs To query. Ndis.Oid[] QueryList = new Ndis.Oid[]{ // // Mandatory General Statistics Queries // Ndis.Oid.OID_GEN_XMIT_OK, Ndis.Oid.OID_GEN_RCV_OK, Ndis.Oid.OID_GEN_XMIT_ERROR, Ndis.Oid.OID_GEN_RCV_ERROR, Ndis.Oid.OID_GEN_RCV_NO_BUFFER, // // Optional General Statistics Queries // Ndis.Oid.OID_GEN_DIRECTED_BYTES_XMIT, Ndis.Oid.OID_GEN_DIRECTED_FRAMES_XMIT, Ndis.Oid.OID_GEN_MULTICAST_BYTES_XMIT, Ndis.Oid.OID_GEN_MULTICAST_FRAMES_XMIT, Ndis.Oid.OID_GEN_BROADCAST_BYTES_XMIT, Ndis.Oid.OID_GEN_BROADCAST_FRAMES_XMIT, Ndis.Oid.OID_GEN_DIRECTED_BYTES_RCV, Ndis.Oid.OID_GEN_DIRECTED_FRAMES_RCV, Oid.OID_GEN_MULTICAST_BYTES_RCV, Ndis.Oid.OID_GEN_MULTICAST_FRAMES_RCV, Ndis.Oid.OID_GEN_BROADCAST_BYTES_RCV, Ndis.Oid.OID_GEN_BROADCAST_FRAMES_RCV, Ndis.Oid.OID_GEN_RCV_CRC_ERROR, Ndis.Oid.OID_GEN_TRANSMIT_QUEUE_LENGTH }; // Query each OID in the list. for( int i = 0; i < QueryList.GetLength(0); ++i ) { uint statistic = 0; // Could use ulong (Uint64) if desired... uint retVal = adapterObject.QueryInformation( QueryList[i], ref statistic, 0 ); if( retVal == 0 ) Console.WriteLine( " {0}: {1}", QueryList[i].ToString(), statistic ); else Console.WriteLine( " {0}: Query Failed; Status: {1}", QueryList[i].ToString(), (Ndis.Status )retVal ); } Console.WriteLine(); } #endregion ///////////////////////////////////////////////////////////////////////////// #region DisplayEthernetStatistics Function /// /// Make NDIS queries and display AdapterObject Ethernet statistics characteristics. /// /// Specifies the adapter to be queried. /// These are various queries from the OID_802_11_XYZ family. Here we use helper /// functions designed to simplify fetching operational characteristics. static void DisplayEthernetStatistics( AdapterObject adapterObject ) { Console.WriteLine( "*****************************************" ); Console.WriteLine( "Adapter Ethernet Statistics" ); // For this simple console sample application make a list of statistics OIDs to // query and then query each OID OID in the list in a loop. All statistic OID return // values are fetched as Uint32 - although Uint64 could be used if desired. // // The loop displays the OID using ToString, so it is not "pretty" but easy to implement. // Build list of statistics OIDs To query. Ndis.Oid[] QueryList = new Ndis.Oid[]{ // // Mandatory Ethernet Statistics Queries // Ndis.Oid.OID_802_3_RCV_ERROR_ALIGNMENT, Ndis.Oid.OID_802_3_XMIT_ONE_COLLISION, Ndis.Oid.OID_802_3_XMIT_MORE_COLLISIONS, // // Optional Ethernet Statistics Queries // Ndis.Oid.OID_802_3_XMIT_DEFERRED, Ndis.Oid.OID_802_3_XMIT_MAX_COLLISIONS, Ndis.Oid.OID_802_3_RCV_OVERRUN, Ndis.Oid.OID_802_3_XMIT_UNDERRUN, Ndis.Oid.OID_802_3_XMIT_HEARTBEAT_FAILURE, Ndis.Oid.OID_802_3_XMIT_TIMES_CRS_LOST, Ndis.Oid.OID_802_3_XMIT_LATE_COLLISIONS }; // Query each OID in the list. for( int i = 0; i < QueryList.GetLength(0); ++i ) { uint statistic = 0; // Could use ulong (Uint64) if desired... uint retVal = adapterObject.QueryInformation( QueryList[i], ref statistic, 0 ); if( retVal == 0 ) Console.WriteLine( " {0}: {1}", QueryList[i].ToString(), statistic ); else Console.WriteLine( " {0}: Query Failed; Status: {1}", QueryList[i].ToString(), (Ndis.Status )retVal ); } Console.WriteLine(); } #endregion ///////////////////////////////////////////////////////////////////////////// #region DisplayEthernetOperationalCharacteristics Function /// /// Make NDIS queries and display AdapterObject Ethernet operational characteristics. /// /// Specifies the adapter to be queried. /// These are various queries from the OID_802_3_XYZ family. Here we use helper /// functions designed to simplify fetching operational characteristics. static void DisplayEthernetOperationalCharacteristics( AdapterObject adapterObject ) { Console.WriteLine( "*****************************************" ); Console.WriteLine( "Adapter Ethernet Operational Characteristics" ); uint retVal = 0; Ndis.NDIS_802_3_ADDRESS macAddress = new NDIS_802_3_ADDRESS(); // Query for Current MAC Address retVal = adapterObject.QueryInformation( Ndis.Oid.OID_802_3_CURRENT_ADDRESS, ref macAddress ); Console.WriteLine( " Current Address: {0}", macAddress ); // Query for Permanent MAC Address retVal = adapterObject.QueryInformation( Ndis.Oid.OID_802_3_PERMANENT_ADDRESS, ref macAddress ); Console.WriteLine( " Permanent Address: {0}", macAddress ); Console.WriteLine(); DisplayWLANInformation( adapterObject ); } #endregion ///////////////////////////////////////////////////////////////////////////// #region DisplayWLANInformation Function /// /// Make NDIS queries and display AdapterObject wireless LAN (802.11) information. /// /// Specifies the adapter to be queried. /// These are various queries from the OID_802_11_XYZ family. Here we use helper /// functions designed to simplify fetching operational characteristics. /// Some SetInformation code fragments are conditionally excluded from being built /// by using the #if SET_INFO_CALL_ILLUSTRATION directive. The code that is excluded /// illustrates the syntax of the SetInformation call. However, the code fragments should /// not actually be executed in the context of this simple demonstration application. If the /// SetInformation code fragments were actually executed the behavior would not be /// sensible. static void DisplayWLANInformation( AdapterObject adapterObject ) { Console.WriteLine( "*****************************************" ); Console.WriteLine( "Adapter 802.11 Information" ); // Get 802.11 Adapter Supported Rates Ndis.NDIS_802_11_SUPPORTED_RATES supportedRates = new Ndis.NDIS_802_11_SUPPORTED_RATES(); uint retVal; retVal = adapterObject.QueryInformation( ref supportedRates ); if( retVal == 0 ) Console.WriteLine( " Supported Rates: {0} Mbps", supportedRates.ToString() ); else { Console.WriteLine( " Supported Rates: Query Failed; Status: {0}", (Ndis.Status )retVal ); return; } // Query for SSID Ndis.NDIS_802_11_SSID ssid = new Ndis.NDIS_802_11_SSID(); retVal = adapterObject.QueryInformation( ref ssid ); if( retVal == 0 ) Console.WriteLine( " SSID: \x22{0}\x22", ssid ); else Console.WriteLine( " SSID: Query Failed; Status: {0}", (Ndis.Status )retVal ); //#if SET_INFO_CALL_ILLUSTRATION if( adapterObject.CanSetInformation ) { //Set the SSID // ssid.Ssid = "pcausa-gee"; ssid.SetBytes( new byte[] { 0x70, 0x63, 0x61, 0x75, 0x73, 0x61, 0x2D, 0x67, 0x65, 0x65 } ); retVal = adapterObject.SetInformation( ref ssid ); if( retVal == 0 ) Console.WriteLine( " Set SSID: Successful" ); else Console.WriteLine( " Set SSID: Failed" ); // Query SSID after setting retVal = adapterObject.QueryInformation( ref ssid ); if( retVal == 0 ) Console.WriteLine( " SSID After Setting: \x22{0}\x22", ssid ); else Console.WriteLine( " SSID After Setting: Query Failed" ); } //#endif // Query for BSSID Ndis.NDIS_802_3_ADDRESS macAddress = new NDIS_802_3_ADDRESS(); retVal = adapterObject.QueryInformation( Ndis.Oid.OID_802_11_BSSID, ref macAddress ); if( retVal == 0 ) Console.WriteLine( " MacAddress: {0}", macAddress ); else Console.WriteLine( " MacAddress: Query Failed; Status: {0}", (Ndis.Status )retVal ); if( adapterObject.CanSetInformation ) { // Set BSSID macAddress.Address = new byte[] {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; retVal = adapterObject.SetInformation( Ndis.Oid.OID_802_11_BSSID, ref macAddress ); if( retVal == 0 ) Console.WriteLine( " Set BSSID: Operation Successful" ); else Console.WriteLine( " Set BSSID: Operation Failed" ); } // Query for RSSI Ndis.NDIS_802_11_RSSI rssi = new NDIS_802_11_RSSI(); retVal = adapterObject.QueryInformation( ref rssi ); if( retVal == 0 ) { Console.WriteLine( " RSSI: {0} dBm ({1})", rssi, rssi.SignalStrength ); } else Console.WriteLine( " RSSI: Query Failed; Status: {0}", (Ndis.Status )retVal ); // Query for Infrastructure Mode Ndis.NDIS_802_11_NETWORK_INFRASTRUCTURE infrastructureMode = new NDIS_802_11_NETWORK_INFRASTRUCTURE(); retVal = adapterObject.QueryInformation( ref infrastructureMode ); if( retVal == 0 ) Console.WriteLine( " Infrastructure Mode: {0}", infrastructureMode ); else Console.WriteLine( " Infrastructure Mode: Query Failed; Status: {0}", (Ndis.Status )retVal ); #if SET_INFO_CALL_ILLUSTRATION if( adapterObject.CanSetInformation ) { // Set infrastructure mode infrastructureMode = NDIS.NDIS_802_11_NETWORK_INFRASTRUCTURE.Ndis802_11IBSS; // An example... retVal = adapterObject.SetInformation( infrastructureMode ); if( retVal == 0 ) Console.WriteLine( " Set Infrastructure Mode: Operation Successful" ); else Console.WriteLine( " Set Infrastructure Mode: Operation Failed" ); } #endif // Query for Authentication Mode Ndis.NDIS_802_11_AUTHENTICATION_MODE authenticationMode = new NDIS_802_11_AUTHENTICATION_MODE(); retVal = adapterObject.QueryInformation( ref authenticationMode ); if( retVal == 0 ) Console.WriteLine( " Authentication Mode: {0}", authenticationMode ); else Console.WriteLine( " Authentication Mode: Query Failed; Status: {0}", (Ndis.Status )retVal ); // Query for Encryption Status Ndis.NDIS_802_11_ENCRYPTION_STATUS encryptionStatus = new NDIS_802_11_ENCRYPTION_STATUS(); retVal = adapterObject.QueryInformation( ref encryptionStatus ); if( retVal == 0 ) Console.WriteLine( " Encryption Status: {0}", encryptionStatus ); else Console.WriteLine( " Encryption Status: Query Failed; Status: {0}", (Ndis.Status )retVal ); #if SET_INFO_CALL_ILLUSTRATION if( adapterObject.CanSetInformation ) { // Set Authentication Mode authenticationMode = NDIS.NDIS_802_11_AUTHENTICATION_MODE.Ndis802_11AuthModeOpen; // An example retVal = adapterObject.SetInformation( authenticationMode ); if( retVal == 0 ) Console.WriteLine( " Set Authentication Mode: Operation Successful" ); else Console.WriteLine( " Set Authentication Mode: Operation Failed" ); } #endif // Query for network type in use Ndis.NDIS_802_11_NETWORK_TYPE networkType = new NDIS_802_11_NETWORK_TYPE(); retVal = adapterObject.QueryInformation( ref networkType ); if( retVal == 0 ) Console.WriteLine( " Network Type In Use: {0}", networkType ); else Console.WriteLine( " Network Type In Use: Query Failed; Status: {0}", (Ndis.Status )retVal ); #if SET_INFO_CALL_ILLUSTRATION if( adapterObject.CanSetInformation ) { // Set network type in use networkType = NDIS.NDIS_802_11_NETWORK_TYPE.Ndis802_11DS; // An example... retVal = adapterObject.SetInformation( networkType ); if( retVal == 0 ) Console.WriteLine( " Set Network Type In Use: Operation Successful" ); else Console.WriteLine( " Set Network Type In Use: Operation Failed" ); } #endif // Query for 802.11 configuration NDIS_802_11_CONFIGURATION configutation = new NDIS_802_11_CONFIGURATION(); retVal = adapterObject.QueryInformation( ref configutation ); if( retVal == 0 ) { Console.WriteLine( " Configuration: Query Successful" ); Console.WriteLine( " Beacon Period: {0} Kusec", configutation.BeaconPeriod ); Console.WriteLine( " ATIM Window: {0} Kusec", configutation.ATIMWindow ); // Calculate and Display Frequency and Channel uint channel = 0; if( configutation.DSConfig >= 2412000 ) { channel = ( (configutation.DSConfig - 2412000)/5000 ) + 1; } Console.WriteLine( " DSConfig: {0} MHz (CH {1})", configutation.DSConfig/1000, channel ); if( adapterObject.CanSetInformation ) { // Set 802.11 configuration // ------------------------ // For illustrative purposes, just set the same data queried above. Understand that // although this is a mandatory OID, some adapters do not seem to accept it. retVal = adapterObject.SetInformation( ref configutation ); if( retVal == 0 ) Console.WriteLine( " Set Configuration: Successful" ); else Console.WriteLine( " Set Configuration: Failed; Status: {0}", (Ndis.Status )retVal ); } } else Console.WriteLine( " 802.11 Configuration: Query Failed; Status: {0}", (Ndis.Status )retVal ); if( adapterObject.CanSetInformation ) { // Make a call to start BSSID list scan retVal = adapterObject.SetInformation( Ndis.Oid.OID_802_11_BSSID_LIST_SCAN ); // No parameter required } // Make a call to get a BSSID list BssidList bssidList = new BssidList(); retVal = adapterObject.QueryInformation( ref bssidList ); if( retVal == 0 ) { int i = 0; Console.WriteLine(); Console.WriteLine( " BSSID List: Query Successful" ); Console.WriteLine( " Number of Items: {0}", bssidList.NumberOfItems ); foreach( BssidListItem bssidItem in bssidList ) { Console.WriteLine(); Console.WriteLine( " BSSID_LIST Entry {0}", i++ ); // Display The MacAddress Field Console.WriteLine( " MacAddress: {0}", bssidItem.MacAddress.ToString() ); // Display The Ssid Console.WriteLine( " SSID: \x22{0}\x22", bssidItem.Ssid ); // Display Rssi Console.WriteLine( " RSSI: {0} dBm ({1})", bssidItem.Rssi, bssidItem.Rssi.SignalStrength ); // Display Network Type In Use Console.WriteLine( " Network Type In Use: {0}", bssidItem.NetworkTypeInUse ); // Display Infrastructure Mode Console.WriteLine( " InfrastructureMode: {0}", bssidItem.InfrastructureMode ); // Display Supported Rates Console.WriteLine( " Supported Rates: {0} Mbps", bssidItem.SupportedRates.ToString() ); // Display Configuration Information NDIS_802_11_CONFIGURATION itemConfiguration = bssidItem.Configuration; Console.WriteLine( " Configuration:" ); Console.WriteLine( " Beacon Period: {0} Kusec", itemConfiguration.BeaconPeriod ); Console.WriteLine( " ATIM Window: {0} Kusec", itemConfiguration.ATIMWindow ); // Calculate and Display Frequency and Channel uint channel = 0; if( itemConfiguration.DSConfig >= 2412000 ) { channel = ( (itemConfiguration.DSConfig - 2412000)/5000 ) + 1; } Console.WriteLine( " DSConfig: {0} MHz (CH {1})", itemConfiguration.DSConfig/1000, channel ); // Display information elements from beacon or probe response messages int IELength = bssidItem.IELength; if( IELength > 0 ) { } } } else Console.WriteLine( " BSSID List: Query Failed; Status: {0}", (Ndis.Status )retVal ); #if SET_INFO_CALL_ILLUSTRATIONs if( adapterObject.CanSetInformation ) { // Make a call to reload defaults retVal = adapterObject.SetInformation( Ndis.Oid.OID_802_11_RELOAD_DEFAULTS ); // No parameter required // Make a call to remove a WEP key uint keyIndex = 0; // NDIS_802_11_KEY_INDEX is a ULONG... retVal = adapterObject.SetInformation( Ndis.Oid.OID_802_11_REMOVE_WEP, keyIndex ); // Make a call to disassociate retVal = adapterObject.SetInformation( Ndis.Oid.OID_802_11_DISASSOCIATE ); // No parameter required } #endif Console.WriteLine(); } #endregion ///////////////////////////////////////////////////////////////////////////// #region DisplayGeneralOperationCharacteristics Function /// /// Make NDIS queries and display AdapterObject general operational characteristics. /// /// Specifies the adapter to be queried. /// These are various queries from the OID_GEN_XYZ family. Here we use helper /// functions designed to simplify fetching operational characteristics. static void DisplayGeneralOperationCharacteristics( AdapterObject adapterObject ) { Console.WriteLine( "*****************************************" ); Console.WriteLine( "Adapter General Operational Characteristics" ); uint retVal = 0; // Get Adapter's Vendor Description String string vendorDescription; retVal = adapterObject.QueryInformation( Ndis.Oid.OID_GEN_VENDOR_DESCRIPTION, out vendorDescription ); if( retVal == 0 ) Console.WriteLine( " Vendor Description: {0}", vendorDescription ); else Console.WriteLine( " Vendor Description: Query Failed; Status: {0}", (Ndis.Status )retVal ); // For this simple console sample application make a list of statistics OIDs to // query and then query each OID OID in the list in a loop. All statistic OID return // values are fetched as Uint32. // // The loop displays the OID using ToString, so it is not "pretty" but easy to implement. // Build list of statistics OIDs To query. Ndis.Oid[] QueryList = new Ndis.Oid[]{ // // Mandatory General Statistics Queries // Ndis.Oid.OID_GEN_MAXIMUM_FRAME_SIZE, Ndis.Oid.OID_GEN_MAXIMUM_TOTAL_SIZE, Ndis.Oid.OID_GEN_CURRENT_LOOKAHEAD, Ndis.Oid.OID_GEN_MAXIMUM_LOOKAHEAD, Ndis.Oid.OID_GEN_LINK_SPEED }; // Query each OID in the list. for( int i = 0; i < QueryList.GetLength(0); ++i ) { uint statistic = 0; retVal = adapterObject.QueryInformation( QueryList[i], ref statistic, 0 ); if( retVal == 0 ) Console.WriteLine( " {0}: {1}", QueryList[i].ToString(), statistic ); else Console.WriteLine( " {0}: Query Failed; Status: {1}", QueryList[i].ToString(), (Ndis.Status )retVal ); } // Get Current NDIS packet filter value PacketType packetFilter = PacketType.None; retVal = adapterObject.QueryInformation( ref packetFilter ); Console.WriteLine( " Current Packet Filter: {0}", packetFilter.ToString() ); // Get Physical Medium // ------------------- // Note that support for OID_GEN_PhysicalMedium is optional. It is usually // supported on 802.11 adapters but not otherwise. Ndis.PhysicalMedium physicalMedium = Ndis.PhysicalMedium.Max; retVal = adapterObject.QueryInformation( ref physicalMedium ); if( retVal == 0 ) Console.WriteLine( " Physical Medium: {0}", physicalMedium.ToString() ); else Console.WriteLine( " Physical Medium: Query Failed; Status: {0}", (Ndis.Status )retVal ); // Get Media Connect State MediaState connectState = Ndis.MediaState.Unknown; retVal = adapterObject.QueryInformation( ref connectState ); Console.WriteLine( " Media Connect Status: {0}", connectState.ToString() ); // Get Medium In Use Ndis.Medium ndisMedium = Ndis.Medium.Max; retVal = adapterObject.QueryInformation( ref ndisMedium ); Console.WriteLine( " Media In Use: {0}", ndisMedium.ToString() ); Console.WriteLine(); Console.WriteLine(); // Display Media-Specific Operational Characteristics switch( ndisMedium ) { case Ndis.Medium.Dix: case Ndis.Medium.Ieee802_3: DisplayEthernetStatistics( adapterObject ); DisplayEthernetOperationalCharacteristics( adapterObject ); break; case Ndis.Medium.Ieee1394: break; default: break; } } #endregion ///////////////////////////////////////////////////////////////////////////// #region SetInformationTest Function /// /// Make NDIS queries and display the NDIS packet filter setting. /// /// Specifies the adapter to be tested. /// These are various queries from the OID_GEN_XYZ family. Here we use helper /// functions designed to simplify fetching operational characteristics. static void SetInformationTest( AdapterObject adapterObject ) { Console.WriteLine( "*****************************************" ); Console.WriteLine( "Set Information Test" ); if( !adapterObject.CanSetInformation ) { Console.WriteLine( " Cannot set information using this AdapterObject" ); return; } // Get Initial NDIS packet filter value PacketType packetFilter = PacketType.None; uint retVal = adapterObject.QueryInformation( ref packetFilter ); Console.WriteLine( " Initial Packet Filter: {0}", packetFilter.ToString() ); // Set NDIS packet filter to PROMISCUOUS retVal = adapterObject.SetInformation( PacketType.Promiscuous ); // Get NDIS packet filter value after setting retVal = adapterObject.QueryInformation( ref packetFilter ); Console.WriteLine( " Packet Filter After Set: {0}", packetFilter.ToString() ); // Set NDIS packet filter to NONE retVal = adapterObject.SetInformation( PacketType.None ); // Get NDIS packet filter value after resetting retVal = adapterObject.QueryInformation( ref packetFilter ); Console.WriteLine( " Packet Filter After Resetting: {0}", packetFilter.ToString() ); Console.WriteLine(); } #endregion /// /// The main entry point for the EnumTest application. /// [STAThread] static void Main(string[] args) { Console.WriteLine( "Rawether.NET Adapter Enumeration Test Application (Visual C#)" ); Console.WriteLine( "Copyright (c) 2000-2004 Printing Communications Associates, Inc" ); Console.WriteLine(); Console.WriteLine( "OS : {0}", Environment.OSVersion ); Console.WriteLine( "Date: {0}", DateTime.Now.ToLocalTime() ); Console.WriteLine(); // Create The NDIS UIO Interface // NdisUioInterface UioApi = new PcaProtInterface(); NdisUioInterface UioApi = new PcaFltInterface(); // NdisUioInterface UioApi = new PcaMuxInterface(); // NdisUioInterface UioApi = new PcaLwfInterface(); // Verify that the specified NDIS UIO interface is present if( UioApi.IsInterfacePresent != true ) { Console.WriteLine( "{0} is not present", UioApi.Description ); return; } else { Console.WriteLine( "Using {0}", UioApi.Description ); Console.WriteLine(); } // Create The Adapter List AdapterList adapterList = UioApi.GetAdapterList(); // Perform The Adapter Enumeration foreach( AdapterName adaptName in adapterList ) { Console.WriteLine( "*****************************************" ); // Display AdapterName Information Console.WriteLine( "Friendly Name : {0}", adaptName.InstanceName ); Console.WriteLine( "DeviceName Name: {0}", adaptName.DeviceName ); // Open an AdapterObject on the found AdapterName AdapterObject adapterObject = UioApi.OpenAdapter( adaptName ); if( adapterObject.IsOpen ) { Console.WriteLine( "OpenAdapter: SUCCESSFUL" ); Console.WriteLine(); DisplayGeneralStatistics( adapterObject ); DisplayGeneralOperationCharacteristics( adapterObject ); SetInformationTest( adapterObject ); adapterObject.CloseAdapter(); } else { Console.WriteLine( "OpenAdapter: FAILED" ); } } Console.WriteLine( "Done" ); } } }