I am using an API which contains following methods:
BOOL GetItemPropertyDescription (HANDLE hConnect, int PropertyIndex, DWORD *pPropertyID, VARTYPE *pVT, BYTE *pDescr, int BufSize);
BOOL ReadPropertyValue (HANDLE hConnect, LPCSTR Itemname, DWORD PropertyID, VARIANT *pValue);
What will be equivalent in c#?
What is the meaning of DWORD, VARTYPE, VARIANT
datatypes?
There is a fairly complete table here at Table 1. Try looking.
There is an article here on the marshaling of VARIANT: http://blogs.msdn.com/b/adam_nathan/archive/2003/04/24/56642.aspx
The exact PInvoke is complex to write, it depends on the direction of the parameters and their exact specification. Is
pPropertyID
a pointer to a singleDWORD
, or is a pointer to the firstDWORD
of an "array"? And who "fills" the value pointed at, the caller or the callee or both? The same for all the other pointers.Technically all/part of the
ref
s could beout
if they are filled by the callee.By the name of the methods, their pinvoke could be: