Skip to content

Commit

Permalink
Assume the hook is gone even if unhooking failed.
Browse files Browse the repository at this point in the history
Update version number to 0.9rc1.
  • Loading branch information
stefansundin committed Dec 29, 2014
1 parent 0055ed1 commit 3dc795e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
Binary file modified AltDrag.ini
Binary file not shown.
24 changes: 8 additions & 16 deletions altdrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

//App
#define APP_NAME L"AltDrag"
#define APP_VERSION "0.9b1"
#define APP_VERSION "0.9rc1"
#define APP_URL L"http://code.google.com/p/altdrag/"
#define APP_UPDATE_STABLE L"http://altdrag.googlecode.com/svn/wiki/latest-stable.txt"
#define APP_UPDATE_UNSTABLE L"http://altdrag.googlecode.com/svn/wiki/latest-unstable.txt"
Expand Down Expand Up @@ -238,32 +238,26 @@ int UnhookSystem() {

//Remove keyboard hook
if (keyhook) {
if (UnhookWindowsHookEx(keyhook) != 0) {
keyhook = NULL;
}
else {
if (UnhookWindowsHookEx(keyhook) == 0) {
Error(L"UnhookWindowsHookEx(keyhook)", L"Could not unhook keyboard. Try restarting "APP_NAME".", GetLastError(), TEXT(__FILE__), __LINE__);
}
keyhook = NULL;
}

//Remove mouse hook
if (mousehook) {
if (UnhookWindowsHookEx(mousehook) != 0) {
mousehook = NULL;
}
else {
if (UnhookWindowsHookEx(mousehook) == 0) {
Error(L"UnhookWindowsHookEx(mousehook)", L"Could not unhook mouse. Try restarting "APP_NAME".", GetLastError(), TEXT(__FILE__), __LINE__);
}
mousehook = NULL;
}

//Remove message hook
if (msghook) {
if (UnhookWindowsHookEx(msghook) == 0) {
msghook = NULL;
}
else {
Error(L"UnhookWindowsHookEx(msghook)", L"Could not unhook windows. Try restarting "APP_NAME".", GetLastError(), TEXT(__FILE__), __LINE__);
}
msghook = NULL;

//Close HookWindows_x64.exe
if (x64) {
Expand All @@ -283,12 +277,10 @@ int UnhookSystem() {

//Unload library
if (hinstDLL) {
if (FreeLibrary(hinstDLL) != 0) {
hinstDLL = NULL;
}
else {
if (FreeLibrary(hinstDLL) == 0) {
Error(L"FreeLibrary()", L"Could not free hooks.dll. Try restarting "APP_NAME".", GetLastError(), TEXT(__FILE__), __LINE__);
}
hinstDLL = NULL;
}

//Success
Expand Down
1 change: 1 addition & 0 deletions include/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void Error(wchar_t *func, wchar_t *info, int errorcode, wchar_t *file, int line)
fwprintf(f, L"%s\n\n", msg);
fclose(f);
#else
//Tip: You can also press Ctrl+C in a MessageBox window to copy the text
HHOOK hhk = SetWindowsHookEx(WH_CBT, &ErrorMsgProc, 0, GetCurrentThreadId());
int response = MessageBox(NULL, msg, APP_NAME" Error", MB_ICONERROR|MB_YESNO|MB_DEFBUTTON2);
UnhookWindowsHookEx(hhk);
Expand Down
4 changes: 2 additions & 2 deletions localization/en-US/info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ AltDrag is open source, licensed under GPL.

Changelog
---------
0.9 release candidate:
0.9 release candidate - 2011-01-22:
Added InactiveScroll. Enable it to scroll inactive windows.
Fixed bug with custom taskbar locations.
Fixed major bug with custom taskbar locations (only present in the beta).
Expanded Aero option.
Expanded AutoRemaximized option.
It is now possible to toggle the maximized state with a resize button while dragging.
Expand Down

0 comments on commit 3dc795e

Please sign in to comment.