private static void InitializeDelegates(DirectoryInfo thunderbirdProfilePath, DirectoryInfo thunderbirdPath) { //Return if under thunderbird 35 (35+ supported) //thunderbird changes their DLL heirarchy/code with different releases //So we need to avoid trying to load a DLL in the wrong order //To prevent pop up saying it could not load the DLL if (new Version(FileVersionInfo.GetVersionInfo(thunderbirdPath.FullName + "\\thunderbird.exe").FileVersion).Major < new Version("35.0.0").Major) { return; } _dll1 = NativeMethods.LoadLibrary(thunderbirdPath.FullName + "\\msvcr100.dll"); _dll2 = NativeMethods.LoadLibrary(thunderbirdPath.FullName + "\\msvcp100.dll"); _dll3 = NativeMethods.LoadLibrary(thunderbirdPath.FullName + "\\msvcr120.dll"); _dll4 = NativeMethods.LoadLibrary(thunderbirdPath.FullName + "\\msvcp120.dll"); _dll5 = NativeMethods.LoadLibrary(thunderbirdPath.FullName + "\\mozglue.dll"); _nssModule = NativeMethods.LoadLibrary(thunderbirdPath.FullName + "\\nss3.dll"); IntPtr pProc = NativeMethods.GetProcAddress(_nssModule, "NSS_Init"); NSS_InitPtr NSS_Init = (NSS_InitPtr)Marshal.GetDelegateForFunctionPointer(pProc, typeof(NSS_InitPtr)); NSS_Init(thunderbirdProfilePath.FullName); _keySlot = PK11_GetInternalKeySlot(); PK11_Authenticate(_keySlot, true, 0); }
private static void InitializeDelegates(DirectoryInfo firefoxProfilePath, DirectoryInfo firefoxPath) { LoadLibrary(firefoxPath.FullName + "\\msvcp120.dll"); LoadLibrary(firefoxPath.FullName + "\\msvcr120.dll"); LoadLibrary(firefoxPath.FullName + "\\mozglue.dll"); nssModule = LoadLibrary(firefoxPath.FullName + "\\nss3.dll"); IntPtr pProc = GetProcAddress(nssModule, "NSS_Init"); NSS_InitPtr NSS_Init = (NSS_InitPtr)Marshal.GetDelegateForFunctionPointer(pProc, typeof(NSS_InitPtr)); NSS_Init(firefoxProfilePath.FullName); long keySlot = PK11_GetInternalKeySlot(); PK11_Authenticate(keySlot, true, 0); }
public static void Init(string configDir) { string path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @" (x86)\Mozilla Firefox\"; if (!Directory.Exists(path)) { path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\Mozilla Firefox\"; } LoadLibrary(path + "msvcr100.dll"); LoadLibrary(path + "msvcp100.dll"); LoadLibrary(path + "mozglue.dll"); _nss3DllPtr = LoadLibrary(path + "nss3.dll"); NSS_InitPtr delegateForFunctionPointer = (NSS_InitPtr)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_nss3DllPtr, "NSS_Init"), typeof(NSS_InitPtr)); delegateForFunctionPointer(configDir); PK11_Authenticate(PK11_GetInternalKeySlot(), true, 0L); }
private static void InitializeDelegates(DirectoryInfo firefoxProfilePath, DirectoryInfo firefoxPath) { if (new Version(FileVersionInfo.GetVersionInfo(firefoxPath.FullName + "\\firefox.exe").FileVersion).Major < new Version("35.0.0").Major) { return; } NativeMethods.LoadLibrary(firefoxPath.FullName + "\\msvcr100.dll"); NativeMethods.LoadLibrary(firefoxPath.FullName + "\\msvcp100.dll"); NativeMethods.LoadLibrary(firefoxPath.FullName + "\\msvcr120.dll"); NativeMethods.LoadLibrary(firefoxPath.FullName + "\\msvcp120.dll"); NativeMethods.LoadLibrary(firefoxPath.FullName + "\\mozglue.dll"); nssModule = NativeMethods.LoadLibrary(firefoxPath.FullName + "\\nss3.dll"); IntPtr pProc = NativeMethods.GetProcAddress(nssModule, "NSS_Init"); NSS_InitPtr NSS_Init = (NSS_InitPtr)Marshal.GetDelegateForFunctionPointer(pProc, typeof(NSS_InitPtr)); NSS_Init(firefoxProfilePath.FullName); long keySlot = PK11_GetInternalKeySlot(); PK11_Authenticate(keySlot, true, 0); }