Forum Replies Created
-
AuthorPosts
-
Can you give me an example for WaitForMultiplyObjects? i can’t create thread for each adapter because it waste my time for recreate the whole system.
@PLY wrote:
Why i can’y calc TCP checksum? Please help
first, i declare this
TIPHeaderPtr = ^TIPHeader;
TIPHeader = packed record
VerLen: Byte; //HL
TOS: Byte;
TotalLen: Word;
Identifer: Word;
FragOffsets: Word;
TTL: Byte;
Protocol: Byte;
CheckSum: Word;
SourceIp: DWORD;
DestIp: DWORD;
// Options: DWORD;
end;
TTCPHeaderPtr = ^TTCPHeader;
TTCPHeader = packed record
SourcePort:Word;
DestPort:Word;
SequenceNumber:DWord;
AcknowledgementNumber:DWord;
Offset:Byte; //only left 4 bits. Header length in 32-bit segments
Flags:Byte;
Window:Word;
Checksum:Word; //includes speudo header instead of TCP header.
UrgentPointer:Word;
end;
pTCPData: PChar;
after that i get IP header and calc IP check sum is collect but why i can’t calc TCP checksum. the code like below.
pTCPHeader.Checksum := 00;
pTCPHeader.Checksum := htons(Checksum(Pword(pTCPHeader), (sizeof(TTCPHeader)+length(pTCPData)) div 2));
i forgot something? or i should not use PChar for get the TCP data?
Why i can’y calc TCP checksum? Please help
first, i decare this
TIPHeaderPtr = ^TIPHeader;
TIPHeader = packed record
VerLen: Byte; //HL
TOS: Byte;
TotalLen: Word;
Identifer: Word;
FragOffsets: Word;
TTL: Byte;
Protocol: Byte;
CheckSum: Word;
SourceIp: DWORD;
DestIp: DWORD;
// Options: DWORD;
end;
TTCPHeaderPtr = ^TTCPHeader;
TTCPHeader = packed record
SourcePort:Word;
DestPort:Word;
SequenceNumber:DWord;
AcknowledgementNumber:DWord;
Offset:Byte; //only left 4 bits. Header length in 32-bit segments
Flags:Byte;
Window:Word;
Checksum:Word; //includes speudo header instead of TCP header.
UrgentPointer:Word;
end;
pTCPData: PChar;
after that i get IP header and calc IP check sum is collect but why i can’t calc TCP checksum. the code like below.
pTCPHeader.Checksum := 00;
pTCPHeader.Checksum := htons(Checksum(Pword(pTCPHeader), (sizeof(TTCPHeader)+length(pTCPData)) div 2));
i forgot something? or i should not use PChar for get the TCP data?
Can you give me an example code for use IP HELPER API to find the network adapter that connected the Internet ?
Thank you very much. this is very simple solution that i forgot it 😆 so sorry for waste your time.
i think your winpkfilter can work on GUI app but problem is the example code of winpkfilter. i try copy two example code (passthru and packetsniffer) to GUI app and problem still occure when other application try call SendMessage or GetMessage for broadcast windows message. so the other application will not respond because SendMessage and GetMessage wait for return message from process and i think the problem are few line of code (i use delphi )
while counter <> 0 do begin
WaitForSingleObject ( hEvent,INFINITE);
ResetEvent(hEvent);
while (ReadPacket (hFilt, @ReadRequest) <> 0) do begin
Dec (counter);
…..
end;
end;i think because we use 2 while loop and WaitForSingleObject. if we don’t exit 2 while loop, the app can’t process any win message and also WaitForSingleObject , Can WaitForSingleObject not use INFINITE? or Can we use other method instead WaitForSingleObject?
Please Help
don’t have any one use Delphi? T_T
-
AuthorPosts