当前位置: 首页>>代码示例>>C++>>正文


C++ DOS_SetError函数代码示例

本文整理汇总了C++中DOS_SetError函数的典型用法代码示例。如果您正苦于以下问题:C++ DOS_SetError函数的具体用法?C++ DOS_SetError怎么用?C++ DOS_SetError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DOS_SetError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DOS_CreateFile

bool DOS_CreateFile(char const * name,Bit16u attributes,Bit16u * entry,bool fcb) {
    // Creation of a device is the same as opening it
    // Tc201 installer
    if (DOS_FindDevice(name) != DOS_DEVICES)
        return DOS_OpenFile(name, OPEN_READ, entry, fcb);

    LOG(LOG_FILES,LOG_NORMAL)("file create attributes %X file %s",attributes,name);
    char fullname[DOS_PATHLENGTH];
    Bit8u drive;
    DOS_PSP psp(dos.psp());
    if (!DOS_MakeName(name,fullname,&drive)) return false;
    /* Check for a free file handle */
    Bit8u handle=DOS_FILES;
    Bit8u i;
    for (i=0; i<DOS_FILES; i++) {
        if (!Files[i]) {
            handle=i;
            break;
        }
    }
    if (handle==DOS_FILES) {
        DOS_SetError(DOSERR_TOO_MANY_OPEN_FILES);
        return false;
    }
    /* We have a position in the main table now find one in the psp table */
    *entry = fcb?handle:psp.FindFreeFileEntry();
    if (*entry==0xff) {
        DOS_SetError(DOSERR_TOO_MANY_OPEN_FILES);
        return false;
    }
    /* Don't allow directories to be created */
    if (attributes&DOS_ATTR_DIRECTORY) {
        DOS_SetError(DOSERR_ACCESS_DENIED);
        return false;
    }
    bool foundit=Drives[drive]->FileCreate(&Files[handle],fullname,attributes);
    if (foundit) {
        Files[handle]->SetDrive(drive);
        Files[handle]->AddRef();
        if (!fcb) psp.SetFileHandle(*entry,handle);
        return true;
    } else {
        if(!PathExists(name)) DOS_SetError(DOSERR_PATH_NOT_FOUND);
        else DOS_SetError(DOSERR_FILE_NOT_FOUND);
        return false;
    }
}
开发者ID:svn2github,项目名称:dosbox,代码行数:47,代码来源:dos_files.cpp

示例2: DOS_MakeDir

bool DOS_MakeDir(char const * const dir) {
	Bit8u drive;char fulldir[DOS_PATHLENGTH];
	size_t len = strlen(dir);
	if(!len || dir[len-1] == '\\') {
		DOS_SetError(DOSERR_PATH_NOT_FOUND);
		return false;
	}
	if (!DOS_MakeName(dir,fulldir,&drive)) return false;
	if(Drives[drive]->MakeDir(fulldir)) return true;

	/* Determine reason for failing */
	if(Drives[drive]->TestDir(fulldir)) 
		DOS_SetError(DOSERR_ACCESS_DENIED);
	else
		DOS_SetError(DOSERR_PATH_NOT_FOUND);
	return false;
}
开发者ID:Avin15,项目名称:dospad,代码行数:17,代码来源:dos_files.cpp

示例3: DOS_FreeMemory

bool DOS_FreeMemory(Bit16u segment) {
//TODO Check if allowed to free this segment
	if (segment < DOS_MEM_START+1) {
		LOG(LOG_DOSMISC,LOG_ERROR)("Program tried to free %X ---ERROR",segment);
		DOS_SetError(DOSERR_MB_ADDRESS_INVALID);
		return false;
	}
      
	DOS_MCB mcb(segment-1);
	if ((mcb.GetType()!=0x4d) && (mcb.GetType()!=0x5a)) {
		DOS_SetError(DOSERR_MB_ADDRESS_INVALID);
		return false;
	}
	mcb.SetPSPSeg(MCB_FREE);
//	DOS_CompressMemory();
	return true;
}
开发者ID:duganchen,项目名称:dosbox,代码行数:17,代码来源:dos_memory.cpp

示例4: DOS_GetFreeDiskSpace

bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit8u * sectors,Bit16u * clusters,Bit16u * free) {
    if (drive==0) drive=DOS_GetDefaultDrive();
    else drive--;
    if ((drive>=DOS_DRIVES) || (!Drives[drive])) {
        DOS_SetError(DOSERR_INVALID_DRIVE);
        return false;
    }
    return Drives[drive]->AllocationInfo(bytes,sectors,clusters,free);
}
开发者ID:svn2github,项目名称:dosbox,代码行数:9,代码来源:dos_files.cpp

示例5: DOS_GetFileDate

bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate) {
    Bit32u handle=RealHandle(entry);
    if (handle>=DOS_FILES) {
        DOS_SetError(DOSERR_INVALID_HANDLE);
        return false;
    };
    if (!Files[handle] || !Files[handle]->IsOpen()) {
        DOS_SetError(DOSERR_INVALID_HANDLE);
        return false;
    };
    if (!Files[handle]->UpdateDateTimeFromHost()) {
        DOS_SetError(DOSERR_INVALID_HANDLE);
        return false;
    }
    *otime = Files[handle]->time;
    *odate = Files[handle]->date;
    return true;
}
开发者ID:svn2github,项目名称:dosbox,代码行数:18,代码来源:dos_files.cpp

示例6: if

bool physfscdromDrive::FileOpen(DOS_File * * file,const char * name,Bit32u flags)
{
	if ((flags&0xf)==OPEN_READWRITE) {
		flags &= ~OPEN_READWRITE;
	} else if ((flags&0xf)==OPEN_WRITE) {
		DOS_SetError(DOSERR_ACCESS_DENIED);
		return false;
	}
	return physfsDrive::FileOpen(file,name,flags);
};
开发者ID:Cliff-F,项目名称:Boxer,代码行数:10,代码来源:drive_physfs.cpp

示例7: DOS_UnlinkFile

bool DOS_UnlinkFile(char const * const name) {
	char fullname[DOS_PATHLENGTH];Bit8u drive;
	if (!DOS_MakeName(name,fullname,&drive)) return false;
	if(Drives[drive]->FileUnlink(fullname)){
		return true;
	} else {
		DOS_SetError(DOSERR_FILE_NOT_FOUND);
		return false;
	}
}
开发者ID:Avin15,项目名称:dospad,代码行数:10,代码来源:dos_files.cpp

示例8: DOS_FlushFile

bool DOS_FlushFile(Bit16u entry)
	{
	Bit32u handle = RealHandle(entry);
	if (handle >= DOS_FILES || !Files[handle])
		{
		DOS_SetError(DOSERR_INVALID_HANDLE);
		return false;
		}
	return true;
	}
开发者ID:rhenssel,项目名称:vDos,代码行数:10,代码来源:dos_files.cpp

示例9: DOS_SeekFile

bool DOS_SeekFile(Bit16u entry, Bit32u* pos, Bit32u type)
	{
	Bit32u handle = RealHandle(entry);
	if (handle >= DOS_FILES || !Files[handle])
		{
		DOS_SetError(DOSERR_INVALID_HANDLE);
		return false;
		}
	return Files[handle]->Seek(pos, type);
	}
开发者ID:rhenssel,项目名称:vDos,代码行数:10,代码来源:dos_files.cpp

示例10: DOS_ReadFile

bool DOS_ReadFile(Bit16u entry, Bit8u* data, Bit16u* amount)
	{
	Bit32u handle = RealHandle(entry);
	if (handle >= DOS_FILES || !Files[handle])
		{
		DOS_SetError(DOSERR_INVALID_HANDLE);
		return false;
		}
	return Files[handle]->Read(data, amount);
}
开发者ID:rhenssel,项目名称:vDos,代码行数:10,代码来源:dos_files.cpp

示例11: DOS_GetCurrentDir

bool DOS_GetCurrentDir(Bit8u drive,char * const buffer) {
    if (drive==0) drive=DOS_GetDefaultDrive();
    else drive--;
    if ((drive>=DOS_DRIVES) || (!Drives[drive])) {
        DOS_SetError(DOSERR_INVALID_DRIVE);
        return false;
    }
    strcpy(buffer,Drives[drive]->curdir);
    return true;
}
开发者ID:svn2github,项目名称:dosbox,代码行数:10,代码来源:dos_files.cpp

示例12: DOS_LockFile

