T
Torben S. Petersen
Hi,
I am currently trying to re-write some VC++ code into C#
but are having problems finding a way to convert the C++
memcpy into C#. The following is part of the code:
static int search_count;
static CFGINFO SearchInfo[MAX_DEVICE_NUM];
typedef struct _DS_INFO{
DWORD apid;
WORD hwid;
WORD flag;
DWORD real_ip_addr;
DWORD pseudo_ip_addr;
DWORD host_ip_addr;
BYTE mac[MACLEN];
}DS_INFO, *PDS_INFO;
typedef struct _CONFIGINFO {
DS_INFO ds_info;
DS_HANDLE dshdl;
PIFCONFIGINFO p_ifconfig;
int ipcfgsetting;
PSERPARMITEM pserial_info;
int baud_index;
BYTE port_type;
char svr_name[16];
int watchdog;
int operation_mode;
PKERNELINFO pkernel_info;
int system_changed;
char new_passwd[17];
char new_privatekey[16];
} CFGINFO, *PCFGINFO;
int CALLBACK EnumSearchProc(PDS_INFO dsinfo)
{
if (dsinfo == NULL)
return true;
if (dsinfo->hwid == 802)
{
memcpy(&SearchInfo
search_count].ds_info, dsinfo, sizeof(DS_INFO));
search_count++;
}
return true;
}
Any help to convert the memcpy to a C# equivelant would be
highly appreciated.
Thank you
Torben
I am currently trying to re-write some VC++ code into C#
but are having problems finding a way to convert the C++
memcpy into C#. The following is part of the code:
static int search_count;
static CFGINFO SearchInfo[MAX_DEVICE_NUM];
typedef struct _DS_INFO{
DWORD apid;
WORD hwid;
WORD flag;
DWORD real_ip_addr;
DWORD pseudo_ip_addr;
DWORD host_ip_addr;
BYTE mac[MACLEN];
}DS_INFO, *PDS_INFO;
typedef struct _CONFIGINFO {
DS_INFO ds_info;
DS_HANDLE dshdl;
PIFCONFIGINFO p_ifconfig;
int ipcfgsetting;
PSERPARMITEM pserial_info;
int baud_index;
BYTE port_type;
char svr_name[16];
int watchdog;
int operation_mode;
PKERNELINFO pkernel_info;
int system_changed;
char new_passwd[17];
char new_privatekey[16];
} CFGINFO, *PCFGINFO;
int CALLBACK EnumSearchProc(PDS_INFO dsinfo)
{
if (dsinfo == NULL)
return true;
if (dsinfo->hwid == 802)
{
memcpy(&SearchInfo
search_count].ds_info, dsinfo, sizeof(DS_INFO));
search_count++;
}
return true;
}
Any help to convert the memcpy to a C# equivelant would be
highly appreciated.
Thank you
Torben