예제 #1
0
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;
}
예제 #2
0
CSetCursorPosHook::~CSetCursorPosHook ( void ) 
{
    WriteDebugEvent ( "CSetCursorPosHook::~CSetCursorPosHook" );

    if ( m_pfnSetCursorPos != NULL )
    {
        RemoveHook ( );
    }
}
예제 #3
0
void LoadOptions() {
    SM.Reset();
    options.Load();

    if (options.enabled) {
        InstallHook();
    }
    else {
        RemoveHook();
    }
}
예제 #4
0
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;
}
예제 #5
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;
}
예제 #6
0
파일: hips.c 프로젝트: hammackj/wintools
void UnloadDriver(IN PDRIVER_OBJECT DriverObject) 
{ 
UNICODE_STRING uszDeviceString; 
NTSTATUS ntStatus; 


//移除挂接 
RemoveHook(); 

IoDeleteDevice(DriverObject->DeviceObject); 

RtlInitUnicodeString(&uszDeviceString, L"\\DosDevices\\ITSys"); 
IoDeleteSymbolicLink(&uszDeviceString); 

}
예제 #7
0
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" );
}
예제 #8
0
파일: ApiHook.cpp 프로젝트: DjPasco/Mag
BOOL CApiHookMgr::UnHookImport(
	PCSTR pszCalleeModName, 
	PCSTR pszFuncName
	)
{
	CLockMgr<CCSWrapper>  lockMgr(sm_CritSec, TRUE);

	BOOL bResult = TRUE;
	try
	{
		bResult = RemoveHook(pszCalleeModName, pszFuncName);
	}
	catch (...)
	{
	}
	return bResult;
}
예제 #9
0
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;
}
예제 #11
0
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;
}
예제 #12
0
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);
}
예제 #13
0
파일: Invoke.cpp 프로젝트: Junch/wtl
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) ;
}
예제 #14
0
ApiHook::~ApiHook()
{
  RemoveHook();
}
예제 #15
0
파일: Hotkey.cpp 프로젝트: if1live/anemone
CHotkey::~CHotkey()
{
	RemoveHook();

	TerminateProcess(hHotkeyThread, 0);
}
MouseEventTool::~MouseEventTool()
{
    RemoveHook();
    delete [] remapping_;
}
예제 #17
0
파일: thunk.c 프로젝트: mingpen/OpenNT
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);
}
예제 #18
0
MouseEventTool::~MouseEventTool() {
    RemoveHook();
}
예제 #19
0
bool Command::RemovePosthook(int id)
{
    return RemoveHook(id, &_posthook);
}
예제 #20
0
bool Command::RemovePrehook(int id)
{
    return RemoveHook(id, &_prehook);
}
예제 #21
0
void AppController::exitApp()
{
	saveConfig(); //Save voice, volume, rate config
	RemoveHook();
	exitTraySystem(); //Remove icon Tray System
}