本文整理汇总了C++中RealHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ RealHandle函数的具体用法?C++ RealHandle怎么用?C++ RealHandle使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RealHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DOS_FCBWrite
Bit8u DOS_FCBWrite(Bit16u seg,Bit16u offset,Bit16u recno) {
DOS_FCB fcb(seg,offset);
Bit8u fhandle,cur_rec;Bit16u cur_block,rec_size;
fcb.GetSeqData(fhandle,rec_size);
if (fhandle==0xff && rec_size!=0) {
if (!DOS_FCBOpen(seg,offset)) return FCB_READ_NODATA;
LOG(LOG_FCB,LOG_WARN)("Reopened closed FCB");
fcb.GetSeqData(fhandle,rec_size);
}
fcb.GetRecord(cur_block,cur_rec);
Bit32u pos=((cur_block*128)+cur_rec)*rec_size;
if (!DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET)) return FCB_ERR_WRITE;
MEM_BlockRead(Real2Phys(dos.dta())+recno*rec_size,dos_copybuf,rec_size);
Bit16u towrite=rec_size;
if (!DOS_WriteFile(fhandle,dos_copybuf,&towrite)) return FCB_ERR_WRITE;
Bit32u size;Bit16u date,time;
fcb.GetSizeDateTime(size,date,time);
if (pos+towrite>size) size=pos+towrite;
//time doesn't keep track of endofday
date = DOS_PackDate(dos.date.year,dos.date.month,dos.date.day);
Bit32u ticks = mem_readd(BIOS_TIMER);
Bit32u seconds = (ticks*10)/182;
Bit16u hour = (Bit16u)(seconds/3600);
Bit16u min = (Bit16u)((seconds % 3600)/60);
Bit16u sec = (Bit16u)(seconds % 60);
time = DOS_PackTime(hour,min,sec);
Bit8u temp=RealHandle(fhandle);
Files[temp]->time=time;
Files[temp]->date=date;
fcb.SetSizeDateTime(size,date,time);
if (++cur_rec>127) { cur_block++;cur_rec=0; }
fcb.SetRecord(cur_block,cur_rec);
return FCB_SUCCESS;
}
示例2: DOS_FCBIncreaseSize
Bit8u DOS_FCBIncreaseSize(Bit16u seg,Bit16u offset) {
DOS_FCB fcb(seg,offset);
Bit8u fhandle,cur_rec;Bit16u cur_block,rec_size;
fcb.GetSeqData(fhandle,rec_size);
fcb.GetRecord(cur_block,cur_rec);
Bit32u pos=((cur_block*128)+cur_rec)*rec_size;
if (!DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET)) return FCB_ERR_WRITE;
Bit16u towrite=0;
if (!DOS_WriteFile(fhandle,dos_copybuf,&towrite)) return FCB_ERR_WRITE;
Bit32u size;Bit16u date,time;
fcb.GetSizeDateTime(size,date,time);
if (pos+towrite>size) size=pos+towrite;
//time doesn't keep track of endofday
date = DOS_PackDate(dos.date.year,dos.date.month,dos.date.day);
Bit32u ticks = mem_readd(BIOS_TIMER);
Bit32u seconds = (ticks*10)/182;
Bit16u hour = (Bit16u)(seconds/3600);
Bit16u min = (Bit16u)((seconds % 3600)/60);
Bit16u sec = (Bit16u)(seconds % 60);
time = DOS_PackTime(hour,min,sec);
Bit8u temp=RealHandle(fhandle);
Files[temp]->time=time;
Files[temp]->date=date;
fcb.SetSizeDateTime(size,date,time);
fcb.SetRecord(cur_block,cur_rec);
return FCB_SUCCESS;
}
示例3: DOS_DuplicateEntry
bool DOS_DuplicateEntry(Bit16u entry,Bit16u * newentry) {
// Dont duplicate console handles
/* if (entry<=STDPRN) {
*newentry = entry;
return true;
};
*/
Bit8u 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;
};
DOS_PSP psp(dos.psp());
*newentry = psp.FindFreeFileEntry();
if (*newentry==0xff) {
DOS_SetError(DOSERR_TOO_MANY_OPEN_FILES);
return false;
}
Files[handle]->AddRef();
psp.SetFileHandle(*newentry,handle);
return true;
}
示例4: BeforeHandle
void BasicHandler::Run()
{
BeforeHandle();
RealHandle(m_request_data, &m_response_data);
AfterHandler();
m_done->Run();
}
示例5: DOS_GetSTDINStatus
bool DOS_GetSTDINStatus(void)
{
Bit32u handle = RealHandle(STDIN);
if (handle == 0xFF)
return false;
if (Files[handle] && (Files[handle]->GetInformation() & 64))
return false;
return true;
}
示例6: 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;
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: DOS_SeekFile
bool DOS_SeekFile(Bit16u entry,Bit32u * pos,Bit32u type,bool fcb) {
Bit32u handle = fcb?entry: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;
};
return Files[handle]->Seek(pos,type);
}
示例11: DOS_ForceDuplicateEntry
bool DOS_ForceDuplicateEntry(Bit16u entry, Bit16u newentry)
{
if (entry == newentry)
{
DOS_SetError(DOSERR_INVALID_HANDLE);
return false;
}
Bit8u orig = RealHandle(entry);
if (orig >= DOS_FILES || !Files[orig])
{
DOS_SetError(DOSERR_INVALID_HANDLE);
return false;
}
Bit8u newone = RealHandle(newentry);
if (newone < DOS_FILES && Files[newone])
DOS_CloseFile(newentry);
DOS_PSP psp(dos.psp());
Files[orig]->AddRef();
psp.SetFileHandle(newentry, orig);
return true;
}
示例12: DOS_FlushFile
bool DOS_FlushFile(Bit16u entry) {
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;
};
LOG(LOG_DOSMISC,LOG_NORMAL)("FFlush used.");
return true;
}
示例13: DOS_GetFileDate
bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate)
{
Bit32u handle = RealHandle(entry);
if (handle >= DOS_FILES || !Files[handle])
{
DOS_SetError(DOSERR_INVALID_HANDLE);
return false;
}
Files[handle]->UpdateDateTimeFromHost();
*otime = Files[handle]->time;
*odate = Files[handle]->date;
return true;
}
示例14: DOS_FCBGetFileSize
bool DOS_FCBGetFileSize(Bit16u seg,Bit16u offset) {
char shortname[DOS_PATHLENGTH];Bit16u entry;Bit8u handle;Bit16u rec_size;
DOS_FCB fcb(seg,offset);
fcb.GetName(shortname);
if (!DOS_OpenFile(shortname,OPEN_READ,&entry)) return false;
handle = RealHandle(entry);
Bit32u size = 0;
Files[handle]->Seek(&size,DOS_SEEK_END);
DOS_CloseFile(entry);fcb.GetSeqData(handle,rec_size);
Bit32u random=(size/rec_size);
if (size % rec_size) random++;
fcb.SetRandom(random);
return true;
}
示例15: sSave
void DOS_FCB::FileOpen(Bit8u _fhandle) {
sSave(sFCB,drive,GetDrive()+1);
sSave(sFCB,file_handle,_fhandle);
sSave(sFCB,cur_block,0);
sSave(sFCB,rec_size,128);
// sSave(sFCB,rndm,0); // breaks Jewels of darkness.
Bit8u temp = RealHandle(_fhandle);
Bit32u size = 0;
Files[temp]->Seek(&size,DOS_SEEK_END);
sSave(sFCB,filesize,size);
size = 0;
Files[temp]->Seek(&size,DOS_SEEK_SET);
sSave(sFCB,time,Files[temp]->time);
sSave(sFCB,date,Files[temp]->date);
}