How to call this native function with a struct in a struct ?

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hello,

Can somebody help me out here , because I'm fairly new in C#.....

For my device I can retrieve some hardware info from a native C++ DLL that
came with the device, but somehow I cann't get it to work because there is a
struct inside a struct.
How can I make this native call working in C# ?


typedef struct _HARDWAREINFO
{

UCHAR RomSize; // In Megabytes

UCHAR RamSize; // In Megabytes

DWORD HardwareVersion; // Board Revison

DWORD CpldVersion; // CPLD Software Version

struct

{

DWORD dwMajor;

DWORD dwMinor;

DWORD dwBuild;

} PicVersion;

UCHAR PassiveLCD; // TRUE - Passive display present, FALSE - Active display
present

UCHAR MillerPresent; // TRUE - If miller modem is detected, FALSE - no
miller

UCHAR ModemPresent; // TRUE - If internal modem card is detected, FALSE - no
modem

} HARDWAREINFO, *LPHARDWAREINFO;

BOOL

WINAPI

IOC_GetHardwareInfo(

LPHARDWAREINFO szHardwareInfo

);



Thanks for any help

Peter van den Acker.
 
What have you tried. Seems like making it look like the nested structure
fields were just fields of the outer structure would work, although
alignment is going to be a challenge, probably. The designer of that
structure definitely wasn't thinking too straight about that.

Paul T.
 
Back
Top