1
0
Fork 0

added DOS_SetFileAttr : check if file is available, failure if cdrom, but no change of file attributes

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1346
This commit is contained in:
Ulf Wohlers 2003-10-17 16:56:38 +00:00
parent 628357a1b0
commit 3a49d4acf2
3 changed files with 24 additions and 3 deletions

View file

@ -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);

View file

@ -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 <stdio.h>
#include <stdlib.h>
@ -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);

View file

@ -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 <string.h>
#include <stdlib.h>
@ -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;