Detours (api hook)library介绍

Detours注入DLL钩子入门教程 本教程非常初级,适合新手食用 开发环境,WIN10 64bit, VS2022 首先在GITHUB下载源码。GitHub - microsoft/Detours: Detours is a software package for monitoring and instrumenting API calls on Windows. It is distributed in source code form.Detours is a software package for monitor... 阅读详情
++++++++++++++++++++++++
In-line function hooking (see especially the Detours library from Hunt/Brubacher)
++++++++++++++++++++++++

Detours library (using it raw or unmodified): 

 - user-level hooking only

   why? because what detours lib does is overwrite the first 5 bytes of
   the hooked function ... and if the hooked function lives in kernel
   space, then we'll get a fatal mem error when we try to overwrite 
   these bytes

   --> confirm : c'est vrai. also the addys of kernel syscalls not
       accessible in same way that addys of win32 api are. so can't use
       existing framework to trivially obtain kernel function addys,
       i.e. those found in the SSDT. Even forgetting for a moment that
       operating as a userland program we wouldn't have sufficient
       permissions to change the permissions on such memory regions in the
       way that is done here for detours.

   ==> in summary, not trivial to adapt detours to work for kernel syscall
       hooking, is not clear that it would be better to adapt detours vs. to
       start from scratch for such a goal.

 - also check on whether detours is an NT/XP/2k/2003 only soln or whether
   also works on '9x ===> seems not.

   - works for all x86 versions of NT, Win2K, XP

   "However, under Windows 95, Windows 98, and Windows ME, the DetourFunction*
    APIs do not work unless the program is running under a debugger (the
    process was created with the DEBUG_PROCESS flag on the call to the
    CreateProcess* APIs)."

    --> limitation derives from two sources: 

	(1) non-support of Win '9x (including Win ME) for 
	    CreateRemoteThread(...) is why injdll doesn't work for Win '9x

	(2) the fact that shared virtual memory (which goes from 2 GB to 3 GB 
	in Win '9x) is not copy-on-write. So VirtualProtect, VirtualProtectEx 
	don't work on memory regions w/in that range. 

	System DLLs are mapped into that area. So we can't (trivially) change 
	the permission on memory regions containing win32 api functions... 
	which means we can't overwrite the first five bytes of such functions 
	to cause control to transfer to our detour function.

	==> note that if the process is created with the DEBUG_PROCESS
	    flag, DLLs *are* mapped with copy-on-write protection...
	   
        ==> so does VirtualProtect{Ex} still fail in such a case?

	    if so, then even if we modify "withdll.exe" to create the
	    process with the DEBUG_PROCESS flag, we still can't use
	    detours in its present form to hook Win '9x

            if not, then GetProcAddress(...) appears to operate
            differently for Win '9x apps run in Debug mode, i.e. it
            returns a debug thunk address, not the actual address

	    - so, would take some work to adapt detours to follow the
	      debug thunk to the actual code and overwrite that there?

       Appears that if we ONLY use "withdll" with our target executables
       and use -d:traceapi and change <detours/src/creatwith.cpp> function
       DetourCreateProcessWithDll{A,W} to create the process with the
       DEBUG_PROCESS creation flag, that hooking will work on Win '9x.

       ==> Maybe there's still a hangup which maybe has to do with 
	   the fact that FlushInstructionCache(...) isn't supported
	   for Win '9x or maybe it works correctly transparently.

    ======================================================================
    So I think the deal here is that the problem comes in overwriting the
    first 5 bytes of target functions

    Target functions by and large live in DLLs

    DLLs live in shared virtual memory

    For Win '9x, shared virtual memory is from 2 GB to 3 GB

    And the function which changes the permissions on memory SO THAT 5
    bytes of it can be overwritten DOESNT work for Win '9x for shared
    virtual memory

     - VirtualProtect, VirtualProtectEx for Win '9x (and ME) don't work
       for shared virtual mem (2GB to 3GB)

     - system DLLs are loaded into shared virtual mem

     - so if we want to change the code in one such DLL's function (which
       presumably also lives in that 2 GB to 3 GB space) then we'd need
       to first change the mem permissions on that area to READ/WRITE/EXEC

     - for Win '9x we cannot make that change via VirtualProtect nor
       VirtualProtectEx for any mem region w/in 2 GB to 3 GB

    I do believe that the "withdll" functionality still works... to inject
    a DLL into a user process, however "injdll" -- which injects a dll 
    into an *existing* user process -- would NOT work since that fxnality
    relies on CreateRemoteThread which isn't supported for Win '9x

    "While Windows NT, Windows 2000 and Windows XP always map DLLs into 
     processes with copy-on-write mapping (which Detours needs in order 
     to patch the binary image), Windows 95, Windows 98, and Windows ME 
     only map DLLs with copy-on-write if the process was started with 
     the DEBUG_PROCESS flag on the call to CreateProcess." [README]

    "Windows 95 doesn't implement copy-on-write in the operating system. 
     With copy-on-write, the operating system will share a common code 
     page in memory, but when a process writes to that memory, the memory 
     is copied so that the individual process gets its own copy that will 
     not interfere with any other process. In the Windows 95 architecture, 
     any memory that is above the 2GB line is shared among all processes. 
     If one process were to write a breakpoint to this shared memory area 
     without the copy-on-write, the breakpoint would apply to all processes, 
     not just the one being debugged."
    ======================================================================

    CreateRemoteThread(...) not supported for Win '9x

     - only supported for 2k, nt, xp

     - a means to injecting a DLL into a targeted process

       -- why is this necessary?

       -- absent this injection, you can't force a process to call your
          functions or, if it does, to be able to resolve those functions

     - we want to force a process to call LoadLibrary(...) with our DLL as the arg

     HANDLE CreateRemoteThread( HANDLE hProcess, // IN
				LPSECURITY_ATTRIBUTES lpThreadAttributes, // IN
				SIZE_T dwStackSize, // IN
				LPTHREAD_START_ROUTINE lpStartAddress, // IN
				LPVOID lpParameter, // IN
				DWORD dwCreationFlags, // IN
				LPDWORD lpThreadId // OUT
			      );
   
    // hProcess : a handle to the process in which this thread is to be created
       --> that handle must have the following access rights :
           (1) PROCESS_CREATE_THREAD
	   (2) PROCESS_QUERY_INFORMATION
	   (3) PROCESS_VM_OPERATION, PROCESS_VM_READ, PROCESS_VM_WRITE

    // lpThreadAttributes : pointer to security attributes of new thread
       --> specifies security descriptor for new thread
       --> if NULL, thread gets default security descriptor and the
	   returned thread handle canNOT be inherited

    // dwStackSize : initial size of the new thread's stack in bytes
       --> if 0, uses default size for the executable

    // lpStartAddress : pointer to application-defined function to be
    // executed by the thread; represents starting address of the thread
    // in the remote process

       --> ThreadProc function : is an application-defined function
           - serves as starting address for a thread

       DWORD WINAPI ThreadProc( LPVOID lpParameter );

       --> lpParameter : thread data passed to the function

    // lpParameter : pointer to var to be passed to thread function

    // dwCreationFlags : flags that control creation of the thread
       --> if 0, thread runs immediately after created

    // lpThreadId : pointer to a var that receives the thread ID
       --> if NULL, thread ID is not returned

 - So how do we use this?

   /* ------------------------------------------------------------
    * So we write our own version of TheadProc which essentially
    * calls LoadLibrary on the string provided
    * ------------------------------------------------------------ */
   DWORD WINAPI ThreadProc( LPVOID lpParameter ) {

      HMODULE targLib = LoadLibrary( lpParameter );

      return targLib;
   }   

   void main( ) {

      HANDLE hProcessForHooking = ;

      hThread = CreateRemoteThread( hProcessForHooking,
				    NULL,   // thread attrs
				    0,      // stack size
				    ThreadProc, // pointer to fxn to execute
				    "C://HookTool.dll", // argument to that fxn
				    0,      // creation flags
				    NULL ); // thread ID wont be returned
  }

 - so, the deal with detours is that there are a couple different
   functionalities on which other functionalities build

   +++++++++++++++++++++++++++++++++++++++++++++++++++++
   withdll : is defined in <detours/samples/withdll.cpp>
   +++++++++++++++++++++++++++++++++++++++++++++++++++++
   e.g. usage : withdll -d:traceapi.dll myexe.exe

    this will :

     (1) create a process with the specified app name and (optional) args

	 - this process is created with the suspend flag so that it is
	   initially suspended

         - this is done via : <detours/samples/creatwith.cpp> function :

	   P = DetourCreateProcessWithDll{A,W}

    (2) then <detours/src/creatwith.cpp> function : 

	InjectLibrary( P.hProcess,
		       P.hThread,
		       GetProcessAddress(
		         GetModuleHandle{A,W}(kernel32.dll),
			 LoadLibrary{A,W} ),
		       traceapi.dll,
		       strlen(traceapi.dll) + 1 );

        which :

	 (a) suspends the thread

	 (b) gets the contents of the control registers (ESP, EIP, EBP, ...)

	   -- which includes current stack pointer (ESP)
	   -- sets nCodeBase = ESP - { space for our assembly code + 
				       space for our args }

	      ==> we're going to write some assembly code and this is the
		  address (within the addy space of the given process) where
		  that code will begin (and so execution should begin)

           -- will create a buffer with assembly code instructions which will :

	      (1) PUSH "your_dll_name" onto the stack
	      (2) CALL LoadLibrary (where (1) is arg to that call)
	      (3) restore the EAX, EBX, ..., ESI, EDI, EBP, ESP, ...
		  values to what they are in (b)
              (4) JMP <to original code start, EIP from (b)>

	   -- then makes stack pointer point 4 below

	   -- and instruction pointer point to where your code will be
              written to (nCodeBase)

	 - changes permissions to read/write nCodeBase

	 - writes starting at nCodeBase with above assembly code (which will
	   cause app to LoadLibrary( yourdll ) then restore the registers
	   to their current contents (before that call) then return to
	   the code they were originally going to execute)

         - then calls FlushInstructionCache(...) to make sure that this
	   new code (starting at nCodeBase) overwrites any existing code 
	   in memory for this process

	 - then sets the thread context so that the new ESP and EIP will take hold

	 - then resumes the thread's execution

	 ==> basically inserts a LoadLibrary(...) call for an arbitrary
	     DLL (specified by you via the command line) into the process's
	     code so that this LoadLibrary is done before the process begins
	     executing then the process returns to exec'ing its normal /
	     original code.

    --> so the 64k question is : is this fxnality supported on Win '9x?

	- well, FlushInstructionCache in Win '9x has no effect

	- for Win '9x, VirtualProtectEx cannot be used on any mem region
	  in shared virtual address space (0x8000000 - 0xbfffffff)
	  -- which is from 2 GB to 3 GB in the virtual addy space
	  -- as noted, this region is shared between processes
	  -- system DLLs are loaded here, also memory mapped files are
	     mapped here

        ==> So in this case the memory whose protection bits we want to
	    change lives on the user stack, which is probably somewhere in
	    the user virtual addy space (from 4 MB to 2 GB)

            - so we should be able to call VirtualProtectEx on that area

	    - and we should be allowed to execute code that lives on the stack
	      (in that location that we've just written w/our assembly code)

            - maybe the inability to call FlushInstructionCache to an
              effect is a deal breaker but, if not, seems that this
              functionality should hold for the win '9x model

   +++++++++++++++++++++++++++++++++++++++++++++++++++
   injdll : is defined in <detours/samples/injdll.cpp>
   +++++++++++++++++++++++++++++++++++++++++++++++++++
   e.g. usage : injdll -p:<pid> -d:traceapi.dll

   - this injects a DLL into an already-executing process (the PID of
     which is specified above as a command-line arg to this program)

   - this opens the specified process

   - then calls DetourContinueProcessWithDll{A,W} which is defined in 

     <detours/src/creatwith.cpp>

     - and which does :

       calls InjectLibraryOld (also in <detours/src/creatwith.cpp>)

       which in turn calls CreateRemoteThread to inject the provided dll
       (from the command line, e.g. "traceapi.dll" from above)

    ==> This (injdll) is the functionality that requires support for
	CreateRemoteThread and so is NOT supported for Win '9x
	except if the original process (which we are attempting to inject
	a DLL into was created in DEBUG mode, which is highly unlikely)

    - basically what this does is :

      (1) open specified process

      (2) allocates memory in that process with read/write permissions

      (3) writes ThreadFunc function and argument to it in that memory

      (4) then calls CreateRemoteThread -- passing function address and
	  arg address where just wrote ThreadFunc to that (remote)
	  process's address space as well as the name of the DLL to inject

      (5) then waits for that created thread to complete executing then
	  closes the handle to it then returns

    ==> won't work for Win '9x since CreateRemoteThread(...) not supported
	on that (those) platforms

--------
I. Intro
--------
Detours : library for intercepting arbitrary win32 binary functions (read:
	  win32 api functions) on x86 machines

 - interception code applied dynamically at run-time

 - replaces first few instructions of target function (which we'll call OVERWRITTEN)
   with an unconditional jump to the user-provided detour function

 - then the trampoline function consists of: OVERWRITTEN then an
   unconditional jump to the remainder of the target function

 - the detour function can then invoke the target function as a subroutine
   via invoking the trampoline function

 - detours are inserted at execution time 

   -- code of target function modified in memory

 - detours guaranteed to work "regardless of the mehod used by the app or
   system code to locate the target function"

   -- think they really mean : "regardless of whether the function is (in a
      library) that is statically linked, dynamically linked or delay loaded..."

Detours also provides functions : 

 - to edit the IAT of any binary
 - to inject a DLL into a new or an existing process
   -- then the injected DLL can can detour any win32 function "whether in
      the application or system libraries"
 - to attach arbitrary data segments to existing binaries

------------------
II. Implementation
------------------
===================================
A. Interception of binary functions
===================================
 - at runtime, detours replaces first few instructions of target function
   with an unconditional jump to user-provided detour function

 - when execution reaches the target function, control jumps directly to
   the user-supplied detour function

 - detour function does whatever

 - then detour function may return control to the source function (the
   original caller) OR may invoke the trampoline function - which invokes
   the target function without interception

 - when the target function completes, it returns control to the detour function

 - the detour function does whatever then returns control to the source function

++++
How?
++++
The detours library intercepts target functions by rewriting their
in-process binary image

 - rewrites target function
 - rewrites matching trampoline function

The tramp function can be allocated dynamically or statically.

 - if statically, the trampoline always invokes the target function w/o
   the detour

 - before insert a detour, static trampoline contains single jump to target fxn

 - after insert detour, trampoline contains OVERWRITTEN and jmp to remainder
   of target function

-----------------------
To detour a function...
-----------------------
 - alloc mem for dynamic tramp fxn (if no static tramp provided)

 - enable write access to both the target and the tramp

 - copies instructions from target to tramp until at least 5 bytes have
   been copied

 - then adds a jmp instruction at end of tramp to the first non-copied
   instruction of target fxn

 - restore original page permissions on both target and tramp

 - flushes CPU instruction cache

==================================
B. Payloads and DLL Import Editing
==================================
Attach arbitrary data segments to a win32 binary ("payloads")
Edit DLL import address tables

Detours creates new section : .detours

 - between export table (the RVA of which is specified in the 0'th entry
   of the DataDirectory which itself is in the Optional Headers which are
   part of the IMAGE_NT_HEADERS of a PE file) and the debug symbols

 - debug symbols MUST reside last in a win32 binary

 - the .detours section contains a detours header record and a copy of the
   original PE header (PE header == IMAGE_NT_HEADERS)

 - if modifying the IAT, detours creates new IAT, appends it to the copied
   PE header, then makes the original PE header point to the new IAT

   -- "makes the original PE header point to the new IAT" == change the
      RVA stored in the second entry in the Data Directory (which points
      to the IAT RVA) to contain the RVA of the new IAT in our .detours section

 - any data segments to be added are then written at the end of the
   .detours section then the debug symbols are appended

 - reversal easy : restor original PE header from .detours section then
   remove .detours section

---------------------
Why create a new IAT?
---------------------
 - preserves original IAT

 - new IAT can contain renamed import DLLs and functions or entirely new
   DLLs and functions

   --> can make YOUR DLL be the first one loaded when an app runs

 - question : so this is done at run-time? when, precisely? after the app
   has been loaded? or before? (before makes mor sense but how modify
   app's image in mem before that app has been loaded?)

Detours also provides routines for enumerating the binary files mapped
into an address space; can also locate payloads w/in those mapped binaries

 - each payload identified by a 128-bit globally unique identifier (guid)

OK. I think this actually modifies the binaries on disk ... not just in mem

 - which makes more sense

----------------------------------------------
Injecting a DLL into a new or existing process
----------------------------------------------
 - inject : detours writes LoadLibrary(...) call into the target process
   with VirtualAllocEx and WriteProcessMemory then invokes call with
   CreateRemoteThread 

   ==> believe this is NOT supported on Win '9x : CONFIRM

   ==> and figure : can detours itself be used on a Win '9x machine?

------------------
III. Using Detours
------------------
User code must include the detours.h header file and link with detours.lib

(1) to intercept a function with a static trampoline

 - create the trampoline with the DETOUR_TRAMPOLINE macro

 DETOUR_TRAMPOLINE( trampoline_prototype, target_name )

 e.g. DETOUR_TRAMPOLINE( VOID WINAPI SleepTrampoline( DWORD ),
			 Sleep );

 fyi, Actual Sleep function signature (from windows.h, is in kernel32.dll):

   VOID Sleep( DWORD dwMilliseconds );

 "Note that for proper interception: the prototype, target, trampoline,
  and detour functions must all have exatly the same call signature
  including number of arguments and calling convention."

 interecepting the target function : invoke DetourFunctionWithTrampoline
 with two args : (1) trampoline, (2) pointer to the detour function

     note that the target function is already encoded in the trampoline
     and so it not needed as an arg

 e.g. DetourFunctionWithTrampoline( (PBYTE)SleepTrampoline,
				    (PBYTE)SleepDetour );

 where

 VOID WINAPI SleepDetour( DWORD dw ) {

    return SleepTrampoline( dw );
 }

(2) to intercept a function with a dynamic trampoline

 - call DetourFunction with two arguments : (1) a pointer to the target
   function and a pointer to the detour function

 - e.g. 
   
   #include <windows.h>
   #include <detours.h>

   VOID (*DynamicTrampoline)(VOID) = NULL;

   VOID DynamicDetour( VOID ) {

	return DynamicTrampoline();
   }

   void main( void ) {

      VOID (*DynamicTarget)(VOID) = TargetFunction;

      DynamicTrampoline = (FUNCPTR)DetourFunction( (PBYTE)DynamicTarget,
						   (PBYTE)DynamicDetour );
      ...

      // below function can be used w/either static or dynamic tramps
      DetourRemoveTrampoline( DynamicTrampoline );
   }

 - DetourFunction : allocates a new trampoline and inserts the
   appropriate interception code into the target function

Static tramps very easy to use when target function is available as a link
symbol; 

DetourFindFunction : can find the pointer to a function when that function
is exported from a known DLL or if debugging symbols are available for the
target function's binary.

 - takes two args : the name of the binary and the name of the function

 - first tries via LoadLibrary(...) and GetProcAddress(...)

 - then uses ImageHlp library to search available debugging symbols

 - the fxn pointer returned by DetourFindFunction can be given to
   DetourFunction to create a dynamic trampoline

Programmer's responsibility to make sure that no other threads are
exec'ing in addy space while a detour is inserted or removed

 - one approach : call functions in the Detours library from a DLL main routine...

--------------
IV. Evaluation
--------------

Other approaches :

 (1) call replacement in app source code

  - calls to target fxn in app replaced with calls to detour fxn

  - requires access to source code

 (2) call replacement in app binary

  - modify app binary to replace calls to target fxn w/calls to detour fxn

  - requires being able to identify all applicable call sites

    -- requires symbolic info which may not be present in general binaries

    -- also would miss dynamically-linked calls to the target fxn
       (i.e. which work by loading dll then getprocaddress(...)) as well
       as calls which use late-demand binding?

 (3) DLL redirection

  - modify DLL import entries in binary to point to a detour DLL

  - fails to intercept DLL internal calls and calls on pointers obtained
    from GetProcAddress(...)

 (4) Breakpoint trapping

  - insert debugging breakpoint into the target function

  - have debugging exception handler invoke the detour function

  - but debugging exceptions suspend all application threads

  - requires second OS process to catch the debug exception

    ==> heavy performance penalty

============
References :
============
 http://research.microsoft.com/sn/detours/
 http://research.microsoft.com/~galenh/Publications/HuntUsenixNt99.pdf
 http://www.sisecure.com/pdf/cs-2003-01.pdf

+++++++++++++++++++
Detours Usage Notes
+++++++++++++++++++

(1) withdll

(2) setdll

(3) 


  
Windows API拦截实战:Detours Hook原理、配置与监控应用 API拦截(Hook)是Windows系统编程中的一项关键技术,它允许开发者在运行时动态修改或监控函数行为,而无需修改原始二进制代码。其核心原理通常涉及修改目标函数入口指令,将执行流重定向到自定义函数,再通过“蹦床”(Trampoline)机制安全地调用原函数。这项技术在软件调试、性能分析、安全监控和功能扩展等场景中具有重要价值。例如,在遗留系统分析、第三方组件行为监控或运行时诊断等场景,无侵入式的API拦截能有效解决源码缺失或服务不可中断的难题。本文以微软开源的Detours库为例,深入解析其通过指令修改 阅读详情

相关推荐

微信Hook模块性能优化:从注入点到异步架构的工程实践

Hook(钩子)技术是Windows平台下实现程序行为监控与修改的核心机制,其原理是通过修改目标程序的代码或数据流,插入自定义逻辑。这项技术在软件调试、安全监控以及自动化工具开发中具有重要价值。在即时通讯软件(如微信)的自动化场景中,Hook常用于实现消息监听、自动回复等高级功能。一个设计良好的Hook模块需要兼顾功能的正确性与执行的高效性,其性能直接影响宿主程序的稳定性和用户体验。本文聚焦于微信自动化生态中的性能瓶颈,深入探讨如何通过精准选择底层注入点、采用事件驱动的异步处理模型(生产者-消费者模式)来构

414

如何生成Detours.lib——Detours的使用准备

 Detours是微软开发的一个函数库,可用于捕获系统API。在用其进行程序开发之前,得做一些准备工作:一.下载Detours     在http://research.microsoft.com/sn/detours 可免费下载Detours,当前的最新版本是Detours Express 2.1 is available for immediate download under

sliufen的专栏 1万+

微信消息防撤回技术原理与实战:从Hook到数据备份的完整指南

在即时通讯软件中,消息撤回功能为用户提供了纠错便利,但其背后的客户端-服务器交互机制与本地数据处理逻辑,构成了现代软件工程中典型的数据同步与状态管理案例。理解这一机制,需要从网络协议分析、本地数据存储和进程间通信等基础技术切入。通过Hook技术拦截关键函数调用,或监控网络流量过滤特定指令,可以在不破坏原有通信流程的前提下,实现消息的本地留存。这种技术实践不仅有助于深入理解客户端安全与逆向工程原理,更在数据备份、通信审计等场景中具有实用价值。本文聚焦于微信平台,详细剖析了防撤回的三大实现路径——本地数据Hoo

weixin_34302561的博客 307

Detours使用方法,简单明了

什么是Detours detours是微软提供的一套工具,主要用于win32 API的拦截。 准备工作(环境) 首先下载detours的资源,地址:https://github.com/microsoft/detours 下载到本地后解压至任意文件夹; 打开cmd终端进到这个文件夹下,键入nmake; 编译完成后: 新建一个工程,将include中的detours.h移动至工程文件下; 将lib.X64(X86也有对应目录)下的detours.lib移动至工程文件下; 示例代码: #include &l

weixin_43414877的博客 1万+

Detours x86 与 x64 位编译好的静态库

Detours x86 与 x64 位编译好的静态库

Detours.lib 是微软开发的一个函数库,可用于捕获系统API。

网上几乎没有下载的,自己下载代码生成,也比较麻烦的,这儿有做好的一个

微软研究院Detour开发包之API拦截技术

我们截获函数执行最直接的目的就是为函数增添功能,修改返回值,或者为调试以及性能测试加入附加的代码,或者截获函数的输入输出作研究,破解使用。 通过访问源代码,我们可以轻而易举的使用重建(Rebuilding)操作系统或者应用程序的方法在它们中间插入新的功能或者做功能扩展。然而,在今天这个商业化的开发世界里,以及在只有二进制代码发布的系统中,研究人员几乎没有机会可以得到源代码。本文主要讨论De

逍遥剑客 3612

detours.lib

detours.lib Detours-Express-3.0 Hook api

微软Detours Hook库编译与使用

Detours 是微软开发的一个强大的Windows API钩子库,用于监视和拦截函数调用。它广泛应用于微软产品团队和众多独立软件开发中,旨在无需修改原始代码的情况下实现函数拦截和修改。Detours 在调试、监控、日志记录和性能分析等方面表现出色,已成为开发者的重要工具。本章将指导读者编译并使用Detours库,通过实现一个简单的弹窗替换功能,帮助读者熟悉该库的使用技巧。

微软技术分享 5120

Detours静态库

Detours 静态库,无需Detours.DLL,但此库只支持32位程序API函数拦截替换

detours.lib 下载- VC编程库

摘要:VC/C++源码,控件相关,detours.lib  发现许多VC编程朋友需要detours.lib这个文件,其它很多VC源码成品里面有这个文件,为了大家寻找方便,所以在这里专门提供detours.lib下载页面,感谢大家对源码爱好者的关注和支持。

Mhook vs Detours:两大Windows Hook库对比与选择指南

在Windows系统开发中,API钩子(Hook)技术是实现功能扩展、调试分析和安全防护的重要手段。**Mhook**作为一款轻量级开源Windows API钩子库,与微软官方的**Detours**库常被开发者拿来比较。本文将从核心功能、使用难度、性能表现和适用场景四个维度,为你提供一份清晰的选择指南,助你快速找到适合项目需求的钩子解决方案。 ## 📌 核心功能对比:谁的钩子更强大? #

gitblog_00275的博客 504

Android13 AudioFlinger混音流程全解析:从prepareTracks_l到threadLoop_write的底层实现

本文深入解析Android13 AudioFlinger混音流程,从prepareTracks_l到threadLoop_write的底层实现。详细剖析MixerThread的核心工作循环,包括音轨预处理、混音算法执行及硬件写入机制,帮助开发者优化音频性能并处理多音轨场景。

tea88的博客 1130

使用x86的detours库编写hook-dll

#include "detours.h" #pragma comment(lib,"detours.lib") typedef HANDLE (WINAPI *HOOK_CreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAcces, DWORD dwShareMode, LPSECU

学习,思考,记录 993

视觉机器人抓取实战:从物体定位到抓取估计的完整流程解析(附Python代码示例)

本文详细解析了视觉引导机器人抓取的完整技术流程,涵盖从物体定位、位姿估计到抓取估计的核心步骤。通过Python代码示例,演示了如何使用Open3D等工具进行点云处理、平面分割、PCA与ICP位姿估计,以及基于几何启发式的抓取生成方法,为机器人视觉抓取开发提供了清晰的实战指南。

peach的博客 913

3️⃣ Coze工作流基础教学(2025年全新版本)

Coze 工作流作为扣子平台的重磅工具,利用可视化节点,如大语言模型、插件、条件判断等,把复杂任务巧妙拆解成多步骤流程。它不仅支持自动化编排,还能实现跨系统协同,有效提升处理效率与输出稳定性。在那些对准确性或格式有严格要求的场景中,比如报告生成、旅行规划,Coze 工作流更是发挥着关键作用。

李同学Lino的博客 5855

关于api hook的知识整理

最近做一个小工具需要在win7的x86和x64上面hook一些系统api调用。使用原来的iat方式没有效果。 以下是在网上搜索到的一些讯息: MHOOK, AN API HOOKING LIBRARY, V2.2 http://codefromthe70s.org/mhook22.aspx Detours http://research.microsoft.com

Larry的专栏 1447

STC单片机 普通 I/O 口中断功能介绍和使用

STC32单片机 普通 I/O 口中断功能介绍和使用

perseverance51博客 3048

mHook MinHook API Library Detour EasyHook

mHook MinHook API Library Detour EasyHook   (2015-01-23 08:36:10)   分类: 软件_Software http://codefromthe70s.org/mhook23.aspx MinHook - 最小化的 x86/x64 API 钩子库 英文原文:MinHoo

lionzl的专栏 2629

AI大模型探索之路-实战篇4:深入DB-GPT数据应用开发框架调研

在当今的人工智能时代,大模型技术的迅猛发展为各行各业带来了前所未有的变革。这些大模型,以其强大的语言理解和生成能力,正在逐步成为智能化应用的核心。然而,如何高效地利用这些大模型,构建出满足各种需求的应用,仍然是一个具有挑战性的问题。DB-GPT,作为一个开源的AI原生数据应用开发框架,应运而生,旨在简化大模型应用的开发过程,让构建智能化应用变得触手可及。本文将深入介绍DB-GPT的核心功能、关键特性,并通过实战操作,展示如何利用DB-GPT进行数据应用开发。DB-GPT是一个开源的AI原生数据应用开发框架。

寻道AI,探索AI无限可能! 1万+

【存算一体架构实战】四、突破编译壁垒:手把手实现AI模型到存算硬件的自动映射

摘要:存算一体硬件的性能优势难以充分释放,核心瓶颈在于传统编译器无法高效适配"计算-存储融合"的新型架构。本文系统剖析传统编译流程在存算硬件上的三大痛点:数据布局不匹配导致90%带宽浪费、算子映射效率低使硬件利用率不足30%、缺乏专用优化_pass导致延迟居高不下。通过构建MLIR-PIM编译框架,实现从AI模型到存算硬件的全自动化映射,核心流程包括:TensorFlow模型→MLIR Dialect转换→存算优化_pass→硬件指令生成。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 242

自己动手写API监控工具

需求来源: 1.长期做木马外挂的逆向分析工作,基本上也就看看API调用情况也就知道大概的原理了,手工一个个地分析无疑浪费时间和精力。 2.想知道一个感兴趣的应用程序是如何编写的,监控下API调用情况也可以基本了解实现原理。 现状: 目前市面上这样的工具还是蛮多的,有AutoDebug,ApiTracing,ApiMonitor,bladeapimonitor,不多有点鱼龙混杂。 ...

weixin_34124939的博客 577

(数字图像处理MATLAB+Python)第五章图像增强-第一节:图像增强概述和基于灰度级变换的图像增强

图像增强(Image Enhancement):指不考虑图像降质原因,利用各种数学方法和变换手段,增强图像中人们感兴趣部分或提高有用的图像特征的清晰度。从图像质量来看,图像增强提高了图像的可懂度,改善了图像的视觉效果例如在现实场景中,针对那些对比度较差、视觉效果不好的图像,我们就可以利用图像增强改善视觉质量图像增强可分为如下几种基于灰度级变换的图像增强基于直方图修正的图像增强基于照度反射模型的图像增强基于模糊技术的图像增强基于伪彩色处理的图像增强其他图像增强方法分段线性灰度级变换。

快乐江湖的博客 3334

项目个人6--项目架构1

├─ DisableThreadLibraryCalls() # 禁用线程通知,减少开销├─ 确定工作目录 # exe/upscalerBridge/├─ Config::Load() # 读 upscalerBridge.ini → 几百个配置项├─ CheckForExcludedProcess() # 被排除?→ 透明转发,直接返回├─ PrepareLogger() # 三路日志(调试/文件/游戏回调)├─ isNvidiaViaNvapi() # GPU 检测(三种路径)

2301_80337159的博客 268

Newton & Nvidia 开源 GPU 加速机器人仿真器入门教程(一)

Newton 是一个 GPU 加速、可扩展和可微分的物理仿真引擎,专为机器人、研究和高级仿真工作流而设计。Newton 基于 NVIDIA Warp 并集成了 MuJoCo Warp,为用户和开发人员提供了高性能仿真、现代 Python API 和灵活的架构。

机器人控制与仿真应用 1482

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

上一篇: windows下一些Structure定义(pe、IMAGE_IMPORT_DESCRIPTOR
下一篇: Windows NT System-Call Hooking (Dr. Dobb's Journal)
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值