I am working on C#.Net CF for WIN-CE platform. In my code I am using
int size = Marshal.SizeOf(typeof(struct_Obj));
IntPtr newptr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(struct_Obj, newptr, false);
I am trying to send this struct info:
[StructLayout(LayoutKind.Sequential,CharSet = CharSet.Unicode)]
public struct __NIC_STAT
{
ulong Size; // Of this structure.
public Char[] ptcDeviceName; // The device name to be queried..
ulong DeviceState; // DEVICE_STATE_XXX above
ulong DeviceState; // DEVICE_STATE_XXX above
ulong MediaType; // NdisMediumXXX
ulong MediaState; // MEDIA_STATE_XXX above
ulong PhysicalMediaType;
ulong LinkSpeed; // In 100bits/s. 10Mb/s = 100000
UInt64 PacketsSent;
UInt64 PacketsReceived;
ulong InitTime; // In milliseconds
ulong ConnectTime; // In seconds
UInt64 BytesSent; // 0 - Unknown (or not supported)
UInt64 BytesReceived; // 0 - Unknown (or not supported)
UInt64 DirectedBytesReceived;
UInt64 DirectedPacketsReceived;
ulong PacketsReceiveErrors;
ulong PacketsSendErrors;
ulong ResetCount;
ulong MediaSenseConnectCount;
ulong MediaSenseDisconnectCount;
} ;
when I run the code in WIN-CE machine, I am getting "not supported exception".Those two methods are throwing exceptions.
Can anybody tell me how to find the structure size and how to convert structure to Ptr with out any issues for WIN-CE.
Thanks!!