Hi,
I’m writing a LWF driver to inject 802.11 packet on windows. I tried the CommView for wifi(http://www.tamos.com/download/main/ca.php), it provides patch-driver for various of adapters, it CAN inject packet with the patch-driver installed, so I think with the patch driver, I can write my LWF driver to inject too.
this is my inject function:
BOOLEAN inject_packet(UCHAR* buf, INT size) {
UCHAR* frame = (UCHAR*)NdisAllocateMemoryWithTagPriority(G.pFilter->FilterHandle, size,
FILTER_ALLOC_TAG, LowPoolPriority);
PMDL pMdl = NdisAllocateMdl(G.pFilter->FilterHandle, frame, size);
if(pMdl == NULL) {
DEBUGP(DL_AJ, (“alloc mdl error\n”));
return FALSE;
}
NdisMoveMemory(frame, buf, size);
PNET_BUFFER_LIST pNetBufferList = NdisAllocateNetBufferAndNetBufferList(
G.pFilter->pool,
0, //Request
0, // back fill size
pMdl,
0, // Data offset
size);
if(pNetBufferList == NULL) {
DEBUGP(DL_AJ, (“alloc NBL error\n”));
return FALSE;
}
pNetBufferList->SourceHandle = G.pFilter->FilterHandle;
NdisFSendNetBufferLists(G.pFilter->FilterHandle,
pNetBufferList,
NDIS_DEFAULT_PORT_NUMBER,
NDIS_SEND_FLAGS_DISPATCH_LEVEL);
NdisFreeMemory(frame, size, 0);
return TRUE;
}
the code doesn’t work, no packet is sent, I can’t figure out why, anyone tried this before or interested ?
my email: aj3423 at gmail
Thanks in advance