;       SCCSID = @(#)smmmpha.inc	6.2 91/05/31
;       SCCSID = @(#)smmmpha.inc	6.2 91/05/31
; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************
;
;   mmpha.inc - MMIO Macro Hooks for SESMGR.DLL
;
; Change History:
;   CJ29 05/31/91  PTR B723200 Fix MMIO hooks DosSMNotifyDD and WriteTermQueue.
;

;   IFDEF Legend:
;
;       1) NOT_RELEASED - Written but not ready for release
;       2) INACTIVE     - Temporarily turned off
;       3) MMIOPH       - Active hook
;       4) BUGGY        - Undetermined error when active

ifdef   MMIOPH
include perfhook.inc
include rasmacro.inc

ifndef  GlobalSelector
        EXTRN   GlobalSelector:WORD
endif

ifndef  SaveReg
        include basemaca.inc
endif
endif


;****************************************************************************
;
;       BASE SESSION MANAGER: External Interface  -  Major Code 80h
;
;****************************************************************************

MMPHPreDOSSMSGStart     MACRO                   ; In-Line: sesmgr\smgsgstr.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8002,8002h,globalselector
        ras8002:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMSGSwitch    MACRO                   ; In-Line: sesmgr\smgsgswt.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8003,8003h,globalselector
        ras8003:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMSGTerminate MACRO                   ; In-Line: sesmgr\smgsgtrm.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8004,8004h,globalselector
        ras8004:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMSGDoPopup   MACRO                   ; In-Line: sesmgr\smgpopup.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8009,8009h,globalselector
        ras8009:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMSGEndPopup  MACRO                   ; In-Line: sesmgr\smgpopup.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras800A,800Ah,globalselector
        ras800A:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMSGSet       MACRO                   ; In-Line: sesmgr\smgsgset.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras800B,800Bh,globalselector
        ras800B:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSelectSession MACRO                   ; In-Line: sesmgr\smrselse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras800C,800Ch,globalselector
        ras800C:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSetSession    MACRO                   ; In-Line: sesmgr\smrsetse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras800D,800Dh,globalselector
        ras800D:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSStartSession  MACRO                   ; In-Line: sesmgr\smrstrse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras800E,800Eh,globalselector

                        SaveReg <ds,di>
                        lds     di,SS:[BP].StartData    ;    load addr of data
                        SendLenStr      800E            ; DEKKO: Start Data
                        RestoreReg <di,ds>
        ras800E:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSStopSession   MACRO                   ; In-Line: sesmgr\smrstpse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras800F,800Fh,globalselector

                        SaveReg <ax>
                        mov     ax, ss:[bp].stpsessionid
                        SendAsDouble    ax              ; DEKKO: SessionId
                        RestoreReg <ax>
        ras800F:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMDoAppReq    MACRO                   ; In-Line: sesmgr\smrapdor.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8011,8011h,globalselector
        ras8011:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMAppNotify   MACRO                   ; In-Line: sesmgr\smrapntf.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8013,8013h,globalselector
        ras8013:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMNotifyDD    MACRO                   ; In-Line: sesmgr\smrnotdd.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8014,8014h,globalselector

                        SaveReg <ds,di,ax>                                 ;CJ29
                        lds     di,dword ptr Parm_Packet_Addr;addr of data ;CJ29

                        mov     ax,ds:[di].notdd_AIM_Type                  ;CJ29
                        mov     es:[PERF_DATA],ax       ; DEKKO: Not. Type ;CJ29

                        RestoreReg <ax,di,ds>                              ;CJ29

        ras8014:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMNotifyDD2   MACRO                   ; In-Line: sesmgr\smrnotdd.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8015,8015h,globalselector
        ras8015:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMParentSwitch MACRO                  ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8016,8016h,globalselector

                        mov     es:[PERF_DATA],cx       ; DEKKO: SessionID
        ras8016:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMGetStatus   MACRO                   ; In-Line: sesmgr\smrqstat.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8017,8017h,globalselector

                        SaveReg <ds,di,ax>
                        lds     di,ss:[bp].QueueStatusPacket

                        mov     ax,ds:[di].QStatHeaderLen
                        mov     es:[PERF_DATA],ax       ; DEKKO: HeaderLength


                        mov     es:[PERF_DATA],0        ; DEKKO: ScreenGroupId

                        mov     ax,ss:[bp].QStatStatusReq
                        mov     es:[PERF_DATA],ax       ; DEKKO: StatusAction

                        RestoreReg <ax,di,ds>
        ras8017:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMRegisterDD  MACRO                   ; In-Line: sesmgr\smrregdd.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8018,8018h,globalselector
        ras8018:
                        ExitMMPH
                        ENDIF
                        ENDM


