;       SCCSID = @(#)smrsmstl.asm       6.1 90/11/18
;       SCCSID @(#)smrsmstl.asm 1.11 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:     SMGSTITL.ASM
;
; Subroutine Name:      DOSSMSETTITLE
;
; Descriptive Name:     Set Session Title
;
; Function:     Sets the title for the current screen group
;
; Notes:
;       Dependencies:   None
;
;       Restrictions:   Screen group titles must be contiguous. This
;                       subroutine calculates the offset of the title
;                       based on the screen group number.
;
;       Change History:
;      @@A9 - 02/27/90 - PTR XXXXXXX - Set up FS for DosWinProc
;
; Entry Point:
;       Linkage:  EXTRN DOSSMSETTITLE:FAR
;                       PUSH@   ASCIIZ SesTitle   ; Session Title
;                       CALL    DOSSMSETTITLE
; Inputs:
;       ASCIIZ  SesTitle   Address of ASCIIZ string containing
;                          the new session title
;
; Exit Normal:
;       AX      ReturnCode Value = 0, Session title set
;
; Exit Errors:
;       AX      ReturnCode error_smg_set_title
;                          error_smg_invalid_session_id
;
;                          DOSGETSHRSEG errors
;
; Effects:      All other registers preserved.
;
; Internal References:
;          Data:        shellredrawsem - Shell redraw notify semaphore
;          Routines:
;
; External References:
;          Routines:    DOSSMSGSETTITLE
;
;************************************************************************
ifdef I1
;
;   IF (session title is valid)
;      Get segment limit of session title
;      IF (segment limit e 0)
;         DOSWINPROC(Load Winthorn modules)
;      ELSE
;         RC = No_Error
;      ENDIF
;      IF (No_Error)
;         WINSETTITLE (Set session title through Winthorn)
;      ENDIF
;   ELSEIF (PM is present)
;      RC = Error_SMG_Set_Title
;   ELSE
;      DOSSMSGSETTITLE (Change session title)
;   ENDIF
;
;************************************************************************
else

.386P
    EXTRN PM_Present       : BYTE       ; Set to 1 if winner in system
    EXTRN WinSetTitle_Name : BYTE       ; Name of call
    EXTRN Winner_Handle    : WORD
    EXTRN WinSetTitle      : DWORD      ; Set session title using winner

    EXTRN DOSWINPROC       : NEAR       ; Set session title
    EXTRN DOSSMSGSETTITLE  : FAR        ; Set session title
.xlist
    INCLUDE SMRSMSTL.INC                ; Set title stack frame definition
.xcref
    INCLUDE ERROR2.INC                  ; Error code equates
    INCLUDE SMRRDATA.INC                ; Router shared segment definition
    INCLUDE BASEMACA.INC                ; loadsl macro for 386 lsl bug
    INCLUDE STRUC.INC
.cref
.list
_DATA           SEGMENT WORD PUBLIC 'DATA' USE16
PERPROCWINLOADED       DW  0           ;

_DATA           ENDS

CODE SEGMENT PARA PUBLIC 'CODE'  USE16  ; Change WORD to PARA alingment
    ASSUME CS:CODE,DS:RDATA,SS:NOTHING,ES:NOTHING
     DMMYLABEL LABEL DWORD              ; Label for loadsl macro DO NOT MOVE THIS LABEL!!

    PUBLIC DOSSMSETTITLE
DOSSMSETTITLE PROC FAR

    ENTER 0,0

    PUSH BX
    PUSH CX
    PUSH DX
    PUSH SI
    PUSH DS
    PUSH FS                             ;                                  @@A9
    PUSH ES
    MOV  BX, _DATA
    MOV  ES, BX
    ASSUME  ES:_DATA

;   **************************************************
;   *  Call Session Manager to change session title  *
;   **************************************************
    MOV  AX, RDATA
    MOV  DS, AX
    MOV  FS, AX                         ; Set up for DosWinProc            @@A9
    XOR  BX, BX                         ; Preset to 0
    MOV  AX, WORD PTR WINSETTITLE+2
    .IF  < nonzero AX >                                                 ;CJ10
       MOV  BX, ES:PERPROCWINLOADED
;      loadsl BX, AX, DMMYLABEL         ; Macro for LSL BX, AX insturction
      .IF  < zero BX >                  ; If limit = 0 then go load PM  ;CJ10
        SUB  CX, CX                     ; Don't do DosGetProAddr        ;CJ10
        LEA  BX, WinSetTitle_Name
        LEA  DX, WINSETTITLE
        LEA  SI, Winner_Handle          ; Pass module name/hdle loc
        CALL DOSWINPROC
      .ELSE
        XOR  AX, AX
      .ENDIF

      .IF  < zero AX >                                                  ;CJ10
        MOV  ES:PERPROCWINLOADED, 1
        PUSH DWORD PTR SS:[BP].SMStlTitle                               ;CJ10
        CALL WINSETTITLE
      .ENDIF

    .ELSEIF < PM_Present e Yes >        ; If Winsettitle is not valid and
      MOV  AX, Error_SMG_Set_Title      ; winner is present - Error
    .ELSE                               ; If Winsettitle not valid and
                                        ; winner is not present then
;CJ10 PUSH SS:[BP].SMStlTitle+2         ; just call Dos version
      PUSH DWORD PTR SS:[BP].SMStlTitle                                 ;CJ10
      CALL DOSSMSGSETTITLE
    .ENDIF

    POP  ES
    POP  FS                            ;                                   @@A9
    POP  DS
    POP  SI
    POP  DX
    POP  CX
    POP  BX

    LEAVE
    RET  4

DOSSMSETTITLE ENDP




PAGE
; ****************************************************************************
; *                                                                          *
; *           Check if Presentation Manager is present or not                *
; *                                                                          *
; ****************************************************************************
    PUBLIC DOSSMPMPRESENT
DOSSMPMPRESENT PROC FAR

    ENTER 0,0                           ; Establish stack frame
    PUSH DS
;   PUSH ES                                                             ;CJ10
    PUSH DI

    MOV  AX, RDATA
    MOV  DS, AX
    MOV  AL, PM_Present
    CBW                                                                 ;CJ10

    LDS  DI, SS:[BP].PMPresentStorAdd   ; Get address at which we       ;CJ10
                                        ; will store the status
    MOV  DS:[DI],AX                                                     ;CJ10
    XOR  AX, AX

    POP  DI
;   POP  ES                                                             ;CJ10
    POP  DS

    LEAVE

    RET  4

DOSSMPMPRESENT ENDP

; ********************************-*****************************************
;    PUBLIC DOSSMREALPRTSC
;DOSSMREALPRTSC PROC FAR
;INT 3
;    ENTER 0,0
;    LEAVE
;    RET
;DOSSMREALPRTSC ENDP
;
;
;    PUBLIC DOSSMGETSTATUS
;DOSSMGETSTATUS PROC FAR
;INT 3
;    ENTER 0,0
;    LEAVE
;    RET 6
;DOSSMGETSTATUS ENDP

CODE ENDS
endif
    END
