Ciao ragazzi, sto cercando di fare un programma (scritto in Visual C++) che visualizzi le reti wireless rilevate dalla scheda wifi, su internet ho trovato solo un codice di programma che mi visualizza le reti wireless preferite. Non posso utilizzare il pacchetto .Net Framework per motivi di lavoro. Il codice che ho trovato su internet ve lo scrivo qui sotto:

//inizio codice

#include "stdafx.h"
#include <string.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <wchar.h>
#using <mscorlib.dll>
#include "resource.h" // main symbols
#include <winioctl.h>
#include <ctype.h>
#include <malloc.h>
#include <winerror.h>
#include <winsock.h>
#include "nuiouser.h"





#if DBG
#define DEBUGP(stmt) printf stmt
#else
#define DEBUGP(stmt)
#endif


struct GUID_STRUCT
{
//How many wireless cards are in the PC?
int count;
wchar_t** guids_ar;
}guids;

struct PSK_STRUCT
{
char ssid[92];
int psk_length;
unsigned char psk[32];
char other[584];
};

struct SSIDS_STRUCT
{
//How many profile are configured?
int count;
char other[24];
PSK_STRUCT psk;
};

struct INTF_ENTRY_STRUCT
{
wchar_t* guid;
char other[72];
SSIDS_STRUCT* ssidlist;
char other2[10000];
}iestr;

typedef int (WINAPI* PQUERYI)(void*, int, void*, void*);
typedef int (WINAPI* PENUMI)(void*, GUID_STRUCT*);


int _tmain(AP_DATA **ppAP_data, long *plItems)
{

PNDIS_802_11_BSSID_LIST blist;
PNDISUIO_QUERY_OID pQueryOid;
PNDISUIO_SET_OID pSetOid;
UCHAR QueryBuffer[1024];
PNDIS_802_11_BSSID_LIST pBssid_List;
ULONG i = 0;
int j = 0;
//Load wzcsapi to use the implemented RPC interface of Wireless Zero
//Configuration Service
HMODULE hMod = LoadLibrary ("wzcsapi.dll");
if (NULL == hMod)
{
printf ("LoadLibrary failed\n");
return 1;
}
//Get the address of the WZCEnumInterfaces. We need the guid of the
//wireless devices.
PENUMI pEnumI = (PENUMI) GetProcAddress(hMod , "WZCEnumInterfaces");
if (NULL == pEnumI)
{
printf ("GetProcAddress pEnumI failed\n");
return 1;
}

//The call of WZCEnumInterfaces
int ret=pEnumI(NULL, &guids);
if (ret!=0)
{
printf("WZCEnumInterfaces failed!\n");
return 1;
}

//Get the address of the WZCQueryInterface
PQUERYI pQueryI = (PQUERYI) GetProcAddress (hMod, "WZCQueryInterface");
if (NULL == pQueryI)
{
printf ("GetProcAddress pQueryI failed\n");
return 1;
}

// int j;
for(j=0;j<guids.count;j++)
{
wprintf(L"%s\n",guids.guids_ar[j]);
iestr.guid=guids.guids_ar[j];

DWORD dwOutFlags=0;
ret=pQueryI(NULL,0xFFFFFFFF, &iestr, &dwOutFlags);
if (ret!=0)
{
printf("WZCQueryInterface failed!\n");
return 1;
}

//This code is still messy...
if (iestr.ssidlist==NULL)
{
wprintf(L"There is no SSIDS for: %s!\n", iestr.guid);
}else
{
PSK_STRUCT* temp=&(iestr.ssidlist->psk);
int i=0;
for(i=0;i<iestr.ssidlist->count;i++)
{
if(32==temp->psk_length)
{
printf("%s:%s\n",temp->ssid);
for(int j=0; j<32; j++)
{
printf("%02x",temp->psk[j]);
}
printf("\n");
}else
{
printf("%s: \n",temp->ssid, temp->psk);
}
temp++;
}
}


}
getchar();
return 0;
}


//fine codice

Se conoscete un codice alternativo o se sapete come correggere questo per stampare le wireless attive rilevate dalla scheda wifi vi prego di mandarmelo...è molto importante!!
Grazie per l'attenzione.

Marco