Fusion API programming help request

M Michal Drabek 3 years 5 months ago
1 0 0

3/26/2012 2571934 Fusion: 2.55.1.0.016R EMDK for C v2.5 TA has encountered two situations where both Fusion profiles needs to be set with At Connect for user credentials. Situation 1: 1) Profile is contains LEAP authentication and encryption WEP 104 bit and DHCP. 2) User credentials structure fields has been filled in both username and password. 3) Using Fusion structure FAPI_PROFILE_4. 4) Any device, I used a MC70 with  WM 5 and BSP 43 but being reported on WT4090 CE 5 with BSP 35. If I fill the following information I don’t get the identity, domain, password filled in (from GUI this works): void AddNewLEAPProfile() {       FAPI_PROFILE_4  fapiProfile = {0};        fapiProfile.dwVersion = FAPI_PROFILE_4_VERSION;       AddLog(3,_T("Detected Fusion Structure Ver = %d"),fapiProfile.dwVersion);       //specify common properties for both Adhoc and Infrastructure       fapiProfile.dwType = FAPI_PROFILE_TYPE;          //----------- Default values --------------       fapiProfile.dwPowerIndex = FAPI_WLAN_POWERMODE_FAST_POWER_SAVE;       fapiProfile.dwTxPower = FAPI_POWER_BSS_AUTO;                            // Must use AUTO or PLUS for infrastructure       fapiProfile.dwOpMode =  FAPI_NDIS802_11INFRASTRUCTURE ;                 // infrastructure mode       fapiProfile.dwIPAddressingMode = FAPI_ADDR_MODE_IPV4_DHCP;       fapiProfile.dwEncryption = FAPI_ENCRYPTION_NONE ;       fapiProfile.NetworkType.Infrastructure.dwAuthentication = FAPI_AUTH_NONE;       _tcscpy(fapiProfile.pszCountryCode,_T("US"));       //----------- End of default values -----------       SYSTEMTIME systime;       GetSystemTime(&systime);  //get current time and date       TCHAR tcsProfileName[64];       _stprintf(tcsProfileName,_T("[My LEAP profile %2.2d:%2.2d]"),systime.wHour,systime.wMinute);       _tcscpy(fapiProfile.pszName,tcsProfileName);              _tcscpy(fapiProfile.pszSSID,_T("[My ESSID 01234567890123456789]"));       _tcscpy(fapiProfile.pszCountryCode,_T("SE"));       fapiProfile.dwEncryption = FAPI_ENCRYPTION_104BIT_PASSPH;       fapiProfile.NetworkType.Infrastructure.dwAuthentication = FAPI_LEAP;        _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszDomain,_T("[Domain]"));       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszIdentity,_T("[Username]"));       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszUserPwd,_T("[Password]"));       fapiProfile.NetworkType.Infrastructure.CredentialSettings.dwCredentialFlags = 0; //see TABLE 3 what to set    //Add a dummy cert and set "at connect" & "resume" credential flags       fapiProfile.NetworkType.Infrastructure.CredentialSettings.dwCredentialFlags = (FAPI_SPECIFY_SERVER_CERTIFICATE_LOCAL | FAPI_SPECIFY_PROFILE_TYPE_AS_USER_PROFILE );       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.ServerCertInstall.LocalCertInstall.pszServerCertFName,_T("Class 2 Public Primary Certification Authority"));       fapiProfile.NetworkType.Infrastructure.CredentialSettings.CredentialPromptOption.dwCacheOpts = (FAPI_CACHE_OPTION_CONNECT | FAPI_CACHE_OPTION_RESUME); //see TABLE 3 what to set //add new profile        g_fusion.AddFusionProfile((PVOID)&fapiProfile); } The above profile is being added but no user or password credentials. --------------------------------------------------------------------- If I comment the dummy cert and skip the credentials flags, username and password is being added as normal but NOT the At Connect and Resume checkboxes in the profile: Code: void AddNewLEAPProfile() {       FAPI_PROFILE_4  fapiProfile = {0};        fapiProfile.dwVersion = FAPI_PROFILE_4_VERSION;       AddLog(3,_T("Detected Fusion Structure Ver = %d"),fapiProfile.dwVersion);       //specify common properties for both Adhoc and Infrastructure       fapiProfile.dwType = FAPI_PROFILE_TYPE;          //----------- Default values --------------       fapiProfile.dwPowerIndex = FAPI_WLAN_POWERMODE_FAST_POWER_SAVE;       fapiProfile.dwTxPower = FAPI_POWER_BSS_AUTO;                            // Must use AUTO or PLUS for infrastructure       fapiProfile.dwOpMode =  FAPI_NDIS802_11INFRASTRUCTURE ;                 // infrastructure mode       fapiProfile.dwIPAddressingMode = FAPI_ADDR_MODE_IPV4_DHCP;       fapiProfile.dwEncryption = FAPI_ENCRYPTION_NONE ;       fapiProfile.NetworkType.Infrastructure.dwAuthentication = FAPI_AUTH_NONE;       _tcscpy(fapiProfile.pszCountryCode,_T("US"));       //----------- End of default values -----------       SYSTEMTIME systime;       GetSystemTime(&systime);  //get current time and date       TCHAR tcsProfileName[64];       _stprintf(tcsProfileName,_T("[My LEAP profile %2.2d:%2.2d]"),systime.wHour,systime.wMinute);       _tcscpy(fapiProfile.pszName,tcsProfileName);              _tcscpy(fapiProfile.pszSSID,_T("[My ESSID 01234567890123456789]"));       _tcscpy(fapiProfile.pszCountryCode,_T("SE"));       fapiProfile.dwEncryption = FAPI_ENCRYPTION_104BIT_PASSPH;       fapiProfile.NetworkType.Infrastructure.dwAuthentication = FAPI_LEAP;        _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszDomain,_T("[Domain]"));       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszIdentity,_T("[Username]"));       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszUserPwd,_T("[Password]"));       fapiProfile.NetworkType.Infrastructure.CredentialSettings.dwCredentialFlags = 0; //see TABLE 3 what to set    //Add a dummy cert and set "at connect" & "resume" credential flags       /*fapiProfile.NetworkType.Infrastructure.CredentialSettings.dwCredentialFlags = (FAPI_SPECIFY_SERVER_CERTIFICATE_LOCAL | FAPI_SPECIFY_PROFILE_TYPE_AS_USER_PROFILE );       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.ServerCertInstall.LocalCertInstall.pszServerCertFName,_T("Class 2 Public Primary Certification Authority"));       fapiProfile.NetworkType.Infrastructure.CredentialSettings.CredentialPromptOption.dwCacheOpts = (FAPI_CACHE_OPTION_CONNECT | FAPI_CACHE_OPTION_RESUME); //see TABLE 3 what to set */       g_fusion.AddFusionProfile((PVOID)&fapiProfile); } ------------------------------------------------------------------------------------------------------- Second scenario: 1) Profile uses DHCP, PEAP MSCHAPv2, 2) Credentials name, Server certificate, and a user certificate. 3) Device being used MC9090 WM 5 same fusion version as mention above. 4) Same problem occurs as the above the profile adds correctly but At Connection and Resume credentials flags is not being set. 5) These credential flags can be set from the Fusion profile GUI but not programmatically. Sample code: void AddNewPEAPProfile() {       FAPI_PROFILE_4  fapiProfile = {0};        fapiProfile.dwVersion = FAPI_PROFILE_4_VERSION;       AddLog(3,_T("Detected Fusion Structure Ver = %d"),fapiProfile.dwVersion);       //specify common properties for both Adhoc and Infrastructure       fapiProfile.dwType = FAPI_PROFILE_TYPE;          //----------- Default values --------------       fapiProfile.dwPowerIndex = FAPI_WLAN_POWERMODE_FAST_POWER_SAVE;       fapiProfile.dwTxPower = FAPI_POWER_BSS_AUTO;                            // Must use AUTO or PLUS for infrastructure       fapiProfile.dwOpMode =  FAPI_NDIS802_11INFRASTRUCTURE ;                 // infrastructure mode       fapiProfile.dwIPAddressingMode = FAPI_ADDR_MODE_IPV4_DHCP;       fapiProfile.dwEncryption = FAPI_ENCRYPTION_NONE ;       fapiProfile.NetworkType.Infrastructure.dwAuthentication = FAPI_AUTH_NONE;       _tcscpy(fapiProfile.pszCountryCode,_T("US"));       //----------- End of default values -----------       SYSTEMTIME systime;       GetSystemTime(&systime);  //get current time and date       TCHAR tcsProfileName[64];       _stprintf(tcsProfileName,_T("[My PEAP profile %2.2d:%2.2d]"),systime.wHour,systime.wMinute);       _tcscpy(fapiProfile.pszName,tcsProfileName);              _tcscpy(fapiProfile.pszSSID,_T("[My ESSID 01234567890123456789]"));       _tcscpy(fapiProfile.pszCountryCode,_T("SE"));       fapiProfile.dwEncryption = FAPI_ENCRYPTION_AES; //    fapiProfile.NetworkType.Infrastructure.dwAuthentication = FAPI_PEAP_MSCHAPV2;        fapiProfile.NetworkType.Infrastructure.dwAuthentication = FAPI_EAP_TLS;        _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszDomain,_T("[Domain]"));       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszIdentity,_T("[Username]"));       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCredSettings.pszUserPwd,_T("[Password]"));       fapiProfile.NetworkType.Infrastructure.CredentialSettings.dwCredentialFlags = 0; //see TABLE 3 what to set    //Add a dummy cert and set "at connect" & "resume" credential flags       fapiProfile.NetworkType.Infrastructure.CredentialSettings.dwCredentialFlags = (FAPI_SPECIFY_SERVER_CERTIFICATE_LOCAL | FAPI_SPECIFY_PROFILE_TYPE_AS_USER_PROFILE | FAPI_SPECIFY_USER_CERTIFICATE_LOCAL );       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.ServerCertInstall.LocalCertInstall.pszServerCertFName,_T("Class 2 Public Primary Certification Authority"));       fapiProfile.NetworkType.Infrastructure.CredentialSettings.CredentialPromptOption.dwCacheOpts = (FAPI_CACHE_OPTION_CONNECT ); //see TABLE 3 what to set       _tcscpy(fapiProfile.NetworkType.Infrastructure.CredentialSettings.UserCertInstall.LocalCertInstall.pszUserCertFName,_T("mycert"));              g_fusion.AddFusionProfile((PVOID)&fapiProfile); }
I have a request that the profile that is being added should have both username and password but also the At Connect should be selected. This can be done using the Fusion user interface but programmatically you can’t. See the sample code for details. To me this looks like a bug with Fusion or I’m not filling the structure correctly. It seems to be working fine on newer fusion versions but not in older versions. I know on the older versions you have to do some tricks which is not very well documented.
------------------

CONTACT
Can’t find what you’re looking for?