Rulik
Помогающий
Offline
|
|
« : 01-08-2005 13:53 » |
|
Доброе время суток. Пишу следующий код:
NDIS_Filter.c
#include <ntstatus.h> #include <ntddk.h> #include <pfhook.h> //#include <ntoskrnl.h>
TCHAR drvsmbl[]=TEXT("\\Device\\IPFILTERDRIVER");
NTSTATUS Status=STATUS_SUCCESS; PFILE_OBJECT fileobject=NULL; PDEVICE_OBJECT devobject=NULL;
PF_SET_EXTENSION_HOOK_INFO hook_info IO_STATUS_BLOCK isb; PIRP myirp=NULL;
VOID Unload(IN PDRIVER_OBJECT DriverObject); PF_FORWARD_ACTION hook_fn(IN unsigned char *PacketHeader,IN unsigned char *Packet, IN unsigned int PacketLength, IN unsigned int RecvInterfaceIndex, IN unsigned int SendInterfaceIndex, IN IPAddr RecvLinkNextHop, IN IPAddr SendLinkNextHop}; //=================================================================================== NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING RegistryPath)
{ Status=Set_Hook(hook_fn);
if(Status!=STATUS_SUCCESS) return Status;
DriverObject->DriverUnload=Unload;
return Status; } //=================================================================================== VOID Unload(IN PDRIVER_OBJECT DriverObject) { Set_Hook(0); } //=================================================================================== NTSTATUS Set_Hook(PacketFilterExtensionPtr hook_fn) { NTSTATUS status=IoGetDeviceObjectPointer(drvsmbl,STANDART_RIGHTS_ALL,&fileopject,&devobject);
if(status!=STATUS_SUCCESS) return status;
hook_info.ExtensionPointer=hook_fn;
myirp=IoBuildDeviceIoControlRequest(IOCTL_PF_SET_EXTENSION_POINTER,devobject,&hook_info, sizeof(hook_info),NULL,0,FALSE,NULL,&isb);
status=IoCallDriver(devobject,myirp);
return status; } //=================================================================================== PF_FORWARD_ACTION hook_fn(IN unsigned char *PacketHeader,IN unsigned char *Packet, IN unsigned int PacketLength, IN unsigned int RecvInterfaceIndex, IN unsigned int SendInterfaceIndex, IN IPAddr RecvLinkNextHop, IN IPAddr SendLinkNextHop}
{ return PF_DROP; } //===================================================================================
И в ответ на BUILD Получаю:
pfhook.h(44) : error C2146: syntax error : missing ')' before identifier 'RecvLinkNextHop' pfhook.h(44) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' pfhook.h(44) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' pfhook.h(44) : error C2143: syntax error : missing ')' before 'identifier' pfhook.h(44) : error C2081: 'IPAddr' : name in formal parameter list illegal pfhook.h(44) : error C2061: syntax error : identifier 'RecvLinkNextHop' pfhook.h(44) : error C2059: syntax error : ';' pfhook.h(44) : error C2059: syntax error : ',' pfhook.h(46) : error C2059: syntax error : ')' pfhook.h(55) : error C2061: syntax error : identifier 'PacketFilterExtensionPtr' pfhook.h(56) : error C2059: syntax error : '}' ndis_filter.c(12) : error C2061: syntax error : identifier 'hook_info' ndis_filter.c(12) : error C2059: syntax error : ';' ndis_filter.c(20) : error C2146: syntax error : missing ')' before identifier 'RecvLinkNextHop' ndis_filter.c(20) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' ndis_filter.c(20) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' ndis_filter.c(20) : error C2143: syntax error : missing ')' before 'identifier' ndis_filter.c(20) : error C2081: 'IPAddr' : name in formal parameter list illegal ndis_filter.c(20) : error C2061: syntax error : identifier 'RecvLinkNextHop' ndis_filter.c(20) : error C2059: syntax error : ';' ndis_filter.c(20) : error C2059: syntax error : ',' ndis_filter.c(26) : error C4013: 'Set_Hook' undefined; assuming extern returning int ndis_filter.c(26) : error C2065: 'hook_fn' : undeclared identifier ndis_filter.c(41) : error C2146: syntax error : missing ')' before identifier 'hook_fn' ndis_filter.c(41) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' ndis_filter.c(41) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unknown>' ndis_filter.c(41) : error C2143: syntax error : missing ')' before 'identifier' ndis_filter.c(41) : error C2061: syntax error : identifier 'hook_fn' ndis_filter.c(41) : error C2059: syntax error : ';' ndis_filter.c(41) : error C2059: syntax error : ')' ndis_filter.c(42) : error C2449: found '{' at file scope (missing function header?) ndis_filter.c(56) : error C2059: syntax error : '}'
В чем я косячу? В чем проблева в pfhook.h?
|