title: converting IntPtr as c# struct pointer
body: <p>I have an unmanaged C++ function that reads like :<code>int myfunction(LPVOID p1, LPVOID p2)</code></p>
  
  <p>My wrapper in C# takes  <code>extern static int mywrapperFunction(IntPtr p1, IntPtr p2)</code></p>
  
  <p>Within my wrapper function definition, i want to deference IntPtr to a structure.</p>
  
  <p>In C++:</p>
  
  <pre><code>int myfunction(LPVOID p1, LPVOID p2)
  {
      (MYFIRSTSTRUCTURE *)abc = (MYFIRSTSTRUCTURE *)p1;
      (MYSECONDSTRUCTURE *)efg = (MYSECONDSTRUCTURE *)p1;
      //rest of the operation involves this abc and efg
  }
  </code></pre>
  
  <p>I need to do similar thing in C#:</p>
  
  <pre><code>int mywrapperFunction(IntPtr p1, IntPtr p2)
  {
     //how to consume IntPtr p1 and IntPtr p2 for C# structure similar to MYFIRSTSTRUCTURE and //MYSECONDSTRUCTURE
  }
  </code></pre>