bool DOS_LockFile(Bit16u entry, Bit8u mode, Bit32u pos, Bit32u size)
	{
	Bit32u handle = RealHandle(entry);
	if (handle >= DOS_FILES || !Files[handle])
		{
		DOS_SetError(DOSERR_INVALID_HANDLE);
		return false;
		}
	return Files[handle]->LockFile(mode, pos, size);
	}
开发者ID:rhenssel,项目名称:vDos,代码行数:10,代码来源:dos_files.cpp

示例13: DOS_GetFileAttr

bool DOS_GetFileAttr(char const * const name,Bit16u * attr) {
	char fullname[DOS_PATHLENGTH];Bit8u drive;
	if (!DOS_MakeName(name,fullname,&drive)) return false;
	if (Drives[drive]->GetFileAttr(fullname,attr)) {
		return true;
	} else {
		DOS_SetError(DOSERR_FILE_NOT_FOUND);
		return false;
	}
}
开发者ID:Avin15,项目名称:dospad,代码行数:10,代码来源:dos_files.cpp

示例14: DOS_SetError

bool localDrive::FindNext(DOS_DTA & dta) {

	char * dir_ent;
	struct stat stat_block;
	char full_name[CROSS_LEN];
	char dir_entcopy[CROSS_LEN];

	Bit8u srch_attr;char srch_pattern[DOS_NAMELENGTH_ASCII];
	Bit8u find_attr;

	dta.GetSearchParams(srch_attr,srch_pattern);
	Bit16u id = dta.GetDirID();

again:
	if (!dirCache.FindNext(id,dir_ent)) {
		DOS_SetError(DOSERR_NO_MORE_FILES);
		return false;
	}
	if(!WildFileCmp(dir_ent,srch_pattern)) goto again;

	strcpy(full_name,srchInfo[id].srch_dir);
	strcat(full_name,dir_ent);
	
	//GetExpandName might indirectly destroy dir_ent (by caching in a new directory 
	//and due to its design dir_ent might be lost.)
	//Copying dir_ent first
	strcpy(dir_entcopy,dir_ent);
	if (stat(dirCache.GetExpandName(full_name),&stat_block)!=0) { 
		goto again;//No symlinks and such
	}	

	if(stat_block.st_mode & S_IFDIR) find_attr=DOS_ATTR_DIRECTORY;
	else find_attr=DOS_ATTR_ARCHIVE;
 	if (~srch_attr & find_attr & (DOS_ATTR_DIRECTORY | DOS_ATTR_HIDDEN | DOS_ATTR_SYSTEM)) goto again;
	
	/*file is okay, setup everything to be copied in DTA Block */
	char find_name[DOS_NAMELENGTH_ASCII];Bit16u find_date,find_time;Bit32u find_size;

	if(strlen(dir_entcopy)<DOS_NAMELENGTH_ASCII){
		strcpy(find_name,dir_entcopy);
		upcase(find_name);
	} 

	find_size=(Bit32u) stat_block.st_size;
	struct tm *time;
	if((time=localtime(&stat_block.st_mtime))!=0){
		find_date=DOS_PackDate((Bit16u)(time->tm_year+1900),(Bit16u)(time->tm_mon+1),(Bit16u)time->tm_mday);
		find_time=DOS_PackTime((Bit16u)time->tm_hour,(Bit16u)time->tm_min,(Bit16u)time->tm_sec);
	} else {
		find_time=6; 
		find_date=4;
	}
	dta.SetResult(find_name,find_size,find_date,find_time,find_attr);
	return true;
}
开发者ID:dborth,项目名称:dosbox-wii,代码行数:55,代码来源:drive_local.cpp

示例15: if

bool cdromDrive::FileOpen(DOS_File * * file,char * name,Bit32u flags) {
	if ((flags&0xf)==OPEN_READWRITE) {
		flags &= ~OPEN_READWRITE;
	} else if ((flags&0xf)==OPEN_WRITE) {
		DOS_SetError(DOSERR_ACCESS_DENIED);
		return false;
	}
	bool retcode = localDrive::FileOpen(file,name,flags);
	if(retcode) (dynamic_cast<localFile*>(*file))->FlagReadOnlyMedium();
	return retcode;
}
开发者ID:dborth,项目名称:dosbox-wii,代码行数:11,代码来源:drive_local.cpp


注:本文中的DOS_SetError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。