Jump to content

DevHelp OpenEventSem

From EDM2
Revision as of 18:46, 27 July 2018 by Martini (talk | contribs) (Created page with "This service opens a 32-bit shared event semaphore. ==Syntax== ===C=== <PRE> USHORT APIENTRY DevHelp_OpenEventSem(ULONG hEvent ); </PRE> ===Assembler=== <PRE> MOV EAX,Sem...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This service opens a 32-bit shared event semaphore.

Syntax

C

USHORT APIENTRY DevHelp_OpenEventSem(ULONG hEvent );

Assembler

MOV   EAX,SemaphoreHandle     ; DWORD semaphore handle
MOV   DL,DevHlp_OpenEventSem

CALL  [Device_Help]

Parameters

C

hEvent (ULONG)
Semaphore handle

Assembler

MOV   EAX,SemaphoreHandle     ; DWORD semaphore handle
MOV   DL,DevHlp_OpenEventSem

CALL  [Device_Help]

Return Code

C

    Success Indicator: 0

           Possible errors:
              ERROR_INVALID_HANDLE       (6)
              ERROR_NOT_ENOUGH_MEMORY    (8)
              ERROR_TOO_MANY_OPENS       (291)

Assembler

   'C' Clear if successful.

   'C' Set if error.
       EAX = Error code.
            Possible errors:
               ERROR_INVALID_HANDLE         (6)
               ERROR_NOT_ENOUGH_MEMORY      (8)
               ERROR_TOO_MANY_OPENS         (291)

Remarks

This function uses the EAX and FLAGS registers. OpenEventSem can be called only from a Ring 0 physical 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, then ERROR_INVALID_HANDLE is returned.

The OPEN/CLOSE operations can be nested. A maximum of 65,534 (64KB-1) opens-per-process are allowed for each semaphore at any one time. If this limit is reached, the next call to OpenEventSem returns ERROR_TOO_MANY_OPENS. In order for a process to intentionally destroy a semaphore prior to termination, the number of calls to CloseEventSem must equal the number of calls to OpenEventSem.

Example Code

C

#include  "dhcalls.h"

USHORT APIENTRY DevHelp_OpenEventSem(ULONG hEvent );

Related Functions