home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
peknmp.zip
/
PEEKNMP.ASM
next >
Wrap
Assembly Source File
|
1994-03-01
|
7KB
|
249 lines
page ,132
title PEEKNMP - TSR to fix DosPeekNmp API call
cr equ 0Dh
lf equ 0Ah
PDB_env equ 002Ch
comment ~ ===========================================================
93May17, George L. Fulk, IBM Corp.
To generate a copy of the executeable TSR, enter the following:
masm peeknmp,,;
link peeknmp,;
exe2bin peeknmp.exe peeknmp.com
MicroSoft has done a very nasty thing. Without telling anyone (except
their own applications people) they have changed the specification on at
least one named pipe call, DosPeekNmp. The MicroSoft application MS-SQL
is expecting the new specification. This TSR program will convert the
old specification to the new one. I'm not 100% certain, but I believe
MicroSoft may have done the same thing to a second named pipe call,
DosQNmpHandState. My test of MS-SQL did not show this API being used.
For legal purposes:
This source code, and the resulting executable file, can be freely copied
and distributed without royalty or payment. Although I've tested this
program and all tests have passed, the code is provided without warranty.
===========================================================
94Feb22 G.L.Fulk
I've changed the source code for the service department.
Changed from .COM to .EXE syntax, added logon message,
added DOS device driver support.
=========================================================== ~
;---------------------------------------
;The following are the IBM/MS standards for TSR programs.
TSR_signature equ 424Bh
TSR_flag_first equ 80h
TSR_int_entry struc
dw 10EBh ; jmp short past
TSR_PrevAddr dd 0
dw TSR_signature
TSR_flags db 0
TSR_reset db 0EBh,0 ; jmp short reset (to far return)
db 0CBh,6 dup (0) ; reserved
TSR_int_entry ends
;---------------------------------------
DD_packet struc
db ?
db ?
cmd db ?
status dw ?
dq ?
db ?
EndAddr dd ?
DD_packet ends
Status_error equ 8000h
Status_done equ 0100h
;---------------------------------------
page
DOSSEG
CSEG SEGMENT BYTE PUBLIC 'CODE'
assume cs:CSEG,ds:nothing,es:nothing,ss:nothing
org 0
dd -1
dw 8000h
dw strategy
pInt dw interrupt
db " PeekNmp"
assume cs:CSEG,ds:nothing,es:nothing,ss:nothing
RetAddr dd ? ;used to save user's retn addr
;------ Standard TSR entry
Our_int21h TSR_int_entry <>
;------ If it's not our call, pass it on.
cmp ax,5F35h
je DosPeekNmp
jmp cs:[Our_int21h].TSR_PrevAddr
;------ our hooked call
DosPeekNmp:
;Stack: (3 words from INT command)
; flags =ss:[sp]+4
; retn,seg =ss:[sp]+2
; retn,ofs =ss:[sp]+0
pop word ptr cs:[RetAddr]+0 ;save the user's return address
pop word ptr cs:[RetAddr]+2
call cs:[Our_int21h].TSR_PrevAddr ;perform the old int 21h
;all 3 words pop-ed off stack
jc peek_failed ;change only applies to successful call
mov di,ax ;New MS LAN Manager returns state in
mov ax,0 ;DI instead of AX, and rc=0 in AX now.
;Successful call now determined by
;AX=0 instead of clear carry flag.
peek_failed:
jmp cs:[RetAddr] ;return to the user
TSR_end_of_TSR label byte
;---------------------------------------
assume cs:CSEG,ds:nothing,es:nothing,ss:nothing
ReqHdr dd ?
strategy proc far
mov word ptr cs:[ReqHdr]+0,bx
mov word ptr cs:[ReqHdr]+2,es
ret
strategy endp
TSR_interrupt proc far
push ds
push bx
LDS BX,[ReqHdr]
mov [bx].status,Status_error+Status_done+3
pop bx
pop ds
ret
TSR_interrupt endp
DD_end_of_TSR label byte
interrupt proc far
push es
push ds
push dx
push bx
push ax
LDS BX,cs:[ReqHdr]
mov [bx].status,Status_error+Status_done+3
cmp [bx].cmd,0
jnz not_init
mov [bx].status,Status_done
LES DX,cs:[pEndTSR_DD]
mov word ptr [bx].EndAddr+0,dx
mov word ptr [bx].EndAddr+2,es
call HookInt
mov cs:[pInt],offset TSR_interrupt
LDS dx,cs:[pBanner]
mov ah,9
int 21h
not_init:
pop ax
pop bx
pop dx
pop ds
pop es
ret
interrupt endp
assume cs:CSEG,ss:STACK,ds:nothing,es:nothing
pEndTSR_TSR dd TSR_end_of_TSR
pEndTSR_DD dd DD_end_of_TSR
PDB dw ?
pOur_int21h dd Our_int21h
pBanner dd Banner
Banner db cr,lf,"PEEKNMP v2.11 for OS/2 loaded.",cr,lf
Banner_size equ $-Banner
db "$"
db "Please do not alter and distribute this program. To add",cr,lf
db "enhancements contact IBM OS/2-WinAp support at (800)992-4777.",cr,lf,0
main proc far
;------ save the PSP(PDB)
mov cs:[PDB],es
;------ sign on banner
LDS DX,[pBanner]
assume ds:nothing
mov cx,Banner_size
mov bx,1 ;standard out
mov ah,40h
int 21h
;------ hook int 21h vector
call HookInt
assume ds:nothing,es:nothing
;------ free all our file handles
mov bx,19
NextClose:
mov ah,3Eh
int 21h
dec bx
jnz NextClose
;------ free our environment space
mov es,cs:[PDB]
assume es:nothing
mov es,es:[PDB_env]
mov ah,49h
int 21h
;------ install as TSR (Terminate Stay Resident)
LDS DX,[pEndTSR_TSR]
add dx,15
mov cx,4
shr dx,cl
mov ax,ds
sub ax,cs:[PDB]
add dx,ax
mov ax,3100h
int 21h
main endp
;---------------------------------------
assume cs:CSEG,ds:nothing,es:nothing,ss:nothing
HookInt proc near
mov ax,3521h
int 21h
assume es:nothing
LDS DX,cs:[pOur_int21h]
mov word ptr cs:[Our_int21h].TSR_PrevAddr+0,bx
mov word ptr cs:[Our_int21h].TSR_PrevAddr+2,es
mov ax,2521h
int 21h
ret
HookInt endp
;---------------------------------------
CSEG ENDS
STACK SEGMENT STACK 'STACK'
dw 1000 dup (?)
STACK ENDS
END main