;       SCCSID = @(#)smgprsde.asm	6.1 90/11/18
;	SCCSID @(#)smgprsde.asm	6.5 90/05/18
PAGE 60,132    ;
; ****************************************************************************
; *									     *
; *			  IBM/Microsoft Confidential			     *
; *									     *
; *		    Copyright (c) IBM Corporation  1987, 1990		     *
; *		    Copyright (c) Microsoft Corp.  1987, 1990		     *
; *			      All Rights Reserved			     *
; *									     *
; ****************************************************************************

;***************************************************************************
;
; Source File Name:	SMGPRSDE.ASM
;
; Subroutine Name:	DOSSMPRSDAEMON
;
; Descriptive Name:	Shift and control print screen daemon thread
;
; Function:	Processes a shift or control print screen. The print
;		screen daemon calls VIO to print the foreground
;		screen group's screen when a shift print screen
;		is detected. This disables screen group switching
;		until the shift print screen has been processed.
;
;		Control print screen has a toggle effect. The first
;		control print screen turns on echo mode and the
;		second control print screen turns off echo mode.
;
; Notes:
;	Dependencies:	This procedure is called via DOSCREATETHREAD.
;
;	Restrictions:	None
;
;	Change History:
;
; Entry Point:
;	Linkage:  EXTRN DOSSMPRSDAEMON:FAR
;
; Inputs:
;	None
;
; Exit Normal:
;	None
;
; Exit Errors:
;	None
;
; Effects:	This is an infinite loop for the Session Manager
;		shift print screen daemon thread.
;
; Internal References:
;	   Data:
;
;	   Routines:
;
; External References:
;	   Data:
;	   Routines:  VIOPRTSC
;		      VIOPRTSCTOGGLE
;
;***************************************************************************
ifdef I1
;
;   REPEAT
;      DOSSYSTEMSERVICE (Wait for Prt_Scrn notification)
;      IF (Shift Prt_Scrn)
;	  VIOPRTSC (Do VIO print screen)
;      ELSE
;	  VIOPRTSCTOGGLE (Toggle prtsc flag)
;      ENDIF
;      VIOGETMODE (Force BVS to release fgnd BVSCB)
;   UNTIL (forever)
;
;***************************************************************************
else

.386C
HARDERR EQU 1				; For conditional assemblies
   EXTRN ModeData	  : BYTE	; HET mode data
   EXTRN PrsRespPacket	  : BYTE	; Print screen response packet

   EXTRN VIOGETMODE	  : FAR 	; Force VIO to release BVSCB
   EXTRN VIOPRTSC	  : FAR 	; Shift print screen proc.
   EXTRN VIOPRTSCTOGGLE   : FAR 	; Toggle VIO ctrl-prtsc flag
   EXTRN DOSSYSTEMSERVICE : FAR 	; Prtsc notification

.xlist
   INCLUDE SMRRDATA.INC
.xcref
   INCLUDE INFOSEG.INC
   INCLUDE STRUC.INC
.cref
.list

CODE SEGMENT WORD PUBLIC 'CODE' USE16
   ASSUME CS:CODE,DS:NOTHING,SS:NOTHING,ES:NOTHING

   PUBLIC DOSSMPRSDAEMON
DOSSMPRSDAEMON PROC FAR

   Local_Bytes	EQU  0

   ENTER Local_Bytes,0
   MOV	AX, SDATA			; Addressability to shared data segment
   MOV	DS, AX
   MOV	SI, OFFSET PrsRespPacket
   MOV	DI, OFFSET ModeData		; Get mode data offset

;  *****************************************************
;  *  Wait for the kernel to notify the daemon thread  *
;  *  that a shift/control print screen has occurred.  *
;  *****************************************************
   .REPEAT
     PUSH 2				; Wait for print screen
     PUSH DWORD PTR 0			; Null address, no action required
;    PUSH 0								;CJ10
     PUSH DS				; Response packet address
     PUSH SI
     CALL DOSSYSTEMSERVICE

     PUSH 0
     .IF  <<DS:BYTE PTR [SI]> eq 0>	; Shift print screen
;      *************************************************************************
;      *  Call VIO to print the foreground screen group if shift print screen  *
;      *************************************************************************
       CALL VIOPRTSC

     .ELSE
;      *******************************************
;      *  Compliment control print screen flag.  *
;      *******************************************
       CALL VIOPRTSCTOGGLE		; Toggle prtsc flag
     .ENDIF

     PUSH DS				; Dummy get mode added to force
     PUSH DI				; BVS to release fgnd BVSCB
     PUSH 0
     CALL VIOGETMODE

   .UNTIL				; Infinite loop, wait for next event

DOSSMPRSDAEMON ENDP

CODE ENDS
endif
   END
