G
grubbymaster
Hello
The problem i have is this :
i want to use the following structure in a DLL that i created:
typedef struct _NDIS_802_11_SSID {
ULONG SsidLength;
UCHAR Ssid [32];
} NDIS_802_11_SSID, *PNDIS_802_11_SSID;
and i want to take the UCHAR Ssid[32] field and copy in it a certain
variable.I've tried the following ways :
NDIS_802_11_SSID Data;
_tcsncpy((TCHAR *)Data.Ssid, mySSID, 32);
strncpy((char *)pData.m_SSID.Ssid, mySSID, 32);
if i display it like this it works : MessageBox(NULL, Data.Ssid, L"",
MB_OK); and it displays ok : "EXAMPLE".
If i pass this as a parameter to a function like this : void X
(NDIS_802_11_SSID Data) and call this function from C# the recieved
string is "E\0X\0A\0\M\0P\0\L\0E\0".We solved this problem also by
using a for loop like this for (j=0; j<32 ; j=j+2) but if we have a
larger string that i want to put in UCHAR Ssid[32]; it will not retain
only 15chars because of the "\0" insertion after each char.I believe
that the problem is in the conversions i'm makeing above, and how i
store the data (with the TCHAR * and char * conversions). Is there a
function to copy from one UCHAR[32] to another UCHAR[32] without
conversions?
The mySSID parameter is taken as a parameter: void y(UCHAR mySSID[32])
,but in the body of the function it is seen as UCHAR[] and i can't use
this :
Data.Ssid = mySSID (error because UCHAR[32] <--->
UCHAR[])
That's it. Hope you can help me in some way.
Thank you.Bye
The problem i have is this :
i want to use the following structure in a DLL that i created:
typedef struct _NDIS_802_11_SSID {
ULONG SsidLength;
UCHAR Ssid [32];
} NDIS_802_11_SSID, *PNDIS_802_11_SSID;
and i want to take the UCHAR Ssid[32] field and copy in it a certain
variable.I've tried the following ways :
NDIS_802_11_SSID Data;
_tcsncpy((TCHAR *)Data.Ssid, mySSID, 32);
strncpy((char *)pData.m_SSID.Ssid, mySSID, 32);
if i display it like this it works : MessageBox(NULL, Data.Ssid, L"",
MB_OK); and it displays ok : "EXAMPLE".
If i pass this as a parameter to a function like this : void X
(NDIS_802_11_SSID Data) and call this function from C# the recieved
string is "E\0X\0A\0\M\0P\0\L\0E\0".We solved this problem also by
using a for loop like this for (j=0; j<32 ; j=j+2) but if we have a
larger string that i want to put in UCHAR Ssid[32]; it will not retain
only 15chars because of the "\0" insertion after each char.I believe
that the problem is in the conversions i'm makeing above, and how i
store the data (with the TCHAR * and char * conversions). Is there a
function to copy from one UCHAR[32] to another UCHAR[32] without
conversions?
The mySSID parameter is taken as a parameter: void y(UCHAR mySSID[32])
,but in the body of the function it is seen as UCHAR[] and i can't use
this :
Data.Ssid = mySSID (error because UCHAR[32] <--->
UCHAR[])
That's it. Hope you can help me in some way.
Thank you.Bye