J
James Jenkins
does anyone know how to implement the following? - I am very new to using
Marshalling and could really do with some help - it's late and I am tired -
I have spent all day on this and the net comes up with very little help - I
have followed lots of tutorials and looked at many peoples source - I am in
need of enlightenment
- thanks
[DllImport("iphlpapi.dll", EntryPoint="GetIpNetTable", SetLastError=true)]
public static extern int GetIpNetTable(IntPtr buffer,ref int Size, bool
Order);
I have got this far in the calling it- as below
IntPtr lpBuffer = IntPtr.Zero;
int size = 0;
int result = IPHelperAPI.GetIpNetTable(lpBuffer,ref size,true);
if(result != NO_ERROR)
{
Debug.WriteLine("NO ERROR");
lpBuffer = Marshal.AllocHGlobal(size);
result = IPHelperAPI.GetIpNetTable(lpBuffer,ref size,true);
if(result != NO_ERROR)
{
Marshal.FreeHGlobal(lpBuffer);
lpBuffer = IntPtr.Zero;
Debug.WriteLine("RETURN ERROR");
return;
}
Debug.WriteLine("I GOT THIS FAR");
// But canot allocate the structures from here - I hope someone out there
can pointer me in the right direction - good night all;;;
JJ
Marshalling and could really do with some help - it's late and I am tired -
I have spent all day on this and the net comes up with very little help - I
have followed lots of tutorials and looked at many peoples source - I am in
need of enlightenment

[DllImport("iphlpapi.dll", EntryPoint="GetIpNetTable", SetLastError=true)]
public static extern int GetIpNetTable(IntPtr buffer,ref int Size, bool
Order);
I have got this far in the calling it- as below
IntPtr lpBuffer = IntPtr.Zero;
int size = 0;
int result = IPHelperAPI.GetIpNetTable(lpBuffer,ref size,true);
if(result != NO_ERROR)
{
Debug.WriteLine("NO ERROR");
lpBuffer = Marshal.AllocHGlobal(size);
result = IPHelperAPI.GetIpNetTable(lpBuffer,ref size,true);
if(result != NO_ERROR)
{
Marshal.FreeHGlobal(lpBuffer);
lpBuffer = IntPtr.Zero;
Debug.WriteLine("RETURN ERROR");
return;
}
Debug.WriteLine("I GOT THIS FAR");
// But canot allocate the structures from here - I hope someone out there
can pointer me in the right direction - good night all;;;
JJ