void StopMessageHook() { EnableMenuItem(mainMenu, ID_FILE_STOPHOOK, MF_DISABLED | MF_GRAYED); EnableMenuItem(mainMenu, ID_FILE_STARTHOOK, MF_ENABLED); AppendText(txtbox, TEXT("Stopping Message Hook\r\n")); //KillHook(); RemoveHook(); msgCount = 0; }
CSetCursorPosHook::~CSetCursorPosHook ( void ) { WriteDebugEvent ( "CSetCursorPosHook::~CSetCursorPosHook" ); if ( m_pfnSetCursorPos != NULL ) { RemoveHook ( ); } }
void LoadOptions() { SM.Reset(); options.Load(); if (options.enabled) { InstallHook(); } else { RemoveHook(); } }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { InstallHook(); MessageBox( NULL, "Hook installed. Press OK to remove and exit.", "DKER HOOK", MB_OK ); RemoveHook(); return 0; }
// // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; static HINSTANCE hinst; typedef void (*P)(); switch (message) { case WM_CREATE: { hinst = LoadLibrary(_T("VKeyDll.dll")); P SetHook = (P) GetProcAddress(hinst, "doSetGlobalHook"); SetHook(); } break; case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_ABOUT: DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break; case WM_DESTROY: { P RemoveHook = (P) GetProcAddress(hinst, "doRemoveGlobalHook"); RemoveHook(); FreeLibrary(hinst); PostQuitMessage(0); } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
void UnloadDriver(IN PDRIVER_OBJECT DriverObject) { UNICODE_STRING uszDeviceString; NTSTATUS ntStatus; //移除挂接 RemoveHook(); IoDeleteDevice(DriverObject->DeviceObject); RtlInitUnicodeString(&uszDeviceString, L"\\DosDevices\\ITSys"); IoDeleteSymbolicLink(&uszDeviceString); }
CTransCtrl::~CTransCtrl( ) { __Comment( "Desktop Control: Button Destroyed" ); DestroyButton( ); if( m_bHooked ) RemoveHook( ); if( hInst_res_x86 ) FreeLibrary( hInst_res_x86 ); hInst_res_x86 = NULL; __Comment( "Desktop Control Destructed" ); }
BOOL CApiHookMgr::UnHookImport( PCSTR pszCalleeModName, PCSTR pszFuncName ) { CLockMgr<CCSWrapper> lockMgr(sm_CritSec, TRUE); BOOL bResult = TRUE; try { bResult = RemoveHook(pszCalleeModName, pszFuncName); } catch (...) { } return bResult; }
void UnpatchEngine( void ) { #ifdef PATCH_ENGINE int i; Com_Printf( "Removing engine patches (GAME)\n" ); level.security.isPatched = qfalse; for ( i=0; i<numHooks; i++ ) RemoveHook( &hooks[i] ); #ifdef HOOK_Q3INFOBOOM PATCH( Q3IB_MSGPATCH, unsigned int, 0x1FF ); #endif #endif // PATCH_ENGINE }
BOOL APIENTRY DllMain (HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: AttachProcess(hModule); break; case DLL_PROCESS_DETACH: if (gOrigHookAddress != 0) RemoveHook(); break; } return TRUE; }
BOOL WINAPI DllMain(HMODULE hInstance, DWORD dwReason, PVOID lpReserved) { switch(dwReason) { case DLL_PROCESS_ATTACH: g_hInstance = hInstance; GetModuleFileName(hInstance, g_szPath, MAX_PATH); DisableThreadLibraryCalls(hInstance); InstallHook(GetCurrentThreadId()); return TRUE; case DLL_PROCESS_DETACH: RemoveHook(GetCurrentThreadId()); break; } return TRUE; }
void CJMBrkr::Shutdown() { if (::IsWindow(m_RegisterDialog.m_hWnd)) m_RegisterDialog.DestroyWindow(); if (::IsWindow(m_UtilWnd.m_hWnd)) m_UtilWnd.DestroyWindow(); m_Clients.clear(); if (m_hJMHookInst) { // Call Shutdown from JMHook.dll typedef BOOL(* PFNSHUTDOWN)(); PFNSHUTDOWN pfShutdown = (PFNSHUTDOWN)::GetProcAddress(m_hJMHookInst, _T("ForceShutdown")); if (pfShutdown) (pfShutdown)(); } RemoveHook(); exit(EXIT_SUCCESS); }
LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { HDC hdc ; PAINTSTRUCT ps ; RECT rect ; switch (iMsg) { case WM_CREATE: { HWND hwndPad=FindWindow(_T("Notepad"), 0); if (!hwndPad) MessageBox(NULL,_T("Does not find the Notepad"), _T("Error!"), MB_OK); else InstallHook(GetWindowThreadProcessId(hwndPad, 0)); break; } case WM_PAINT : hdc = BeginPaint (hwnd, &ps) ; GetClientRect (hwnd, &rect) ; DrawText (hdc, L"Hello, Windows 95!", -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER) ; EndPaint (hwnd, &ps) ; return 0 ; case WM_DESTROY : RemoveHook(); PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, iMsg, wParam, lParam) ; }
ApiHook::~ApiHook() { RemoveHook(); }
CHotkey::~CHotkey() { RemoveHook(); TerminateProcess(hHotkeyThread, 0); }
MouseEventTool::~MouseEventTool() { RemoveHook(); delete [] remapping_; }
BOOL APIENTRY ThunkDlgProc( HWND hDlg, unsigned message, DWORD wParam, LONG lParam ) { PNAME_LIST Item; switch (message) { case WM_INITDIALOG: SourceModule = NULL; ImportModule = NULL; ThunkCreateDriverList (); NameList2ComboBox (hDlg, IDM_THUNK_SOURCE, DriverList); NameList2ListBox (hDlg, IDM_THUNK_LIST, ActiveThunks); return (TRUE); case WM_COMMAND: switch(wParam) { // // end function // case COMBOCMD (CBN_SELCHANGE, IDM_THUNK_SOURCE): case COMBOCMD (CBN_SELCHANGE, IDM_THUNK_IMPORT): Item = GetComboSelection (hDlg, IDM_THUNK_SOURCE); if (Item && Item != SourceModule) { SourceModule = Item; NameList2ComboBox (hDlg, IDM_THUNK_IMPORT, Item->ChildList); } Item = GetComboSelection (hDlg, IDM_THUNK_IMPORT); if (Item && Item != ImportModule) { ImportModule = Item; NameList2ComboBox (hDlg, IDM_THUNK_FUNCTION, Item->ChildList); } break; case IDM_THUNK_REMOVE: RemoveHook (hDlg); break; case IDM_THUNK_CLEAR_ALL: ClearAllHooks (hDlg); break; case IDM_THUNK_ADD: AddThunk (hDlg); break; case IDOK: case IDCANCEL: //DlgThunkData (hDlg); FreeNameList (DriverList); DriverList = NULL; EndDialog(hDlg, DIALOG_SUCCESS); return (TRUE); } } return (FALSE); }
MouseEventTool::~MouseEventTool() { RemoveHook(); }
bool Command::RemovePosthook(int id) { return RemoveHook(id, &_posthook); }
bool Command::RemovePrehook(int id) { return RemoveHook(id, &_prehook); }
void AppController::exitApp() { saveConfig(); //Save voice, volume, rate config RemoveHook(); exitTraySystem(); //Remove icon Tray System }