- Read the IP information from the interface key inside the Tcpip service key (confirmed on XP)
- Fix a logic error in my code (no idea how I missed it)
- Restores static IP functionality (still waiting on janderwald to fix netcfgx's DNS value writing)

svn path=/trunk/; revision=48602
This commit is contained in:
Cameron Gutman 2010-08-23 01:17:41 +00:00
parent ca6ff51038
commit 8d77a3fe00

View file

@ -570,8 +570,6 @@ VOID NTAPI ProtocolBindAdapter(
* SystemSpecific2: Unused & must not be touched * SystemSpecific2: Unused & must not be touched
*/ */
{ {
/* XXX confirm that this is still true, or re-word the following comment */
/* we get to ignore BindContext because we will never pend an operation with NDIS */
TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName)); TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName));
*Status = LANRegisterAdapter(DeviceName, SystemSpecific1); *Status = LANRegisterAdapter(DeviceName, SystemSpecific1);
} }
@ -952,10 +950,13 @@ BOOLEAN BindAdapter(
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE ParameterHandle; HANDLE ParameterHandle;
PKEY_VALUE_PARTIAL_INFORMATION KeyValueInfo; PKEY_VALUE_PARTIAL_INFORMATION KeyValueInfo;
WCHAR Buffer[150];
UNICODE_STRING IPAddress = RTL_CONSTANT_STRING(L"IPAddress"); UNICODE_STRING IPAddress = RTL_CONSTANT_STRING(L"IPAddress");
UNICODE_STRING Netmask = RTL_CONSTANT_STRING(L"SubnetMask"); UNICODE_STRING Netmask = RTL_CONSTANT_STRING(L"SubnetMask");
UNICODE_STRING Gateway = RTL_CONSTANT_STRING(L"DefaultGateway"); UNICODE_STRING Gateway = RTL_CONSTANT_STRING(L"DefaultGateway");
UNICODE_STRING EnableDhcp = RTL_CONSTANT_STRING(L"EnableDHCP"); UNICODE_STRING EnableDhcp = RTL_CONSTANT_STRING(L"EnableDHCP");
UNICODE_STRING Prefix = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\");
UNICODE_STRING TcpipRegistryPath;
UNICODE_STRING RegistryDataU; UNICODE_STRING RegistryDataU;
ANSI_STRING RegistryDataA; ANSI_STRING RegistryDataA;
@ -1010,8 +1011,18 @@ BOOLEAN BindAdapter(
TI_DbgPrint(DEBUG_DATALINK,("Adapter Description: %wZ\n", TI_DbgPrint(DEBUG_DATALINK,("Adapter Description: %wZ\n",
&IF->Description)); &IF->Description));
TcpipRegistryPath.MaximumLength = sizeof(WCHAR) * 150;
TcpipRegistryPath.Length = 0;
TcpipRegistryPath.Buffer = Buffer;
RtlAppendUnicodeStringToString(&TcpipRegistryPath,
&Prefix);
RtlAppendUnicodeStringToString(&TcpipRegistryPath,
&IF->Name);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
RegistryPath, &TcpipRegistryPath,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
0, 0,
NULL); NULL);
@ -1019,6 +1030,7 @@ BOOLEAN BindAdapter(
AddrInitIPv4(&DefaultMask, 0); AddrInitIPv4(&DefaultMask, 0);
Status = ZwOpenKey(&ParameterHandle, KEY_READ, &ObjectAttributes); Status = ZwOpenKey(&ParameterHandle, KEY_READ, &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
IF->Unicast = DefaultMask; IF->Unicast = DefaultMask;
@ -1040,7 +1052,7 @@ BOOLEAN BindAdapter(
KeyValueInfo, KeyValueInfo,
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(ULONG), sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(ULONG),
&Unused); &Unused);
if (NT_SUCCESS(Status) && KeyValueInfo->DataLength == sizeof(ULONG) && (*(PULONG)KeyValueInfo->Data) != 0) if (NT_SUCCESS(Status) && KeyValueInfo->DataLength == sizeof(ULONG) && (*(PULONG)KeyValueInfo->Data) == 0)
{ {
RegistryDataU.MaximumLength = 16 + sizeof(WCHAR); RegistryDataU.MaximumLength = 16 + sizeof(WCHAR);
RegistryDataU.Buffer = (PWCHAR)KeyValueInfo->Data; RegistryDataU.Buffer = (PWCHAR)KeyValueInfo->Data;