360双击CTRL桌面快捷搜索逆向

// 原理就是安装全局的WH_KEYBOARD_LL底层键盘钩子.主程序是360安装路径下的safemon文件夹下的searchdesktop.exe
// 安装底层键盘钩子
g_hHook =::SetWindowsHookEx( WH_KEYBOARD_LL, LowKeyboardProc, g_hDll, 0);

// 底层钩子过程
LRESULT CALLBACK LowKeyboardProc( int code, WPARAM wParam, LPARAM lParam )
{
    static BOOL bDbClicked = FALSE;
    static DWORD dwFirstClickTime = 0;
    static const DWORD DBCLICKTIME = 500;
    
    DWORD dwVKCode = ( DWORD )wParam;
    
    LRESULT lRet =::CallNextHookEx( g_hHook, code, wParam, lParam );
    if ( HC_ACTION != code )
    {
        return lRet;
    }
    
    KBDLLHOOKSTRUCT* pKbDllHookStruct = ( KBDLLHOOKSTRUCT* )( lParam );
    if ( NULL == pKbDllHookStruct )
    {
        return lRet;
    }
    
    if ( pKbDllHookStruct->flags & LLKHF_INJECTED )
    {
        return lRet;
    }
    
    if ( ( pKbDllHookStruct->vkCode != VK_LCONTROL ) && ( pKbDllHookStruct->vkCode != VK_RCONTROL ) )
    {
        dwFirstClickTime = 0;
        return lRet;
    }
    
    if ( wParam == WM_KEYUP )
    {
        if ( bDbClicked )
        {
            DWORD dwSecondClickTime = GetTickCount();
            DWORD dwIntervalTime = dwSecondClickTime - dwFirstClickTime;
            if ( dwIntervalTime < DBCLICKTIME )
            {
                SendMessage( g_hWndNotify, WM_MYMESSAGE, ( WPARAM )g_pCallback, ( LPARAM )g_pParam );
                dwFirstClickTime = 0;
                bDbClicked = FALSE;
                return lRet;
            }
            else
            {
                dwFirstClickTime = dwSecondClickTime;
                bDbClicked = FALSE;
            }
        }
        else
        {
            bDbClicked = FALSE;
        }
    }
    else
    {
        if ( dwVKCode == WM_KEYFIRST )
        {
            bDbClicked = TRUE;
        }
    }
    
    return lRet;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值