summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2017-02-04 19:38:36 +0000
committerReuben Thomas <rrt@sc3d.org>2017-02-09 00:28:24 +0000
commitedf345cce39e4a06173e937e85cf9ff58b08984c (patch)
tree1c577cdb87befef06624e1aed47dae95e5f03348
parentbd3e40a4b9c934b284caefe00b22869de1c7b0d4 (diff)
downloadenchant-edf345cce39e4a06173e937e85cf9ff58b08984c.tar.gz
Remove pre-loading of aspell on Windows
This should either be done for all back-ends or (preferably) not at all.
-rw-r--r--src/aspell/aspell_provider.c132
1 files changed, 0 insertions, 132 deletions
diff --git a/src/aspell/aspell_provider.c b/src/aspell/aspell_provider.c
index bb2c5b0..47f8ea3 100644
--- a/src/aspell/aspell_provider.c
+++ b/src/aspell/aspell_provider.c
@@ -276,135 +276,3 @@ init_enchant_provider (void)
return provider;
}
-
-
-#if defined(_WIN32)
-
-static WCHAR* GetDirectoryOfThisLibrary(void)
-{
- WCHAR dll_path[MAX_PATH];
- gchar* utf8_dll_path;
- gchar* utf8_prefix;
- gunichar2* utf16_prefix;
-
- if(!GetModuleFileNameW(s_hModule,dll_path,MAX_PATH))
- { /* unable to determine filename of this library */
- return NULL;
- }
- utf8_dll_path = g_utf16_to_utf8 (dll_path, -1, NULL, NULL, NULL);
- utf8_prefix = g_path_get_dirname(utf8_dll_path);
- g_free(utf8_dll_path);
-
- utf16_prefix = g_utf8_to_utf16 (utf8_prefix, -1, NULL, NULL, NULL);
- g_free(utf8_prefix);
-
- return utf16_prefix;
-}
-
-static HMODULE LoadLibraryFromPath(const WCHAR* path, const WCHAR* libraryName)
-{
- HMODULE h;
- WCHAR* wszFullLibraryPath;
- size_t fullLibraryPathLen;
-
- fullLibraryPathLen = wcslen(path) + 1 /* '\\' */+ wcslen(libraryName);
- wszFullLibraryPath = g_new0(WCHAR, fullLibraryPathLen + 1);
-
- wcscpy(wszFullLibraryPath, path);
- wcscat(wszFullLibraryPath, L"\\");
- wcscat(wszFullLibraryPath, libraryName);
-
- h = LoadLibraryW(wszFullLibraryPath);
-
- g_free(wszFullLibraryPath);
- return h;
-}
-
-static WCHAR* GetRegistryValue(HKEY baseKey, const WCHAR * uKeyName, const WCHAR * uKey)
-{
- HKEY hKey;
- unsigned long lType;
- DWORD dwSize;
- WCHAR* wszValue = NULL;
-
- if(RegOpenKeyExW(baseKey, uKeyName, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
- {
- /* Determine size of string */
- if(RegQueryValueExW( hKey, uKey, NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS)
- {
- wszValue = g_new0(WCHAR, dwSize + 1);
- RegQueryValueExW(hKey, uKey, NULL, &lType, (LPBYTE) wszValue, &dwSize);
- }
- }
-
- return wszValue;
-}
-#endif
-
-#if defined(_WIN32)
-gboolean load_library(EnchantProvider * me, const char *dir_name, const WCHAR *aspell_module_name)
-{
- HMODULE aspell_module = NULL;
- char* szModule;
-
- /* first try load from registry path */
- szModule = enchant_get_registry_value ("Aspell", "Module");
- if(szModule)
- {
- WCHAR* wszModule;
-
- wszModule = g_utf8_to_utf16 (szModule, -1, NULL, NULL, NULL);
- aspell_module = LoadLibraryW(wszModule);
- g_free(wszModule);
- }
-
- if (aspell_module == NULL)
- {
- /* next try load from aspell registry path */
- WCHAR* wszDirectory = GetRegistryValue (HKEY_LOCAL_MACHINE, L"Software\\Aspell", L"Path");
- if(wszDirectory)
- {
- aspell_module = LoadLibraryFromPath(wszDirectory, aspell_module_name);
- g_free(wszDirectory);
- }
- }
-
- if (aspell_module == NULL)
- {
- /* then try from same directory as provider */
- WCHAR* wszDirectory = GetDirectoryOfThisLibrary();
- if(wszDirectory)
- {
- aspell_module = LoadLibraryFromPath(wszDirectory, aspell_module_name);
- g_free(wszDirectory);
- }
- }
-
- if (aspell_module == NULL)
- {
- /* then try default lookup */
- aspell_module = LoadLibraryW(aspell_module_name);
- }
-
- if (aspell_module == NULL)
- {
- return FALSE;
- }
- return TRUE;
-}
-#endif
-
-void configure_enchant_provider(EnchantProvider * me, const char *dir_name)
-{
-#if defined(_WIN32)
- if(!load_library(me, dir_name, L"aspell-15.dll") &&
- !load_library(me, dir_name, L"libaspell-15.dll"))
- {
- /* we can't seem to load aspell. Avoid late binding problems later */
- g_warning("Unable to load library aspell-15.dll.");
- me->request_dict = NULL;
- me->dispose_dict = NULL;
- me->list_dicts = NULL;
- }
-#endif
-}