DevHelp AllocateCtxHook: Difference between revisions
m Ak120 moved page OS2 API:DEVHLP:AllocateCtxHook to DevHelp AllocateCtxHook |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:DevHelp_AllocateCtxHook}} | |||
This service allocates a context hook for use by a physical device driver that needs task time processing, but has no task time thread available to complete it. | This service allocates a context hook for use by a physical device driver that needs task time processing, but has no task time thread available to complete it. | ||
==Syntax== | ==Syntax== | ||
USHORT APIENTRY DevHelp_AllocateCtxHook (NPFN HookHandler, | USHORT APIENTRY DevHelp_AllocateCtxHook (NPFN HookHandler, | ||
PULONG HookHandle) | PULONG HookHandle) | ||
==Parameters== | ==Parameters== | ||
Line 19: | Line 18: | ||
==Remarks== | ==Remarks== | ||
When the context hook is armed and triggers, the Hook_Handler function is called with the following parameters passed on the call to ArmCtxHook: | When the context hook is armed and triggers, the Hook_Handler function is called with the following parameters passed on the call to ArmCtxHook: | ||
EAX = Value passed on the ArmCtxHook DevHelp call in EAX. | |||
EBX = 0FFFFFFFFH, reserved value. | |||
The hook handler is responsible for saving and restoring registers on entry and exit. The hook handler address should be zero-extended when it is moved into EAX. | The hook handler is responsible for saving and restoring registers on entry and exit. The hook handler address should be zero-extended when it is moved into EAX. |
Revision as of 02:56, 27 February 2017
This service allocates a context hook for use by a physical device driver that needs task time processing, but has no task time thread available to complete it.
Syntax
USHORT APIENTRY DevHelp_AllocateCtxHook (NPFN HookHandler,
PULONG HookHandle)
Parameters
- HookHandler (NPFN)
- - input - 16 bit offset to context hook handler
- HookHandle (PULONG)
- - - Reserved value - context hook returned
Return Code
Success Indicator: 0
Possible errors:
- ERROR_INVALID_PARAMETER (87)
Remarks
When the context hook is armed and triggers, the Hook_Handler function is called with the following parameters passed on the call to ArmCtxHook:
EAX = Value passed on the ArmCtxHook DevHelp call in EAX. EBX = 0FFFFFFFFH, reserved value.
The hook handler is responsible for saving and restoring registers on entry and exit. The hook handler address should be zero-extended when it is moved into EAX.
The DS register must be set to the physical device driver's data segment prior to issuing the call. If the device driver has issued a call to PhysToVirt referencing the DS register, it should restore DS to its original value. The Hook_Handler cannot be preempted. The Hook_Handler must reside in the same segment in which the AllocateCtxHook is made.
Example Code
C
Calling Sequence in C
#include "dhcalls.h" USHORT APIENTRY DevHelp_AllocateCtxHook (NPFN HookHandler, PULONG HookHandle)
Assembler
Calling Sequence in Assembler
MOV EAX,Hook_Handler ; 16 bit offset to context hook handler MOV EBX,0FFFFFFFFh ; Reserved value MOV DL,DevHlp_AllocateCtxHook CALL [Device_Help]
Results in Assembler
'C' Clear if hook allocated. EAX = Hook handle - used by ArmCtxHook. 'C' Set if error. EAX = Error code. Possible errors: ERROR_INVALID_PARAMETER (87)