Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C#] need help,WinDivertHelperCalcChecksums Not modify of packet check bits and length bits #124

Closed
boyyao opened this issue Feb 24, 2018 · 7 comments

Comments

@boyyao
Copy link

boyyao commented Feb 24, 2018

code like:
IntPtr handle = WinDivertMethods.WinDivertOpen(Filter, WINDIVERT_LAYER.WINDIVERT_LAYER_NETWORK, -1, 0);
byte[] buffer = new byte[MAXBUF];
while (true)
{
Array.Clear(buffer, 0, buffer.Length);
if (WinDivertMethods.WinDivertRecv(handle, buffer, MAXBUF, ref windivert_ADDRESS, ref packetLen))
{
fixed (byte* buffer_fixed = buffer)
{
WinDivertMethods.WinDivertHelperParsePacket(buffer_fixed, packetLen, &IPHDR, null, null, null, &TCPHDR, null, &ppData, null);
..........some code...
string data = Marshal.PtrToStringAnsi((IntPtr)((void*)ppData));
if(date.contains("need Modify data"))
{
byte[] newbody = System.Text.Encoding.ASCII.GetBytes("i'm is new data");
//use new data modify raw data ,,40byte is tcp/ip head
Buffer.BlockCopy(newbody, 0, buffer, 40, newbody.Length);

//redefinition packetLen to newdata + 40byte head
packetLen = (uint)newbody.Length + 40;

}
}
}
//....invalid....... buffer not modify ?????????????????
WinDivertMethods.WinDivertHelperCalcChecksums(buffer, packetLen, 0UL);

}

wait for your help thx......

@TechnikEmpire
Copy link

Where are you getting C# code from? Another repo? Or did you write it?

@boyyao
Copy link
Author

boyyao commented Feb 24, 2018

thx for reply...
i use https://github.com/TechnikEmpire/DivertPInvoke for windivert in C#

@TechnikEmpire
Copy link

@boyyao Then open tickets on that repo. As you can plainly, easily see, the diver pivoke project is not created/run/maintained by the same person as WinDivert itself. You're cross posting and bugging people who can't even help you.

@boyyao
Copy link
Author

boyyao commented Feb 24, 2018

I'm very sorry, because I'm in a hurry. And think there are more people here.

@TechnikEmpire
Copy link

Sure but they're following a C repository not a c# one and most of them have never heard of my wrappers anyway.

@boyyao
Copy link
Author

boyyao commented Feb 24, 2018

Your wrappers is very good. It's very suitable for a novice like me. Thank you for your Class. I tried Divert.Net before, but x86 compiled the error.

@basil00
Copy link
Owner

basil00 commented Feb 25, 2018

This issue is handled here: TechnikEmpire/DivertPInvoke#5

In general, issues posted here should only relate to the core WinDivert driver and libraries. If you are using a wrapper, then please report the issue to the wrapper's maintainer.

@basil00 basil00 closed this as completed Feb 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants