converting from header files to Win32API declare

  • Thread starter Thread starter Majed
  • Start date Start date
M

Majed

hi,
I'm trying to convert some .h files to API Declaration to use the function
and structs.
one of it is this:
NTMS_GUID CurrentLibrary; // the current library

NTMS_GUID MediaPool; // media pool that the media belongs to

NTMS_GUID Location; // actual location of the media

DWORD LocationType;

NTMS_GUID MediaType;

NTMS_GUID HomeSlot; // home slot for online media

CHAR szBarCode[NTMS_BARCODE_LENGTH]; // bar code string

DWORD BarCodeState; // current state of the bar code

CHAR szSequenceNumber[NTMS_SEQUENCE_LENGTH];

DWORD MediaState; // current media state

DWORD dwNumberOfPartitions;

} NTMS_I1_PMIDINFORMATIONA;

which I've converted to this (vb.net):

<StructLayout(LayoutKind.Sequential)>

Private Structure NTMS_I1_PMIDINFORMATIONA

Public CurrentLibrary As NTMS_GUID ' // the current library

Public MediaPool As NTMS_GUID ' // media pool that the media belongs to

Public Location As NTMS_GUID ' // actual location of the media

Public LocationType As Int32

Public MediaType As NTMS_GUID

Public HomeSlot As NTMS_GUID ' // home slot for online media

Public szBarCode(NTMS_BARCODE_LENGTH) As Byte ' // bar code string

Public BarCodeState As Int32 ' // current state of the bar code

Public szSequenceNumber(NTMS_SEQUENCE_LENGTH) As Byte

Public MediaState As Int32 ' // current media state

Public dwNumberOfPartitions As Int32

End Structure

am I on the right track here and would you help me please converting this
struct:

typedef struct _NTMS_OBJECTINFORMATIONW {

DWORD dwSize;

DWORD dwType;

SYSTEMTIME Created;

SYSTEMTIME Modified;

NTMS_GUID ObjectGuid;

BOOL Enabled;

DWORD dwOperationalState;

WCHAR szName[NTMS_OBJECTNAME_LENGTH];

WCHAR szDescription[NTMS_DESCRIPTION_LENGTH];

#ifdef MIDL_PASS

[switch_is(dwType)] union {

[case(NTMS_DRIVE)] NTMS_DRIVEINFORMATIONW Drive;

[case(NTMS_DRIVE_TYPE)] NTMS_DRIVETYPEINFORMATIONW DriveType;

[case(NTMS_LIBRARY)] NTMS_LIBRARYINFORMATION Library;

[case(NTMS_CHANGER)] NTMS_CHANGERINFORMATIONW Changer;

[case(NTMS_CHANGER_TYPE)] NTMS_CHANGERTYPEINFORMATIONW ChangerType;

[case(NTMS_STORAGESLOT)] NTMS_STORAGESLOTINFORMATION StorageSlot;

[case(NTMS_IEDOOR)] NTMS_IEDOORINFORMATION IEDoor;

[case(NTMS_IEPORT)] NTMS_IEPORTINFORMATION IEPort;

[case(NTMS_PHYSICAL_MEDIA)] NTMS_PMIDINFORMATIONW PhysicalMedia;

[case(NTMS_LOGICAL_MEDIA)] NTMS_LMIDINFORMATION LogicalMedia;

[case(NTMS_PARTITION)] NTMS_PARTITIONINFORMATIONW Partition;

[case(NTMS_MEDIA_POOL)] NTMS_MEDIAPOOLINFORMATION MediaPool;

[case(NTMS_MEDIA_TYPE)] NTMS_MEDIATYPEINFORMATION MediaType;

[case(NTMS_LIBREQUEST)] NTMS_LIBREQUESTINFORMATIONW LibRequest;

[case(NTMS_OPREQUEST)] NTMS_OPREQUESTINFORMATIONW OpRequest;

[case(NTMS_COMPUTER)] NTMS_COMPUTERINFORMATION Computer;

[default] ;

} Info;

#else

union {

NTMS_DRIVEINFORMATIONW Drive;

NTMS_DRIVETYPEINFORMATIONW DriveType;

NTMS_LIBRARYINFORMATION Library;

NTMS_CHANGERINFORMATIONW Changer;

NTMS_CHANGERTYPEINFORMATIONW ChangerType;

NTMS_STORAGESLOTINFORMATION StorageSlot;

NTMS_IEDOORINFORMATION IEDoor;

NTMS_IEPORTINFORMATION IEPort;

NTMS_PMIDINFORMATIONW PhysicalMedia;

NTMS_LMIDINFORMATION LogicalMedia;

NTMS_PARTITIONINFORMATIONW Partition;

NTMS_MEDIAPOOLINFORMATION MediaPool;

NTMS_MEDIATYPEINFORMATION MediaType;

NTMS_LIBREQUESTINFORMATIONW LibRequest;

NTMS_OPREQUESTINFORMATIONW OpRequest;

NTMS_COMPUTERINFORMATION Computer;

} Info;

#endif // MIDL_PASS

} NTMS_OBJECTINFORMATIONW, *LPNTMS_OBJECTINFORMATIONW;



