;       SCCSID = @(#)sswopnsy.asm	6.1 90/11/18
;      SCCSID = @(#)sswopnsy.asm	6.3 90/03/19

; ****************************************************************************
; *									     *
; *			  IBM/Microsoft Confidential			     *
; *									     *
; *		    Copyright (c) IBM Corporation  1987, 1990		     *
; *		    Copyright (c) Microsoft Corp.  1987, 1990		     *
; *			      All Rights Reserved			     *
; *									     *
; ****************************************************************************

;*********************** START OF SPECIFICATIONS ***********************/
;								       */
;  SUBROUTINE NAME:  SSWOPNSY					       */
;								       */
;  DESCRIPTIVE NAME:  Screen Switcher system semaphore opening proc.   */
;								       */
;  FUNCTION:  Sets up storage for returned semaphore handles and       */
;	      issues operating system calls to open the semaphores.    */
;								       */
;  NOTES:  Executes on Level 3					       */
;								       */
;  ENTRY POINT:  SSOpenSysSem					       */
;								       */
;  INPUT:  DS register must point to the common data segment.	       */
;	   DI points to the sgcb. SI contains the offset of the        */
;	   ASCIIZ string name of the system semaphore.		       */
;	   SS:[BP].lockneededlow -> system semaphore handle	@TL6   */
;				    address to be returned	@TL6   */
;								       */
;  EXIT-NORMAL: None						       */
;								       */
;  EXIT-ERROR:	None						       */
;								       */
;  EFFECTS:  The specified system semaphore is opened. The handle      */
;	     returned is inserted into a dword stored on stack.        */
;	     The CX register is destroyed.			       */
;								       */
;								       */
;  INTERNAL REFERENCES: 					       */
;    ROUTINES:							       */
;								       */
;  EXTERNAL REFERENCES: 					       */
;    ROUTINES:							       */
;								       */
;	Change History: 					       */
;								       */
;	@TL6 - 03/01/90 - DCR 704 - Merge SMG/SSW instance data into   */
;			  OS2CHAR				       */
;								       */
;								       */
;************************ END OF SPECIFICATIONS ************************/
EXTRN

.xlist
INCLUDE SSWINC.INC
INCLUDE SSWLOCK.INC							;@TL6
.list

.386p

CODE	SEGMENT WORD PUBLIC 'CODE' USE16                                ;@TL6

	ASSUME	CS:CODE, DS:NOTHING,SS:NOTHING,ES:NOTHING		;@TL6

 PUBLIC  SSOPENSYSEM

SSOPENSYSEM    PROC    NEAR			    ; DS:SI has offset of
						    ; ASCIIZ sem name
						    ; DI has offset of sgcb
;@TL6	       pop     cx			    ; Save the return addr
	       mov     ax,word ptr [di].suffix	    ; Initialize the suffix
	       mov     [si+10],ax		    ; location in the string
	       mov     al,[di].suffix+2 	    ; with the value from
	       mov     [si+12],al		    ; the sgcb
;@TL6	       xor     ax,ax
;@TL6	       push    ax			    ; Set up storage for
;@TL6	       push    ax			    ; system sem handles
;@TL6	       mov     ax,sp
	       push    ss
	       lea     ax,[bp].lockneededlow				;@TL6
	       push    ax
	       push    ds
	       push    si
	       call    DOSOPENSEM
;@TL6	       push    cx

	       ret
SSOPENSYSEM    ENDP

CODE	ENDS								;@TL6
 END
