Convert C++ code to C#
<p>I have code wrote on C++:</p>

<pre><code>    char szTempString[1500];
    DWORD dwDataLength = PacketBuffer.m_Length - (sizeof(ether_header) + pIpHeader-&gt;ip_hl*4 + pTcpHeader-&gt;th_off*4);
    PCHAR pData = (PCHAR)pEthHeader + (sizeof(ether_header) + pIpHeader-&gt;ip_hl*4 + pTcpHeader-&gt;th_off*4);

    // If packet contains any data - process it
    if (dwDataLength)
    {
        //
        // Copy packet payload into the temporary string
        //
        memcpy (szTempString, pData, dwDataLength);         
</code></pre>

<p>C#:</p>

<pre><code>char[] szTempString = new char[1500];
var dwDataLength = (int)PacketBuffer.m_Length -
(Marshal.SizeOf(typeof (ETHER_HEADER)) + (pIpHeader-&gt;IPLenVer &amp; 0xF)*4 + (pTcpHeader-&gt;Off &amp; 0xF)*4);

var pData = (IntPtr)pEthHeader + (Marshal.SizeOf(typeof(ETHER_HEADER)) +
(pIpHeader-&gt;IPLenVer &amp; 0xF) * 4 + (pTcpHeader-&gt;Off &amp; 0xF) * 4);

if(dwDataLength != 0)
{
    Marshal.Copy(pData,szTempString, 0, dwDataLength);
    Console.WriteLine(szTempString);
}
</code></pre>

<p><strong>ehter_header, pIp_header</strong> and other is structs, they are converted to C#.
The var <strong>szTempString</strong> contains strange data. Have I converted the <strong>pData</strong> and function <strong>memcpy</strong> properly?<br>
Thanks.<br>
PS. This is WinPkFilter library. Maybe somebody used it in C#?</p>
