diff --git a/include/dos_inc.h b/include/dos_inc.h index 43ba1d15..df977352 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -117,6 +117,7 @@ bool DOS_RemoveDir(char * dir); bool DOS_Rename(char * oldname,char * newname); bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit8u * sectors,Bit16u * clusters,Bit16u * free); bool DOS_GetFileAttr(char * name,Bit16u * attr); +bool DOS_SetFileAttr(char * name,Bit16u attr); /* IOCTL Stuff */ bool DOS_IOCTL(void); diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index e0959e8d..02243133 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos.cpp,v 1.57 2003-10-14 23:33:33 harekiet Exp $ */ +/* $Id: dos.cpp,v 1.58 2003-10-17 16:56:38 finsterr Exp $ */ #include #include @@ -527,7 +527,12 @@ static Bitu DOS_21Handler(void) { break; case 0x01: /* Set */ LOG(LOG_MISC,LOG_ERROR)("DOS:Set File Attributes for %s not supported",name1); - CALLBACK_SCF(false); + if (DOS_SetFileAttr(name1,reg_cx)) { + CALLBACK_SCF(false); + } else { + CALLBACK_SCF(true); + reg_ax=dos.errorcode; + } break; default: LOG(LOG_MISC,LOG_ERROR)("DOS:0x43:Illegal subfunction %2X",reg_al); diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 82dace06..74fb195b 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.47 2003-10-10 13:50:34 finsterr Exp $ */ +/* $Id: dos_files.cpp,v 1.48 2003-10-17 16:56:06 finsterr Exp $ */ #include #include @@ -447,6 +447,21 @@ bool DOS_GetFileAttr(char * name,Bit16u * attr) { } } +bool DOS_SetFileAttr(char * name,Bit16u attr) +// this function does not change the file attributs +// it just does some tests if file is available +// returns false when using on cdrom (stonekeep) +{ + Bit16u attrTemp; + char fullname[DOS_PATHLENGTH];Bit8u drive; + if (!DOS_MakeName(name,fullname,&drive)) return false; + if (strcmp(Drives[drive]->GetInfo(),"CDRom.")==0) { + DOS_SetError(DOSERR_ACCESS_DENIED); + return false; + } + return Drives[drive]->GetFileAttr(fullname,&attrTemp); +} + bool DOS_Canonicalize(char * name,char * big) { //TODO Add Better support for devices and shit but will it be needed i doubt it :) Bit8u drive;