Home > Back-end >  Consult packet filtering problem, hope can be settled as soon as possible, very urgent
Consult packet filtering problem, hope can be settled as soon as possible, very urgent

Time:10-07

 
# define ADD_FILTER CTL_CODE (FILE_DEVICE_DRVFLTIP, DRVFLTIP_IOCTL_INDEX + 2, METHOD_BUFFERED, FILE_WRITE_ACCESS)

DWORD CAddRuleDlg: : AddFilter IPFilter (pf)
{

DWORD result=ipFltDrv. WriteIo (ADD_FILTER, & amp; Pf, sizeof (pf));//function call



if (result !=DRV_SUCCESS)
{
AfxMessageBox (" Unable to rule to add the driver ");

Return FALSE;
}

The else
Return TRUE;
}

DWORD TDriver: : WriteIo (DWORD code, PVOID buffer, dwords count)//the function definition
{
If (driverHandle==NULL)
Return DRV_ERROR_INVALID_HANDLE;

DWORD bytesReturned;

BOOL returnCode=DeviceIoControl (driverHandle,//call DeviceIoControl () packet filter to realize
Code,
Buffer,
The count,
NULL,
0,
& BytesReturned,
NULL);

if(! ReturnCode)
Return DRV_ERROR_IO;

Return DRV_SUCCESS;
}

In function is illustrated below AddFilter IPFilter (pf) of each variable test values

Below for the function WriteIo (DWORD code, PVOID buffer, dwords count) of each variable test values

Corresponding parameter values are correct, and the debugging results without error, but there is no actual packet filter action, I do not know is what reason,
Ask ace to help solve this problem, very worried, thank you very much,

CodePudding user response:

Check the returnCode normal?

CodePudding user response:

Run successfully after returnCode value is 1, defined as long type is 1, but soon I just involve the packet filter, the return value is normally really don't know much about it, the document said only in the success of the return value is nonzero, the hope can help to explain it, thank you very much

CodePudding user response:

Fill lpOutBuffer parameters in, see what was the result returned, check the BytesReturned, all in all, to check the equipment for a reflection of this instruction, then according to the situation to see what to do next

CodePudding user response:

BytesReturned value is 0, outputBuffer did not return a result, no device to perform such operations? If it is, is that the device driver itself? What I use is DrvFltip. Sys file contains the driver, Windows 7, VS2013 environment, will be related to this? That I want to how to solve the redo environment?

CodePudding user response:

This case, you can send equipment first some other commands, such as some relatively simple and fundamental code, let's see if this equipment can normal accordingly, if have no reaction, all the instruction through other channels to try artificial manipulation of this equipment, overall look at the device itself is not normal, locking the question in a particular link
  • Related