📄 int2f.asm
字号:
;; File:; int2f.asm; Description:; multiplex interrupt support code;; Copyright (c) 1996, 1998; Pasquale J. Villani; All Rights Reserved;; This file is part of DOS-C.;; DOS-C is free software; you can redistribute it and/or; modify it under the terms of the GNU General Public License; as published by the Free Software Foundation; either version; 2, or (at your option) any later version.;; DOS-C is distributed in the hope that it will be useful, but; WITHOUT ANY WARRANTY; without even the implied warranty of; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See; the GNU General Public License for more details.;; You should have received a copy of the GNU General Public; License along with DOS-C; see the file COPYING. If not,; write to the Free Software Foundation, 675 Mass Ave,; Cambridge, MA 02139, USA.;; $Id: int2f.asm,v 1.35 2004/07/24 23:54:23 bartoldeman Exp $; %include "segs.inc" %include "stacks.inc"segment HMA_TEXT extern _cu_psp:wrt DGROUP extern _syscall_MUX14 extern _DGROUP_ global reloc_call_int2f_handlerreloc_call_int2f_handler: sti ; Enable interrupts cmp ah,11h ; Network interrupt? jne Int2f3 ; No, continueInt2f1: or al,al ; Installation check? jz FarTabRetn ; yes, just returnInt2f2: mov ax,1 ; TE 07/13/01 ; at least for redirected INT21/5F44 ; --> 2f/111e ; the error code is AX=0001 = unknown function stcFarTabRetn: retf 2 ; Return farInt2f3: cmp ah,16h je FarTabRetn ; Win Hook return fast cmp ah,12h je IntDosCal ; Dos Internal calls cmp ax,4a01h je IntDosCal ; Dos Internal calls cmp ax,4a02h je IntDosCal ; Dos Internal calls%ifdef WITHFAT32 cmp ax,4a33h ; Check DOS version 7 jne Check4Share xor ax,ax ; no undocumented shell strings iretCheck4Share:%endif cmp ah,10h ; SHARE.EXE interrupt? je Int2f1 ; yes, do installation check cmp ah,08h je DriverSysCal ; DRIVER.SYS calls cmp ah,14h ; NLSFUNC.EXE interrupt? jne Int2f?iret ; yes, do installation checkInt2f?14: ;; MUX-14 -- NLSFUNC API ;; all functions are passed to syscall_MUX14 push bp ; Preserve BP later on PUSH$ALL call _syscall_MUX14 pop bp ; Discard incoming AX push ax ; Correct stack for POP$ALL POP$ALL mov bp, sp or ax, ax jnz Int2f?14?1 ; must return set carry ;; -6 == -2 (CS), -2 (IP), -2 (flags) ;; current SP = on old_BP and BYTE [bp-6], 0feh ; clear carry as no error condition pop bp iretInt2f?14?1: or BYTE [bp-6], 1 pop bpInt2f?iret: iret; DRIVER.SYS calls - now only 0803.DriverSysCal: extern _Dyn:wrt DGROUP cmp al, 3 jne Int2f?iret mov ds, [cs:_DGROUP_] mov di, _Dyn+2 jmp short Int2f?iret;***********************************************************; internal doscalls INT2F/11xx - handled through C ;***********************************************************IntDosCal: ; set up register frame;struct int2f12regs;{; [space for 386 regs]; UWORD es,ds;; UWORD di,si,bp,bx,dx,cx,ax;; UWORD ip,cs,flags;; UWORD callerARG1; ;} push ax push cx push dx push bx push bp push si push di push ds push es cld%if XCPU >= 386 %ifdef WATCOM mov si,fs mov di,gs %else Protect386Registers %endif%endif mov ds,[cs:_DGROUP_] extern _int2F_12_handler call _int2F_12_handler%if XCPU >= 386 %ifdef WATCOM mov fs,si mov gs,di %else Restore386Registers %endif%endif pop es pop ds pop di pop si pop bp pop bx pop dx pop cx pop ax iret global SHARE_CHECKSHARE_CHECK: mov ax, 0x1000 int 0x2f ret ; DOS calls this to see if it's okay to open the file.; Returns a file_table entry number to use (>= 0) if okay; to open. Otherwise returns < 0 and may generate a critical; error. If < 0 is returned, it is the negated error return; code, so DOS simply negates this value and returns it in; AX.; STATIC int share_open_check(char * filename,; /* pointer to fully qualified filename */; unsigned short pspseg,; /* psp segment address of owner process */; int openmode,; /* 0=read-only, 1=write-only, 2=read-write */; int sharemode) /* SHARE_COMPAT, etc... */ global SHARE_OPEN_CHECKSHARE_OPEN_CHECK: mov es, si ; save si pop ax ; return address pop dx ; sharemode; pop cx ; openmode; pop bx ; pspseg; pop si ; filename push ax ; return address mov ax, 0x10a0 int 0x2f ; returns ax mov si, es ; restore si ret; DOS calls this to record the fact that it has successfully; closed a file, or the fact that the open for this file failed.; STATIC void share_close_file(int fileno) /* file_table entry number */ global SHARE_CLOSE_FILESHARE_CLOSE_FILE: pop ax pop bx push ax mov ax, 0x10a1 int 0x2f ret; DOS calls this to determine whether it can access (read or; write) a specific section of a file. We call it internally; from lock_unlock (only when locking) to see if any portion; of the requested region is already locked. If pspseg is zero,; then it matches any pspseg in the lock table. Otherwise, only; locks which DO NOT belong to pspseg will be considered.; Returns zero if okay to access or lock (no portion of the; region is already locked). Otherwise returns non-zero and; generates a critical error (if allowcriter is non-zero).; If non-zero is returned, it is the negated return value for; the DOS call.;STATIC int share_access_check(unsigned short pspseg,; /* psp segment address of owner process */; int fileno, /* file_table entry number */; unsigned long ofs, /* offset into file */; unsigned long len, /* length (in bytes) of region to access */; int allowcriter) /* allow a critical error to be generated */ global SHARE_ACCESS_CHECKSHARE_ACCESS_CHECK: mov ax, 0x10a2share_common: push bp mov bp, sp push si push di mov bx, [bp + 16] ; pspseg mov cx, [bp + 14] ; fileno mov si, [bp + 12] ; high word of ofs mov di, [bp + 10] ; low word of ofs les dx, [bp + 6] ; len or ax, [bp + 4] ; allowcriter/unlock int 0x2f pop di pop si pop bp ret 14 ; returns ax; DOS calls this to lock or unlock a specific section of a file.; Returns zero if successfully locked or unlocked. Otherwise
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -