• 大小: 382KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-07
  • 语言: 其他
  • 标签: ARP防火墙  

资源简介

一个不错的ARP防火墙源代码,包括Ring3控制程序和核心驱动源代码

资源截图

代码片段和文件信息


#include “precomp.h“
#pragma hdrstop

#define MAX_NOTIFY_PACKET 512

NOTIFY_PACKET* g_PacketListHead = NULL;

NOTIFY_PACKET* g_PacketListTail = NULL;

NOTIFY_PACKET* g_PacketArray = NULL;

NOTIFY_PACKET* g_FreePacketList = NULL;

NTSTATUS
InitPacketList()
{
UINT i;

g_PacketListHead = g_PacketListTail = NULL;

g_PacketArray = (NOTIFY_PACKET*)ExAllocatePoolWithTag(NonPagedPoolMAX_NOTIFY_PACKET*sizeof(NOTIFY_PACKET)TAG);

if(!g_PacketArray)
return STATUS_UNSUCCESSFUL;

RtlZeroMemory(g_PacketArrayMAX_NOTIFY_PACKET*sizeof(NOTIFY_PACKET));

for( i = 0; i< MAX_NOTIFY_PACKET; i++ )
{
g_PacketArray[i].Next = g_FreePacketList;
g_FreePacketList   = &g_PacketArray[i];
}

return STATUS_SUCCESS;
}

VOID
UnInitPacketList()
{

g_PacketListHead = g_PacketListTail = g_FreePacketList = NULL;

ExFreePool(g_PacketArray);

g_PacketArray = NULL;

}


VOID
AddPacketToListTail(NOTIFY_PACKET* pPacket)
{
if(pPacket == NULL) return;

NdisAcquireSpinLock(&GlobalLock);

if(g_PacketListHead)
{
pPacket->Next = NULL;    // Tail->Next = NULL;
g_PacketListTail->Next = pPacket; // Old->Next  = New;
g_PacketListTail = pPacket; // Tail       = New;
}
else
{
pPacket->Next = NULL;    // Tail->Next = NULL;
g_PacketListTail = pPacket;    // Tail  = New;
g_PacketListHead = pPacket;    // Head  = New;
}

NdisReleaseSpinLock(&GlobalLock);

}


NOTIFY_PACKET*
GetPacketFromListHead()
{

NOTIFY_PACKET* pPacket= NULL;

NdisAcquireSpinLock(&GlobalLock);

if(g_PacketListHead)
{
pPacket = g_PacketListHead;
g_PacketListHead = pPacket->Next;
}
else
{
pPacket = NULL;
}

NdisReleaseSpinLock(&GlobalLock);

return pPacket;
}


VOID
FreePacket(NOTIFY_PACKET* pPacket)
{
NdisAcquireSpinLock(&GlobalLock);

if(pPacket)
{
pPacket->Next = g_FreePacketList;
g_FreePacketList = pPacket;
}

NdisReleaseSpinLock(&GlobalLock);

}


NOTIFY_PACKET*
AllocatePacket()
{
NOTIFY_PACKET* Packet = NULL;

NdisAcquireSpinLock(&GlobalLock);

if(g_FreePacketList )
{
Packet = g_FreePacketList;
g_FreePacketList = Packet->Next;
}

NdisReleaseSpinLock(&GlobalLock);

return Packet;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......       938  2009-04-23 11:38  arpwall\Debug\MPWONARP.inf

    .......      1906  2009-04-23 11:38  arpwall\Debug\PTWONARP.inf

    .......      2464  2009-04-23 11:38  arpwall\Debug\WonArp6.inf

    .......       938  2009-04-23 11:38  arpwall\Release\MPWONARP.inf

    .......      1906  2009-04-23 11:38  arpwall\Release\PTWONARP.inf

    .......      2464  2009-04-23 11:38  arpwall\Release\WonArp6.inf

    .......      3101  2009-04-23 11:38  arpwall\setup\WonArp.iss

    .......      2687  2009-04-23 11:38  arpwall\Share\ShareStruct.h

    .......      2277  2009-04-23 11:38  arpwall\WonArp5\DoubleList.c

    .......       341  2009-04-23 11:38  arpwall\WonArp5\DoubleList.h

    .......      2214  2009-04-23 11:38  arpwall\WonArp5\GatewayCheck.c

    .......       497  2009-04-23 11:38  arpwall\WonArp5\GatewayCheck.h

    .......     13359  2009-04-23 11:38  arpwall\WonArp5\IoCtrl.c

    .......       248  2009-04-23 11:38  arpwall\WonArp5\makefile

    .......     15803  2009-04-23 11:38  arpwall\WonArp5\miniport4.c

    .......      3298  2009-04-23 11:38  arpwall\WonArp5\Miniport4.h

    .......     23019  2009-04-23 11:38  arpwall\WonArp5\miniport51.c

    .......      3337  2009-04-23 11:38  arpwall\WonArp5\Miniport51.h

    .......       938  2009-04-23 11:38  arpwall\WonArp5\MPWONARP.inf

    .......     20712  2009-04-23 11:38  arpwall\WonArp5\Packet.c

    .......      1763  2009-04-23 11:38  arpwall\WonArp5\Packet.h

    .......      2014  2009-04-23 11:38  arpwall\WonArp5\precomp.h

    .......     24107  2009-04-23 11:38  arpwall\WonArp5\protocol4.c

    .......      3876  2009-04-23 11:38  arpwall\WonArp5\Protocol4.h

    .......     22188  2009-04-23 11:38  arpwall\WonArp5\protocol5.c

    .......      3686  2009-04-23 11:38  arpwall\WonArp5\Protocol5.h

    .......      1906  2009-04-23 11:38  arpwall\WonArp5\PTWONARP.inf

    .......     17040  2009-04-23 11:38  arpwall\WonArp5\SendRecv4.c

    .......     21576  2009-04-23 11:38  arpwall\WonArp5\SendRecv5.c

    .......      2173  2009-04-23 11:38  arpwall\WonArp5\Share.h

............此处省略135个文件信息

评论

共有 条评论

相关资源