Author: cgutman
Date: Sun Nov 20 22:31:26 2011
New Revision: 54467
URL: http://svn.reactos.org/svn/reactos?rev=54467&view=rev
Log:
[NDIS]
- Remove unicode debug stuff out of the spinlock
- Add a comment
Modified:
trunk/reactos/drivers/network/ndis/ndis/miniport.c
Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Sun Nov 20 22:31:26 2011
@@ -610,6 +610,8 @@
return NULL;
}
+ NDIS_DbgPrint(DEBUG_MINIPORT, ("AdapterName = %wZ\n", AdapterName));
+
KeAcquireSpinLock(&AdapterListLock, &OldIrql);
{
CurrentEntry = AdapterListHead.Flink;
@@ -621,9 +623,9 @@
ASSERT(Adapter);
NDIS_DbgPrint(DEBUG_MINIPORT, ("Examining adapter 0x%lx\n", Adapter));
- NDIS_DbgPrint(DEBUG_MINIPORT, ("AdapterName = %wZ\n", AdapterName));
- NDIS_DbgPrint(DEBUG_MINIPORT, ("DeviceName = %wZ\n", &Adapter->NdisMiniportBlock.MiniportName));
-
+
+ /* We're technically not allowed to call this above PASSIVE_LEVEL, but it doesn't break
+ * right now and I'd rather use a working API than reimplement it here */
if (RtlCompareUnicodeString(AdapterName, &Adapter->NdisMiniportBlock.MiniportName, TRUE) == 0)
{
break;
Author: cgutman
Date: Sun Nov 20 21:37:16 2011
New Revision: 54464
URL: http://svn.reactos.org/svn/reactos?rev=54464&view=rev
Log:
[NDIS]
- Print debugging information if a mismatch occurs between requested and returned parameter types
- Print debugging information if a registry read returns a type that NDIS doesn't handle
- Ensure that all digits are less than the base during conversion from string to integer (otherwise it's a string)
Modified:
trunk/reactos/drivers/network/ndis/ndis/config.c
Modified: trunk/reactos/drivers/network/ndis/ndis/config.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/config.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/config.c [iso-8859-1] Sun Nov 20 21:37:16 2011
@@ -68,6 +68,8 @@
WCHAR Buff[11];
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
+
+ NDIS_DbgPrint(MID_TRACE, ("Parameter type: %d\n", ParameterValue->ParameterType));
/* reset parameter type to standard reg types */
switch(ParameterValue->ParameterType)
@@ -373,7 +375,7 @@
* TRUE if it is valid, FALSE if not
*/
{
- ULONG i;
+ ULONG i, Base;
/* I don't think this will ever happen, but we warn it if it does */
if (String->Length == 0)
@@ -384,6 +386,7 @@
/* Set the default parameter type */
*ParameterType = NdisParameterInteger;
+ Base = 10;
for (i = 0; i < String->Length / sizeof(WCHAR); i++)
{
@@ -395,6 +398,7 @@
{
NDIS_DbgPrint(MID_TRACE, ("Identified hex string\n"));
*ParameterType = NdisParameterHexInteger;
+ Base = 0x10;
continue;
}
}
@@ -403,8 +407,8 @@
if (String->Buffer[i] == UNICODE_NULL)
continue;
- /* Make sure the character is valid for a numeric string */
- if (UnicodeToHexByte(String->Buffer[i]) == 0xFF)
+ /* Make sure the character is valid for a numeric string of this base */
+ if (UnicodeToHexByte(String->Buffer[i]) >= Base)
return FALSE;
}
@@ -449,6 +453,7 @@
*Status = NDIS_STATUS_FAILURE;
NDIS_DbgPrint(MAX_TRACE,("requested read of %wZ\n", Keyword));
+ NDIS_DbgPrint(MID_TRACE,("requested parameter type: %d\n", ParameterType));
if (ConfigurationContext == NULL)
{
@@ -661,7 +666,7 @@
(*ParameterValue)->ParameterData.StringData.Buffer = Buffer;
(*ParameterValue)->ParameterData.StringData.Length = KeyInformation->DataLength;
}
- else
+ else if (KeyInformation->Type == REG_SZ)
{
UNICODE_STRING str;
@@ -697,6 +702,22 @@
(*ParameterValue)->ParameterData.StringData.Buffer = Buffer;
(*ParameterValue)->ParameterData.StringData.Length = KeyInformation->DataLength;
}
+ }
+ else
+ {
+ NDIS_DbgPrint(MIN_TRACE, ("Invalid type for NdisReadConfiguration (%d)\n", KeyInformation->Type));
+ NDIS_DbgPrint(MIN_TRACE, ("Requested type: %d\n", ParameterType));
+ NDIS_DbgPrint(MIN_TRACE, ("Registry entry: %wZ\n", Keyword));
+ *Status = NDIS_STATUS_FAILURE;
+ ExFreePool(KeyInformation);
+ return;
+ }
+
+ if ((*ParameterValue)->ParameterType != ParameterType)
+ {
+ NDIS_DbgPrint(MIN_TRACE, ("Parameter type mismatch! (Requested: %d | Received: %d)\n",
+ ParameterType, (*ParameterValue)->ParameterType));
+ NDIS_DbgPrint(MIN_TRACE, ("Registry entry: %wZ\n", Keyword));
}
MiniportResource->ResourceType = MINIPORT_RESOURCE_TYPE_REGISTRY_DATA;
Author: jgardou
Date: Sun Nov 20 17:54:52 2011
New Revision: 54461
URL: http://svn.reactos.org/svn/reactos?rev=54461&view=rev
Log:
[HAL]
- truncate PCI vendor id instead of casting it.
MSVC chokes on it with /RTCc
Modified:
trunk/reactos/hal/halx86/legacy/bus/pcibus.c
Modified: trunk/reactos/hal/halx86/legacy/bus/pcibus.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/legacy/bus/pcib…
==============================================================================
--- trunk/reactos/hal/halx86/legacy/bus/pcibus.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/legacy/bus/pcibus.c [iso-8859-1] Sun Nov 20 17:54:52 2011
@@ -1188,7 +1188,7 @@
sizeof(ULONG)))
{
/* Validate the vendor ID */
- if ((USHORT)VendorId != PCI_INVALID_VENDORID)
+ if ((VendorId & 0xFFFF) != PCI_INVALID_VENDORID)
{
/* Set this as the maximum ID */
MaxPciBusNumber = i;