WIFI : Set SSID in C++

WIFI : Set SSID in C++ - C++ - Programmation

Marsh Posté le 27-11-2006 à 12:17:38    

Bonjour a tous,  
 
voila, je suis programmeur et je developpe en ce moment un soft qui gere toutes les connections (lan, wlan, dialup, vpn, ...) a un ordinateur quelconque.  
 
J'ai un petit souci avec les connexions sans-fil.
 
je recupere bien la liste des differents reseaux WIFI disponible.
recuperer toutes les infprmations necessaires n est pas un probleme.
En fait, mon probleme est : quand je desire me connecter a un autre reseauc WIFI, la fonction deviceIoControl(...) me retourne une erreur: NOT_SUPPORTED.
 
je ne vois pas pourquoi, le fait de "set SSID" n est pas supporte.
 
Voici mon code:
 
************************************************
UCHAR buf[4096];
ULONG OidData;
NDIS_802_11_SSID Ssid;
PNDISUIO_SET_OID pSetOid;
 
for(int i=0;i<m_strSSID.GetLength();i++)
{
 Ssid.Ssid[i] = (UCHAR)m_strSSID[i];
}
Ssid.SsidLength = m_strSSID.GetLength();
pSetOid = (PNDISUIO_SET_OID) &buf[0];
pSetOid->Oid = OID_802_11_SSID;
memcpy(&pSetOid->Data[0], &Ssid, sizeof(Ssid));
 
strcpy(szMACFileName, DEVICE_PREFIX);
strcat(szMACFileName, lpAdapterName);
 
   hMAC = CreateFile(
                szMACFileName,
                GENERIC_READ | GENERIC_WRITE,
    FILE_SHARE_READ | FILE_SHARE_WRITE, //0,
                NULL,
                OPEN_EXISTING,
                0,
                INVALID_HANDLE_VALUE
                );
 
    if (hMAC != INVALID_HANDLE_VALUE)
    {
 
        DeviceIoControl(
                hMAC,
                IOCTL_NDISUIO_SET_OID_VALUE,
                (LPVOID) &buf[0],
    sizeof( buf ),
    (LPVOID) &buf[0],
    0,
                pBytesWritten,
                NULL);
     }
************************************************
 
Voila, je ne comprends pas pourquoi, pour chaque requete, OID_802_11_AUTHENTICATION_MODE, OID_802_11_INFRASTRUCTURE_MODE ou OID_802_11_SSID, la fonction DeviceIoControl me retourne ERROR_NOT_SUPPORTED.
 
Si quelqu'un peut m aider, j en serai heureux.
 
merci d avance.
 

Reply

Marsh Posté le 27-11-2006 à 12:17:38   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed