DosOpenMutexSem

Syntax
rc = DosOpenMutexSem( pszSemaphoreName,                       phmtxSemaphore );

Parameters
handle contained in phmtxSemaphore will be used. ERROR_INVALID_PARAMETER will be returned. On successful return of this function, phmtxSemaphore will point to a mutex handle (HMTX) containing the opened semaphore.
 * PSZ pszSemaphoreName (input):This is a pointer to a null-terminated string containing the name of the semaphore to gain access to. If pszSemaphoreName equals NULL then the
 * PHMTX phmtxSemaphore (input/output):This is a pointer to the HMTX containing the handle of the semaphore to be opened. If the semaphore is to be opened by name using pszSemaphoreName then the input value of phmtxSemaphore must be NULL or

Returns
APIRET rc The following values can be returned

Usage Explanation
DosOpenMutexSem gains access to a shared semaphore for the calling process. When access is granted to the calling process, DosOpenMutexSem increments, by one (1), the usage count for the semaphore pointed to by phmtxSemaphore or named in pszSemaphoreName.

Sample Code

 * 1) define INCL_DOSSEMAPHORES
 * 2) include 

UCHAR SemName[15]; PHMTX phmtxMySemaphore= NULL; /* pointer to my semaphore handle */

/* a shared mutex semaphore is successfully created in another process */ /* its name happens to be \SEM32\MySem */

strcpy(SemName,"\\SEM32\\MySem");

rc = DosOpenMutexSem(SemName, phmtxMySemaphore);

if (rc != 0) {	 /* We got an error to take care of. */	}	else {	 /* The semaphore was successfully opened */ /* it may be accessed via the handle pointer, phmtxMySemaphore */ }