mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
- Big debugging update
- Also fix some little bugs and reduce code duplication svn path=/trunk/; revision=41461
This commit is contained in:
parent
02b61191c8
commit
cf30be51fb
9 changed files with 165 additions and 140 deletions
|
@ -357,6 +357,7 @@ NdisAllocateBuffer(
|
|||
(*Buffer)->Next = NULL;
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
} else {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("IoAllocateMdl failed (%x, %lx)\n", VirtualAddress, Length));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -401,43 +402,13 @@ NdisAllocatePacket(
|
|||
* PoolHandle = Handle returned by NdisAllocatePacketPool
|
||||
*/
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
PNDIS_PACKET Temp;
|
||||
PNDISI_PACKET_POOL Pool = (PNDISI_PACKET_POOL)PoolHandle;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) Packet (0x%X) PoolHandle (0x%X).\n",
|
||||
Status, Packet, PoolHandle));
|
||||
|
||||
*Packet = NULL;
|
||||
|
||||
if (Pool == NULL)
|
||||
{
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
KeAcquireSpinLock(&Pool->SpinLock.SpinLock, &OldIrql);
|
||||
|
||||
if (Pool->FreeList) {
|
||||
Temp = Pool->FreeList;
|
||||
Pool->FreeList = (PNDIS_PACKET)Temp->Reserved[0];
|
||||
|
||||
KeReleaseSpinLock(&Pool->SpinLock.SpinLock, OldIrql);
|
||||
|
||||
RtlZeroMemory(Temp, Pool->PacketLength);
|
||||
Temp->Private.Pool = Pool;
|
||||
Temp->Private.ValidCounts = TRUE;
|
||||
Temp->Private.NdisPacketFlags = fPACKET_ALLOCATED_BY_NDIS;
|
||||
Temp->Private.NdisPacketOobOffset = Pool->PacketLength -
|
||||
(sizeof(NDIS_PACKET_OOB_DATA) +
|
||||
sizeof(NDIS_PACKET_EXTENSION));
|
||||
|
||||
*Packet = Temp;
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
} else {
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
KeReleaseSpinLock(&Pool->SpinLock.SpinLock, OldIrql);
|
||||
}
|
||||
KeAcquireSpinLock(&Pool->SpinLock.SpinLock, &Pool->SpinLock.OldIrql);
|
||||
NdisDprAllocatePacketNonInterlocked(Status,
|
||||
Packet,
|
||||
PoolHandle);
|
||||
KeReleaseSpinLock(&Pool->SpinLock.SpinLock, Pool->SpinLock.OldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -499,6 +470,7 @@ NdisAllocatePacketPoolEx(
|
|||
|
||||
if (NumberOfDescriptors > 0xffff)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Invalid number of descriptors (%lx)\n"))
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
else
|
||||
|
@ -506,6 +478,7 @@ NdisAllocatePacketPoolEx(
|
|||
NumberOfDescriptors += NumberOfOverflowDescriptors;
|
||||
if (NumberOfDescriptors > 0xffff)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Total number of descriptors > 0xffff (%lx)\n"));
|
||||
NumberOfDescriptors = 0xffff;
|
||||
}
|
||||
|
||||
|
@ -533,8 +506,10 @@ NdisAllocatePacketPoolEx(
|
|||
}
|
||||
Packet->Reserved[0] = 0;
|
||||
}
|
||||
else
|
||||
else {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Attempted to allocate a packet pool with 0 descriptors\n"));
|
||||
Pool->FreeList = NULL;
|
||||
}
|
||||
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
*PoolHandle = (PNDIS_HANDLE)Pool;
|
||||
|
@ -689,42 +664,13 @@ NdisDprAllocatePacket(
|
|||
* PoolHandle = Handle returned by NdisAllocatePacketPool
|
||||
*/
|
||||
{
|
||||
PNDIS_PACKET Temp;
|
||||
PNDISI_PACKET_POOL Pool = (PNDISI_PACKET_POOL)PoolHandle;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) Packet (0x%X) PoolHandle (0x%X).\n",
|
||||
Status, Packet, PoolHandle));
|
||||
|
||||
*Packet = NULL;
|
||||
|
||||
if (Pool == NULL)
|
||||
{
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&Pool->SpinLock.SpinLock);
|
||||
|
||||
if (Pool->FreeList) {
|
||||
Temp = Pool->FreeList;
|
||||
Pool->FreeList = (PNDIS_PACKET)Temp->Reserved[0];
|
||||
|
||||
KeReleaseSpinLockFromDpcLevel(&Pool->SpinLock.SpinLock);
|
||||
|
||||
RtlZeroMemory(Temp, Pool->PacketLength);
|
||||
Temp->Private.Pool = Pool;
|
||||
Temp->Private.ValidCounts = TRUE;
|
||||
Temp->Private.NdisPacketFlags = fPACKET_ALLOCATED_BY_NDIS;
|
||||
Temp->Private.NdisPacketOobOffset = Pool->PacketLength -
|
||||
(sizeof(NDIS_PACKET_OOB_DATA) +
|
||||
sizeof(NDIS_PACKET_EXTENSION));
|
||||
|
||||
*Packet = Temp;
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
} else {
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
KeReleaseSpinLockFromDpcLevel(&Pool->SpinLock.SpinLock);
|
||||
}
|
||||
NdisDprAllocatePacketNonInterlocked(Status,
|
||||
Packet,
|
||||
PoolHandle);
|
||||
KeReleaseSpinLockFromDpcLevel(&Pool->SpinLock.SpinLock);
|
||||
}
|
||||
|
||||
|
||||
|
@ -756,6 +702,7 @@ NdisDprAllocatePacketNonInterlocked(
|
|||
if (Pool == NULL)
|
||||
{
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Called passed a bad pool handle\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -774,6 +721,7 @@ NdisDprAllocatePacketNonInterlocked(
|
|||
*Packet = Temp;
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
} else {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No more free descriptors\n"));
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
@ -792,12 +740,11 @@ NdisDprFreePacket(
|
|||
* Packet = Pointer to packet to free
|
||||
*/
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Packet (0x%X).\n", Packet));
|
||||
PNDISI_PACKET_POOL Pool = (PNDISI_PACKET_POOL)Packet->Private.Pool;
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&((NDISI_PACKET_POOL*)Packet->Private.Pool)->SpinLock.SpinLock);
|
||||
Packet->Reserved[0] = (ULONG_PTR)((NDISI_PACKET_POOL*)Packet->Private.Pool)->FreeList;
|
||||
((NDISI_PACKET_POOL*)Packet->Private.Pool)->FreeList = Packet;
|
||||
KeReleaseSpinLockFromDpcLevel(&((NDISI_PACKET_POOL*)Packet->Private.Pool)->SpinLock.SpinLock);
|
||||
KeAcquireSpinLockAtDpcLevel(&Pool->SpinLock.SpinLock);
|
||||
NdisDprFreePacketNonInterlocked(Packet);
|
||||
KeReleaseSpinLockFromDpcLevel(&Pool->SpinLock.SpinLock);
|
||||
}
|
||||
|
||||
|
||||
|
@ -885,14 +832,11 @@ NdisFreePacket(
|
|||
* Packet = Pointer to packet descriptor
|
||||
*/
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
PNDISI_PACKET_POOL Pool = (PNDISI_PACKET_POOL)Packet->Private.Pool;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Packet (0x%X).\n", Packet));
|
||||
|
||||
KeAcquireSpinLock(&((NDISI_PACKET_POOL*)Packet->Private.Pool)->SpinLock.SpinLock, &OldIrql);
|
||||
Packet->Reserved[0] = (ULONG_PTR)((NDISI_PACKET_POOL*)Packet->Private.Pool)->FreeList;
|
||||
((NDISI_PACKET_POOL*)Packet->Private.Pool)->FreeList = Packet;
|
||||
KeReleaseSpinLock(&((NDISI_PACKET_POOL*)Packet->Private.Pool)->SpinLock.SpinLock, OldIrql);
|
||||
KeAcquireSpinLock(&Pool->SpinLock.SpinLock, &Pool->SpinLock.OldIrql);
|
||||
NdisDprFreePacketNonInterlocked(Packet);
|
||||
KeReleaseSpinLock(&Pool->SpinLock.SpinLock, Pool->SpinLock.OldIrql);
|
||||
}
|
||||
|
||||
|
||||
|
@ -951,6 +895,7 @@ NdisGetFirstBufferFromPacket(
|
|||
*_FirstBufferVA = MmGetSystemAddressForMdl(Buffer);
|
||||
Buffer = Buffer->Next;
|
||||
} else {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No buffers linked to this packet\n"));
|
||||
*_FirstBufferLength = 0;
|
||||
*_FirstBufferVA = NULL;
|
||||
}
|
||||
|
@ -986,6 +931,7 @@ NdisGetFirstBufferFromPacketSafe(
|
|||
*_FirstBufferVA = MmGetSystemAddressForMdlSafe(Buffer, Priority);
|
||||
Buffer = Buffer->Next;
|
||||
} else {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No buffers linked to this packet\n"));
|
||||
*_FirstBufferLength = 0;
|
||||
*_FirstBufferVA = NULL;
|
||||
}
|
||||
|
@ -1088,6 +1034,7 @@ NdisUnchainBufferAtBack(
|
|||
&NdisBuffer,
|
||||
NULL);
|
||||
if (!NdisBuffer) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No buffer to unchain\n"));
|
||||
*Buffer = NULL;
|
||||
return;
|
||||
}
|
||||
|
@ -1136,6 +1083,7 @@ NdisUnchainBufferAtFront(
|
|||
&NdisBuffer,
|
||||
NULL);
|
||||
if (!NdisBuffer) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No buffer to unchain\n"));
|
||||
*Buffer = NULL;
|
||||
return;
|
||||
}
|
||||
|
@ -1182,6 +1130,7 @@ NdisCopyBuffer(
|
|||
*Buffer = IoAllocateMdl(CurrentVa, Length, FALSE, FALSE, NULL);
|
||||
if (!*Buffer)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("IoAllocateMdl failed (%x, %lx)\n", CurrentVa, Length));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ NdisWriteConfiguration(
|
|||
PVOID Data;
|
||||
WCHAR Buff[25];
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
/* reset parameter type to standard reg types */
|
||||
switch(ParameterType)
|
||||
{
|
||||
|
@ -114,9 +116,10 @@ NdisWriteConfiguration(
|
|||
*Status = ZwSetValueKey(((PMINIPORT_CONFIGURATION_CONTEXT)ConfigurationHandle)->Handle,
|
||||
Keyword, 0, ParameterType, Data, DataSize);
|
||||
|
||||
if(*Status != STATUS_SUCCESS)
|
||||
if(*Status != STATUS_SUCCESS) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("ZwSetValueKey failed (%x)\n", *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
else
|
||||
} else
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -189,7 +192,7 @@ NdisOpenConfiguration(
|
|||
DUPLICATE_SAME_ACCESS);
|
||||
if(!NT_SUCCESS(*Status))
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Failed to open registry configuration for this miniport\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Failed to open registry configuration for this miniport\n"));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
@ -263,6 +266,7 @@ NdisOpenProtocolConfiguration(
|
|||
|
||||
if(*Status != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("ZwOpenKey failed (%x)\n", *Status));
|
||||
*ConfigurationHandle = NULL;
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
|
@ -330,7 +334,7 @@ NdisReadConfiguration(
|
|||
ParameterType != NdisParameterBinary
|
||||
)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE,("unsupported parameter type\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE,("unsupported parameter type\n"));
|
||||
*Status = NDIS_STATUS_NOT_SUPPORTED;
|
||||
return;
|
||||
}
|
||||
|
@ -339,7 +343,7 @@ NdisReadConfiguration(
|
|||
|
||||
if (ConfigurationContext == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE,("invalid parameter ConfigurationContext (0x%x)\n",ConfigurationContext));
|
||||
NDIS_DbgPrint(MIN_TRACE,("invalid parameter ConfigurationContext (0x%x)\n",ConfigurationContext));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -460,7 +464,7 @@ NdisReadConfiguration(
|
|||
*Status = ZwQueryValueKey(ConfigurationContext->Handle, Keyword, KeyValuePartialInformation, NULL, 0, &KeyDataLength);
|
||||
if(*Status != STATUS_BUFFER_OVERFLOW && *Status != STATUS_BUFFER_TOO_SMALL && *Status != STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE,("ZwQueryValueKey #1 failed for %wZ, status 0x%x\n", Keyword, *Status));
|
||||
NDIS_DbgPrint(MIN_TRACE,("ZwQueryValueKey #1 failed for %wZ, status 0x%x\n", Keyword, *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
@ -480,7 +484,7 @@ NdisReadConfiguration(
|
|||
if(*Status != STATUS_SUCCESS)
|
||||
{
|
||||
ExFreePool(KeyInformation);
|
||||
NDIS_DbgPrint(MID_TRACE,("ZwQueryValueKey #2 failed for %wZ, status 0x%x\n", Keyword, *Status));
|
||||
NDIS_DbgPrint(MIN_TRACE,("ZwQueryValueKey #2 failed for %wZ, status 0x%x\n", Keyword, *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
@ -551,7 +555,7 @@ NdisReadConfiguration(
|
|||
|
||||
if(KeyInformation->Type != REG_SZ && KeyInformation->Type != REG_MULTI_SZ)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE,("requested type does not match actual value type\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE,("requested type does not match actual value type\n"));
|
||||
ExFreePool(KeyInformation);
|
||||
*ParameterValue = NULL;
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
|
@ -721,6 +725,7 @@ NdisReadNetworkAddress(
|
|||
NdisReadConfiguration(Status, &ParameterValue, ConfigurationHandle, &Keyword, NdisParameterString);
|
||||
if(*Status != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("NdisReadConfiguration failed (%x)\n", *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
@ -808,6 +813,7 @@ NdisOpenConfigurationKeyByIndex(
|
|||
*Status = ZwEnumerateKey(ConfigurationHandle, Index, KeyBasicInformation, NULL, 0, &KeyInformationLength);
|
||||
if(*Status != STATUS_BUFFER_TOO_SMALL && *Status != STATUS_BUFFER_OVERFLOW && *Status != STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("ZwEnumerateKey failed (%x)\n", *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
@ -825,6 +831,7 @@ NdisOpenConfigurationKeyByIndex(
|
|||
|
||||
if(*Status != STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("ZwEnumerateKey failed (%x)\n", *Status));
|
||||
ExFreePool(KeyInformation);
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
|
@ -842,6 +849,7 @@ NdisOpenConfigurationKeyByIndex(
|
|||
|
||||
if(*Status != STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("ZwOpenKey failed (%x)\n", *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
@ -901,6 +909,7 @@ NdisOpenConfigurationKeyByName(
|
|||
|
||||
if(*Status != STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("ZwOpenKey failed (%x)\n", *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,8 +44,12 @@ EthCreateFilter(
|
|||
*Filter = (PETH_FILTER)NewFilter;
|
||||
return TRUE;
|
||||
}
|
||||
*Filter = NULL;
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
*Filter = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,7 +92,10 @@ EthFilterDprIndicateReceive(
|
|||
/* Not sure if this is a valid thing to do, but we do arrive here early
|
||||
* in the boot process with Filter NULL. We need to investigate whether
|
||||
* this should be handled or not allowed. */
|
||||
if( !Filter ) return;
|
||||
if( !Filter ) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Filter is NULL\n"));
|
||||
return;
|
||||
}
|
||||
MiniIndicateData((PLOGICAL_ADAPTER)((PETHI_FILTER)Filter)->Miniport,
|
||||
MacReceiveContext,
|
||||
HeaderBuffer,
|
||||
|
@ -118,7 +125,10 @@ EthFilterDprIndicateReceiveComplete(
|
|||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
if( !Filter ) return;
|
||||
if( !Filter ) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Filter is NULL\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
Adapter = (PLOGICAL_ADAPTER)((PETHI_FILTER)Filter)->Miniport;
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ NdisMPciAssignResources(
|
|||
if (Adapter->NdisMiniportBlock.BusType != NdisInterfacePci ||
|
||||
Adapter->NdisMiniportBlock.AllocatedResources == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Bad bus type or no resources\n"));
|
||||
*AssignedResources = NULL;
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
|
|
@ -68,12 +68,14 @@ BOOLEAN NTAPI ServiceRoutine(
|
|||
NDIS_DbgPrint(MAX_TRACE, ("Called. Interrupt (0x%X)\n", NdisInterrupt));
|
||||
|
||||
if (NdisInterrupt->IsrRequested) {
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling MiniportISR\n"));
|
||||
(*NdisMiniportBlock->DriverHandle->MiniportCharacteristics.ISRHandler)(
|
||||
&InterruptRecognized,
|
||||
&QueueMiniportHandleInterrupt,
|
||||
NdisMiniportBlock->MiniportAdapterContext);
|
||||
|
||||
} else if (NdisMiniportBlock->DriverHandle->MiniportCharacteristics.DisableInterruptHandler) {
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling MiniportDisableInterrupt\n"));
|
||||
(*NdisMiniportBlock->DriverHandle->MiniportCharacteristics.DisableInterruptHandler)(
|
||||
NdisMiniportBlock->MiniportAdapterContext);
|
||||
QueueMiniportHandleInterrupt = TRUE;
|
||||
|
@ -276,8 +278,10 @@ NdisMAllocateMapRegisters(
|
|||
ASSERT(Adapter);
|
||||
|
||||
/* only bus masters may call this routine */
|
||||
if(!(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER))
|
||||
if(!(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER)) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Not a bus master\n"));
|
||||
return NDIS_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
DeviceObject = Adapter->NdisMiniportBlock.DeviceObject;
|
||||
|
||||
|
@ -564,10 +568,11 @@ NdisMFreeMapRegisters(
|
|||
ASSERT(Adapter);
|
||||
|
||||
/* only bus masters may call this routine */
|
||||
ASSERT(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER);
|
||||
if(!(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER) ||
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject == NULL)
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject == NULL) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Not bus master or bad adapter object\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
MapRegistersPerBaseRegister = ((Adapter->NdisMiniportBlock.MaximumPhysicalMapping - 2) / PAGE_SIZE) + 2;
|
||||
|
||||
|
@ -717,12 +722,15 @@ NdisMRegisterDmaChannel(
|
|||
|
||||
|
||||
DmaBlock = ExAllocatePool(NonPagedPool, sizeof(NDIS_DMA_BLOCK));
|
||||
if (!DmaBlock)
|
||||
if (!DmaBlock) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
DmaBlock->SystemAdapterObject = (PVOID)IoGetDmaAdapter(Adapter->NdisMiniportBlock.PhysicalDeviceObject, &DeviceDesc, &MapRegisters);
|
||||
|
||||
if (!DmaBlock->SystemAdapterObject) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
ExFreePool(DmaBlock);
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
@ -882,8 +890,10 @@ NdisMRegisterIoPortRange(
|
|||
*PortOffset = MmMapIoSpace(TranslatedAddress, NumberOfPorts, MmNonCached);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Returning 0x%x for port range\n", *PortOffset));
|
||||
|
||||
if(!*PortOffset)
|
||||
if(!*PortOffset) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("MmMapIoSpace failed\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -941,8 +951,10 @@ NdisMInitializeScatterGatherDma(
|
|||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
if (!(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER))
|
||||
if (!(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER)) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Not a bus master\n"));
|
||||
return NDIS_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
RtlZeroMemory(&DeviceDesc, sizeof(DEVICE_DESCRIPTION));
|
||||
|
||||
|
|
|
@ -41,8 +41,10 @@ NdisAllocateMemoryWithTag(
|
|||
Block = ExAllocatePoolWithTag(NonPagedPool, Length, Tag);
|
||||
*VirtualAddress = Block;
|
||||
|
||||
if (!Block)
|
||||
if (!Block) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Failed to allocate memory (%lx)\n", Length));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -94,8 +96,10 @@ NdisAllocateMemory(
|
|||
*VirtualAddress = ExAllocatePool(NonPagedPool, Length);
|
||||
}
|
||||
|
||||
if (!*VirtualAddress)
|
||||
if (!*VirtualAddress) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Allocation failed (%lx, %lx)\n", MemoryFlags, Length));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -241,7 +245,7 @@ NdisMFreeSharedMemory(
|
|||
|
||||
if(!Memory)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Insufficient resources\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -319,7 +323,7 @@ NdisMAllocateSharedMemoryAsync(
|
|||
|
||||
if(!Memory)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Insufficient resources\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ MiniIndicateData(
|
|||
|
||||
if (CurrentEntry == &Adapter->ProtocolListHead)
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("WARNING: No upper protocol layer.\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("WARNING: No upper protocol layer.\n"));
|
||||
}
|
||||
|
||||
while (CurrentEntry != &Adapter->ProtocolListHead)
|
||||
|
@ -523,13 +523,13 @@ MiniAdapterHasAddress(
|
|||
#if DBG
|
||||
if(!Adapter)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Adapter object was null\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Adapter object was null\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Packet)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Packet was null\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Packet was null\n"));
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
@ -538,7 +538,7 @@ MiniAdapterHasAddress(
|
|||
|
||||
if (!NdisBuffer)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Packet contains no buffers.\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Packet contains no buffers.\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -560,7 +560,7 @@ MiniAdapterHasAddress(
|
|||
|
||||
if (BufferLength < Length)
|
||||
{
|
||||
NDIS_DbgPrint(MID_TRACE, ("Buffer is too small.\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Buffer is too small.\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -597,7 +597,7 @@ MiniLocateDevice(
|
|||
|
||||
if(IsListEmpty(&AdapterListHead))
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("No registered miniports for protocol to bind to\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No registered miniports for protocol to bind to\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -632,7 +632,7 @@ MiniLocateDevice(
|
|||
}
|
||||
else
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Leaving (adapter not found).\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Leaving (adapter not found for %wZ).\n", AdapterName));
|
||||
}
|
||||
|
||||
return Adapter;
|
||||
|
@ -654,13 +654,8 @@ MiniQueryInformation(
|
|||
* Size = Size of the passed buffer
|
||||
* Buffer = Buffer for the output
|
||||
* BytesWritten = Address of buffer to place number of bytes written
|
||||
* NOTES:
|
||||
* If the specified buffer is too small, a new buffer is allocated,
|
||||
* and the query is attempted again
|
||||
* RETURNS:
|
||||
* Status of operation
|
||||
* TODO:
|
||||
* Is there any way to use the buffer provided by the protocol?
|
||||
*/
|
||||
{
|
||||
NDIS_STATUS NdisStatus;
|
||||
|
@ -669,7 +664,10 @@ MiniQueryInformation(
|
|||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
NdisRequest = ExAllocatePool(NonPagedPool, sizeof(NDIS_REQUEST));
|
||||
if (!NdisRequest) return NDIS_STATUS_RESOURCES;
|
||||
if (!NdisRequest) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
RtlZeroMemory(NdisRequest, sizeof(NDIS_REQUEST));
|
||||
|
||||
|
@ -903,6 +901,8 @@ MiniDequeueWorkItem(
|
|||
}
|
||||
else
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No work item to dequeue\n"));
|
||||
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -956,6 +956,7 @@ MiniDoRequest(
|
|||
break;
|
||||
|
||||
default:
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Bad request type\n"));
|
||||
Status = NDIS_STATUS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -1747,6 +1748,7 @@ NdisIPnPStartDevice(
|
|||
ExAllocatePool(PagedPool, ResourceListSize);
|
||||
if (Adapter->NdisMiniportBlock.AllocatedResources == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
@ -1755,6 +1757,7 @@ NdisIPnPStartDevice(
|
|||
ExAllocatePool(PagedPool, ResourceListSize);
|
||||
if (!Adapter->NdisMiniportBlock.Resources)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
ExFreePool(Adapter->NdisMiniportBlock.AllocatedResources);
|
||||
ExInterlockedRemoveEntryList(&Adapter->ListEntry, &AdapterListLock);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -1781,6 +1784,7 @@ NdisIPnPStartDevice(
|
|||
ExAllocatePool(PagedPool, ResourceListSize);
|
||||
if (Adapter->NdisMiniportBlock.AllocatedResourcesTranslated == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
@ -1890,7 +1894,7 @@ NdisIPnPStartDevice(
|
|||
|
||||
if (SelectedMediumIndex >= MEDIA_ARRAY_SIZE)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("MiniportInitialize() failed for an adapter\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("MiniportInitialize() selected a bad index\n"));
|
||||
ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
|
||||
return NDIS_STATUS_UNSUPPORTED_MEDIA;
|
||||
}
|
||||
|
@ -1912,7 +1916,7 @@ NdisIPnPStartDevice(
|
|||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
|
||||
NDIS_DbgPrint(MAX_TRACE, ("MiniQueryInformation failed (%x)\n", NdisStatus));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("MiniQueryInformation failed (%x)\n", NdisStatus));
|
||||
return NdisStatus;
|
||||
}
|
||||
|
||||
|
@ -1930,14 +1934,13 @@ NdisIPnPStartDevice(
|
|||
/* FIXME: Support other types of media */
|
||||
NDIS_DbgPrint(MIN_TRACE, ("error: unsupported media\n"));
|
||||
ASSERT(FALSE);
|
||||
/* FIXME - KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql); */
|
||||
ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("couldn't create filter (%x)\n", NdisStatus));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("couldn't create filter (%x)\n", NdisStatus));
|
||||
return NdisStatus;
|
||||
}
|
||||
|
||||
|
@ -2100,6 +2103,8 @@ NdisIDispatchPnp(
|
|||
{
|
||||
Status = NdisIPnPStartDevice(DeviceObject, Irp);
|
||||
}
|
||||
else
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Lower driver failed device start\n"));
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
|
@ -2110,6 +2115,8 @@ NdisIDispatchPnp(
|
|||
{
|
||||
Status = NdisIPnPStopDevice(DeviceObject, Irp);
|
||||
}
|
||||
else
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Lower driver failed device stop\n"));
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
|
@ -2176,8 +2183,8 @@ NdisIAddDevice(
|
|||
MiniportPtr = IoGetDriverObjectExtension(DriverObject, (PVOID)TAG('D','I','M','N'));
|
||||
if (MiniportPtr == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't get driver object extension.\n"));
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Can't get driver object extension.\n"));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
Miniport = *MiniportPtr;
|
||||
|
||||
|
@ -2193,7 +2200,7 @@ NdisIAddDevice(
|
|||
0, NULL, &DriverKeyLength);
|
||||
if (Status != STATUS_BUFFER_TOO_SMALL && Status != STATUS_BUFFER_OVERFLOW && Status != STATUS_SUCCESS)
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't get miniport driver key length.\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Can't get miniport driver key length.\n"));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -2201,7 +2208,7 @@ NdisIAddDevice(
|
|||
sizeof(ClassKeyName) + sizeof(LinkageKeyName));
|
||||
if (LinkageKeyBuffer == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't allocate memory for driver key name.\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Can't allocate memory for driver key name.\n"));
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
@ -2211,7 +2218,7 @@ NdisIAddDevice(
|
|||
&DriverKeyLength);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't get miniport driver key.\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Can't get miniport driver key.\n"));
|
||||
ExFreePool(LinkageKeyBuffer);
|
||||
return Status;
|
||||
}
|
||||
|
@ -2239,7 +2246,7 @@ NdisIAddDevice(
|
|||
ExFreePool(LinkageKeyBuffer);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't get miniport device name. (%x)\n", Status));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Can't get miniport device name. (%x)\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -2428,7 +2435,7 @@ NdisMRegisterMiniport(
|
|||
sizeof(PNDIS_M_DRIVER_BLOCK), (PVOID*)&MiniportPtr);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't allocate driver object extension.\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Can't allocate driver object extension.\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
|
@ -2718,8 +2725,10 @@ NdisMQueryAdapterInstanceName(
|
|||
AdapterName.Length = 0;
|
||||
AdapterName.MaximumLength = Adapter->NdisMiniportBlock.MiniportName.MaximumLength;
|
||||
AdapterName.Buffer = ExAllocatePool(PagedPool, AdapterName.MaximumLength);
|
||||
if (!AdapterName.Buffer)
|
||||
if (!AdapterName.Buffer) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
RtlCopyUnicodeString(&AdapterName, &Adapter->NdisMiniportBlock.MiniportName);
|
||||
|
||||
|
@ -2865,6 +2874,7 @@ NdisMRegisterDevice(
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("IoCreateDevice failed (%x)\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -2872,6 +2882,7 @@ NdisMRegisterDevice(
|
|||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("IoCreateSymbolicLink failed (%x)\n", Status));
|
||||
IoDeleteDevice(DeviceObject);
|
||||
return Status;
|
||||
}
|
||||
|
@ -2880,6 +2891,7 @@ NdisMRegisterDevice(
|
|||
|
||||
if (!DeviceBlock)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
IoDeleteDevice(DeviceObject);
|
||||
IoDeleteSymbolicLink(SymbolicName);
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
|
|
|
@ -158,6 +158,7 @@ NdisMapFile(
|
|||
if (HandleObject->Mapped)
|
||||
{
|
||||
/* If a file already mapped we will return an error code */
|
||||
NDIS_DbgPrint(MIN_TRACE, ("File already mapped\n"));
|
||||
*Status = NDIS_STATUS_ALREADY_MAPPED;
|
||||
return;
|
||||
}
|
||||
|
@ -247,6 +248,7 @@ NdisOpenFile(
|
|||
|
||||
if ( !FullFileName.Buffer )
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -254,6 +256,7 @@ NdisOpenFile(
|
|||
FileHandleObject = ExAllocatePool ( NonPagedPool, sizeof(NDIS_HANDLE_OBJECT) );
|
||||
if ( !FileHandleObject )
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
*Status = NDIS_STATUS_RESOURCES;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -263,6 +266,7 @@ NdisOpenFile(
|
|||
*Status = RtlAppendUnicodeStringToString ( &FullFileName, FileName );
|
||||
if ( !NT_SUCCESS(*Status) )
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("RtlAppendUnicodeStringToString failed (%x)\n", *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -288,6 +292,7 @@ NdisOpenFile(
|
|||
|
||||
if ( !NT_SUCCESS(*Status) )
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("ZwCreateFile failed (%x)\n", *Status));
|
||||
*Status = NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,10 @@ ProSetupPnPEvent(
|
|||
PNET_PNP_EVENT PnPEvent;
|
||||
|
||||
PnPEvent = ExAllocatePool(PagedPool, sizeof(NET_PNP_EVENT));
|
||||
if (!PnPEvent)
|
||||
if (!PnPEvent) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RtlZeroMemory(PnPEvent, sizeof(NET_PNP_EVENT));
|
||||
|
||||
|
@ -48,6 +50,7 @@ ProSetupPnPEvent(
|
|||
PnPEvent->Buffer = ExAllocatePool(PagedPool, EventBufferLength);
|
||||
if (!PnPEvent->Buffer)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
ExFreePool(PnPEvent);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -117,8 +120,10 @@ NdisIPwrSetPower(
|
|||
ASSERT(Stack->Parameters.Power.Type == DevicePowerState);
|
||||
|
||||
PnPEvent = ProSetupPnPEvent(NetEventSetPower, &Stack->Parameters.Power.State, sizeof(NDIS_DEVICE_POWER_STATE));
|
||||
if (!PnPEvent)
|
||||
if (!PnPEvent) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp);
|
||||
}
|
||||
|
@ -136,8 +141,10 @@ NdisIPwrQueryPower(
|
|||
ASSERT(Stack->Parameters.Power.Type == DevicePowerState);
|
||||
|
||||
PnPEvent = ProSetupPnPEvent(NetEventQueryPower, &Stack->Parameters.Power.State, sizeof(NDIS_DEVICE_POWER_STATE));
|
||||
if (!PnPEvent)
|
||||
if (!PnPEvent) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp);
|
||||
}
|
||||
|
@ -153,8 +160,10 @@ NdisIPnPQueryStopDevice(
|
|||
PNET_PNP_EVENT PnPEvent;
|
||||
|
||||
PnPEvent = ProSetupPnPEvent(NetEventQueryRemoveDevice, NULL, 0);
|
||||
if (!PnPEvent)
|
||||
if (!PnPEvent) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp);
|
||||
}
|
||||
|
@ -169,8 +178,10 @@ NdisIPnPCancelStopDevice(
|
|||
PNET_PNP_EVENT PnPEvent;
|
||||
|
||||
PnPEvent = ProSetupPnPEvent(NetEventCancelRemoveDevice, NULL, 0);
|
||||
if (!PnPEvent)
|
||||
if (!PnPEvent) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
return ProSendAndFreePnPEvent(Adapter, PnPEvent, Irp);
|
||||
}
|
||||
|
@ -198,7 +209,10 @@ NdisCompleteBindAdapter(
|
|||
{
|
||||
PROTOCOL_BINDING *Protocol = (PROTOCOL_BINDING *)BindAdapterContext;
|
||||
|
||||
if (!NT_SUCCESS(Status)) return;
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Binding failed (%x)\n", Status));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Put protocol binding struct on global list */
|
||||
ExInterlockedInsertTailList(&ProtocolListHead, &Protocol->ListEntry, &ProtocolListLock);
|
||||
|
@ -219,7 +233,10 @@ NdisCompleteUnbindAdapter(
|
|||
|
||||
PROTOCOL_BINDING *Protocol = (PROTOCOL_BINDING *)UnbindAdapterContext;
|
||||
|
||||
if (!NT_SUCCESS(Status)) return;
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Unbinding failed (%x)\n", Status));
|
||||
return;
|
||||
}
|
||||
|
||||
ExInterlockedRemoveEntryList(&Protocol->ListEntry, &ProtocolListLock);
|
||||
}
|
||||
|
@ -252,8 +269,10 @@ ProIndicatePacket(
|
|||
#endif
|
||||
|
||||
LookaheadBuffer = ExAllocatePool(NonPagedPool, Adapter->NdisMiniportBlock.CurrentLookahead + Adapter->MediumHeaderSize);
|
||||
if (!LookaheadBuffer)
|
||||
if (!LookaheadBuffer) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
NdisQueryPacket(Packet, NULL, NULL, NULL, &PacketLength);
|
||||
|
||||
|
@ -497,8 +516,10 @@ ProSend(
|
|||
&PacketLength);
|
||||
|
||||
Context = ExAllocatePool(NonPagedPool, sizeof(DMA_CONTEXT));
|
||||
if (!Context)
|
||||
if (!Context) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
Context->Adapter = Adapter;
|
||||
Context->Packet = Packet;
|
||||
|
@ -520,7 +541,7 @@ ProSend(
|
|||
KeLowerIrql(OldIrql);
|
||||
|
||||
if (!NT_SUCCESS(NdisStatus)) {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("GetScatterGatherList failed!\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("GetScatterGatherList failed! (%x)\n", NdisStatus));
|
||||
return NdisStatus;
|
||||
}
|
||||
|
||||
|
@ -760,7 +781,7 @@ NdisOpenAdapter(
|
|||
|
||||
if(!NdisProtocolHandle)
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("NdisProtocolHandle is NULL\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("NdisProtocolHandle is NULL\n"));
|
||||
*OpenErrorStatus = *Status = NDIS_STATUS_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
@ -973,7 +994,7 @@ ndisBindMiniportsToProtocol(OUT PNDIS_STATUS Status, IN PNDIS_PROTOCOL_CHARACTER
|
|||
if(BindHandler)
|
||||
BindHandler(Status, BindContext, &DeviceName, &RegistryPath, 0);
|
||||
else
|
||||
NDIS_DbgPrint(MID_TRACE, ("No protocol bind handler specified\n"));
|
||||
NDIS_DbgPrint(MIN_TRACE, ("No protocol bind handler specified\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1081,6 +1102,7 @@ NdisRegisterProtocol(
|
|||
if (*Status == NDIS_STATUS_SUCCESS) {
|
||||
ExInterlockedInsertTailList(&ProtocolListHead, &Protocol->ListEntry, &ProtocolListLock);
|
||||
} else {
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Binding failed (%x)\n", *Status));
|
||||
ExFreePool(Protocol);
|
||||
*NdisProtocolHandle = NULL;
|
||||
}
|
||||
|
@ -1225,6 +1247,7 @@ NdisGetDriverHandle(
|
|||
|
||||
if (!Binding)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Bad binding handle\n"));
|
||||
*NdisDriverHandle = NULL;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue