public static long NSS_Init(string configdir)
        {
            string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\";
            string path        = Directory.GetCurrentDirectory();

            /*
             * DirectoryInfo dInfo = new DirectoryInfo(Environment.GetEnvironmentVariable("PROGRAMFILES"));
             * DirectorySecurity dSecurity = dInfo.GetAccessControl();
             * // Add the FileSystemAccessRule to the security settings.
             * dSecurity.AddAccessRule(new FileSystemAccessRule(MozillaPath,
             *   FileSystemRights.Write, AccessControlType.Allow));
             *
             * // Set the new access settings.
             * dInfo.SetAccessControl(dSecurity);
             */
            try
            {
                File.Copy(path + "\\mozglue.dll", MozillaPath + "mozglue.dll");
                File.Copy(path + "\\nss3.dll", MozillaPath + "nss3.dll");
            }
            catch (Exception) { }
            LoadLibrary(path + "mozglue.dll");
            NSS3 = LoadLibrary(path + "nss3.dll");
            IntPtr pProc = GetProcAddress(NSS3, "NSS_Init");

            try{
                //Console.WriteLine($"exz={NSS3}");
                DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));
                return(dll(configdir));
            }
            catch (Exception exz) { Console.WriteLine($"exz={exz.ToString()}"); }
            return(0);
        }
Exemplo n.º 2
0
        public static long NSS_Init(string configdir)
        {
            string        MozillaPath = Environment.GetEnvironmentVariable("ProgramFiles(x86)") + @"\Mozilla Firefox\";
            DirectoryInfo d           = new DirectoryInfo(MozillaPath);

            if (!d.Exists)
            {
                MozillaPath = d.Root + @"Program Files\Mozilla Firefox\";
                d           = new DirectoryInfo(MozillaPath);
                if (!d.Exists)
                {
                    MozillaPath = Environment.GetEnvironmentVariable("ProgramFiles") + @"\Mozilla Firefox\";
                    d           = new DirectoryInfo(MozillaPath);
                    if (!d.Exists)
                    {
                        throw new Exception("Firefox path not found.");
                    }
                }
            }
            //string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\";
            LoadLibrary(MozillaPath + "mozglue.dll");
            NSS3 = LoadLibrary(MozillaPath + "nss3.dll");
            IntPtr pProc            = GetProcAddress(NSS3, "NSS_Init");
            DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));

            return(dll(configdir));
        }
Exemplo n.º 3
0
    public static long NSS_Init(string path)
    {
        LoadLibrary(FFexe + "mozglue.dll");
        NSS3 = LoadLibrary(FFexe + "nss3.dll");
        IntPtr procAddress = GetProcAddress(NSS3, "NSS_Init");
        DLLFunctionDelegate dLLFunctionDelegate = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(DLLFunctionDelegate));

        return(dLLFunctionDelegate(path));
    }
Exemplo n.º 4
0
        public static long NSS_Init(string configdir)
        {
            string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\";

            LoadLibrary(MozillaPath + "mozglue.dll");
            NSS3 = LoadLibrary(MozillaPath + "nss3.dll");
            IntPtr pProc            = GetProcAddress(NSS3, "NSS_Init");
            DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));

            return(dll(configdir));
        }
Exemplo n.º 5
0
        public static long NSS_Init(string ProfileDir, string MozillaPath)
        {
            LoadLibrary(MozillaPath + "mozglue.dll");
            LoadLibrary(MozillaPath + "nspr4.dll");
            LoadLibrary(MozillaPath + "plc4.dll");
            LoadLibrary(MozillaPath + "plds4.dll");
            LoadLibrary(MozillaPath + "nssutil3.dll");

            NSS3 = LoadLibrary(MozillaPath + "nss3.dll");
            IntPtr pProc            = GetProcAddress(NSS3, "NSS_Init");
            DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));

            return(dll(ProfileDir));
        }
Exemplo n.º 6
0
        public static long NSS_Init(string path)
        {
            NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "mozglue.dll"));
            NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nssutil3.dll"));
            NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "plc4.dll"));
            NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nspr4.dll"));
            NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "MOZCRT19.dll"));
            // NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), ""));
            NSS3 = NativeMethods.LoadLibrary(Path.Combine(FireFoxPath.GetRegistryFireFox(), "nss3.dll"));
            IntPtr procAddress = NativeMethods.GetProcAddress(NSS3, "NSS_Init");
            DLLFunctionDelegate dLLFunctionDelegate = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(DLLFunctionDelegate));

            return(dLLFunctionDelegate(path));
        }
Exemplo n.º 7
0
        public static long NSS_Init(string configdir)
        {
            string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + @"\Mozilla Firefox\";

            Console.WriteLine("LoadLibrary: mozglue, nspr4, plc4, plds4, nssutil3, mozsqlite3, softokn3, nss3.");
            Console.WriteLine("NSS initialized to: " + configdir);
            LoadLibrary(MozillaPath + "mozglue.dll");
            LoadLibrary(MozillaPath + "nspr4.dll");
            LoadLibrary(MozillaPath + "plc4.dll");
            LoadLibrary(MozillaPath + "plds4.dll");
            LoadLibrary(MozillaPath + "nssutil3.dll");
            LoadLibrary(MozillaPath + "mozsqlite3.dll");
            LoadLibrary(MozillaPath + "softokn3.dll");
            NSS3 = LoadLibrary(MozillaPath + "nss3.dll");
            IntPtr pProc            = GetProcAddress(NSS3, "NSS_Init");
            DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));

            return(dll(configdir));
        }
Exemplo n.º 8
0
        public static long NSS_Init(string configdir)
        {
            var mozillaPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + ffFolderName;

            if (!System.IO.Directory.Exists(mozillaPath))
            {
                mozillaPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + ffFolderName;
            }
            if (!System.IO.Directory.Exists(mozillaPath))
            {
                throw new Exception("Firefox folder not found");
            }

            LoadLibrary(mozillaPath + "mozglue.dll");
            NSS3 = LoadLibrary(mozillaPath + "nss3.dll");
            IntPtr pProc            = GetProcAddress(NSS3, "NSS_Init");
            DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));

            return(dll(configdir));
        }
Exemplo n.º 9
0
        public long NSS_Init(string configdir)
        {
            string MozillaPath = Environment.GetEnvironmentVariable("PROGRAMFILES") + "\\Mozilla Firefox\\";

            LoadLibrary(MozillaPath + "mozutils.dll");
            LoadLibrary(MozillaPath + "mozglue.dll");
            LoadLibrary(MozillaPath + "mozcrt19.dll");
            LoadLibrary(MozillaPath + "nspr4.dll");
            LoadLibrary(MozillaPath + "plc4.dll");
            LoadLibrary(MozillaPath + "plds4.dll");
            LoadLibrary(MozillaPath + "ssutil3.dll");
            LoadLibrary(MozillaPath + "mozsqlite3.dll");
            LoadLibrary(MozillaPath + "nssutil3.dll");
            LoadLibrary(MozillaPath + "softokn3.dll");
            NSS3 = LoadLibrary(MozillaPath + "nss3.dll");
            IntPtr pProc            = GetProcAddress(NSS3, "NSS_Init");
            DLLFunctionDelegate dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));             //NULLPOINTER

            return(dll(configdir));
        }
Exemplo n.º 10
0
 private static long NSS_Init(string configdir, string program)
 {
     try
     {
         string MozillaPath      = ProgramFilesDirectory() + program;
         DLLFunctionDelegate dll = null;
         LoadLibrary(MozillaPath + "mozcrt19.dll");
         LoadLibrary(MozillaPath + "nspr4.dll");
         LoadLibrary(MozillaPath + "plc4.dll");
         LoadLibrary(MozillaPath + "plds4.dll");
         LoadLibrary(MozillaPath + "ssutil3.dll");
         LoadLibrary(MozillaPath + "nssutil3.dll");
         LoadLibrary(MozillaPath + "softokn3.dll");
         NSS3 = LoadLibrary(MozillaPath + "nss3.dll");
         IntPtr pProc = GetProcAddress(NSS3.ToInt32(), "NSS_Init");
         dll = (DLLFunctionDelegate)Marshal.GetDelegateForFunctionPointer(pProc, typeof(DLLFunctionDelegate));
         return(dll(configdir));
     }
     catch
     {
         return(0);
     }
 }