mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 15:36:04 +00:00
The adapter name is actually the GUID. Also store the human recognizable
description. This brings the network control panel applet a step further. svn path=/trunk/; revision=20633
This commit is contained in:
parent
3a24f9a505
commit
7e8a6ab862
2 changed files with 28 additions and 22 deletions
|
@ -781,8 +781,8 @@ NTSTATUS NTAPI AppendUnicodeString(PUNICODE_STRING ResultFirst,
|
||||||
|
|
||||||
static NTSTATUS CheckForDeviceDesc( PUNICODE_STRING EnumKeyName,
|
static NTSTATUS CheckForDeviceDesc( PUNICODE_STRING EnumKeyName,
|
||||||
PUNICODE_STRING TargetKeyName,
|
PUNICODE_STRING TargetKeyName,
|
||||||
PUNICODE_STRING ShortName,
|
PUNICODE_STRING Name,
|
||||||
PUNICODE_STRING OutName ) {
|
PUNICODE_STRING DeviceDesc ) {
|
||||||
UNICODE_STRING RootDevice = { 0 }, LinkageKeyName = { 0 };
|
UNICODE_STRING RootDevice = { 0 }, LinkageKeyName = { 0 };
|
||||||
UNICODE_STRING DescKeyName = { 0 }, Linkage = { 0 };
|
UNICODE_STRING DescKeyName = { 0 }, Linkage = { 0 };
|
||||||
UNICODE_STRING BackSlash = { 0 };
|
UNICODE_STRING BackSlash = { 0 };
|
||||||
|
@ -809,14 +809,14 @@ static NTSTATUS CheckForDeviceDesc( PUNICODE_STRING EnumKeyName,
|
||||||
Status = ReadStringFromRegistry( LinkageKey, L"RootDevice", &RootDevice );
|
Status = ReadStringFromRegistry( LinkageKey, L"RootDevice", &RootDevice );
|
||||||
if( !NT_SUCCESS(Status) ) goto cleanup;
|
if( !NT_SUCCESS(Status) ) goto cleanup;
|
||||||
|
|
||||||
if( RtlCompareUnicodeString( &RootDevice, ShortName, TRUE ) == 0 ) {
|
if( RtlCompareUnicodeString( &RootDevice, Name, TRUE ) == 0 ) {
|
||||||
Status = OpenRegistryKey( &DescKeyName, &DescKey );
|
Status = OpenRegistryKey( &DescKeyName, &DescKey );
|
||||||
if( !NT_SUCCESS(Status) ) goto cleanup;
|
if( !NT_SUCCESS(Status) ) goto cleanup;
|
||||||
|
|
||||||
Status = ReadStringFromRegistry( DescKey, L"DriverDesc", OutName );
|
Status = ReadStringFromRegistry( DescKey, L"DriverDesc", DeviceDesc );
|
||||||
if( !NT_SUCCESS(Status) ) goto cleanup;
|
if( !NT_SUCCESS(Status) ) goto cleanup;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_DATALINK,("ADAPTER NAME: %wZ\n", OutName));
|
TI_DbgPrint(DEBUG_DATALINK,("ADAPTER DESC: %wZ\n", DeviceDesc));
|
||||||
} else Status = STATUS_UNSUCCESSFUL;
|
} else Status = STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -831,8 +831,8 @@ cleanup:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS FindDeviceNameForAdapter( PUNICODE_STRING ShortName,
|
static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
|
||||||
PUNICODE_STRING OutName ) {
|
PUNICODE_STRING DeviceDesc ) {
|
||||||
UNICODE_STRING EnumKeyName, TargetKeyName;
|
UNICODE_STRING EnumKeyName, TargetKeyName;
|
||||||
HANDLE EnumKey;
|
HANDLE EnumKey;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -872,7 +872,7 @@ static NTSTATUS FindDeviceNameForAdapter( PUNICODE_STRING ShortName,
|
||||||
TargetKeyName.Buffer = Kbio->Name;
|
TargetKeyName.Buffer = Kbio->Name;
|
||||||
|
|
||||||
Status = CheckForDeviceDesc
|
Status = CheckForDeviceDesc
|
||||||
( &EnumKeyName, &TargetKeyName, ShortName, OutName );
|
( &EnumKeyName, &TargetKeyName, Name, DeviceDesc );
|
||||||
if( NT_SUCCESS(Status) ) {
|
if( NT_SUCCESS(Status) ) {
|
||||||
NtClose( EnumKey );
|
NtClose( EnumKey );
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -880,25 +880,30 @@ static NTSTATUS FindDeviceNameForAdapter( PUNICODE_STRING ShortName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlInitUnicodeString( OutName, L"" );
|
RtlInitUnicodeString( DeviceDesc, L"" );
|
||||||
AppendUnicodeString( OutName, &TargetKeyName, FALSE );
|
AppendUnicodeString( DeviceDesc, &TargetKeyName, FALSE );
|
||||||
NtClose( EnumKey );
|
NtClose( EnumKey );
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID GetShortName( PUNICODE_STRING RegistryKey,
|
VOID GetName( PUNICODE_STRING RegistryKey,
|
||||||
PUNICODE_STRING ShortNameOut ) {
|
PUNICODE_STRING OutName ) {
|
||||||
PWCHAR Ptr;
|
PWCHAR Ptr;
|
||||||
ShortNameOut->Buffer =
|
UNICODE_STRING PartialRegistryKey;
|
||||||
|
|
||||||
|
PartialRegistryKey.Buffer =
|
||||||
RegistryKey->Buffer + wcslen(CCS_ROOT L"\\Services\\");
|
RegistryKey->Buffer + wcslen(CCS_ROOT L"\\Services\\");
|
||||||
Ptr = ShortNameOut->Buffer;
|
Ptr = PartialRegistryKey.Buffer;
|
||||||
|
|
||||||
while( *Ptr != L'\\' &&
|
while( *Ptr != L'\\' &&
|
||||||
((PCHAR)Ptr) < ((PCHAR)RegistryKey->Buffer) + RegistryKey->Length )
|
((PCHAR)Ptr) < ((PCHAR)RegistryKey->Buffer) + RegistryKey->Length )
|
||||||
Ptr++;
|
Ptr++;
|
||||||
|
|
||||||
ShortNameOut->Length = ShortNameOut->MaximumLength =
|
PartialRegistryKey.Length = PartialRegistryKey.MaximumLength =
|
||||||
(Ptr - ShortNameOut->Buffer) * sizeof(WCHAR);
|
(Ptr - PartialRegistryKey.Buffer) * sizeof(WCHAR);
|
||||||
|
|
||||||
|
RtlInitUnicodeString( OutName, L"" );
|
||||||
|
AppendUnicodeString( OutName, &PartialRegistryKey, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID BindAdapter(
|
VOID BindAdapter(
|
||||||
|
@ -920,14 +925,11 @@ VOID BindAdapter(
|
||||||
ULONG Lookahead = LOOKAHEAD_SIZE;
|
ULONG Lookahead = LOOKAHEAD_SIZE;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE RegHandle = 0;
|
HANDLE RegHandle = 0;
|
||||||
UNICODE_STRING ShortName;
|
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||||
|
|
||||||
Adapter->State = LAN_STATE_OPENING;
|
Adapter->State = LAN_STATE_OPENING;
|
||||||
|
|
||||||
GetShortName( RegistryPath, &ShortName );
|
|
||||||
|
|
||||||
NdisStatus = NDISCall(Adapter,
|
NdisStatus = NDISCall(Adapter,
|
||||||
NdisRequestSetInformation,
|
NdisRequestSetInformation,
|
||||||
OID_GEN_CURRENT_LOOKAHEAD,
|
OID_GEN_CURRENT_LOOKAHEAD,
|
||||||
|
@ -963,11 +965,14 @@ VOID BindAdapter(
|
||||||
* services (ZwOpenKey, etc).
|
* services (ZwOpenKey, etc).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
GetName( RegistryPath, &IF->Name );
|
||||||
|
|
||||||
Status = OpenRegistryKey( RegistryPath, &RegHandle );
|
Status = OpenRegistryKey( RegistryPath, &RegHandle );
|
||||||
|
|
||||||
if(NT_SUCCESS(Status)) {
|
if(NT_SUCCESS(Status)) {
|
||||||
Status = FindDeviceNameForAdapter( &ShortName, &IF->Name );
|
Status = FindDeviceDescForAdapter( &IF->Name, &IF->Description );
|
||||||
TI_DbgPrint(DEBUG_DATALINK,("Adapter Name: %wZ\n", &IF->Name));
|
TI_DbgPrint(DEBUG_DATALINK,("Adapter Description: %wZ\n",
|
||||||
|
&IF->Description));
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultMask.Type = IP_ADDRESS_V4;
|
DefaultMask.Type = IP_ADDRESS_V4;
|
||||||
|
|
|
@ -150,7 +150,8 @@ typedef struct _IP_INTERFACE {
|
||||||
IP_ADDRESS PointToPoint; /* Point to point address */
|
IP_ADDRESS PointToPoint; /* Point to point address */
|
||||||
IP_ADDRESS Netmask; /* Netmask */
|
IP_ADDRESS Netmask; /* Netmask */
|
||||||
IP_ADDRESS Broadcast; /* Broadcast */
|
IP_ADDRESS Broadcast; /* Broadcast */
|
||||||
UNICODE_STRING Name; /* Adapter name */
|
UNICODE_STRING Name; /* Adapter name (GUID) */
|
||||||
|
UNICODE_STRING Description; /* Adapter description (Human readable) */
|
||||||
PUCHAR Address; /* Pointer to interface address */
|
PUCHAR Address; /* Pointer to interface address */
|
||||||
UINT AddressLength; /* Length of address in bytes */
|
UINT AddressLength; /* Length of address in bytes */
|
||||||
UINT Index; /* Index of adapter (used to add ip addr) */
|
UINT Index; /* Index of adapter (used to add ip addr) */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue