DevHelp ArmCtxHook

From EDM2
Jump to: navigation, search

This service arms a context hook allocated by the DevHlp_AllocateCtxHook can be called at interrupt time. The next available task-time thread calls the function address specified at hook allocation time.

Syntax

C

USHORT APIENTRY DevHelp_ArmCtxHook (ULONG HookData,
                                    ULONG HookHandle)

Assembler

MOV   EAX,Hook_Data         ; Data to be passed on to the hook handler
MOV   EBX,Hook_Handle       ; handle to the hook to arm
MOV   ECX,0FFFFFFFFh        ; Reserved value
MOV   DL,DevHlp_ArmCtxHook

CALL  [Device_Help]

Parameters

C

HookData (ULONG) 
Data to be passed on to the hook handler
HookHandle (ULONG) 
Handle to hook to arm

Assembler

MOV   EAX,Hook_Data         ; Data to be passed on to the hook handler
MOV   EBX,Hook_Handle       ; handle to the hook to arm
MOV   ECX,0FFFFFFFFh        ; Reserved value
MOV   DL,DevHlp_ArmCtxHook

CALL  [Device_Help]

Return Code

C

Success Indicator: 0 if hook successfully armed.

Possible errors:

ERROR_INVALID_PARAMETER (87)
This function returns only the above error code.
The cause of the error, however, may be due to Not Enough Memory or Hook Already Armed.

Assembler

 'C' Clear if hook successfully armed.

   'C' Set if error.
       EAX = Error code.
            Possible errors:
               ERROR_INVALID_PARAMETER (87)
               This function returns only the above error code.
               The cause of the error, however, may be due to Not
               Enough Memory or Hook Already Armed.

Remarks

After the context hook is armed, it operates once and automatically disarms itself. It is an error to attempt to arm a context hook that is already armed. Once the context hook starts execution, the hook can be rearmed.

The parameter in EAX is passed on to the Hook_Handler routine in the same register.

Example Code

C

#include  "dhcalls.h"

USHORT APIENTRY DevHelp_ArmCtxHook (ULONG HookData,
                                    ULONG HookHandle)

Related Functions