Question

Signaler
Messages postés
9
Date d'inscription
lundi 30 mars 2009
Statut
Membre
Dernière intervention
19 avril 2009
-
Messages postés
2
Date d'inscription
dimanche 20 mai 2007
Statut
Membre
Dernière intervention
16 octobre 2009
-
voila un class de mon projet fin d'étude je veu comprendre ces  codes svp
/**************************************************************************/

/* WIRE1x for Vista Version 1.0.1: An open-source IEEE 802.1x supplicant */

/* for Microsoft Windows based on Xsupplicant of Open1x. */

/* */

/* This code is released under both the GPL version 2 and BSD licenses. */

/* Either license may be used. */

/* */

/* Copyright (C) 2003-2008 WIRE Lab., National Tsing Hua University, */

/* Hsinchu, Taiwan, R.O.C. All Rights Reserved. */

/**************************************************************************/

// export_file_Dlg.cpp :

//

#include

"stdafx.h"#include

"WIRE1x_v.h"#include

"export_file_Dlg.h" 

// export_file_Dlg

IMPLEMENT_DYNAMIC(export_file_Dlg, CDialog)

export_file_Dlg::export_file_Dlg(CWnd* pParent

/*=NULL*/): CDialog(export_file_Dlg::IDD, pParent)

{

}

export_file_Dlg::~export_file_Dlg()

{

}

void

export_file_Dlg::DoDataExchange(CDataExchange* pDX){

CDialog::DoDataExchange(pDX);

DDX_Control(pDX, IDC_LIST1, m_profile_list);

}

 

BEGIN_MESSAGE_MAP(export_file_Dlg, CDialog)

ON_BN_CLICKED(IDOK, &export_file_Dlg::OnBnClickedOk)

END_MESSAGE_MAP()

 

// export_file_Dlg

BOOL export_file_Dlg::OnInitDialog()

{

CDialog::OnInitDialog();

HKEY hkey;

TCHAR szBuf[300];

char ValueName[256];

unsigned
char DataValue[256];

unsigned
long cbValueName=256;

unsigned
long cbDataValue=256; DWORD dwType;

// Create the event source as a subkey of the log. sprintf(szBuf,

"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\WIRE1x_vista\\Config"); RegOpenKeyEx(HKEY_LOCAL_MACHINE, szBuf, 0, KEY_QUERY_VALUE, &hkey);

for (
int i=0;;i++) {

cbValueName=256;

cbDataValue=256;

if(RegEnumValue(hkey,i,ValueName,&cbValueName,NULL, &dwType,DataValue,&cbDataValue) == ERROR_SUCCESS){m_profile_list.AddString(ValueName);

}

else{

break;}

}

return TRUE;}

void