MMPHPostDOSSMSGStart    MACRO                   ; In-Line: sesmgr\smgsgstr.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8082,8082h,globalselector
        ras8082:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMSGSwitch   MACRO                   ; In-Line: sesmgr\smgsgswt.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8083,8083h,globalselector
        ras8083:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMSGTerminate MACRO                  ; In-Line: sesmgr\smgsgtrm.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8084,8084h,globalselector
        ras8084:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMSGDoPopup  MACRO                   ; In-Line: sesmgr\smgpopup.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8089,8089h,globalselector
        ras8089:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMSGEndPopup MACRO                   ; In-Line: sesmgr\smgpopup.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras808A,808Ah,globalselector
        ras808A:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMSGSet      MACRO                   ; In-Line: sesmgr\smgsgset.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras808B,808Bh,globalselector
        ras808B:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSelectSession MACRO                  ; In-Line: sesmgr\smrselse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras808C,808Ch,globalselector
        ras808C:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSetSession   MACRO                   ; In-Line: sesmgr\smrsetse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras808D,808Dh,globalselector
        ras808D:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSStartSession MACRO                   ; In-Line: sesmgr\smrstrse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras808E,808Eh,globalselector

                        SaveReg <ds,di,ax>

                        xor     ax,ax
                        cmp     ss:[bp].StartNewProcess,0  ; check for null ptr
                        je      ras808Ea
                        lds     di,ss:[bp].StartNewProcess ; not null, load it
                        mov     ax,ds:[di]
        ras808Ea:       SendAsDouble    ax              ; DEKKO: NewProcessID

                        xor     ax,ax
                        cmp     ss:[bp].StartNewSession,0  ; check for null ptr
                        je      ras808Eb
                        lds     di,ss:[bp].StartNewSession ; not null, load it
                        mov     ax,ds:[di]
        ras808Eb:       SendAsDouble    ax              ; DEKKO: NewSessionId

                        RestoreReg <ax,di,ds>
        ras808E:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSStopSession  MACRO                   ; In-Line: sesmgr\smrstpse.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras808F,808Fh,globalselector
        ras808F:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMDoAppReq   MACRO                   ; In-Line: sesmgr\smrapdor.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8091,8091h,globalselector
        ras8091:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMAppNotify  MACRO                   ; In-Line: sesmgr\smrapntf.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8093,8093h,globalselector
        ras8093:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMNotifyDD   MACRO                   ; In-Line: sesmgr\smrnotdd.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8094,8094h,globalselector

                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras8094:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMNotifyDD2  MACRO                   ; In-Line: sesmgr\smrnotdd.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8095,8095h,globalselector

                        mov     es:[PERF_DATA],ax       ; DEKKO: DosDevIOCTLsRC
        ras8095:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMParentSwitch MACRO                 ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8096,8096h,globalselector

                        mov     es:[PERF_DATA],ax       ; DEKKO: Switched
        ras8096:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMGetStatus  MACRO                   ; In-Line: sesmgr\smrqstat.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8097,8097h,globalselector

                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras8097:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMRegisterDD MACRO                   ; In-Line: sesmgr\smrregdd.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    80h,ras8098,8098h,globalselector
        ras8098:
                        ExitMMPH
                        ENDIF
                        ENDM

;****************************************************************************
;
;       BASE SESSION MANAGER: Internal Interface  -  Major Code 81h
;
;****************************************************************************

MMPHPreDOSSMGetSGId     MACRO                   ; In-Line: sesmgr\smrgetid.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8103,8103h,globalselector
        ras8103:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMFreeSGId    MACRO                   ; In-Line: sesmgr\smrfreid.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8104,8104h,globalselector
        ras8104:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMAddSGQueue  MACRO                   ; In-Line: sesmgr\smraddcb.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8105,8105h,globalselector
        ras8105:
                        ExitMMPH
                        ENDIF
                        ENDM

