mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 12:07:19 +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,
|
||||
PUNICODE_STRING TargetKeyName,
|
||||
PUNICODE_STRING ShortName,
|
||||
PUNICODE_STRING OutName ) {
|
||||
PUNICODE_STRING Name,
|
||||
PUNICODE_STRING DeviceDesc ) {
|
||||
UNICODE_STRING RootDevice = { 0 }, LinkageKeyName = { 0 };
|
||||
UNICODE_STRING DescKeyName = { 0 }, Linkage = { 0 };
|
||||
UNICODE_STRING BackSlash = { 0 };
|
||||
|
@ -809,14 +809,14 @@ static NTSTATUS CheckForDeviceDesc( PUNICODE_STRING EnumKeyName,
|
|||
Status = ReadStringFromRegistry( LinkageKey, L"RootDevice", &RootDevice );
|
||||
if( !NT_SUCCESS(Status) ) goto cleanup;
|
||||
|
||||
if( RtlCompareUnicodeString( &RootDevice, ShortName, TRUE ) == 0 ) {
|
||||
if( RtlCompareUnicodeString( &RootDevice, Name, TRUE ) == 0 ) {
|
||||
Status = OpenRegistryKey( &DescKeyName, &DescKey );
|
||||
if( !NT_SUCCESS(Status) ) goto cleanup;
|
||||
|
||||
Status = ReadStringFromRegistry( DescKey, L"DriverDesc", OutName );
|
||||
Status = ReadStringFromRegistry( DescKey, L"DriverDesc", DeviceDesc );
|
||||
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;
|
||||
|
||||
cleanup:
|
||||
|
@ -831,8 +831,8 @@ cleanup:
|
|||
return Status;
|
||||
}
|
||||
|
||||
static NTSTATUS FindDeviceNameForAdapter( PUNICODE_STRING ShortName,
|
||||
PUNICODE_STRING OutName ) {
|
||||
static NTSTATUS FindDeviceDescForAdapter( PUNICODE_STRING Name,
|
||||
PUNICODE_STRING DeviceDesc ) {
|
||||
UNICODE_STRING EnumKeyName, TargetKeyName;
|
||||
HANDLE EnumKey;
|
||||
NTSTATUS Status;
|
||||
|
@ -872,7 +872,7 @@ static NTSTATUS FindDeviceNameForAdapter( PUNICODE_STRING ShortName,
|
|||
TargetKeyName.Buffer = Kbio->Name;
|
||||
|
||||
Status = CheckForDeviceDesc
|
||||
( &EnumKeyName, &TargetKeyName, ShortName, OutName );
|
||||
( &EnumKeyName, &TargetKeyName, Name, DeviceDesc );
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
NtClose( EnumKey );
|
||||
return Status;
|
||||
|
@ -880,25 +880,30 @@ static NTSTATUS FindDeviceNameForAdapter( PUNICODE_STRING ShortName,
|
|||
}
|
||||
}
|
||||
|
||||
RtlInitUnicodeString( OutName, L"" );
|
||||
AppendUnicodeString( OutName, &TargetKeyName, FALSE );
|
||||
RtlInitUnicodeString( DeviceDesc, L"" );
|
||||
AppendUnicodeString( DeviceDesc, &TargetKeyName, FALSE );
|
||||
NtClose( EnumKey );
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
VOID GetShortName( PUNICODE_STRING RegistryKey,
|
||||
PUNICODE_STRING ShortNameOut ) {
|
||||
VOID GetName( PUNICODE_STRING RegistryKey,
|
||||
PUNICODE_STRING OutName ) {
|
||||
PWCHAR Ptr;
|
||||
ShortNameOut->Buffer =
|
||||
UNICODE_STRING PartialRegistryKey;
|
||||
|
||||
PartialRegistryKey.Buffer =
|
||||
RegistryKey->Buffer + wcslen(CCS_ROOT L"\\Services\\");
|
||||
Ptr = ShortNameOut->Buffer;
|
||||
Ptr = PartialRegistryKey.Buffer;
|
||||
|
||||
while( *Ptr != L'\\' &&
|
||||
((PCHAR)Ptr) < ((PCHAR)RegistryKey->Buffer) + RegistryKey->Length )
|
||||
Ptr++;
|
||||
|
||||
ShortNameOut->Length = ShortNameOut->MaximumLength =
|
||||
(Ptr - ShortNameOut->Buffer) * sizeof(WCHAR);
|
||||
PartialRegistryKey.Length = PartialRegistryKey.MaximumLength =
|
||||
(Ptr - PartialRegistryKey.Buffer) * sizeof(WCHAR);
|
||||
|
||||
RtlInitUnicodeString( OutName, L"" );
|
||||
AppendUnicodeString( OutName, &PartialRegistryKey, FALSE );
|
||||
}
|
||||
|
||||
VOID BindAdapter(
|
||||
|
@ -920,14 +925,11 @@ VOID BindAdapter(
|
|||
ULONG Lookahead = LOOKAHEAD_SIZE;
|
||||
NTSTATUS Status;
|
||||
HANDLE RegHandle = 0;
|
||||
UNICODE_STRING ShortName;
|
||||
|
||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
||||
|
||||
Adapter->State = LAN_STATE_OPENING;
|
||||
|
||||
GetShortName( RegistryPath, &ShortName );
|
||||
|
||||
NdisStatus = NDISCall(Adapter,
|
||||
NdisRequestSetInformation,
|
||||
OID_GEN_CURRENT_LOOKAHEAD,
|
||||
|
@ -963,11 +965,14 @@ VOID BindAdapter(
|
|||
* services (ZwOpenKey, etc).
|
||||
*/
|
||||
|
||||
GetName( RegistryPath, &IF->Name );
|
||||
|
||||
Status = OpenRegistryKey( RegistryPath, &RegHandle );
|
||||
|
||||
if(NT_SUCCESS(Status)) {
|
||||
Status = FindDeviceNameForAdapter( &ShortName, &IF->Name );
|
||||
TI_DbgPrint(DEBUG_DATALINK,("Adapter Name: %wZ\n", &IF->Name));
|
||||
Status = FindDeviceDescForAdapter( &IF->Name, &IF->Description );
|
||||
TI_DbgPrint(DEBUG_DATALINK,("Adapter Description: %wZ\n",
|
||||
&IF->Description));
|
||||
}
|
||||
|
||||
DefaultMask.Type = IP_ADDRESS_V4;
|
||||
|
|
|
@ -150,7 +150,8 @@ typedef struct _IP_INTERFACE {
|
|||
IP_ADDRESS PointToPoint; /* Point to point address */
|
||||
IP_ADDRESS Netmask; /* Netmask */
|
||||
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 */
|
||||
UINT AddressLength; /* Length of address in bytes */
|
||||
UINT Index; /* Index of adapter (used to add ip addr) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue