Hi all,


I'm Marco and I'm a .NET software developer. I'm developing a C# console application based on a C++ set of DLLs using the DllImport attribute.

The C++ DLLs are part of a Video Management System SDK developed by a third part.

Following you'll find a piece of code that I wrote but that's not work properly:


Code:
[DllImport("TruVNetSDK.dll")]
public static extern int NET_DVR_Login_V30(string sDVRIP, int wDVRPort, string sUserName, string sPassword, out LPNET_DVR_DEVICEINFO_V30 lpDeviceInfo);

public struct LPNET_DVR_DEVICEINFO_V30
{
public byte sSerialNumber; public byte byAlarmInPortNum; public byte byAlarmOutPortNum; public byte byDiskNum; public byte byChanNum; public byte byStartChan;
} public void LogOn() {
LPNET_DVR_DEVICEINFO_V30 _info; NET_DVR_Login_V30("ip_address", port_number, "username", "password", out _info);
}
And following the documentation provided by the third part developer team about the "NET_DVR_Login_V30" function and the "LPNET_DVR_DEVICEINFO_V30" struct:

LONG NET_DVR_Login_V30 (char *sDVRIP, WORD wDVRPort, char *sUserName, char *sPassword, LPNET_DVR_DEVICEINFO_V30 lpDeviceInfo)
Parameters:
sDVRIP
[in] IP address of the DVR
wServerPort
[in] Port NO. of the DVR
sUserName
[in] User's name
sPassword
[in] Password
lpDeviceInfo
[out] Information of device


struct{
BYTE sSerialNumber[SERIALNO_LEN];
BYTE byAlarmInPortNum;
BYTE byAlarmOutPortNum;
BYTE byDiskNum;
BYTE byChanNum;
BYTE byStartChan;
}NET_DVR_DEVICEINFO,*LPNET_DVR_DEVICEINFO;

Members:
sSerialNumber
Serial NO.
byAlarmInPortNum
The number of alarm input
byAlarmOutPortNum
The number of alarm output
byDiskNum
The number of hard disks
byChanNum
The number of analog channels
byStartChan
Start number of channel, start from 1 currently.

The problem is that I don't understand what kind of values are stored in the "_info" struct:

_info.sSerialNumber = 86
_info.byAlarmInPortNum = 82
_info.byAlarmOutPortNum = 48
_info.byDiskNum = 49
_info.byChanNum = 56
_info.byStartChan = 84


These values are not correct, the real values should be:

TVR11080820121218BBRR090016095WCVU
4
1
1
8
1


What's wrong?


Thank you a lot