export_file_Dlg::OnBnClickedOk(){

char filename[30];CString temp_name;

char char_name[30];DWORD BufferSize=1024;

char *profile;profile = (

char *)malloc(BufferSize);HKEY hkey;

TCHAR szBuf[300];

m_profile_list.GetText(m_profile_list.GetCurSel(),temp_name);

strcpy(char_name, temp_name);

strcpy(filename, temp_name);

strcat(filename,

".w1x");CString szFilter =

"*.w1x|*.*|*.*||";CFileDialog fd(FALSE,

"w1x",filename,OFN_OVERWRITEPROMPT,szFilter,
this); 

 

if (fd.DoModal()){

CString szFilename = fd.GetPathName();

if(szFilename != filename){sprintf(szBuf,

"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\WIRE1x_vista\\Config");RegOpenKeyEx(HKEY_LOCAL_MACHINE, szBuf, 0,

KEY_QUERY_VALUE, &hkey);

if (RegQueryValueEx(hkey, temp_name, NULL, NULL,

// value type (LPBYTE)profile,

// pointer to value data &BufferSize))

{

printf(

"Could not get the registry."); }

RegCloseKey(hkey);

FILE *fp;

fp = fopen(szFilename.GetBuffer(0),

"w");strcat(char_name,

"\n");

for(
int i = 0; i < (
int)strlen(char_name); i++)fputc(char_name[i], fp);

for(
int i = 0; i < (
int)strlen(profile); i++)fputc(profile[i], fp);

fclose(fp);

OnOK();

}

}

}

8 réponses

Messages postés
3983
Date d'inscription
jeudi 14 juillet 2005
Statut
Membre
Dernière intervention
30 juin 2013
14
C'est un morceau de programme MFC qui permet de configurer WIRE1x
Messages postés
9
Date d'inscription
lundi 30 mars 2009
Statut
Membre
Dernière intervention
19 avril 2009

salut merci de me répondre,c koi le MFC c'est une librairi ou koi  et qu'est ce qu'elle fait éxactement s'il vous plais je veux savoir par détail  et je veux une commentaire sur chaque fonction car mon but de projet  fin d'étude de comprendre bien le code à fin de le faire modifier et comprendre ou se passe le scanning de réseau sans fil,l'authentification,l'association et la réassociation.
 voila quelque classes de mon projet fin d'étude ça me fera très plaisir de m'aider à le comprendre svp.
en plus j'ai fait l'éxécution avec visual studio c++ 6 et j'ai trouver un problème de débogage si nous ne sommes pas connéctés en réseau sans fil  notre interface apparaisse normalement par contre si nous sommes connéctés l'interface n'apparaisse pas et ne détécte aucun réseau mon encadreure m'a dis que l'application est éxécutable,
svp j'ai besoin de ton aide.  

class:WIRE1x_vv.cpp

/**************************************************************************/

/* WIRE1x for Vista Version 1.0.1: An open-source IEEE 802.1x supplicant */

/* for Microsoft Windows based on Xsupplicant of Open1x. */

/* */

/* This code is released under both the GPL version 2 and BSD licenses. */

/* Either license may be used. */

/* */

/* Copyright (C) 2003-2008 WIRE Lab., National Tsing Hua University, */

/* Hsinchu, Taiwan, R.O.C. All Rights Reserved. */

/**************************************************************************/

// WIRE1x_v.cpp : Defines the class behaviors for the application.

//

#include

"stdafx.h"#include

"WIRE1x_v.h"#include

"WIRE1x_vDlg.h"#include

"data_config.h"#include

"wlan_function.h" 

 

 

#ifdef

_DEBUG
#define

new DEBUG_NEW
#endif

Network_config_data network_data;

Network_info info[100];

// CWIRE1x_vApp

BEGIN_MESSAGE_MAP(CWIRE1x_vApp, CWinApp)

ON_COMMAND(ID_HELP, &CWinApp::OnHelp)

END_MESSAGE_MAP()

 

// CWIRE1x_vApp construction

CWIRE1x_vApp::CWIRE1x_vApp()

{

// TODO: add construction code here,

// Place all significant initialization in InitInstance}

 

// The one and only CWIRE1x_vApp object

CWIRE1x_vApp theApp;

 

// CWIRE1x_vApp initialization

BOOL CWIRE1x_vApp::InitInstance()

{

CWinApp::InitInstance();

// Standard initialization

// If you are not using these features and wish to reduce the size

// of your final executable, you should remove from the following

// the specific initialization routines you do not need

// Change the registry key under which our settings are stored

// TODO: You should modify this string to be something appropriate

// such as the name of your company or organizationSetRegistryKey(_T(

"Local AppWizard-Generated Applications"));CWIRE1x_vDlg dlg;

m_pMainWnd = &dlg;

INT_PTR nResponse = dlg.DoModal();

if (nResponse == IDOK){

// TODO: Place code here to handle when the dialog is

// dismissed with OK}

else
if (nResponse == IDCANCEL){

// TODO: Place code here to handle when the dialog is

// dismissed with Cancel}

// Since the dialog has been closed, return FALSE so that we exit the

// application, rather than start the application's message pump.

return FALSE;}

**********************************************************************************************
class:wlan_function.cpp
/**************************************************************************/

/* WIRE1x for Vista Version 1.0.1: An open-source IEEE 802.1x supplicant */

/* for Microsoft Windows based on Xsupplicant of Open1x. */

/* */

/* This code is released under both the GPL version 2 and BSD licenses. */

/* Either license may be used. */

/* */

/* Copyright (C) 2003-2008 WIRE Lab., National Tsing Hua University, */

/* Hsinchu, Taiwan, R.O.C. All Rights Reserved. */

/**************************************************************************/

#define

_WIN32_DCOM
#include

"stdafx.h"#include

<windows.h>#include

<conio.h>#include

<objbase.h>#include

<rpcsal.h>#include

<objbase.h>#include

<msxml6.h>#include

#include

#include

#include

<wlanapi.h>#include

"wlan_function.h"using

namespace std;
extern

GUID NIC_GUID;
// get win32 error from HRESULT

#define

WIN32_FROM_HRESULT(hr) \(SUCCEEDED(hr) ? ERROR_SUCCESS : \

(HRESULT_FACILITY(hr) == FACILITY_WIN32 ? HRESULT_CODE(hr) : (hr)))

 

// get SSID from the WCHAR string

DWORD

StringWToSsid(

__in LPCWSTR strSsid,

__out PDOT11_SSID pSsid

)

{

DWORD dwRetCode = ERROR_SUCCESS;

BYTE pbSsid[DOT11_SSID_MAX_LENGTH + 1] = {0};
if (strSsid NULL || pSsid NULL){

dwRetCode = ERROR_INVALID_PARAMETER;

}

else{

pSsid->uSSIDLength = WideCharToMultiByte (CP_ACP,

0,

strSsid,

-1,

(LPSTR)pbSsid,

sizeof(pbSsid),NULL,

NULL);

pSsid->uSSIDLength--;

memcpy(&pSsid->ucSSID, pbSsid, pSsid->uSSIDLength);

}

return dwRetCode;}

LPWSTR

SsidToStringW(

__out_ecount(count) LPWSTR buf,

__in ULONG count,

__in PDOT11_SSID pSsid

)

{

ULONG bytes, i;

bytes = min( count-1, pSsid->uSSIDLength);

for( i=0; iconst
char *)&pSsid->ucSSID[i], 1);buf[bytes] =

'\0';

return buf;}

 

// get auth algorithm string

char

*GetAuthAlgoString(DOT11_AUTH_ALGORITHM dot11AuthAlgo){

char *RetStr =
"Unknown algorithm";

switch(dot11AuthAlgo){

case DOT11_AUTH_ALGO_80211_OPEN:RetStr =

"Open";

break;

case DOT11_AUTH_ALGO_80211_SHARED_KEY:RetStr =

"Shared";

break;

case DOT11_AUTH_ALGO_WPA:RetStr =

"WPA-Enterprise";

break;

case DOT11_AUTH_ALGO_WPA_PSK:RetStr =

"WPA-Personal";

break;

case DOT11_AUTH_ALGO_WPA_NONE:RetStr =

"WPA-NONE";

break;

case DOT11_AUTH_ALGO_RSNA:RetStr =

"WPA2-Enterprise";

break;

case DOT11_AUTH_ALGO_RSNA_PSK:RetStr =

"WPA2-Personal";

break;

default:

if (dot11AuthAlgo & DOT11_AUTH_ALGO_IHV_START){

RetStr =

"Vendor-specific algorithm";}

}

return RetStr;}

// get cipher algorithm string

char

*GetCipherAlgoString(DOT11_CIPHER_ALGORITHM dot11CipherAlgo){

char* RetStr =
"Unknown algorithm";

switch(dot11CipherAlgo){

case DOT11_CIPHER_ALGO_NONE:RetStr =

"None";

break;

case DOT11_CIPHER_ALGO_WEP40:RetStr =

"WEP40";

break;

case DOT11_CIPHER_ALGO_TKIP:RetStr =

"TKIP";

break;

case DOT11_CIPHER_ALGO_CCMP:RetStr =

"AES";

break;

case DOT11_CIPHER_ALGO_WEP104:RetStr =

"WEP104";

break;

case DOT11_CIPHER_ALGO_WPA_USE_GROUP:RetStr =

"USE-GROUP";

break;

case DOT11_CIPHER_ALGO_WEP:RetStr =

"WEP";

break;

default:

if (dot11CipherAlgo & DOT11_CIPHER_ALGO_IHV_START){

RetStr =

"Vendor-specific algorithm";}

}

return RetStr;}

// get interface state string

char

*GetNICStateString(WLAN_INTERFACE_STATE NICState){

char *RetStr;

switch(NICState){

case wlan_interface_state_not_ready:RetStr =

"not ready";

break;

case wlan_interface_state_connected:RetStr =

"Connected";

break;

case wlan_interface_state_ad_hoc_network_formed:RetStr =

"ad hoc network formed";

break;

case wlan_interface_state_disconnecting:RetStr =

"Disconnecting";

break;

case wlan_interface_state_disconnected:RetStr =

"Disconnected";

break;

case wlan_interface_state_associating:RetStr =

"Associating";

break;

case wlan_interface_state_discovering:RetStr =

"Discovering";

break;

case wlan_interface_state_authenticating:RetStr =

"Authenticating";

break;

default:RetStr =

"invalid interface state";}

return RetStr;}

// open a WLAN client handle and check version

DWORD

OpenHandleAndCheckVersion(

PHANDLE phClient

)

{

DWORD dwError = ERROR_SUCCESS;

DWORD dwServiceVersion;

HANDLE hClient = NULL;

__try{

*phClient = NULL;

// open a handle to the service

if ((dwError = WlanOpenHandle(WLAN_API_VERSION,

NULL,

// reserved&dwServiceVersion,

&hClient

)) != ERROR_SUCCESS)

{

__leave;}

// check service version

if (WLAN_API_VERSION_MAJOR(dwServiceVersion) < WLAN_API_VERSION_MAJOR(WLAN_API_VERSION_2_0)){

// No-op, because the version check is for demonstration purpose only.

// You can add your own logic here.}

*phClient = hClient;

// set hClient to NULL so it will not be closedhClient = NULL;

}

__finally{

if (hClient != NULL){

// clean upWlanCloseHandle(

hClient,

NULL

// reserved);

}

}

return dwError;}

 

int

Enuminterface(NIC_info * nic){

DWORD dwError = ERROR_SUCCESS;

HANDLE hClient = NULL;

PWLAN_INTERFACE_INFO_LIST pIntfList = NULL;

RPC_WSTR strGuid = NULL;

UINT i = 0;

 

 

// open handle

if ((dwError = OpenHandleAndCheckVersion(&hClient

)) != ERROR_SUCCESS)

{

// clean up

if (pIntfList != NULL){

WlanFreeMemory(pIntfList);

}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

// enumerate wireless interfaces

if ((dwError = WlanEnumInterfaces(hClient,

NULL,

// reserved&pIntfList

)) != ERROR_SUCCESS)

{

// clean up

if (pIntfList != NULL){

WlanFreeMemory(pIntfList);

}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

 

// print out interface information

for (i = 0; i < pIntfList->dwNumberOfItems; i++){

nic[i].Guidinf = pIntfList->InterfaceInfo[i].InterfaceGuid;

WideCharToMultiByte(950,0,pIntfList->InterfaceInfo[i].strInterfaceDescription,-1,nic[i].Desc,50,NULL,NULL);

strcpy_s(nic[i].State, GetNICStateString(pIntfList->InterfaceInfo[i].isState));

}

nic[0].num_nic = pIntfList->dwNumberOfItems;

 

// clean up

if (pIntfList != NULL){

WlanFreeMemory(pIntfList);

}

if (hClient != NULL){

WlanCloseHandle(

hClient,

NULL

// reserved);

}

return 0;}

int

Current_connection(Connection_info *info){

DWORD dwError = ERROR_SUCCESS;

HANDLE hClient = NULL;

PWLAN_INTERFACE_INFO_LIST pIntfList = NULL;

PWLAN_CONNECTION_ATTRIBUTES pCurrentNetwork = NULL;

WCHAR strSsid[DOT11_SSID_MAX_LENGTH+1];

PVOID pData = NULL;

DWORD dwDataSize = 0;

 

// open handle

if ((dwError = OpenHandleAndCheckVersion(&hClient

)) != ERROR_SUCCESS)

{

// clean up

if (pIntfList != NULL){

WlanFreeMemory(pIntfList);

}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

// query the current connection

if ((dwError = WlanQueryInterface(hClient,

&NIC_GUID,

wlan_intf_opcode_current_connection,

NULL,

// reserved&dwDataSize,

&pData,

NULL

// not interesed in the type of the opcode value)) == ERROR_SUCCESS &&

dwDataSize ==

sizeof(WLAN_CONNECTION_ATTRIBUTES))

{

pCurrentNetwork = (PWLAN_CONNECTION_ATTRIBUTES)pData;

}

// we don't treat ERROR_INVALID_STATE as an error for querying the interface

if (dwError == ERROR_INVALID_STATE){

dwError = ERROR_SUCCESS;

}

if (pCurrentNetwork == NULL){

// no connection informationinfo[0].Quality = -1;

// clean up

if (pIntfList != NULL){

WlanFreeMemory(pIntfList);

}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}
if (pCurrentNetwork->isState wlan_interface_state_connected||pCurrentNetwork->isState wlan_interface_state_associating ||

pCurrentNetwork->isState == wlan_interface_state_discovering ||

pCurrentNetwork->isState == wlan_interface_state_authenticating)

{

WideCharToMultiByte(950,0,SsidToStringW(strSsid,

sizeof(strSsid)/
sizeof(WCHAR), &pCurrentNetwork->wlanAssociationAttributes.dot11Ssid),-1,info[0].SSID,30,NULL,NULL);info[0].Quality = pCurrentNetwork->wlanAssociationAttributes.wlanSignalQuality;

info[0].connect_state = pCurrentNetwork->isState;

wsprintf(info[0].MAC,

"%02X:%02X:%02X:%02X:%02X:%02X",pCurrentNetwork->wlanAssociationAttributes.dot11Bssid[0] ,

pCurrentNetwork->wlanAssociationAttributes.dot11Bssid[1] ,

pCurrentNetwork->wlanAssociationAttributes.dot11Bssid[2] ,

pCurrentNetwork->wlanAssociationAttributes.dot11Bssid[3] ,

pCurrentNetwork->wlanAssociationAttributes.dot11Bssid[4] ,

pCurrentNetwork->wlanAssociationAttributes.dot11Bssid[5] );

strcpy_s(info[0].AUTH, GetAuthAlgoString(pCurrentNetwork->wlanSecurityAttributes.dot11AuthAlgorithm));

strcpy_s(info[0].CIPH, GetCipherAlgoString(pCurrentNetwork->wlanSecurityAttributes.dot11CipherAlgorithm));

}

 

// clean up

if (pIntfList != NULL){

WlanFreeMemory(pIntfList);

}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return 0;}

int

Visible_Network_List(Network_info *info){

DWORD dwError = ERROR_SUCCESS;

HANDLE hClient = NULL;

WCHAR strSsid[DOT11_SSID_MAX_LENGTH+1];

PWLAN_INTERFACE_CAPABILITY pInterfaceCapability = NULL;

PWLAN_AVAILABLE_NETWORK_LIST pVList = NULL;

UINT i;

 

 

// open handle

if ((dwError = OpenHandleAndCheckVersion(&hClient

)) != ERROR_SUCCESS)

{

WlanFreeMemory(pVList);

// clean up

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

if ((dwError = WlanGetAvailableNetworkList(hClient,

&NIC_GUID,

0,

// only show visible networksNULL,

// reserved&pVList

)) != ERROR_SUCCESS)

{

info[0].num_nt = 0;

WlanFreeMemory(pVList);

// clean up

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

for (i = 0; i < pVList->dwNumberOfItems; i++){

WideCharToMultiByte(950,0,SsidToStringW(strSsid,

sizeof(strSsid)/
sizeof(WCHAR), &pVList->Network[i].dot11Ssid),-1,info[i].SSID,30,NULL,NULL);info[i].Quality = pVList->Network[i].wlanSignalQuality;

strcpy_s(info[i].AUTH, GetAuthAlgoString(pVList->Network[i].dot11DefaultAuthAlgorithm));

strcpy_s(info[i].CIPH, GetCipherAlgoString(pVList->Network[i].dot11DefaultCipherAlgorithm));

if(pVList->Network[i].bSecurityEnabled){

info[i].security_check = 1;

}

else{

info[i].security_check = 0;

}

// whether it is connected

if (pVList->Network[i].dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED){

info[i].connected_check = 1;

}

else{

info[i].connected_check = 0;

}

}

info[0].num_nt = pVList->dwNumberOfItems;

WlanFreeMemory(pVList);

// clean up

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return 0;}

int

Scan(){

DWORD dwError = ERROR_SUCCESS;

HANDLE hClient = NULL;

PWLAN_INTERFACE_CAPABILITY pInterfaceCapability = NULL;

PWLAN_AVAILABLE_NETWORK_LIST pVList = NULL;

 

 

// open handle

if ((dwError = OpenHandleAndCheckVersion(&hClient

)) != ERROR_SUCCESS)

{

return -1;}

// get interface capability, which includes the supported PHYs

if ((dwError = WlanGetInterfaceCapability(hClient,

&NIC_GUID,

NULL,

// reserved&pInterfaceCapability

)) != ERROR_SUCCESS)

{

if (hClient != NULL){

WlanCloseHandle(

hClient,

NULL

// reserved);

}

return -1;}

if((dwError = WlanScan(hClient,

&NIC_GUID,

NULL,

// don't perform additional probe for a specific SSIDNULL,

// no IE data for the additional probeNULL

// reserved)) != ERROR_SUCCESS)

{

if (hClient != NULL){

WlanCloseHandle(

hClient,

NULL

// reserved);

}

return -1;}

Sleep(2000);

// clean up

if (hClient != NULL){

WlanCloseHandle(

hClient,

NULL

// reserved);

}

return 0;}

int

RadioState(){

DWORD dwError = ERROR_SUCCESS;

HANDLE hClient = NULL;

PWLAN_CONNECTION_ATTRIBUTES pCurrentNetwork = NULL;

WLAN_RADIO_STATE wlanRadioState;

PVOID pData = NULL;

DWORD dwDataSize = 0;

int state;UINT i;

 

// open handle

if ((dwError = OpenHandleAndCheckVersion(&hClient

)) != ERROR_SUCCESS)

{

if (hClient != NULL){

WlanCloseHandle(

hClient,

NULL

// reserved);

}

return -1;}

// query radio state information

// this opcode is not supported in XP

if ((dwError = WlanQueryInterface(hClient,

&NIC_GUID,

wlan_intf_opcode_radio_state,

NULL,

// reserved&dwDataSize,

&pData,

NULL

// not interesed in the type of the opcode value)) != ERROR_SUCCESS &&

dwError != ERROR_NOT_SUPPORTED)

{

if (hClient != NULL){

WlanCloseHandle(

hClient,

NULL

// reserved);

}

return -1;}

if (dwError == ERROR_SUCCESS){

if (dwDataSize !=
sizeof(WLAN_RADIO_STATE)){

dwError = ERROR_INVALID_DATA;

return -1;}

wlanRadioState = *((PWLAN_RADIO_STATE)pData);

// print radio state

for (i = 0; i < wlanRadioState.dwNumberOfPhys; i++){

state = wlanRadioState.PhyRadioState[i].dot11SoftwareRadioState;

}

//return 1;WlanFreeMemory(pData);

pData = NULL;

}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return state;}

int

SetRadioOn(){

DWORD dwError = ERROR_SUCCESS;

HANDLE hClient = NULL;

PWLAN_INTERFACE_CAPABILITY pInterfaceCapability = NULL;

DWORD i;

WLAN_PHY_RADIO_STATE wlanPhyRadioState;

 

// open handle

if ((dwError = OpenHandleAndCheckVersion(&hClient

)) != ERROR_SUCCESS)

{

if (hClient != NULL){

WlanCloseHandle(

hClient,

NULL

// reserved);

}

return -1;}

// get interface capability, which includes the supported PHYs

if ((dwError = WlanGetInterfaceCapability(hClient,

&NIC_GUID,

NULL,

// reserved&pInterfaceCapability

)) != ERROR_SUCCESS)

{

return -1;}

// set radio state on every PHYwlanPhyRadioState.dot11SoftwareRadioState = dot11_radio_state_on;

for (i = 0; i < pInterfaceCapability->dwNumberOfSupportedPhys; i++){

// set radio state on every PHYwlanPhyRadioState.dwPhyIndex = i;

if ((dwError = WlanSetInterface(hClient,

&NIC_GUID,

wlan_intf_opcode_radio_state,

sizeof(wlanPhyRadioState),(PBYTE)&wlanPhyRadioState,

NULL

// reserved)) != ERROR_SUCCESS)

{

// rollback is nice to have, but not required

return -1;}

}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return 0;}

 

// connect to a network using a saved profile

int

Connect(WCHAR *pro_file,WCHAR *pwcSSID){

DWORD dwError = ERROR_SUCCESS;

HANDLE hClient = NULL;

DOT11_SSID dot11Ssid = {0};

WLAN_CONNECTION_PARAMETERS wlanConnPara;

DWORD dwReason;

 

// open handle

if ((dwError = OpenHandleAndCheckVersion(&hClient )) != ERROR_SUCCESS){

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

// set profiledwError = WlanSetProfile(

hClient,

&NIC_GUID,

0,

// no flags for the profile pro_file,

NULL,

// use the default ACLTRUE,

// overwrite a profile if it already existsNULL,

// reserved&dwReason

);

if (dwError == ERROR_BAD_PROFILE){

AfxMessageBox(

"Bad profile");

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

 

// set the connection mode (connecting using a profile)wlanConnPara.wlanConnectionMode = wlan_connection_mode_profile;

// set the profile namewlanConnPara.strProfile = L

"WIRE1x"; 

// get SSID

if ((dwError = StringWToSsid(pwcSSID, &dot11Ssid)) != ERROR_SUCCESS){

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

// set the SSIDwlanConnPara.pDot11Ssid = &dot11Ssid;

// get BSS typewlanConnPara.dot11BssType = dot11_BSS_type_infrastructure;

// the desired BSSID list is emptywlanConnPara.pDesiredBssidList = NULL;

// no connection flagswlanConnPara.dwFlags = 0;

if((dwError = WlanConnect( hClient, &NIC_GUID, &wlanConnPara, NULL )) != ERROR_SUCCESS){

return -1;}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

 

return 0;}

int

Disconnect(){

HANDLE hClient = NULL;

// open handle

if (OpenHandleAndCheckVersion(&hClient) != ERROR_SUCCESS){

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return -1;}

if(WlanDisconnect(hClient, &NIC_GUID, NULL) !=ERROR_SUCCESS){

return -1;}

if (hClient != NULL){

WlanCloseHandle(hClient, NULL);

}

return 0;}
***************************************************************************
class:USERINFI_Dlg.cpp

/**************************************************************************/

/* WIRE1x for Vista Version 1.0.1: An open-source IEEE 802.1x supplicant */

/* for Microsoft Windows based on Xsupplicant of Open1x. */

/* */

/* This code is released under both the GPL version 2 and BSD licenses. */

/* Either license may be used. */

/* */

/* Copyright (C) 2003-2008 WIRE Lab., National Tsing Hua University, */

/* Hsinchu, Taiwan, R.O.C. All Rights Reserved. */

/**************************************************************************/

// USERINFO_Dlg.cpp :

//

#include

"stdafx.h"#include

"WIRE1x_v.h"#include

"USERINFO_Dlg.h"#include

"data_config.h" 

extern

Network_config_data network_data;
// USERINFO_Dlg

IMPLEMENT_DYNAMIC(USERINFO_Dlg, CDialog)

USERINFO_Dlg::USERINFO_Dlg(CWnd* pParent

/*=NULL*/): CDialog(USERINFO_Dlg::IDD, pParent)

{

}

USERINFO_Dlg::~USERINFO_Dlg()

{

}

void

USERINFO_Dlg::DoDataExchange(CDataExchange* pDX){

CDialog::DoDataExchange(pDX);

DDX_Control(pDX, IDC_EDIT1, m_username);

DDX_Control(pDX, IDC_EDIT2, m_password);

DDX_Control(pDX, IDC_SAVE, m_check);

}

 

BEGIN_MESSAGE_MAP(USERINFO_Dlg, CDialog)

ON_BN_CLICKED(IDOK, &USERINFO_Dlg::OnBnClickedOk)

ON_EN_CHANGE(IDC_EDIT1, &USERINFO_Dlg::OnEnChangeEdit1)

END_MESSAGE_MAP()

 

// USERINFO_Dlg

BOOL USERINFO_Dlg::OnInitDialog()

{

CDialog::OnInitDialog();

m_username.SetWindowTextA(network_data.username);

m_password.SetWindowTextA(network_data.password);

if(network_data.store_name_pswd == 1){m_check.SetCheck(1);

}

else
if(network_data.store_name_pswd == 2){m_check.ShowWindow(0);

}

return TRUE;}

void

USERINFO_Dlg::OnBnClickedOk(){

// TODO: CString username;

CString password;

 

m_username.GetWindowTextA(username);

m_password.GetWindowTextA(password);

strcpy_s(network_data.username,username);

strcpy_s(network_data.password,password);
if(m_check.GetCheck() BST_CHECKED){network_data.store_name_pswd 1;

store_profile();

}

elsenetwork_data.store_name_pswd = 0;

OnOK();

}

 

void

USERINFO_Dlg::OnEnChangeEdit1(){

// TODO: S'il s'agit d'un contrôle RICHEDIT, le contrôle

// n'enverra la notification que si vous substituez la fonction CDialog::OnInitDialog()

// et l'appel CRichEditCtrl().SetEventMask()

// avec l'indicateur ENM_CHANGE ajouté au masque grâce à l'opérateur OR.

// TODO: Ajoutez ici le code de votre gestionnaire de notification de contrôle
}

*******************************************************************
si vous voulez je vous envoie le reste des classes pour que vous arrivez à m'aider ,Merci
Messages postés
3983
Date d'inscription
jeudi 14 juillet 2005
Statut
Membre
Dernière intervention
30 juin 2013
14
MFC est une librairie développée par Microsoft qui permet le développement rapide d'application GUI (fenêtrées).
Pour le reste,

DWORD StringWToSsid(__in LPCWSTR strSsid, __out PDOT11_SSID pSsid);
=> Récupère le SSID à partir de la chaîne WCHAR.

LPWSTR SsidToStringW(__out_ecount(count) LPWSTR buf, __in ULONG count, __in PDOT11_SSID pSsid);
=> Récupère la chaîne WCHAR à partir du SSID

char *GetAuthAlgoString(DOT11_AUTH_ALGORITHM dot11AuthAlgo);
=> Récupère le nom affichable de l'algo. d'authentification à partir de son ID.

char *GetCipherAlgoString(DOT11_CIPHER_ALGORITHM dot11CipherAlgo);
=> Récupère le nom de affichable de l'algo. de chiffrement à partir de son ID.

char *GetNICStateString(WLAN_INTERFACE_STATE NICState);
=> Récupère l'état de l'interface réseau sous forme de chaîne de caractères

DWORD OpenHandleAndCheckVersion(PHANDLE phClient);
=> Ouvre un handle de client WLAN et vérifie la version.

int Enuminterface(NIC_info * nic);
=> Enumère les interfaces réseau.

int Current_connection(Connection_info *info);
=> ??

int Visible_Network_List(Network_info *info);
=> Remplit un tableau contenant la liste des WAP ainsi que leurs infos.

int RadioState();
=> Renvoie l'état de l'émetteur WiFi

int Connect(WCHAR *pro_file,WCHAR *pwcSSID);
=> Se connecte à un réseau WiFi en utilisant un profile sauvé

int Disconnect();
=> Se déconnecte d'un réseau WiFi
Messages postés
9
Date d'inscription
lundi 30 mars 2009
Statut
Membre
Dernière intervention
19 avril 2009

merci pour la réponse;
pour l'utilisation d'un logiciel du conception des diagrammes d'uml de ce code de quoi vous  me conseillez comme logiciel rapide pour  télécharger .
merci pour l'aide. 
Messages postés
3983
Date d'inscription
jeudi 14 juillet 2005
Statut
Membre
Dernière intervention
30 juin 2013
14
Aucune idée sur la question : je n'utilise pas cette technologie ...
Messages postés
9
Date d'inscription
lundi 30 mars 2009
Statut
Membre
Dernière intervention
19 avril 2009

s'il vous plais je veux savoir par détail  et je veux une commentaire sur chaque fonction car mon but de projet  fin d'étude de comprendre bien le code à fin de le faire modifier et comprendre ou se passe le scanning de réseau sans fil,l'authentification,l'association et la réassociation.
 voila quelque classes de mon projet fin d'étude ça me fera très plaisir de m'aider à le comprendre svp.
class Networc_config_Data:

/**************************************************************************/

/* WIRE1x for Vista Version 1.0.1: An open-source IEEE 802.1x supplicant */

/* for Microsoft Windows based on Xsupplicant of Open1x. */

/* */

/* This code is released under both the GPL version 2 and BSD licenses. */

/* Either license may be used. */

/* */

/* Copyright (C) 2003-2008 WIRE Lab., National Tsing Hua University, */

/* Hsinchu, Taiwan, R.O.C. All Rights Reserved. */

/**************************************************************************/

// NETWORK_Config_Dlg.cpp

//

#include

"stdafx.h"#include

"WIRE1x_v.h"#include

"NETWORK_Config_Dlg.h"#include

"data_config.h"#include

"certdlg.h"#include

"USERINFO_Dlg.h"#include

"SIM_Setting_Dlg.h"#include

"User_cert_Dlg.h"extern

Network_config_data network_data;
// NETWORK_Config_Dlg

IMPLEMENT_DYNAMIC(NETWORK_Config_Dlg, CDialog)

NETWORK_Config_Dlg::NETWORK_Config_Dlg(CWnd* pParent

/*=NULL*/): CDialog(NETWORK_Config_Dlg::IDD, pParent)

{

}

NETWORK_Config_Dlg::~NETWORK_Config_Dlg()

{

}

void

NETWORK_Config_Dlg::DoDataExchange(CDataExchange* pDX){

CDialog::DoDataExchange(pDX);

DDX_Control(pDX, IDC_COMBO2, m_auth_type);

DDX_Control(pDX, IDC_COMBO3, m_dataencryp);

DDX_Control(pDX, IDC_EDIT1, m_key);

DDX_Control(pDX, IDC_CHECK_PW, m_pwcheck);

DDX_Control(pDX, IDC_EAP_COMBO, m_eap_method);

DDX_Control(pDX, IDC_VERIFY_CHECK, m_verify_check);

DDX_Control(pDX, IDC_TUNNEL_COMBO, m_tunnel_protocol);

DDX_Control(pDX, IDC_VERIFY_BUTTON, m_cert_setting);

DDX_Control(pDX, IDC_EAP_SETTING, m_eap_setting);

}

 

BEGIN_MESSAGE_MAP(NETWORK_Config_Dlg, CDialog)

ON_BN_CLICKED(IDC_VERIFY_BUTTON, &NETWORK_Config_Dlg::OnBnClickedVerifyButton)

ON_CBN_SELCHANGE(IDC_COMBO2, &NETWORK_Config_Dlg::OnCbnSelchangeCombo2)

ON_BN_CLICKED(IDC_CHECK_PW, &NETWORK_Config_Dlg::OnBnClickedCheckPw)

ON_BN_CLICKED(IDOK, &NETWORK_Config_Dlg::OnBnClickedOk)

ON_EN_CHANGE(IDC_EDIT1, &NETWORK_Config_Dlg::OnEnChangeEdit1)

ON_CBN_SELCHANGE(IDC_EAP_COMBO, &NETWORK_Config_Dlg::OnCbnSelchangeEapCombo)

ON_BN_CLICKED(IDC_VERIFY_CHECK, &NETWORK_Config_Dlg::OnBnClickedVerifyCheck)

ON_BN_CLICKED(IDC_EAP_SETTING, &NETWORK_Config_Dlg::OnBnClickedEapSetting)

ON_CBN_SELCHANGE(IDC_COMBO3, &NETWORK_Config_Dlg::OnCbnSelchangeCombo3)

END_MESSAGE_MAP()

 

// NETWORK_Config_Dlg

BOOL NETWORK_Config_Dlg::OnInitDialog()

{

CDialog::OnInitDialog();

 

char mychar =
'*'; m_key.SetPasswordChar(mychar);

m_auth_type.AddString(

"Open"); m_auth_type.AddString(

"Shared");m_auth_type.AddString(

"WPA-Enterprise");m_auth_type.AddString(

"WPA-Personal");m_auth_type.AddString(

"WPA2-Enterprise");m_auth_type.AddString(

"WPA2-Personal");m_eap_method.AddString(

"EAP-TLS");m_eap_method.AddString(

"EAP-TTLS");m_eap_method.AddString(

"EAP-PEAP");m_eap_method.AddString(

"EAP-SIM");m_eap_method.AddString(

"EAP-AKA"); 

 

 

if(network_data.auth_type == open){ 

m_auth_type.SetCurSel(0);

m_dataencryp.AddString(

"NONE");m_dataencryp.AddString(

"WEP");

if(network_data.encryp_type== none){m_dataencryp.SetCurSel(0);

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

m_key.EnableWindow(FALSE);

}

else
if(network_data.encryp_type == wep){m_dataencryp.SetCurSel(1);

m_key.EnableWindow(TRUE);

}

}

else
if(network_data.auth_type == shared){ 

m_auth_type.SetCurSel(0);

m_dataencryp.AddString(

"NONE");m_dataencryp.AddString(

"WEP"); 

if(network_data.encryp_type== none){m_dataencryp.SetCurSel(0);

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

m_key.EnableWindow(FALSE);

}

else
if(network_data.encryp_type == wep){m_dataencryp.SetCurSel(1);

m_key.EnableWindow(TRUE);

}

}

else
if(network_data.auth_type == wpa){m_auth_type.SetCurSel(2);

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_eap_method.EnableWindow(TRUE);

m_tunnel_protocol.EnableWindow(TRUE);

m_eap_setting.EnableWindow(TRUE);

m_key.EnableWindow(FALSE);

if(network_data.encryp_type == tkip){m_dataencryp.SetCurSel(0);

}

else
if(network_data.encryp_type == aes){m_dataencryp.SetCurSel(1);

}

}

else
if(network_data.auth_type == wpapsk){m_auth_type.SetCurSel(3);

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_key.EnableWindow(TRUE);

m_pwcheck.EnableWindow(TRUE);

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_key.EnableWindow(TRUE);

if(network_data.encryp_type == tkip){m_dataencryp.SetCurSel(0);

}

else
if(network_data.encryp_type == aes){m_dataencryp.SetCurSel(1);

}

}

else
if(network_data.auth_type == wpa2){m_auth_type.SetCurSel(4);

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_eap_method.EnableWindow(TRUE);

m_tunnel_protocol.EnableWindow(TRUE);

m_eap_setting.EnableWindow(TRUE);

m_key.EnableWindow(FALSE);

if(network_data.encryp_type == tkip){m_dataencryp.SetCurSel(0);

}

else
if(network_data.encryp_type == aes){m_dataencryp.SetCurSel(1);

}

}

else
if(network_data.auth_type == wpa2psk){m_auth_type.SetCurSel(5);

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_key.EnableWindow(TRUE);

m_pwcheck.EnableWindow(TRUE);

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_key.EnableWindow(TRUE);

if(network_data.encryp_type == tkip){m_dataencryp.SetCurSel(0);

}

else
if(network_data.encryp_type == aes){m_dataencryp.SetCurSel(1);

}

}

if(network_data.eap_type == tls){

m_eap_method.SetCurSel(0);

m_verify_check.EnableWindow(TRUE);

m_verify_check.ShowWindow(1);

m_cert_setting.ShowWindow(1);

}

else
if(network_data.eap_type == peap){

m_eap_method.SetCurSel(2);

m_verify_check.EnableWindow(TRUE);

m_verify_check.ShowWindow(1);

m_cert_setting.ShowWindow(1);

m_tunnel_protocol.AddString(

"MSCHAPv2");m_tunnel_protocol.AddString(

"EAP-GTC");

if(network_data.eap_innertype == mschapv2){m_tunnel_protocol.SetCurSel(0);

}

else
if(network_data.eap_innertype == gtc){m_tunnel_protocol.SetCurSel(1);

}

}

else
if(network_data.eap_type == ttls){

m_eap_method.SetCurSel(1);

m_verify_check.EnableWindow(TRUE);

m_verify_check.ShowWindow(1);

m_cert_setting.ShowWindow(1);

m_tunnel_protocol.AddString(

"PAP");m_tunnel_protocol.AddString(

"EAP-MD5");m_tunnel_protocol.AddString(

"CHAP");m_tunnel_protocol.AddString(

"MSCHAP");m_tunnel_protocol.AddString(

"MSCHAPv2");

if(network_data.eap_innertype == pap){m_tunnel_protocol.SetCurSel(0);

}

else
if(network_data.eap_innertype == md5){m_tunnel_protocol.SetCurSel(1);

}

else
if(network_data.eap_innertype == chap){m_tunnel_protocol.SetCurSel(2);

}

else
if(network_data.eap_innertype == mschap){m_tunnel_protocol.SetCurSel(3);

}

else
if(network_data.eap_innertype == mschapv2){m_tunnel_protocol.SetCurSel(4);

}

}

else
if(network_data.eap_type == sim){

m_eap_method.SetCurSel(3);

m_verify_check.EnableWindow(FALSE);

}

else
if(network_data.eap_type == aka){

m_eap_method.SetCurSel(4);

m_verify_check.EnableWindow(FALSE);

}

else
if(network_data.eap_type == no_eap){m_eap_method.SetCurSel(1);

m_tunnel_protocol.AddString(

"PAP");m_tunnel_protocol.AddString(

"EAP-MD5");m_tunnel_protocol.AddString(

"CHAP");m_tunnel_protocol.AddString(

"MSCHAP");m_tunnel_protocol.AddString(

"MSCHAPv2");m_tunnel_protocol.SetCurSel(0);

m_verify_check.EnableWindow(FALSE);

}

 

 

if(network_data.verifycert == 1){m_verify_check.SetCheck(1);

if(IsDlgButtonChecked(IDC_VERIFY_CHECK)== FALSE){m_cert_setting.EnableWindow(FALSE);

}

elsem_cert_setting.EnableWindow(TRUE);

}

else{m_verify_check.EnableWindow(FALSE);

}

m_key.SetWindowTextA(network_data.key);

 

return TRUE;}

// NETWORK_Config_Dlg

 

void

NETWORK_Config_Dlg::OnCbnSelchangeCombo2(){

char temp2[20];GetDlgItemText(IDC_COMBO2,temp2, 20);

if(strcmp(
"WPA-Enterprise",temp2) == 0){

m_dataencryp.ResetContent();

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_dataencryp.SetCurSel(0);

network_data.auth_type = wpa;

m_eap_method.EnableWindow(TRUE);

m_tunnel_protocol.EnableWindow(TRUE);

m_verify_check.EnableWindow(TRUE);

m_eap_setting.EnableWindow(TRUE);

m_key.EnableWindow(FALSE);

m_key.SetWindowTextA(

""); 

}

else
if(strcmp(
"WPA2-Enterprise",temp2) == 0){

m_dataencryp.ResetContent();

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_dataencryp.SetCurSel(0);

network_data.auth_type = wpa2;

m_eap_method.EnableWindow(TRUE);

m_tunnel_protocol.EnableWindow(TRUE);

m_verify_check.EnableWindow(TRUE);

m_eap_setting.EnableWindow(TRUE);

m_key.EnableWindow(FALSE);

m_key.SetWindowTextA(

""); 

}

else
if(strcmp(
"WPA-Personal",temp2) == 0){

m_dataencryp.ResetContent();

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_dataencryp.SetCurSel(0);

network_data.auth_type = wpapsk;

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_key.EnableWindow(TRUE);

}

else
if(strcmp(
"WPA2-Personal",temp2) == 0){

m_dataencryp.ResetContent();

m_dataencryp.AddString(

"TKIP");m_dataencryp.AddString(

"AES");m_dataencryp.SetCurSel(0);

network_data.auth_type = wpa2psk;

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_key.EnableWindow(TRUE);

}

else
if(strcmp(
"Open",temp2) == 0){

m_dataencryp.ResetContent();

m_dataencryp.AddString(

"NONE");m_dataencryp.AddString(

"WEP");m_dataencryp.SetCurSel(0);

network_data.auth_type = open;

network_data.encryp_type = none;

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_key.EnableWindow(FALSE);

m_key.SetWindowTextA(

"");}

else
if(strcmp(
"Shared",temp2) == 0){

m_dataencryp.ResetContent();

m_dataencryp.AddString(

"NONE");m_dataencryp.AddString(

"WEP");m_dataencryp.SetCurSel(0);

network_data.auth_type = shared;

network_data.encryp_type = none;

m_eap_method.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_key.EnableWindow(FALSE);

m_key.SetWindowTextA(

"");}

}

 

void

NETWORK_Config_Dlg::OnBnClickedCheckPw(){

// TODO: Add extra initialization here

char mychar =
'*';  

if(m_pwcheck.GetCheck() == BST_CHECKED){

m_key.SetPasswordChar(0);

}

else{

m_key.SetPasswordChar(mychar);

}

}

void

NETWORK_Config_Dlg::OnBnClickedOk(){

// TODO: Add extra initialization hereCString username;

CString password;

CString eap;

CString eap_inner;

CString key;

char temp[20];GetDlgItemText(IDC_COMBO3,temp, 10);

 

m_eap_method.GetWindowTextA(eap);

m_tunnel_protocol.GetWindowTextA(eap_inner);

m_key.GetWindowTextA(key);

 

 

if(strcmp("TKIP",temp) 0){network_data.encryp_type tkip;

}

else
if(strcmp("AES",temp) 0){network_data.encryp_type aes;

}

else
if(strcmp("NONE",temp) 0){network_data.encryp_type none;

}

else
if(strcmp("WEP",temp) 0){network_data.encryp_type wep;

}

if(strcmp("EAP-TLS",eap) 0){network_data.eap_type tls;

strcpy_s(network_data.password,

"WIRE1x8888");}

else
if(strcmp("EAP-TTLS",eap) 0){network_data.eap_type ttls;

}

else
if(strcmp("EAP-PEAP",eap) 0){network_data.eap_type peap;

}

else
if(strcmp("EAP-SIM",eap) 0){network_data.eap_type sim;

 

}

else
if(strcmp("EAP-AKA",eap) 0){network_data.eap_type aka;

}

if(strcmp("PAP",eap_inner) 0){network_data.eap_innertype pap;

}

else
if(strcmp("MSCHAPv2",eap_inner) 0){network_data.eap_innertype mschapv2;

}

else
if(strcmp("EAP-GTC",eap_inner) 0){network_data.eap_innertype gtc;

}

else
if(strcmp("EAP-MD5",eap_inner) 0){network_data.eap_innertype md5;

}

else
if(strcmp("CHAP",eap_inner) 0){network_data.eap_innertype chap;

}

else
if(strcmp("MSCHAP",eap_inner) 0){network_data.eap_innertype mschap;

}

else{network_data.eap_innertype = no_inner;

}
if(m_verify_check.GetCheck() BST_CHECKED){network_data.verifycert 1;

}

else{

network_data.verifycert = 0;

strcpy_s(network_data.rootcertname,

"");}

strcpy(network_data.key,key);

store_profile();

OnOK();

}

void

NETWORK_Config_Dlg::OnEnChangeEdit1(){

CString key;

char key_char[100];m_key.GetWindowTextA(key);

strcpy_s(key_char,key);
if((network_data.auth_type open || network_data.auth_type shared) && network_data.encryp_type == wep){

if(strcmp(key_char,
"") != 0){m_eap_method.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

}

else{m_eap_method.EnableWindow(TRUE);

m_eap_setting.EnableWindow(TRUE);

m_tunnel_protocol.EnableWindow(TRUE);

m_verify_check.EnableWindow(TRUE);

}

}

}

void

NETWORK_Config_Dlg::OnCbnSelchangeEapCombo(){

char temp[20];GetDlgItemText(IDC_EAP_COMBO,temp, 20);

strcpy_s(network_data.username,

"");strcpy_s(network_data.password,

"");network_data.store_name_pswd = 0;

if(strcmp(
"EAP-TLS",temp) == 0){m_tunnel_protocol.ResetContent();

m_verify_check.EnableWindow(TRUE);

m_verify_check.ShowWindow(1);

m_cert_setting.ShowWindow(1);

}

else
if(strcmp(
"EAP-TTLS",temp) == 0){m_tunnel_protocol.ResetContent();

m_tunnel_protocol.AddString(

"PAP");m_tunnel_protocol.AddString(

"EAP-MD5");m_tunnel_protocol.AddString(

"CHAP");m_tunnel_protocol.AddString(

"MSCHAP");m_tunnel_protocol.AddString(

"MSCHAPv2");m_tunnel_protocol.SetCurSel(0);

m_verify_check.EnableWindow(TRUE);

m_verify_check.ShowWindow(1);

m_cert_setting.ShowWindow(1);

}

else
if(strcmp(
"EAP-PEAP",temp) == 0){m_tunnel_protocol.ResetContent();

m_tunnel_protocol.AddString(

"MSCHAPv2");m_tunnel_protocol.AddString(

"EAP-GTC");m_tunnel_protocol.SetCurSel(0);

m_verify_check.EnableWindow(TRUE);

m_verify_check.ShowWindow(1);

m_cert_setting.ShowWindow(1);

}

else
if(strcmp(
"EAP-SIM",temp) == 0){m_tunnel_protocol.ResetContent();

m_verify_check.EnableWindow(FALSE);

m_cert_setting.EnableWindow(FALSE);

m_verify_check.ShowWindow(0);

m_cert_setting.ShowWindow(0);

}

else
if(strcmp(
"EAP-AKA",temp) == 0){m_tunnel_protocol.ResetContent();

m_verify_check.EnableWindow(FALSE);

m_cert_setting.EnableWindow(FALSE);

m_verify_check.ShowWindow(0);

m_cert_setting.ShowWindow(0);

}

}

void

NETWORK_Config_Dlg::OnBnClickedVerifyCheck(){

if(IsDlgButtonChecked(IDC_VERIFY_CHECK)== FALSE){m_cert_setting.EnableWindow(FALSE);

}

elsem_cert_setting.EnableWindow(TRUE);

}

void

NETWORK_Config_Dlg::OnBnClickedVerifyButton(){

Certdlg certconfig;

certconfig.dlgstyle = 2;

//open root certicate storecertconfig.DoModal();

if(certconfig.choice == 1){strcpy(network_data.rootcertname,certconfig.certname);

m_verify_check.SetCheck(1);

}

else{m_verify_check.SetCheck(0);

}

}

 

void

NETWORK_Config_Dlg::OnBnClickedEapSetting(){

// TODO:

char temp[20];GetDlgItemText(IDC_EAP_COMBO,temp, 20);

if(strcmp(
"EAP-TLS",temp) == 0){User_cert_Dlg Config;

Config.DoModal();

}

else
if(strcmp(
"EAP-TTLS",temp) == 0){USERINFO_Dlg Config;

Config.DoModal();

}

else
if(strcmp(
"EAP-PEAP",temp) == 0){USERINFO_Dlg Config;

Config.DoModal();

}

else
if(strcmp(
"EAP-SIM",temp) == 0){SIM_Setting_Dlg Config;

Config.DoModal();

}

else
if(strcmp(
"EAP-AKA",temp) == 0){SIM_Setting_Dlg Config;

Config.DoModal();

}

}

void

NETWORK_Config_Dlg::OnCbnSelchangeCombo3(){

char temp[10];

char temp2[20];GetDlgItemText(IDC_COMBO3,temp, 10);

GetDlgItemText(IDC_COMBO2,temp2, 20);

if(strcmp("TKIP",temp) 0){network_data.encryp_type tkip;

m_dataencryp.SetCurSel(0);

}

else
if(strcmp("AES",temp) 0){network_data.encryp_type aes;

m_dataencryp.SetCurSel(1);

}

else
if(strcmp(
"NONE",temp) == 0){m_eap_method.EnableWindow(FALSE);

m_eap_setting.EnableWindow(FALSE);

m_tunnel_protocol.EnableWindow(FALSE);

m_verify_check.EnableWindow(FALSE);

m_key.EnableWindow(FALSE);

network_data.encryp_type = none;

m_dataencryp.SetCurSel(0);

}

else
if(strcmp(
"WEP",temp) == 0){m_key.EnableWindow(TRUE);

m_eap_method.EnableWindow(TRUE);

m_eap_setting.EnableWindow(TRUE);

m_tunnel_protocol.EnableWindow(TRUE);

m_verify_check.EnableWindow(TRUE);

network_data.encryp_type = wep;

m_dataencryp.SetCurSel(1);

}

}
Messages postés
3983
Date d'inscription
jeudi 14 juillet 2005
Statut
Membre
Dernière intervention
30 juin 2013
14
Je ne sais pas t'en dire plus : je ne connais pas le sujet.
Ce que j'ai mis précédemment, n'importe qui parlant anglais et connaissant au minimum le C aurait pu le dire !
Messages postés
2
Date d'inscription
dimanche 20 mai 2007
Statut
Membre
Dernière intervention
16 octobre 2009

salut tt le monde, je fait mon projet sur la simulation des réseaux wifi (procédure authentification , association ...) et je veux faire aussi la simulation du handover ver le réseau UMTS svp nouha32 et ghuysmans99 si vous pouvez m aider j ai besoin de votre aide.et je serais trés reconnaissante svp n'hesitez pas à m'aider