Skip to content
Draft

Share #277

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ mv -n bin/kgc*.map bin/kgc*.sys _output/gcc/.
mv -n bin/country.sys _output/gcc/.
# GCC share
(
git submodule update --remote share
cd share
git submodule update --init --recursive
git clean -x -d -f
env COMPILER=gcc ./build.sh
)
mv -n share/src/share.com _output/gcc/.
mv -n share/src/share.map _output/gcc/.
cp -p share/src/share.com _output/gcc/.
cp -p share/src/share.map _output/gcc/.

# Open Watcom Environment Setup
export WATCOM=$BUILD_DIR/_watcom
Expand Down Expand Up @@ -95,13 +95,13 @@ if [ -d ${HOME}/.dosemu/drive_c/tc201 ] ; then
mv -n bin/country.sys _output/tc_dos/.
# TC share
(
git submodule update --remote share
cd share
git submodule update --init --recursive
git clean -x -d -f
env COMPILER=tcc2-emu ./build.sh
)
mv -n share/src/share.com _output/tc_dos/.
mv -n share/src/share.map _output/tc_dos/.
cp -p share/src/share.com _output/tc_dos/.
cp -p share/src/share.map _output/tc_dos/.
fi

echo done
18 changes: 15 additions & 3 deletions kernel/dosfns.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extern int ASMPASCAL
1 if open
0 if not */
extern int ASMPASCAL
share_is_file_open(const char far * filename);
share_is_file_open(const char far * filename, unsigned short *mode, unsigned short *pspseg);

/* /// End of additions for SHARE. - Ron Cemer */

Expand Down Expand Up @@ -1235,6 +1235,13 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD attrp)
DebugPrintf(("DosSetFattr(%s)\n", name));
if (IsShareInstalled(TRUE))
{
UWORD mode, psp;

/* SHARE refuses to change attrs if file is opened */
if (share_is_file_open(PriPathName, &mode, &psp) &&
(((mode >> 8) != 0 /* SHARE_COMPAT */) || psp != cu_psp))
return DE_ACCESS;

/* SHARE closes the file if it is opened in
* compatibility mode, else generate a critical error.
* Here generate a critical error by opening in "rw compat" mode */
Expand All @@ -1259,6 +1266,7 @@ UBYTE DosSelectDrv(UBYTE drv)
COUNT DosDelete(BYTE FAR * path, int attrib)
{
COUNT result;
UWORD mode, psp;

result = truename(path, PriPathName, CDS_MODE_CHECK_DEV_PATH);
if (result < SUCCESS)
Expand All @@ -1272,22 +1280,26 @@ COUNT DosDelete(BYTE FAR * path, int attrib)
if (result & IS_DEVICE)
return DE_FILENOTFND;

if (IsShareInstalled(TRUE) && share_is_file_open(PriPathName))
if (IsShareInstalled(TRUE) && share_is_file_open(PriPathName, &mode, &psp) &&
(((mode >> 8) != 0 /* SHARE_COMPAT */) || psp != cu_psp))
return DE_ACCESS;

return dos_delete(PriPathName, attrib);
}

COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib)
{
UWORD mode, psp;

if (path1[0] != path2[0])
{
return DE_DEVICE; /* not same device */
}
if (FP_OFF(current_ldt) == 0xFFFF || (current_ldt->cdsFlags & CDSNETWDRV))
return network_redirector(REM_RENAME);

if (IsShareInstalled(TRUE) && share_is_file_open(path1))
if (IsShareInstalled(TRUE) && share_is_file_open(path1, &mode, &psp) &&
(((mode >> 8) != 0 /* SHARE_COMPAT */) || psp != cu_psp))
return DE_ACCESS;

return dos_rename(path1, path2, attrib);
Expand Down
45 changes: 35 additions & 10 deletions kernel/int2f.asm
Original file line number Diff line number Diff line change
Expand Up @@ -354,20 +354,45 @@ SHARE_LOCK_UNLOCK:
; Returns:
; 1 if open
; 0 if not
; STATIC WORD share_is_file_open(const char far *filename) /* pointer to fully qualified filename */
; STATIC WORD share_is_file_open(const char far *filename, UWORD *mode, UWORD *pspseg)
global SHARE_IS_FILE_OPEN
SHARE_IS_FILE_OPEN:
mov si, ds
mov es, si ; save ds
pop ax ; save return address
pop si ; filename
pop ds ; SEG filename
push ax ; restore return address
push bp
mov bp, sp
arg {filename,4}, mode, pspseg
push si
push ds
lds si, [.filename]
xor cx, cx
xor dx, dx
mov ax, 0x10a6
stc
int 0x2f ; returns ax
mov si, es ; restore ds
mov ds, si
ret
jc .notopen ; error or missing
cmp ax, 1 ; only an explicit 1 means "open"
je .setparams
.notopen:
xor ax, ax
xor cx, cx
xor dx, dx

.setparams:
pop ds ; caller's DS again, for the pointers

.setmode
mov si, [.mode]
test si, si ; NULL = caller doesn't want the mode
jz .setpsp
mov [si], cx ; (sharemode << 8) | openmode
.setpsp:
mov si, [.pspseg]
test si, si ; NULL = caller doesn't want the pspseg
jz .done
mov [si], dx ; PSP of the open file
.done:
pop si
pop bp
ret 8

; Int 2F Multipurpose Remote System Calls
;
Expand Down