Jump to content

DevHelp OpenEventSem: Difference between revisions

From EDM2
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..."
 
No edit summary
 
Line 1: Line 1:
{{DISPLAYTITLE:DevHelp_OpenEventSem}}
This service opens a 32-bit shared event semaphore.  
This service opens a 32-bit shared event semaphore.  



Latest revision as of 02:34, 4 May 2025

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