Exemplo n.º 1
0
bool DOS_FCBRenameFile(Bit16u seg, Bit16u offset) {
    DOS_FCB fcbold(seg,offset);
    DOS_FCB fcbnew(seg,offset+16);
    if(!fcbold.Valid()) return false;
    char oldname[DOS_FCBNAME];
    char newname[DOS_FCBNAME];
    fcbold.GetName(oldname);
    fcbnew.GetName(newname);

    /* Check, if sourcefile is still open. This was possible in DOS, but modern oses don't like this */
    Bit8u drive;
    char fullname[DOS_PATHLENGTH];
    if (!DOS_MakeName(oldname,fullname,&drive)) return false;

    DOS_PSP psp(dos.psp());
    for (Bit8u i=0; i<DOS_FILES; i++) {
        if (Files[i] && Files[i]->IsOpen() && Files[i]->IsName(fullname)) {
            Bit16u handle = psp.FindEntryByHandle(i);
            //(more than once maybe)
            if (handle == 0xFF) {
                DOS_CloseFile(i,true);
            } else {
                DOS_CloseFile(handle);
            }
        }
    }

    /* Rename the file */
    return DOS_Rename(oldname,newname);
}
Exemplo n.º 2
0
bool DOS_FCBRenameFile(Bit16u seg, Bit16u offset){
	DOS_FCB fcbold(seg,offset);
	DOS_FCB fcbnew(seg,offset+16);
	char oldname[DOS_FCBNAME];
	char newname[DOS_FCBNAME];
	fcbold.GetName(oldname);fcbnew.GetName(newname);
	return DOS_Rename(oldname,newname);
}
Exemplo n.º 3
0
bool DOS_FCBRenameFile(Bit16u seg, Bit16u offset)
	{
	DOS_FCB fcbold(seg, offset);
	DOS_FCB fcbnew(seg, offset+16);
	if (!fcbold.Valid())
		return false;
	char oldname[DOS_FCBNAME];
	char newname[DOS_FCBNAME];
	fcbold.GetName(oldname);
	FCBNameToStr(oldname);
	fcbnew.GetName(newname);
	FCBNameToStr(newname);
	return DOS_Rename(oldname, newname);											// Rename the file
	}