LONG do_act_MAKE_HARD_LINK(Global_T *g, DOSPKT *pkt) { LOCK *fl1 = (LOCK *) pkt->dp_Arg1; CBSTR cbstr1 = (CBSTR) pkt->dp_Arg2; /* special treating of Arg3, must be converted here, Arg3 may char pointer in case of softlink */ LOCK *fl2 = (LOCK *) BADDR(pkt->dp_Arg3); UBYTE *Name1 = NULL; LONG Res2; ELOCK *destelock; DCEntry *ParentDir1; destelock = lock_Lookup(g, fl2); if(!destelock) { SetRes(g, DOSFALSE, ERROR_INVALID_LOCK); goto exit; } ParentDir1 = LRootLocateDir(g, fl1, cbstr1, 0 /* not CString */, &Name1, NULL, NULL,NULL, /* no FullName needed */ &Res2); if(!ParentDir1) { SetRes(g, DOSFALSE, Res2); goto exit; } if(nfs_Link(g->g_NFSClnt, &destelock->efl_NFSFh, &ParentDir1->dce_NFSFh, Name1, &Res2)) SetRes1(g, DOSTRUE); else SetRes(g, DOSFALSE, Res2); exit: fn_Delete(&Name1); return g->g_Res1; }
BAMItem::BAMItem(itemType newType) { uint32 resNum; selfType = ITEM; // for self-identification priorityLevel = PRI_ITEM; type = newType; resNum = pWorld->itemMgr.GetPortAnim(type); SetRes(RES_ANIM, resNum, 1); }
LONG act_MAKE_LINK(Global_T *g, DOSPKT *pkt) { LONG Mode = pkt->dp_Arg4; switch(Mode) { case LINK_SOFT: return do_act_MAKE_SOFT_LINK(g, pkt); case LINK_HARD: return do_act_MAKE_HARD_LINK(g, pkt); default: return SetRes(g, DOSFALSE, ERROR_REQUIRED_ARG_MISSING); } }
void WorldCursor::Setup(grip gContext) { Context *pContext; msgMask = E_MOUSE_DOWN | E_MOUSE_UP; fIsMouseDown = FALSE; // attach ourselves to context SetContext(gContext); SetRes(RES_ANIM,102,2); SetContext(gContext); SetPri(PRI_INTERFACE + 1); FindStart(); Guy::Setup(); pContext = ADerefAs(Context,gContext); pContext->CutObject(gSelf, CT_SERV); }
LONG act_WRITE(Global_T *g, DOSPKT *pkt) { LONG Arg1 = pkt->dp_Arg1; UBYTE *Buf = (UBYTE *) pkt->dp_Arg2; LONG Num = pkt->dp_Arg3; LONG Res1 = DOSFALSE; LONG Res2 = g->g_Res2; EFH *efh; LONG Mode; if(Num<0) Num = 0; efh = fh_Lookup(g, Arg1); if(efh) { Mode = efh->efh_Mode; if(efh->efh_Res2) /* error from cached write */ { Res2 = efh->efh_Res2; efh->efh_Res2 = 0; /* FIXME: this may be wrong ??? */ } else { if(!((Mode == MODE_OLDFILE) || (Mode == MODE_READWRITE) || (Mode == MODE_NEWFILE))) { Res2 = ERROR_FILE_NOT_OBJECT; } else { /* FIXME: release only if regions overlap ?*/ if(HasBufferedRData(efh)) rb_ReleaseRBufData(g, efh); if(Num > 0) { #if 0 Num = nfs_MWrite(g->g_NFSClnt, &efh->efh_ELock->efl_NFSFh, efh->efh_FilePos, Buf, Num, &efh->efh_FileLen, g->g_MaxWriteSize, &Res2); #else Num = wc_WriteCache(g, efh, Buf, Num, &Res2); #endif if(Num >= 0) { efh->efh_FilePos += Num; Res1 = Num; Res2 = 0; } else { Res1 = -1; } } else { if(HasBufferedWData(efh)) { if(wc_FlushCache(g, efh, &Res2) == DOSFALSE) { Res1 = -1; } else { Res1 = Num; Res2 = 0; } } else { Res1 = Num; Res2 = 0; } } } } } else Res2 = ERROR_FILE_NOT_OBJECT; return SetRes(g, Res1, Res2); }