diff --git a/AltDrag.ini b/AltDrag.ini index 7f875da..a7d13bb 100644 Binary files a/AltDrag.ini and b/AltDrag.ini differ diff --git a/altdrag.c b/altdrag.c index 6afacf4..7a8fa01 100644 --- a/altdrag.c +++ b/altdrag.c @@ -163,7 +163,7 @@ int HookSystem() { wcscat(path, L"\\hooks.dll"); hinstDLL = LoadLibrary(path); if (hinstDLL == NULL) { - Error(L"LoadLibrary('hooks.dll')", L"This probably means that the file hooks.dll is missing.\nYou can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + Error(L"LoadLibrary('hooks.dll')", L"This probably means that the file hooks.dll is missing. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); return 1; } } @@ -173,7 +173,7 @@ int HookSystem() { //Get address to keyboard hook (beware name mangling) procaddr = (HOOKPROC)GetProcAddress(hinstDLL, "LowLevelKeyboardProc@12"); if (procaddr == NULL) { - Error(L"GetProcAddress('LowLevelKeyboardProc@12')", L"This probably means that the file hooks.dll is from an old version or corrupt.\nYou can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + Error(L"GetProcAddress('LowLevelKeyboardProc@12')", L"This probably means that the file hooks.dll is from an old version or corrupt. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); return 1; } //Set up the keyboard hook @@ -188,7 +188,7 @@ int HookSystem() { //Get address to message hook (beware name mangling) procaddr = (HOOKPROC)GetProcAddress(hinstDLL, "CallWndProc@12"); if (procaddr == NULL) { - Error(L"GetProcAddress('CallWndProc@12')", L"This probably means that the file hooks.dll is from an old version or corrupt.\nYou can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + Error(L"GetProcAddress('CallWndProc@12')", L"This probably means that the file hooks.dll is from an old version or corrupt. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); return 1; } //Set up the message hook @@ -254,7 +254,12 @@ int UnhookSystem() { //Tell dll file that we are unloading void (*Unload)() = (void*)GetProcAddress(hinstDLL, "Unload"); - Unload(); + if (Unload == NULL) { + Error(L"GetProcAddress('Unload')", L"This probably means that the file hooks.dll is from an old version or corrupt. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + } + else { + Unload(); + } //Unload library if (hinstDLL) { diff --git a/hooks.c b/hooks.c index 2c1171d..98bf429 100644 --- a/hooks.c +++ b/hooks.c @@ -945,7 +945,7 @@ __declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wP //Block the alt keyup to prevent the window menu to be selected. //The way this works is that the alt key is "disguised" by sending ctrl keydown/keyup events just before the altup (see issue 20). - if (vkey == VK_LMENU && (state.blockaltup || sharedstate.action)) { + if (state.blockaltup || sharedstate.action) { state.ignorectrl = 1; KEYBDINPUT ctrl[2] = {{VK_CONTROL,0,0,0}, {VK_CONTROL,0,KEYEVENTF_KEYUP,0}}; ctrl[0].dwExtraInfo = ctrl[1].dwExtraInfo = GetMessageExtraInfo(); @@ -1701,6 +1701,7 @@ __declspec(dllexport) LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPA __declspec(dllexport) void Unload() { sharedsettings_loaded = 0; + #ifndef _WIN64 DestroyWindow(g_hwnd); if (scrollhook) { if (UnhookWindowsHookEx(scrollhook) == 0) { @@ -1708,6 +1709,7 @@ __declspec(dllexport) void Unload() { } scrollhook = NULL; } + #endif } BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) { diff --git a/hookwindows_x64.c b/hookwindows_x64.c index d7df870..ef1e06d 100644 --- a/hookwindows_x64.c +++ b/hookwindows_x64.c @@ -88,7 +88,7 @@ int HookSystem() { wcscat(path, L"\\hooks_x64.dll"); hinstDLL = LoadLibrary(path); if (hinstDLL == NULL) { - Error(L"LoadLibrary('hooks_x64.dll')", L"This probably means that the file hooks_x64.dll is missing.\nYou can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + Error(L"LoadLibrary('hooks_x64.dll')", L"This probably means that the file hooks_x64.dll is missing. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); return 1; } } @@ -98,7 +98,7 @@ int HookSystem() { //Get address to keyboard hook (beware name mangling) procaddr = (HOOKPROC)GetProcAddress(hinstDLL, "LowLevelKeyboardProc"); if (procaddr == NULL) { - Error(L"GetProcAddress('LowLevelKeyboardProc')", L"This probably means that the file hooks_x64.dll is from an old version or corrupt.\nYou can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + Error(L"GetProcAddress('LowLevelKeyboardProc')", L"This probably means that the file hooks_x64.dll is from an old version or corrupt. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); return 1; } //Set up the keyboard hook @@ -113,7 +113,7 @@ int HookSystem() { if (!msghook) { procaddr = (HOOKPROC)GetProcAddress(hinstDLL, "CallWndProc"); if (procaddr == NULL) { - Error(L"GetProcAddress('CallWndProc')", L"This probably means that the file hooks_x64.dll is from an old version or corrupt.\nYou can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + Error(L"GetProcAddress('CallWndProc')", L"This probably means that the file hooks_x64.dll is from an old version or corrupt. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); return 1; } //Set up the message hook @@ -148,9 +148,14 @@ int UnhookSystem() { } msghook = NULL; - //Clear sharedsettings_loaded flag in dll (sometimes it isn't cleared because msghook keeps it alive somehow) - void (*ClearSettings)() = (void*)GetProcAddress(hinstDLL, "ClearSettings"); - ClearSettings(); + //Tell dll file that we are unloading + void (*Unload)() = (void*)GetProcAddress(hinstDLL, "Unload"); + if (Unload == NULL) { + Error(L"GetProcAddress('Unload')", L"This probably means that the file hooks_x64.dll is from an old version or corrupt. You can try to download "APP_NAME" again from the website.", GetLastError(), TEXT(__FILE__), __LINE__); + } + else { + Unload(); + } if (hinstDLL) { //Unload library diff --git a/localization/config.h b/localization/config.h index c6ef5ed..215c321 100644 --- a/localization/config.h +++ b/localization/config.h @@ -60,8 +60,8 @@ struct strings { }; #include "../localization/en-US/config.h" -#include "../localization/es-ES/config.h" -#include "../localization/gl-ES/config.h" +//#include "../localization/es-ES/config.h" +//#include "../localization/gl-ES/config.h" #include "../localization/zh-CN/config.h" struct { @@ -70,8 +70,8 @@ struct { wchar_t *language; } languages[] = { {L"en-US", &en_US, L"English"}, - {L"es-ES", &es_ES, L"Spanish"}, - {L"gl-ES", &gl_ES, L"Galician"}, + //{L"es-ES", &es_ES, L"Spanish"}, + //{L"gl-ES", &gl_ES, L"Galician"}, {L"zh-CN", &zh_CN, L"Chinese"}, {NULL} };