Another option may be this:
[DllImport(unmanaged.dll), CharSet=CharSet.Unicode, ExactSpelling=true, PreserveSig=false)]
private static extern int getdevice(ref StringBuilder pDeviceList, IntPtr pDeviceCount, ulong ulFlags);
In the example above, you would want to construct the
StringBuilder
with an initial capacity larger than the expected size of the return string. This can be done like the following example:
StringBuilder deviceList = new StringBuilder(256);
You are going to have to experiment with the
pDeviceList
parameter. The function prototype you use depends on how that parameter is used in C/C++.