none
Marshalling C++ structure in C# RRS feed

  • Question

  • Hi,

    I am calling tDeviceProperty structure from My C# code. I tryed lot of options but still not working. Can any one help me in marshalling this code in C#.

    Thanks in advance.

    typedef struct _FILETIME {

        DWORD dwLowDateTime;

        DWORD dwHighDateTime;

    } FILETIME, *PFILETIME, *LPFILETIME;

    #define _FILETIME_

     

    #if defined(MIDL_PASS)

    typedef struct _LARGE_INTEGER {

    #else

    typedef union _LARGE_INTEGER {

        struct {

            DWORD LowPart;

            LONG HighPart;

        };

        struct {

            DWORD LowPart;

            LONG HighPart;

        } u;

    #endif

        LONGLONG QuadPart;

    } LARGE_INTEGER;

     

    typedef LARGE_INTEGER *PLARGE_INTEGER;

     

    struct tDeviceProperty {

         

          DWORD Tag;

          DWORD Size;      

          union _DP value; 

    };

     

    typedef union _DP

    {

          short int           i;         

          LONG                l;         

          ULONG               ul;        

          float               flt;       

          double              dbl;       

          BOOL        b;         

          double              at;        

          FILETIME            ft;        

          LPSTR               lpszA;     

          LPWSTR              lpszW;      

          LARGE_INTEGER       li;        

          struct tBinary    bin;       

          BYTE                reserved[40]; 

    } __UDP;

     

    struct tBinary {

          ULONG size;      

          BYTE * bin;      

    };

    Wednesday, May 19, 2010 2:58 PM

Answers