Skip to content

Commit

Permalink
Diversify error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Apr 3, 2023
1 parent ef325a9 commit 095a67a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions packetWin7/npf/npf/Openclos.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,10 +863,9 @@ NPF_OidGetUlongNonpagedPtr(

INFO_DBG("pFiltMod(%p) Oid %#x, Status %#x, %lu bytes\n",
pFiltMod, Oid, Status, BytesProcessed);
if (Status == NDIS_STATUS_SUCCESS && BytesProcessed != sizeof(ULONG))
if (Status == NDIS_STATUS_SUCCESS)
{
ERROR_DBG("BytesProcessed = %#lx != sizeof(ULONG)\n", BytesProcessed);
Status = NDIS_STATUS_FAILURE;
NT_ASSERT(BytesProcessed == sizeof(ULONG));
}
return Status;
}
Expand Down Expand Up @@ -999,7 +998,7 @@ NPF_GetDataRateMappingTable(
{
WARNING_DBG("pFiltMod(%p) DOT11_DATA_RATE_MAPPING_TABLE Status %#x, read %lu, expected %zu\n",
pFiltMod, Status, BytesProcessed, sizeof(DOT11_DATA_RATE_MAPPING_TABLE));
Status = NDIS_STATUS_FAILURE;
Status = NDIS_STATUS_INVALID_DATA;
pFiltMod->DataRateMappingTable = NULL;
ExFreePoolWithTag(pDRMT, NPF_DOT11_POOL_TAG);
}
Expand Down Expand Up @@ -3139,10 +3138,9 @@ NPF_SetPacketFilter(

ExFreePoolWithTag(pBuffer, NPF_INTERNAL_OID_TAG);

if (BytesProcessed != sizeof(PacketFilter))
if (Status == NDIS_STATUS_SUCCESS)
{
INFO_DBG("BytesProcessed != sizeof(PacketFilter), BytesProcessed = %#lx, sizeof(PacketFilter) = %#zx\n", BytesProcessed, sizeof(PacketFilter));
Status = NDIS_STATUS_FAILURE;
NT_ASSERT(BytesProcessed == sizeof(PacketFilter));
}
TRACE_EXIT();
return Status;
Expand Down Expand Up @@ -3206,10 +3204,9 @@ NPF_SetLookaheadSize(

ExFreePoolWithTag(pBuffer, NPF_INTERNAL_OID_TAG);

if (Status != STATUS_SUCCESS || BytesProcessed != sizeof(ULONG))
if (Status == STATUS_SUCCESS)
{
INFO_DBG("NPF_DoInternalRequest error %#x, BytesProcessed = %#lx, sizeof(ULONG) = %#zx\n", Status, BytesProcessed, sizeof(ULONG));
Status = NDIS_STATUS_FAILURE;
NT_ASSERT(BytesProcessed != sizeof(ULONG));
}
TRACE_EXIT();
return Status;
Expand Down Expand Up @@ -3321,7 +3318,7 @@ NDIS_STATUS NPF_DoInternalRequest(
break;
default:
NT_ASSERT(RequestType && FALSE);
Status = NDIS_STATUS_FAILURE;
Status = NDIS_STATUS_INVALID_PARAMETER;
goto InternalRequestExit;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion packetWin7/npf/npf/Packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ static NTSTATUS funcBIOC_OID(_In_ POPEN_INSTANCE pOpen,
if (bSetOid)
{
INFO_DBG("Dot11: AdapterName=%ws, OID_GEN_MEDIA_IN_USE & BIOCSETOID, fail it\n", pOpen->pFiltMod->AdapterName.Buffer);
Status = STATUS_UNSUCCESSFUL;
Status = STATUS_NOT_SUPPORTED;
}
else
{
Expand Down

0 comments on commit 095a67a

Please sign in to comment.