Thanks All

Majed
 
hi

my post was missing the first line of the struct and here it is:



typedef struct _NTMS_I1_PMIDINFORMATIONA {

NTMS_GUID CurrentLibrary; // the current library

NTMS_GUID MediaPool; // media pool that the media belongs to

NTMS_GUID Location; // actual location of the media

DWORD LocationType;

NTMS_GUID MediaType;

NTMS_GUID HomeSlot; // home slot for online media

CHAR szBarCode[NTMS_BARCODE_LENGTH]; // bar code string

DWORD BarCodeState; // current state of the bar code

CHAR szSequenceNumber[NTMS_SEQUENCE_LENGTH];

DWORD MediaState; // current media state

DWORD dwNumberOfPartitions;

} NTMS_I1_PMIDINFORMATIONA;

I converted it to vb.net like this

<StructLayout(LayoutKind.Sequential)>

Private Structure NTMS_I1_PMIDINFORMATIONA

Public CurrentLibrary As NTMS_GUID ' // the current library

Public MediaPool As NTMS_GUID ' // media pool that the media belongs to

Public Location As NTMS_GUID ' // actual location of the media

Public LocationType As Int32

Public MediaType As NTMS_GUID

Public HomeSlot As NTMS_GUID ' // home slot for online media

Public szBarCode(NTMS_BARCODE_LENGTH) As Byte ' // bar code string

Public BarCodeState As Int32 ' // current state of the bar code

Public szSequenceNumber(NTMS_SEQUENCE_LENGTH) As Byte

Public MediaState As Int32 ' // current media state

Public dwNumberOfPartitions As Int32

End Structure

can you help converting this struct ,please.!

typedef struct _NTMS_OBJECTINFORMATIONW {

DWORD dwSize;

DWORD dwType;

SYSTEMTIME Created;

SYSTEMTIME Modified;

NTMS_GUID ObjectGuid;

BOOL Enabled;

DWORD dwOperationalState;

WCHAR szName[NTMS_OBJECTNAME_LENGTH];

WCHAR szDescription[NTMS_DESCRIPTION_LENGTH];

#ifdef MIDL_PASS

[switch_is(dwType)] union {

[case(NTMS_DRIVE)] NTMS_DRIVEINFORMATIONW Drive;

[case(NTMS_DRIVE_TYPE)] NTMS_DRIVETYPEINFORMATIONW DriveType;

[case(NTMS_LIBRARY)] NTMS_LIBRARYINFORMATION Library;

[case(NTMS_CHANGER)] NTMS_CHANGERINFORMATIONW Changer;

[case(NTMS_CHANGER_TYPE)] NTMS_CHANGERTYPEINFORMATIONW ChangerType;

[case(NTMS_STORAGESLOT)] NTMS_STORAGESLOTINFORMATION StorageSlot;

[case(NTMS_IEDOOR)] NTMS_IEDOORINFORMATION IEDoor;

[case(NTMS_IEPORT)] NTMS_IEPORTINFORMATION IEPort;

[case(NTMS_PHYSICAL_MEDIA)] NTMS_PMIDINFORMATIONW PhysicalMedia;

[case(NTMS_LOGICAL_MEDIA)] NTMS_LMIDINFORMATION LogicalMedia;

[case(NTMS_PARTITION)] NTMS_PARTITIONINFORMATIONW Partition;

[case(NTMS_MEDIA_POOL)] NTMS_MEDIAPOOLINFORMATION MediaPool;

[case(NTMS_MEDIA_TYPE)] NTMS_MEDIATYPEINFORMATION MediaType;

[case(NTMS_LIBREQUEST)] NTMS_LIBREQUESTINFORMATIONW LibRequest;

[case(NTMS_OPREQUEST)] NTMS_OPREQUESTINFORMATIONW OpRequest;

[case(NTMS_COMPUTER)] NTMS_COMPUTERINFORMATION Computer;

[default] ;

} Info;

#else

union {

NTMS_DRIVEINFORMATIONW Drive;

NTMS_DRIVETYPEINFORMATIONW DriveType;

NTMS_LIBRARYINFORMATION Library;

NTMS_CHANGERINFORMATIONW Changer;

NTMS_CHANGERTYPEINFORMATIONW ChangerType;

NTMS_STORAGESLOTINFORMATION StorageSlot;

NTMS_IEDOORINFORMATION IEDoor;

NTMS_IEPORTINFORMATION IEPort;

NTMS_PMIDINFORMATIONW PhysicalMedia;

NTMS_LMIDINFORMATION LogicalMedia;

NTMS_PARTITIONINFORMATIONW Partition;

NTMS_MEDIAPOOLINFORMATION MediaPool;

NTMS_MEDIATYPEINFORMATION MediaType;

NTMS_LIBREQUESTINFORMATIONW LibRequest;

NTMS_OPREQUESTINFORMATIONW OpRequest;

NTMS_COMPUTERINFORMATION Computer;

} Info;

#endif // MIDL_PASS

} NTMS_OBJECTINFORMATIONW, *LPNTMS_OBJECTINFORMATIONW;
 
Back
Top