DevHelp AllocateCtxHook: Difference between revisions
Created page with "==Description== 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..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
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. | ||
Line 10: | Line 9: | ||
==Parameters== | ==Parameters== | ||
; HookHandler (NPFN): - input - 16 bit offset to context hook handler | ; HookHandler (NPFN): - input - 16 bit offset to context hook handler | ||
; HookHandle (PULONG): - - Reserved value - context hook returned | ; HookHandle (PULONG): - - Reserved value - context hook returned | ||
Line 17: | Line 15: | ||
Possible errors: | Possible errors: | ||
:ERROR_INVALID_PARAMETER (87) | |||
==Remarks== | ==Remarks== | ||
Line 34: | Line 32: | ||
Calling Sequence in C | Calling Sequence in C | ||
<PRE> | <PRE> | ||
#include "dhcalls.h" | |||
USHORT APIENTRY DevHelp_AllocateCtxHook (NPFN HookHandler, | USHORT APIENTRY DevHelp_AllocateCtxHook (NPFN HookHandler, | ||
PULONG HookHandle) | PULONG HookHandle) | ||
</PRE> | </PRE> | ||
===Assembler=== | ===Assembler=== | ||
Calling Sequence in Assembler | |||
<PRE> | <PRE> | ||
MOV EAX,Hook_Handler ; 16 bit offset to context hook handler | MOV EAX,Hook_Handler ; 16 bit offset to context hook handler | ||
MOV EBX,0FFFFFFFFh ; Reserved value | MOV EBX,0FFFFFFFFh ; Reserved value | ||
Line 56: | Line 46: | ||
CALL [Device_Help] | CALL [Device_Help] | ||
</PRE> | |||
Results in Assembler | Results in Assembler | ||
<PRE> | |||
'C' Clear if hook allocated. | 'C' Clear if hook allocated. | ||
EAX = Hook handle - used by ArmCtxHook. | EAX = Hook handle - used by ArmCtxHook. | ||
Line 70: | Line 56: | ||
Possible errors: | Possible errors: | ||
ERROR_INVALID_PARAMETER (87) | ERROR_INVALID_PARAMETER (87) | ||
</PRE> | </PRE> | ||
[[Category:The OS/2 API Project]] | [[Category:The OS/2 API Project]] |
Revision as of 22:49, 18 January 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)