mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
- Enable "Full Maps" by default
- IP addresses are now registry-configured, per-adapter - Minor bugfix for off-by-one with extended attributes svn path=/trunk/; revision=7105
This commit is contained in:
parent
fd2014a883
commit
0e8ef19002
10 changed files with 147 additions and 33 deletions
|
@ -716,7 +716,7 @@ NdisRegisterProtocol(
|
||||||
InitializeListHead(&Protocol->AdapterListHead);
|
InitializeListHead(&Protocol->AdapterListHead);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bind the adapter to all of its miniports
|
* bind the protocol to all of its miniports
|
||||||
*
|
*
|
||||||
* open registry path
|
* open registry path
|
||||||
* get list of devices from Bind key
|
* get list of devices from Bind key
|
||||||
|
|
|
@ -499,12 +499,13 @@ VOID ProtocolBindAdapter(
|
||||||
* BindContext: Handle provided by NDIS to track pending binding operations
|
* BindContext: Handle provided by NDIS to track pending binding operations
|
||||||
* DeviceName: Name of the miniport device to bind to
|
* DeviceName: Name of the miniport device to bind to
|
||||||
* SystemSpecific1: Pointer to a registry path with protocol-specific configuration information
|
* SystemSpecific1: Pointer to a registry path with protocol-specific configuration information
|
||||||
* SystemSpecific2: Unused
|
* 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 */
|
/* we get to ignore BindContext because we will never pend an operation with NDIS */
|
||||||
TI_DbgPrint(DEBUG_DATALINK, ("Called.\n"));
|
TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ\n", SystemSpecific1));
|
||||||
*Status = LANRegisterAdapter(DeviceName);
|
*Status = LANRegisterAdapter(DeviceName, SystemSpecific1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -591,7 +592,8 @@ VOID LANTransmit(
|
||||||
|
|
||||||
|
|
||||||
VOID BindAdapter(
|
VOID BindAdapter(
|
||||||
PLAN_ADAPTER Adapter)
|
PLAN_ADAPTER Adapter,
|
||||||
|
PNDIS_STRING RegistryPath)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Binds a LAN adapter to IP layer
|
* FUNCTION: Binds a LAN adapter to IP layer
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -653,16 +655,87 @@ VOID BindAdapter(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Get address from registry.
|
{
|
||||||
For now just use a private address, eg. 10.0.0.100 */
|
/*
|
||||||
Address = AddrBuildIPv4(0x6400000A);
|
* Query per-adapter configuration from the registry
|
||||||
// Address = AddrBuildIPv4(0x6048F2D1); // 209.242.72.96
|
* In case anyone is curious: there *is* an Ndis configuration api
|
||||||
if (!Address) {
|
* for this sort of thing, but it doesn't really support things like
|
||||||
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
* REG_MULTI_SZ very well, and there is a note in the DDK that says that
|
||||||
FreeTDPackets(Adapter);
|
* protocol drivers developed for win2k and above just use the native
|
||||||
IPDestroyInterface(Adapter->Context);
|
* services (ZwOpenKey, etc).
|
||||||
return;
|
*/
|
||||||
}
|
|
||||||
|
OBJECT_ATTRIBUTES Attributes;
|
||||||
|
HANDLE RegHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
UNICODE_STRING ValueName;
|
||||||
|
UCHAR buf[1024];
|
||||||
|
PKEY_VALUE_PARTIAL_INFORMATION Information = (PKEY_VALUE_PARTIAL_INFORMATION)buf;
|
||||||
|
ULONG ResultLength;
|
||||||
|
ANSI_STRING AnsiAddress;
|
||||||
|
UNICODE_STRING UnicodeAddress;
|
||||||
|
ULONG AnsiLen;
|
||||||
|
|
||||||
|
InitializeObjectAttributes(&Attributes, RegistryPath, OBJ_CASE_INSENSITIVE, 0, 0);
|
||||||
|
Status = ZwOpenKey(&RegHandle, GENERIC_READ, &Attributes);
|
||||||
|
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
TI_DbgPrint(MIN_TRACE, ("Unable to open protocol-specific registry key: 0x%x\n", Status));
|
||||||
|
|
||||||
|
/* XXX how do we proceed? No ip address, no parameters... do we guess? */
|
||||||
|
FreeTDPackets(Adapter);
|
||||||
|
IPDestroyInterface(Adapter->Context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&ValueName, L"IPAddress");
|
||||||
|
ZwQueryValueKey(RegHandle, &ValueName, KeyValuePartialInformation, Information, sizeof(buf), &ResultLength);
|
||||||
|
ZwClose(RegHandle);
|
||||||
|
|
||||||
|
/* IP address is stored as a REG_MULTI_SZ - we only pay attention to the first one though */
|
||||||
|
TI_DbgPrint(MIN_TRACE, ("Information DataLength: 0x%x\n", Information->DataLength));
|
||||||
|
|
||||||
|
UnicodeAddress.Buffer = (PWCHAR)&Information->Data;
|
||||||
|
UnicodeAddress.Length = Information->DataLength;
|
||||||
|
UnicodeAddress.MaximumLength = Information->DataLength;
|
||||||
|
|
||||||
|
AnsiLen = RtlUnicodeStringToAnsiSize(&UnicodeAddress);
|
||||||
|
|
||||||
|
if(!AnsiLen)
|
||||||
|
{
|
||||||
|
TI_DbgPrint(MIN_TRACE, ("Unable to calculate address length\n"));
|
||||||
|
FreeTDPackets(Adapter);
|
||||||
|
IPDestroyInterface(Adapter->Context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AnsiAddress.Buffer = ExAllocatePoolWithTag(PagedPool, AnsiLen, 0x01020304);
|
||||||
|
|
||||||
|
if(!AnsiAddress.Buffer)
|
||||||
|
{
|
||||||
|
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||||
|
FreeTDPackets(Adapter);
|
||||||
|
IPDestroyInterface(Adapter->Context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlUnicodeStringToAnsiString(&AnsiAddress, &UnicodeAddress, FALSE);
|
||||||
|
|
||||||
|
AnsiAddress.Buffer[AnsiAddress.Length] = 0;
|
||||||
|
|
||||||
|
Address = AddrBuildIPv4(inet_addr(AnsiAddress.Buffer));
|
||||||
|
|
||||||
|
if (!Address) {
|
||||||
|
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||||
|
FreeTDPackets(Adapter);
|
||||||
|
IPDestroyInterface(Adapter->Context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TI_DbgPrint(MID_TRACE, ("--> Our IP address on this interface: 0x%x\n", inet_addr(AnsiAddress.Buffer)));
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a net table entry for this interface */
|
/* Create a net table entry for this interface */
|
||||||
if (!IPCreateNTE(IF, Address, 8)) {
|
if (!IPCreateNTE(IF, Address, 8)) {
|
||||||
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||||
|
@ -721,7 +794,8 @@ VOID UnbindAdapter(
|
||||||
|
|
||||||
|
|
||||||
NDIS_STATUS LANRegisterAdapter(
|
NDIS_STATUS LANRegisterAdapter(
|
||||||
PNDIS_STRING AdapterName)
|
PNDIS_STRING AdapterName,
|
||||||
|
PNDIS_STRING RegistryPath)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Registers protocol with an NDIS adapter
|
* FUNCTION: Registers protocol with an NDIS adapter
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -734,6 +808,7 @@ NDIS_STATUS LANRegisterAdapter(
|
||||||
PLAN_ADAPTER IF;
|
PLAN_ADAPTER IF;
|
||||||
NDIS_STATUS NdisStatus;
|
NDIS_STATUS NdisStatus;
|
||||||
NDIS_STATUS OpenStatus;
|
NDIS_STATUS OpenStatus;
|
||||||
|
PNDIS_CONFIGURATION_PARAMETER Parameter;
|
||||||
UINT MediaIndex;
|
UINT MediaIndex;
|
||||||
NDIS_MEDIUM MediaArray[MAX_MEDIA];
|
NDIS_MEDIUM MediaArray[MAX_MEDIA];
|
||||||
UINT AddressOID;
|
UINT AddressOID;
|
||||||
|
@ -874,7 +949,7 @@ NDIS_STATUS LANRegisterAdapter(
|
||||||
&AdapterListLock);
|
&AdapterListLock);
|
||||||
|
|
||||||
/* Bind adapter to IP layer */
|
/* Bind adapter to IP layer */
|
||||||
BindAdapter(IF);
|
BindAdapter(IF, RegistryPath);
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_DATALINK, ("Leaving.\n"));
|
TI_DbgPrint(DEBUG_DATALINK, ("Leaving.\n"));
|
||||||
|
|
||||||
|
@ -952,7 +1027,7 @@ NTSTATUS LANRegisterProtocol(
|
||||||
ProtChars.MinorNdisVersion = NDIS_VERSION_MINOR;
|
ProtChars.MinorNdisVersion = NDIS_VERSION_MINOR;
|
||||||
ProtChars.Name.Length = Name->Length;
|
ProtChars.Name.Length = Name->Length;
|
||||||
ProtChars.Name.Buffer = Name->Buffer;
|
ProtChars.Name.Buffer = Name->Buffer;
|
||||||
ProtChars.Name.MaximumLength = Name->MaximumLength;
|
ProtChars.Name.MaximumLength = Name->MaximumLength;
|
||||||
ProtChars.OpenAdapterCompleteHandler = ProtocolOpenAdapterComplete;
|
ProtChars.OpenAdapterCompleteHandler = ProtocolOpenAdapterComplete;
|
||||||
ProtChars.CloseAdapterCompleteHandler = ProtocolCloseAdapterComplete;
|
ProtChars.CloseAdapterCompleteHandler = ProtocolCloseAdapterComplete;
|
||||||
ProtChars.ResetCompleteHandler = ProtocolResetComplete;
|
ProtChars.ResetCompleteHandler = ProtocolResetComplete;
|
||||||
|
@ -963,7 +1038,7 @@ NTSTATUS LANRegisterProtocol(
|
||||||
ProtChars.ReceiveCompleteHandler = ProtocolReceiveComplete;
|
ProtChars.ReceiveCompleteHandler = ProtocolReceiveComplete;
|
||||||
ProtChars.StatusHandler = ProtocolStatus;
|
ProtChars.StatusHandler = ProtocolStatus;
|
||||||
ProtChars.StatusCompleteHandler = ProtocolStatusComplete;
|
ProtChars.StatusCompleteHandler = ProtocolStatusComplete;
|
||||||
ProtChars.BindAdapterHandler = ProtocolBindAdapter;
|
ProtChars.BindAdapterHandler = ProtocolBindAdapter;
|
||||||
|
|
||||||
/* Try to register protocol */
|
/* Try to register protocol */
|
||||||
NdisRegisterProtocol(&NdisStatus,
|
NdisRegisterProtocol(&NdisStatus,
|
||||||
|
|
|
@ -73,6 +73,9 @@ PADDRESS_FILE AddrSearchFirst(
|
||||||
PADDRESS_FILE AddrSearchNext(
|
PADDRESS_FILE AddrSearchNext(
|
||||||
PAF_SEARCH SearchContext);
|
PAF_SEARCH SearchContext);
|
||||||
|
|
||||||
|
ULONG inet_addr(
|
||||||
|
PCSTR AddrString);
|
||||||
|
|
||||||
#endif /* __ADDRESS_H */
|
#endif /* __ADDRESS_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -81,7 +81,8 @@ typedef struct LAN_ADAPTER {
|
||||||
|
|
||||||
|
|
||||||
NDIS_STATUS LANRegisterAdapter(
|
NDIS_STATUS LANRegisterAdapter(
|
||||||
PNDIS_STRING AdapterName);
|
PNDIS_STRING AdapterName,
|
||||||
|
PNDIS_STRING RegistryPath);
|
||||||
|
|
||||||
NDIS_STATUS LANUnregisterAdapter(
|
NDIS_STATUS LANUnregisterAdapter(
|
||||||
PLAN_ADAPTER Adapter);
|
PLAN_ADAPTER Adapter);
|
||||||
|
|
|
@ -414,4 +414,43 @@ PADDRESS_FILE AddrSearchNext(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG inet_addr(PCSTR AddrString)
|
||||||
|
/*
|
||||||
|
* Convert an ansi string dotted-quad address to a ulong
|
||||||
|
* NOTES:
|
||||||
|
* - this isn't quite like the real inet_addr() - * it doesn't
|
||||||
|
* handle "10.1" and similar - but it's good enough.
|
||||||
|
* - Returns in *host* byte order, unlike real inet_addr()
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
ULONG Octets[4] = {0,0,0,0};
|
||||||
|
ULONG i = 0;
|
||||||
|
|
||||||
|
if(!AddrString)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
while(*AddrString)
|
||||||
|
{
|
||||||
|
CHAR c = *AddrString;
|
||||||
|
AddrString++;
|
||||||
|
|
||||||
|
if(c == '.')
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(c < '0' || c > '9')
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
Octets[i] *= 10;
|
||||||
|
Octets[i] += (c - '0');
|
||||||
|
|
||||||
|
if(Octets[i] > 255)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0];
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <rosrtl/string.h>
|
#include <rosrtl/string.h>
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
DWORD DebugTraceLevel = MIN_TRACE;
|
DWORD DebugTraceLevel = -1;
|
||||||
#endif /* DBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
PDEVICE_OBJECT TCPDeviceObject = NULL;
|
PDEVICE_OBJECT TCPDeviceObject = NULL;
|
||||||
|
@ -190,8 +190,10 @@ CP
|
||||||
TDI_TRANSPORT_ADDRESS_LENGTH) == TDI_TRANSPORT_ADDRESS_LENGTH)) {
|
TDI_TRANSPORT_ADDRESS_LENGTH) == TDI_TRANSPORT_ADDRESS_LENGTH)) {
|
||||||
/* This is a request to open an address */
|
/* This is a request to open an address */
|
||||||
CP
|
CP
|
||||||
|
|
||||||
|
/* XXX This should probably be done in IoCreateFile() */
|
||||||
/* Parameter checks */
|
/* Parameter checks */
|
||||||
Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength);
|
Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength + 1); //0-term
|
||||||
if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) ||
|
if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) ||
|
||||||
(Address->TAAddressCount != 1) ||
|
(Address->TAAddressCount != 1) ||
|
||||||
(Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) ||
|
(Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) ||
|
||||||
|
@ -389,9 +391,9 @@ NTSTATUS TiCleanupFileObject(
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
//#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
STDCALL_FUNC
|
STDCALL_FUNC
|
||||||
//#endif
|
#endif
|
||||||
TiDispatchOpenClose(
|
TiDispatchOpenClose(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
|
|
|
@ -41,8 +41,6 @@ extern ULONG DebugTraceLevel;
|
||||||
|
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
/* in ndis.h now */
|
|
||||||
#if 0
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
#undef ASSERT
|
#undef ASSERT
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,7 +50,6 @@ extern ULONG DebugTraceLevel;
|
||||||
#else /* NASSERT */
|
#else /* NASSERT */
|
||||||
#define ASSERT(x) if (!(x)) { TDI_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
|
#define ASSERT(x) if (!(x)) { TDI_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
|
||||||
#endif /* NASSERT */
|
#endif /* NASSERT */
|
||||||
#endif
|
|
||||||
#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
|
#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
|
||||||
|
|
||||||
#else /* DBG */
|
#else /* DBG */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.9 2003/11/20 06:31:51 vizzini Exp $
|
# $Id: makefile,v 1.10 2003/12/17 23:34:35 vizzini Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../..
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ TARGET_TYPE = driver
|
||||||
|
|
||||||
TARGET_NAME = tditest
|
TARGET_NAME = tditest
|
||||||
|
|
||||||
TARGET_CFLAGS = -I./include -Wall -Werror
|
TARGET_CFLAGS = -I./include -Wall -Werror -DDBG=1
|
||||||
|
|
||||||
TARGET_OBJECTS = \
|
TARGET_OBJECTS = \
|
||||||
tditest/tditest.o
|
tditest/tditest.o
|
||||||
|
|
|
@ -878,9 +878,6 @@ VOID TdiUnload(
|
||||||
ObReferenceObjectByHandle(SendThread, THREAD_ALL_ACCESS, NULL, KernelMode, &SendThreadObject, NULL);
|
ObReferenceObjectByHandle(SendThread, THREAD_ALL_ACCESS, NULL, KernelMode, &SendThreadObject, NULL);
|
||||||
ObReferenceObjectByHandle(ReceiveThread, THREAD_ALL_ACCESS, NULL, KernelMode, &ReceiveThreadObject, NULL);
|
ObReferenceObjectByHandle(ReceiveThread, THREAD_ALL_ACCESS, NULL, KernelMode, &ReceiveThreadObject, NULL);
|
||||||
|
|
||||||
ASSERT(ReceiveThreadObject);
|
|
||||||
ASSERT(SendThreadObject);
|
|
||||||
|
|
||||||
KeSetEvent(&StopEvent, 0, FALSE);
|
KeSetEvent(&StopEvent, 0, FALSE);
|
||||||
|
|
||||||
/* Wait for send thread to stop */
|
/* Wait for send thread to stop */
|
||||||
|
|
|
@ -9,7 +9,7 @@ HOST = mingw32-windows
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build map files which includes source and asm code
|
# Build map files which includes source and asm code
|
||||||
# FULL_MAP = yes
|
FULL_MAP = yes
|
||||||
|
|
||||||
# Default to no PCH support
|
# Default to no PCH support
|
||||||
ifeq ($(ROS_USE_PCH),)
|
ifeq ($(ROS_USE_PCH),)
|
||||||
|
|
Loading…
Reference in a new issue