diff --git a/kernel/dosfns.c b/kernel/dosfns.c index 787fd8e..51bfc84 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -88,8 +88,7 @@ extern int ASMPASCAL /* /// End of additions for SHARE. - Ron Cemer */ -extern int ASMCFUNC - remote_lock_unlock(sft FAR *sftp, /* SFT for file */ +STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */ unsigned long ofs, /* offset into file */ unsigned long len, /* length (in bytes) of region to lock or unlock */ int unlock); /* one to unlock; zero to lock */ @@ -908,7 +907,8 @@ COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp) if (cdsp->cdsFlags & CDSNETWDRV) { - remote_getfree(cdsp, rg); + if (remote_getfree(cdsp, rg) != SUCCESS) + return DE_INVLDDRV; xfsp->xfs_clussize = rg[0]; xfsp->xfs_totalclusters = rg[1]; @@ -1467,3 +1467,19 @@ COUNT DosTruename(const char FAR *src, char FAR *dest) return rc; } +STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */ + unsigned long ofs, /* offset into file */ + unsigned long len, /* length (in bytes) of region to lock or unlock */ + int unlock) + /* one to unlock; zero to lock */ +{ + struct + { + unsigned long ofs, len; + int unlock; + } param_block; + param_block.ofs = ofs; + param_block.len = len; + param_block.unlock = unlock; + return (int)network_redirector_mx(REM_LOCK, sftp, ¶m_block); +} diff --git a/kernel/int2f.asm b/kernel/int2f.asm index 07d2e41..d257dfa 100644 --- a/kernel/int2f.asm +++ b/kernel/int2f.asm @@ -273,17 +273,6 @@ SHARE_LOCK_UNLOCK: ; sumtimes return data *ptr is the push stack word ; - global _remote_printredir -_remote_printredir: - push bp - mov bp,sp - push si - push di - mov ax, 1125h - mov dx, [bp+4] - push word [bp+6] - jmp short int2f_call - remote_lseek: ; arg is a pointer to the long seek value mov bx, cx mov dx, [bx] @@ -296,6 +285,17 @@ remote_getfattr: jc no_clear_ax jmp short no_neg_ax +remote_lock_unlock: + mov dx, cx ; parameter block (dx) in arg + mov bx, cx + mov bl, [bx + 8] ; unlock or not + mov cx, 1 + int 0x2f + mov ah, 0 + jc lock_error + mov al, 0 +lock_error: jmp no_clear_ax + ;long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg) global NETWORK_REDIRECTOR_MX NETWORK_REDIRECTOR_MX: @@ -317,13 +317,22 @@ call_int2f: je remote_rw cmp al, 09h je remote_rw - cmp al, 0ch - je remote_getfree + cmp al, 0ah + je remote_lock_unlock + cmp al, 21h + je remote_lseek + cmp al, 22h + je remote_process_end cmp al, 23h je qremote_fn - cmp al, 25h - je remote_lseek + push cx ; arg + cmp al, 0ch + je remote_getfree + cmp al, 1eh + je remote_print_doredir + cmp al, 1fh + je remote_print_doredir int2f_call: xor cx, cx ; set to succeed; clear carry and CX @@ -342,32 +351,18 @@ no_neg_ax: pop bp ret - global _remote_doredirect -_remote_doredirect: - mov al, 1eh - jmp short print_doredir +remote_print_doredir: ; di points to an lregs structure + mov es,[di+0xe] + mov bx,[di+2] + mov cx,[di+4] + mov dx,[di+6] + mov si,[di+8] + lds di,[di+0xa] - global _remote_printset -_remote_printset: - mov al, 1fh -print_doredir: - push bp - mov bp,sp - push si - push di - push ds - mov ah, 11h - mov si,[bp+14] - les di,[bp+10] - mov dx,[bp+8] - mov cx,[bp+6] - mov bx,[bp+4] - - mov ds, [bp+18] - push word [bp+16] ; very fakey, HaHa ;) clc ; set to succeed int 2fh - pop bx + pop bx ; restore stack and ds=ss + push ss pop ds jc no_clear_ax xor cx, cx @@ -375,9 +370,8 @@ print_doredir: remote_getfree: clc ; set to succeed - push cx ; pointer arg int 2fh - pop di + pop di ; retrieve pushed pointer arg jc no_clear_ax mov [di],ax mov [di+2],bx @@ -409,39 +403,12 @@ qremote_fn: xor cx, cx jmp short clear_ax - global _remote_process_end -_remote_process_end: ; Terminate process +remote_process_end: ; Terminate process mov ds, [_cu_psp] - mov ax, 1122h - call call_int2f + int 2fh push ss pop ds - ret - -;STATIC int ASMCFUNC remote_lock_unlock(sft FAR *sftp, /* SFT for file */ -; unsigned long ofs, /* offset into file */ -; unsigned long len, /* length (in bytes) of region to lock or unlock */ -; int unlock) -; one to unlock; zero to lock - global _remote_lock_unlock -_remote_lock_unlock: - push bp - mov bp, sp - push di - les di, [bp + 4] ; sftp - lea dx, [bp + 8] ; parameter block on the stack! - mov bl, [bp + 16] ; unlock - mov ax, 0x110a - mov cx, 1 - int 0x2f - mov ah, 0 - jc lock_error - mov al, 0 -lock_error: - neg al - pop di - pop bp - ret + jmp short no_neg_ax ; extern UWORD ASMCFUNC call_nls(UWORD subfct, struct nlsInfoBlock *nlsinfo, ; UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize, UWORD FAR *buf, UWORD *id); diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index fa57db2..055f3d8 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1326,8 +1326,7 @@ dispatch: break; default: - rc = remote_printset(lr.BX, lr.CX, lr.DX, (FP_ES_DI), - lr.SI, (MK_FP(lr.DS, Int21AX))); + rc = (int)network_redirector_mx(REM_PRINTSET, &lr, (void *)Int21AX); if (rc != SUCCESS) goto error_exit; lr.AX = SUCCESS; @@ -1359,14 +1358,7 @@ dispatch: } else { -/* - void int_2f_111e_call(iregs FAR *r); - int_2f_111e_call(r); - break;*/ - - rc = remote_doredirect(lr.BX, lr.CX, lr.DX, - (FP_ES_DI), lr.SI, - (MK_FP(lr.DS, Int21AX))); + rc = (int)network_redirector_mx(REM_DOREDIRECT, &lr, (void *)Int21AX); /* the remote function manipulates *r directly !, so we should not copy lr to r here */ if (rc != SUCCESS) diff --git a/kernel/network.c b/kernel/network.c index 5004243..a29e6ac 100644 --- a/kernel/network.c +++ b/kernel/network.c @@ -60,3 +60,4 @@ int network_redirector(unsigned cmd) { return network_redirector_fp(cmd, NULL); } + diff --git a/kernel/proto.h b/kernel/proto.h index d7416c9..0a2b5d3 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -382,15 +382,10 @@ COUNT truename(const char FAR * src, char * dest, COUNT t); int network_redirector(unsigned cmd); int network_redirector_fp(unsigned cmd, void far *s); long ASMPASCAL network_redirector_mx(unsigned cmd, void far *s, void *arg); -COUNT ASMCFUNC remote_doredirect(UWORD b, UCOUNT n, UWORD d, VOID FAR * s, - UWORD i, VOID FAR * data); -COUNT ASMCFUNC remote_printset(UWORD b, UCOUNT n, UWORD d, VOID FAR * s, - UWORD i, VOID FAR * data); -COUNT ASMCFUNC remote_process_end(VOID); #define remote_getfree(s,d) (int)network_redirector_mx(REM_GETSPACE, s, d) #define remote_lseek(s,new_pos) network_redirector_mx(REM_LSEEK, s, &new_pos) #define remote_setfattr(attr) (int)network_redirector_mx(REM_SETATTR, NULL, (void *)attr) -COUNT ASMCFUNC remote_printredir(UCOUNT dx, UCOUNT ax); +#define remote_printredir(dx,ax) (int)network_redirector_mx(REM_PRINTREDIR, MK_FP(0,dx),(void *)ax) #define QRemote_Fn(d,s) (int)network_redirector_mx(REM_FILENAME, d, &s) UWORD get_machine_name(BYTE FAR * netname);