Added simple dword OID query to lan.
Correct oper status, admin status and type settings in iinfo.
Small fixes in lan.c for adapter name.
Modified: trunk/reactos/drivers/lib/ip/network/interface.c
Modified: trunk/reactos/drivers/net/tcpip/datalink/lan.c
Modified: trunk/reactos/drivers/net/tcpip/include/interface.h
Modified: trunk/reactos/drivers/net/tcpip/include/lan.h
Modified: trunk/reactos/drivers/net/tcpip/include/precomp.h
Modified: trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c

Modified: trunk/reactos/drivers/lib/ip/network/interface.c
--- trunk/reactos/drivers/lib/ip/network/interface.c	2005-03-18 02:56:29 UTC (rev 14172)
+++ trunk/reactos/drivers/lib/ip/network/interface.c	2005-03-18 03:26:12 UTC (rev 14173)
@@ -209,3 +209,28 @@
 
     return NULL;
 }
+
+NTSTATUS GetInterfaceConnectionStatus
+( PIP_INTERFACE Interface, PDWORD Result ) {
+    NTSTATUS Status = TcpipLanGetDwordOid
+        ( Interface, OID_GEN_HARDWARE_STATUS, Result );
+    if( NT_SUCCESS(Status) ) switch( *Result ) {
+    case NdisHardwareStatusReady:
+        *Result = MIB_IF_OPER_STATUS_OPERATIONAL;
+        break;
+    case NdisHardwareStatusInitializing:
+        *Result = MIB_IF_OPER_STATUS_CONNECTING;
+        break;
+    case NdisHardwareStatusReset:
+        *Result = MIB_IF_OPER_STATUS_DISCONNECTED;
+        break;
+    case NdisHardwareStatusNotReady:
+        *Result = MIB_IF_OPER_STATUS_DISCONNECTED;
+        break;
+    case NdisHardwareStatusClosing:
+    default:
+        *Result = MIB_IF_OPER_STATUS_NON_OPERATIONAL;
+        break;
+    }
+    return Status;
+}

Modified: trunk/reactos/drivers/net/tcpip/datalink/lan.c
--- trunk/reactos/drivers/net/tcpip/datalink/lan.c	2005-03-18 02:56:29 UTC (rev 14172)
+++ trunk/reactos/drivers/net/tcpip/datalink/lan.c	2005-03-18 03:26:12 UTC (rev 14173)
@@ -165,6 +165,28 @@
 }
 
 
+NTSTATUS TcpipLanGetDwordOid
+( PIP_INTERFACE Interface,
+  NDIS_OID Oid,
+  PDWORD Result ) {
+    /* Get maximum frame size */
+    if( Interface->Context ) {
+        return NDISCall((PLAN_ADAPTER)Interface->Context,
+                        NdisRequestQueryInformation,
+                        Oid,
+                        Result,
+                        sizeof(DWORD));
+    } else switch( Oid ) { /* Loopback Case */
+    case OID_GEN_HARDWARE_STATUS:
+        *Result = NdisHardwareStatusReady;
+        return STATUS_SUCCESS;
+
+    default:
+        return STATUS_INVALID_PARAMETER;
+    }
+}
+
+
 VOID STDCALL ProtocolOpenAdapterComplete(
     NDIS_HANDLE BindingContext,
     NDIS_STATUS Status,
@@ -916,11 +938,10 @@
     TI_DbgPrint(MID_TRACE,("BCAST(IF) %s\n", A2S(&IF->Broadcast)));
 
     if(NT_SUCCESS(Status)) {
+        RtlZeroMemory( &IF->Name, sizeof(IF->Name) );
 	Status = ReadStringFromRegistry( RegHandle, L"DeviceDesc",
 					 &IF->Name );
 
-	RtlZeroMemory( &IF->Name, sizeof( IF->Name ) );
-
 	/* I think that not getting a devicedesc is not a fatal error */
 	if( !NT_SUCCESS(Status) ) {
 	    if( IF->Name.Buffer ) exFreePool( IF->Name.Buffer );
@@ -929,6 +950,8 @@
 	Status = STATUS_SUCCESS;
     }
 
+    TI_DbgPrint(MID_TRACE,("Adapter Name: %wZ\n", &IF->Name));
+
     if(!NT_SUCCESS(Status))
     {
 	TI_DbgPrint(MIN_TRACE, ("Unable to open protocol-specific registry key: 0x%x\n", Status));

Modified: trunk/reactos/drivers/net/tcpip/include/interface.h
--- trunk/reactos/drivers/net/tcpip/include/interface.h	2005-03-18 02:56:29 UTC (rev 14172)
+++ trunk/reactos/drivers/net/tcpip/include/interface.h	2005-03-18 03:26:12 UTC (rev 14173)
@@ -13,6 +13,8 @@
 NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed );
 NTSTATUS GetInterfaceName( PIP_INTERFACE Interface, PCHAR NameBuffer,
 			   UINT NameMaxLen );
+NTSTATUS GetInterfaceConnectionStatus( PIP_INTERFACE Interface,
+                                       PDWORD OperStatus );
 PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address);
 
 #endif//_TCPIP_INTERFACE_H

Modified: trunk/reactos/drivers/net/tcpip/include/lan.h
--- trunk/reactos/drivers/net/tcpip/include/lan.h	2005-03-18 02:56:29 UTC (rev 14172)
+++ trunk/reactos/drivers/net/tcpip/include/lan.h	2005-03-18 03:26:12 UTC (rev 14173)
@@ -98,6 +98,9 @@
 VOID LANStartup();
 VOID LANShutdown();
 
+NTSTATUS TcpipLanGetDwordOid( PIP_INTERFACE Interface, NDIS_OID Oid, 
+                              PDWORD Result );
+
 NDIS_STATUS NDISCall(
     PLAN_ADAPTER Adapter,
     NDIS_REQUEST_TYPE Type,

Modified: trunk/reactos/drivers/net/tcpip/include/precomp.h
--- trunk/reactos/drivers/net/tcpip/include/precomp.h	2005-03-18 02:56:29 UTC (rev 14172)
+++ trunk/reactos/drivers/net/tcpip/include/precomp.h	2005-03-18 03:26:12 UTC (rev 14173)
@@ -35,5 +35,6 @@
 #include <oskittcp.h>
 #include <interface.h>
 #include <ports.h>
+#include <ipifcons.h>
 #define NTOS_MODE_USER
 #include <ntos.h>

Modified: trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c
--- trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c	2005-03-18 02:56:29 UTC (rev 14172)
+++ trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c	2005-03-18 03:26:12 UTC (rev 14173)
@@ -35,14 +35,20 @@
 
     OutData->Index = ID->tei_instance + 1; 
     /* viz: tcpip keeps those indices */
-    OutData->Type = Interface == Loopback ? IFENT_SOFTWARE_LOOPBACK : 0;
+    OutData->Type = Interface == 
+        Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET;
     OutData->Mtu = Interface->MTU;
     TI_DbgPrint(MAX_TRACE, 
 		("Getting interface speed\n"));
     OutData->PhysAddrLen = Interface->AddressLength;
-    OutData->AdminStatus = 1; /* XXX Up -- How do I know? */
-    OutData->OperStatus = 1; /* XXX Up -- How do I know? */
+    OutData->AdminStatus = MIB_IF_ADMIN_STATUS_UP;
+    /* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */
+    Status = GetInterfaceConnectionStatus( Interface, &OutData->OperStatus );
 
+    /* Not sure what to do here, but not ready seems a safe bet on failure */
+    if( !NT_SUCCESS(Status) ) 
+        OutData->OperStatus = NdisHardwareStatusNotReady;
+
     IFDescr = (PCHAR)&OutData[1];
 
     if( IF ) {