Marshalling Problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Marshalling Problem

venkatraj82venkatraj82 Posts: 5Member
Hi,
Im doing a Firewall in C#,on the Process


"byte[] buffer = new byte[20000]; // Start with 20.000 bytes left for information about tcp table
int pdwSize = 20000;
int BufferSize = 100000;
IntPtr lpTable = Marshal.AllocHGlobal(BufferSize);
IntPtr current = lpTable;
int res = IPHlpAPI32Wrapper.GetTcpTable(buffer, out pdwSize, true);
if (res != NO_ERROR)
{
buffer = new byte[pdwSize];
res = IPHlpAPI32Wrapper.GetTcpTable(buffer, out pdwSize, true);
if (res != 0)
return; // Error. You should handle it
}

TcpConnexion = new IpHlpApidotnet.MIB_TCPTABLE();
int nOffset = 0;
// number of entry in the
TcpConnexion.dwNumEntries = Convert.ToInt32(buffer[nOffset]);

nOffset+=4;
TcpConnexion.table = new MIB_TCPROW[TcpConnexion.dwNumEntries];"

Iam passing the MIB_TCPROW object to SetTcpEntry...
But iam getting the Following Error
"Can not marshal field Local of type IpHlpApidotnet.MIB_TCPROW: The type definition of this field has no layout information."

Can u anybody help me out???
Thanx
venkat

Comments

  • deserteagledeserteagle Posts: 5Member
    : Hi,
    : Im doing a Firewall in C#,on the Process
    :
    : .....

    Hi,

    Sorry, I don't have an answer to your question but I want to make a firewall in C# for my graduation project (Computer Science). I was wondering if you can tell me about any resources that may help (tutorials, source code samples, books, ...) as I couldn't find any.

    This would be really kind of you to help me, thanks in advance.

    Best Regards,
    Wessam Fathi
Sign In or Register to comment.