zoukankan      html  css  js  c++  java
  • 过用户层HOOK思路

    以FindWinow为例,首先逆向FindWindow,分析写出下面代码

    #pragma pack(1)
    typedef struct _UNICODE_STRING {
        USHORT Length;
        USHORT MaximumLength; 
        PWSTR  Buffer;
     
    } UNICODE_STRING,*PUNICODE_STRING;
    #pragma pack()

    __declspec(naked) void sysFastCall()
    {

     __asm{
      mov edx,esp
      __emit 0x0f
      __emit 0x34
     }
    }

    __declspec(naked)  HWND  __stdcall My_FindWindow(
                int p1,
                int p2,
                PUNICODE_STRING pu_classname,
                PUNICODE_STRING pu_catption,
                int p5)
    {
     __asm
     {
      MOV EAX,0x1179
       call sysFastCall
       RETN 0x14
       
     }
    }

    下面是调用:


    void CFindWindowsDemoDlg::OnBtnMyFindwindow()
    {
     // TODO: Add your control notification handler code here
     UNICODE_STRING pu_className,pu_Caption;
     typedef   (__stdcall *PRtlInitUnicodeString)(PUNICODE_STRING, PCWSTR);
     PRtlInitUnicodeString  RtlInitUnicodeString;
     RtlInitUnicodeString=(PRtlInitUnicodeString)GetProcAddress(GetModuleHandle("ntdll.dll"),"RtlInitUnicodeString");
     RtlInitUnicodeString(&pu_className,L"SciCalc");
     RtlInitUnicodeString(&pu_Caption,L"计算器");
     HWND h=My_FindWindow(0,0,&pu_className,&pu_Caption,0);
      ::SendMessage(h,WM_CLOSE,0,0);
    }

  • 相关阅读:
    Linux之网络基础
    Tomcat配置虚拟目录并发布web应用
    Linux之权限管理操作
    Linux之shell编程基础
    Python简介
    Python代码注释 Python零基础入门教程
    Python Pycharm Anacanda 区别
    Python Hello World入门
    Python2.x 和 Python3.x,如何选择?
    数据库课程设计心得【1】
  • 原文地址:https://www.cnblogs.com/einyboy/p/2529848.html
Copyright © 2011-2022 走看看