diff --git a/c_adlib/ad_ff/FireFox.cs b/c_adlib/ad_ff/FireFox.cs index 876bb54b..a688cc3c 100644 --- a/c_adlib/ad_ff/FireFox.cs +++ b/c_adlib/ad_ff/FireFox.cs @@ -151,6 +151,9 @@ public class HostElement [DllImport("libad_ff.so.1.1.1")] public static extern int FPM_FirefoxProfileInit(string profileName); + [DllImport("libad_ff.so.1.1.1")] + public static extern int FPM_IsStoreAvailable(); + [DllImport("libad_ff.so.1.1.1")] public static extern int FPM_FirefoxProfileExit(string profileName); @@ -169,6 +172,10 @@ public class HostElement //int FPM_AddHost(char *profileName, struct Host *host, int doUpdate) //int FPM_ModifyHost(char *profileName, struct Host *host, int doUpdate) //int FPM_RemoveHost(char *profileName, char *hostname, int doUpdate) + public static int IsStoreAvailable() + { + return FPM_IsStoreAvailable(); + } //-------------------------------------------------------------- @@ -193,15 +200,18 @@ public class HostElement profCount=FPM_GetProfileList(out profileListIntPtr,out profileFlagsIntPtr); //Console.WriteLine("FireFox:No of Profiles found= "+profCount); - for(int i=0; i< profCount; i++) - { - profileName=Marshal.PtrToStringAnsi(profileListIntPtr[i]); - profileFlag=(int)profileFlagsIntPtr[i]; - //Console.WriteLine("FireFox:Iter="+i+"profileName="+profileName); - //Console.WriteLine("FireFox:Iter="+i+"profileFlag="+profileFlag); - if(profileFlag==1) - defaultProfileName=profileName; //Get the default profile name to init later - } + //try + ///{ + for(int i=0; i< profCount; i++) + { + //Console.WriteLine("Firefox.cs : Inside The for Loop"); + profileName=Marshal.PtrToStringAnsi(profileListIntPtr[i]); + profileFlag=(int)profileFlagsIntPtr[i]; + //Console.WriteLine("FireFox:Iter="+i+"profileName="+profileName); + //Console.WriteLine("FireFox:Iter="+i+"profileFlag="+profileFlag); + if(profileFlag==1) + defaultProfileName=profileName; //Get the default profile name to init later + } return defaultProfileName; @@ -237,10 +247,8 @@ public class HostElement Host hostList; // = new Host(); - NOT NEEDED SINCE WE GET THIS FILLED FROM NATIVE WHEN // WE MARSHAL PTR TO STRUCTURE int methodStatusCode=-1; - - //Console.WriteLine("FireFox:Initializing the Profile "+profileName); - //methodStatusCode=InitProfile(profileName); - //Console.WriteLine("FireFox:InitProfile returned "+methodStatusCode); + String defaultProfileName = null; + int initProfileStatus = -1; //if(methodStatusCode==1) {//If Init of the profile was sucessfull, get the sigon data to complete the aggregation @@ -252,32 +260,31 @@ public class HostElement methodStatusCode = FPM_GetSignonData(profileName,out hostListIntPtr,LOAD_PROFILE_ALWAYSFROM_FILE); if( 1 != methodStatusCode ) { - //Console.WriteLine("FireFox:Getting Data for profile Failed with error "+methodStatusCode); - hostList = null; - } - - } + Console.WriteLine("FireFox:Getting Data for profile Failed with error "+methodStatusCode); + hostList=null; + return hostList; + } + hostList = null; + hostList = (Host)Marshal.PtrToStructure(hostListIntPtr, typeof(Host)); + //This can be Null only when nothing is aggregated. + if (((String)Marshal.PtrToStringAnsi(hostList.hostName)) == null ) + { + //TBD: Log that there are no secrets to aggregate + //Console.WriteLine("FireFox:no secrets to aggregate"); + hostList = null; + } + } catch(Exception e) { - Console.WriteLine("FireFox:Exception during invokation of FPM_GetSignonData"); + //Console.WriteLine("FireFox:Exception during invokation of FPM_GetSignonData"); //Console.WriteLine(e.ToString()); hostList = null; } - hostList = (Host)Marshal.PtrToStructure(hostListIntPtr, typeof(Host)); - //This can be Null only when nothing is aggregated. - if (((String)Marshal.PtrToStringAnsi(hostList.hostName)) == null ) - { - //TBD: Log that there are no secrets to aggregate - //Console.WriteLine("FireFox:no secrets to aggregate"); - hostList = null; - } - //Uninitialize the profile //Console.WriteLine("FireFox:UnInitializing the Profile "+profileName); //UninitProfile(profileName); } - return hostList; }