DevHelp ResetEventSem: Difference between revisions
Created page with "This service resets an event semaphore that has been previously opened with OpenEventSem. The number of posts performed on the event before it was reset is returned to the cal..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This service resets an event semaphore that has been previously opened with OpenEventSem. The number of posts performed on the event before it was reset is returned to the caller in the pulPostCt parameter. If the event was already reset, the ERROR_ALREADY_RESET return code is returned, and zero is returned in the pulPostCt parameter. It is not reset a second time. | {{DISPLAYTITLE:DevHelp_ResetEventSem}} | ||
This service resets an event semaphore that has been previously opened with OpenEventSem. The number of posts performed on the event before it was reset is returned to the caller in the pulPostCt parameter. If the event was already reset, the ERROR_ALREADY_RESET return code is returned, and zero is returned in the pulPostCt parameter. It is not reset a second time. | |||
==Syntax== | ==Syntax== | ||
Line 17: | Line 18: | ||
==Parameters== | ==Parameters== | ||
===C=== | ===C=== | ||
; hEvent (ULONG) : Semaphore handle | ;hEvent (ULONG): Semaphore handle | ||
;pNumPosts (PULONG): Pointer to a variable to receive the number of posts performed on the event before the reset. | |||
===Assembler=== | ===Assembler=== | ||
<PRE> | <PRE> | ||
Line 28: | Line 29: | ||
==Return Code== | ==Return Code== | ||
===C=== | ===C=== | ||
Success Indicator: 0 | Success Indicator: 0 | ||
Possible errors: | Possible errors: | ||
ERROR_INVALID_HANDLE (6) | |||
ERROR_ALREADY_RESET (300) | |||
===Assembler=== | ===Assembler=== | ||
Line 50: | Line 50: | ||
This function uses the EAX, EDI, and Flags registers. ResetEventSem can be called only from a Ring 0 device driver or file system driver. The handle passed in must be a handle to a shared event semaphore. If the handle does not exist or is not a shared event semaphore, or if the semaphore was not previously opened with OpenEventSem, then ERROR_INVALID_HANDLE is returned. | This function uses the EAX, EDI, and Flags registers. ResetEventSem can be called only from a Ring 0 device driver or file system driver. The handle passed in must be a handle to a shared event semaphore. If the handle does not exist or is not a shared event semaphore, or if the semaphore was not previously opened with OpenEventSem, then ERROR_INVALID_HANDLE is returned. | ||
To reverse this operation, call PostEventSem. This posts the event, so that any threads that were waiting for the event semaphore to be posted (with DosWaitEventSem) are allowed to run. | To reverse this operation, call PostEventSem. This posts the event, so that any threads that were waiting for the event semaphore to be posted (with DosWaitEventSem) are allowed to run. | ||
==Example Code== | ==Example Code== | ||
Line 60: | Line 60: | ||
PULONG pNumPosts ); | PULONG pNumPosts ); | ||
</PRE> | </PRE> | ||
[[Category:DevHlps]] | [[Category:DevHlps]] |
Latest revision as of 14:24, 2 January 2020
This service resets an event semaphore that has been previously opened with OpenEventSem. The number of posts performed on the event before it was reset is returned to the caller in the pulPostCt parameter. If the event was already reset, the ERROR_ALREADY_RESET return code is returned, and zero is returned in the pulPostCt parameter. It is not reset a second time.
Syntax
C
USHORT APIENTRY DevHlp_ResetEventSem( ULONG hEvent, PULONG pNumPosts );
Assembler
MOV EAX,SemaphoreHandle ; DWORD semaphore handle MOV EDI,pNumPosts ; Pointer to variable to receive the number of ; posts performed on the event before the reset. MOV DL,DevHlp_ResetEventSem CALL [Device_Help]
Parameters
C
- hEvent (ULONG)
- Semaphore handle
- pNumPosts (PULONG)
- Pointer to a variable to receive the number of posts performed on the event before the reset.
Assembler
MOV EAX,SemaphoreHandle ; DWORD semaphore handle MOV EDI,pNumPosts ; Pointer to variable to receive the number of ; posts performed on the event before the reset.
Return Code
C
Success Indicator: 0
Possible errors:
ERROR_INVALID_HANDLE (6) ERROR_ALREADY_RESET (300)
Assembler
'C:' Clear if successful. 'C' Set if error. EAX = Error code. Possible errors: ERROR_INVALID_HANDLE (6) ERROR_ALREADY_RESET (300)
Remarks
This function uses the EAX, EDI, and Flags registers. ResetEventSem can be called only from a Ring 0 device driver or file system driver. The handle passed in must be a handle to a shared event semaphore. If the handle does not exist or is not a shared event semaphore, or if the semaphore was not previously opened with OpenEventSem, then ERROR_INVALID_HANDLE is returned.
To reverse this operation, call PostEventSem. This posts the event, so that any threads that were waiting for the event semaphore to be posted (with DosWaitEventSem) are allowed to run.
Example Code
C
#include "dhcalls.h" USHORT APIENTRY DevHlp_ResetEventSem( ULONG hEvent, PULONG pNumPosts );