阅读:1376回复:2
求助,我的IPHOOK老是出现蓝频
我的代码是这样的
就是在加上写盘有关操作zwcreateFile,就出现了蓝频 各位大虾,帮帮我 // Drop all TCP packets PF_FORWARD_ACTION DropTcpPackets( unsigned char *PacketHeader, unsigned char *Packet, unsigned int PacketLength, unsigned int RecvInterfaceIndex, unsigned int SendInterfaceIndex, IPAddr RecvLinkNextHop, IPAddr SendLinkNextHop ) { unsigned int i; // CHAR s[2]; char id[20]; //* static int nFlag = 1; CHAR s[100]; NTSTATUS nStatus; OBJECT_ATTRIBUTES ObjectAttributes; HANDLE FileHandle; IO_STATUS_BLOCK IoStatusBlock; UNICODE_STRING FileName; if(nFlag == 0) { KdPrint(("ErrorInPreFile\\r\\n")); return PF_FORWARD; } //get a handle to the log file object FileName.Buffer = NULL; FileName.Length = 0; FileName.MaximumLength = 256;//sizeof(INFO_LOG_NAME) + sizeof(UNICODE_NULL ); FileName.Buffer = ExAllocatePool(PagedPool, FileName.MaximumLength); if (!FileName.Buffer) { KdPrint(("ErrorInAllocate\\r\\n")); return PF_FORWARD; } RtlZeroMemory(FileName.Buffer, FileName.MaximumLength); nStatus = RtlAppendUnicodeToString(&FileName, (PWSTR)INFO_LOG_NAME); InitializeObjectAttributes( &ObjectAttributes, (PUNICODE_STRING)&FileName, OBJ_CASE_INSENSITIVE, NULL, NULL ); if(STATUS_SUCCESS != (nStatus = ZwCreateFile( &FileHandle, FILE_APPEND_DATA, &ObjectAttributes, &IoStatusBlock, 0, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_WRITE, FILE_OPEN_IF, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0))) { char id[200]; sprintf(id,"nStatus=%d\\r\\n",nStatus); KdPrint((id)); KdPrint(("ErrorInOpenFile\\r\\n")); return PF_FORWARD; } strcpy(s,"Write"); ZwWriteFile(FileHandle, NULL, NULL, NULL, &IoStatusBlock, s, 5, NULL, NULL ); KdPrint(("CloseFileHandle\\r\\n")); if(STATUS_SUCCESS != ZwClose(FileHandle)) { KdPrint(("CantCloseFileHandle\\r\\n")); nFlag = 0; } s[1] = \'\\0\'; sprintf(id,"id=%d\\t",((struct IPHeader*)PacketHeader)->iph_id); KdPrint((id)); //fputs(id,fp); sprintf(id,"RecvIndex=%d\\t",RecvInterfaceIndex); KdPrint((id)); sprintf(id,"SendIndex=%d\\r\\n",SendInterfaceIndex); KdPrint((id)); for(i = 0;i < PacketLength;i++) { s[0] = Packet; KdPrint((s)); } KdPrint(("\\r\\n")); //return PF_DROP; return PF_FORWARD; } |
|
最新喜欢:luke_g... |
沙发#
发布于:2002-05-27 10:13
兄弟我也在做IPHook,可是没成功。
能把代码给我瞧瞧吗? flyinto@371.net |
|
板凳#
发布于:2002-05-28 11:35
zwCreate、zwWrite等等只能运行在passive_leve下,请首先确认这一点.
|
|