;; 8106 - PreDOSSMGetSGQueue: see \drv6\src\os2char\smrgetcb.asm

MMPHPreDOSSMDelSGQueue  MACRO                   ; In-Line: sesmgr\smrdelcb.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8107,8107h,globalselector
        ras8107:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreDOSSMChildExit   MACRO                   ; In-Line: sesmgr\smgcexit.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8109,8109h,globalselector
                        mov     es:[PERF_DATA],dx       ; DEKKO: ScreenGroupId
        ras8109:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreParentNotify     MACRO                   ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras810A,810Ah,globalselector
                        mov     es:[PERF_DATA],cx       ; DEKKO: Session Id
                        mov     es:[PERF_DATA],ax       ; DEKKO: Term type
        ras810A:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreParentSwitch     MACRO                   ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras810B,810Bh,globalselector
                        mov     es:[PERF_DATA],cx       ; DEKKO: Session Id
        ras810B:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPreWriteTermQueue   MACRO                   ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras810C,810Ch,globalselector

                        push    ax
                        mov     ax,ss:[bp].ParentTermRequest
                        mov     es:[PERF_DATA],ax       ; DEKKO: Action

;CJ29;;;;;;;;;;;;;;;;;; mov     ax,ss:[bp].ParentNotPID
;CJ29;;;;;;;;;;;;;;;;;; mov     es:[PERF_DATA],ax       ; DEKKO: ParentProcId

;CJ29;;;;;;;;;;;;;;;;;; mov     ax,ss:[bp].ParentNotSID
;CJ29;;;;;;;;;;;;;;;;;; mov     es:[PERF_DATA],ax       ; DEKKO: ParenSrcGrpId

;CJ29;;;;;;;;;;;;;;;;;; mov     es:[PERF_DATA],cx       ; DEKKO: TermSessId

;CJ29;;;;;;;;;;;;;;;;;; mov     es:[PERF_DATA],dx       ; DEKKO: ProcessId
                        pop     ax
        ras810C:
                        ExitMMPH
                        ENDIF
                        ENDM


MMPHPostDOSSMGetSGId    MACRO                   ; In-Line: sesmgr\smrgetid.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8183,8183h,globalselector

                        mov     es:[PERF_DATA],dx       ; DEKKO: ScreenGroupId
                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras8183:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMFreeSGId   MACRO                   ; In-Line: sesmgr\smrfreid.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8184,8184h,globalselector

                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras8184:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMAddSGQueue MACRO                   ; In-Line: sesmgr\smraddcb.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8185,8185h,globalselector

                        mov     es:[PERF_DATA],dx       ; DEKKO: ScreenGroupId
                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras8185:
                        ExitMMPH
                        ENDIF
                        ENDM

;; 8186 - PostDOSSMGetSGQueue: see \drv6\src\os2char\smrgetcb.asm

MMPHPostDOSSMDelSGQueue MACRO                   ; In-Line: sesmgr\smrdelcb.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8187,8187h,globalselector
                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras8187:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostDOSSMChildExit  MACRO                   ; In-Line: sesmgr\smgcexit.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras8189,8189h,globalselector
                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras8189:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostParentNotify    MACRO                   ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras818A,818Ah,globalselector
                        mov     es:[PERF_DATA],ax       ; DEKKO: Switched
        ras818A:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostParentSwitch    MACRO                   ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras818B,818Bh,globalselector
                        mov     es:[PERF_DATA],ax       ; DEKKO: Switched
        ras818B:
                        ExitMMPH
                        ENDIF
                        ENDM

MMPHPostWriteTermQueue  MACRO                   ; In-Line: sesmgr\smrpanot.asm
                        IFDEF   MMIOPH          ; 6.105
                        SetupTestDLL    81h,ras818C,818Ch,globalselector
                        mov     es:[PERF_DATA],ax       ; DEKKO: Return Code
        ras818C:
                        ExitMMPH
                        ENDIF
                        ENDM

