kernel/eka/kernel/sexec.cpp
changeset 4 56f325a607ea
parent 0 a41df078684a
child 22 2f92ad2dc5db
--- a/kernel/eka/kernel/sexec.cpp	Mon Dec 21 16:14:42 2009 +0000
+++ b/kernel/eka/kernel/sexec.cpp	Wed Dec 23 11:43:31 2009 +0000
@@ -1396,10 +1396,27 @@
 	kumemput32(anInfo,&hinfo,sizeof(hinfo));
 	}
 
-TUint ExecHandler::HandleAttributes(TInt /*aHandle*/)
+TUint ExecHandler::HandleAttributes(TInt aHandle)
 	{
-	// NOT YET IMPLEMENTED
-	return 0x0f;
+	__KTRACE_OPT(KEXEC,Kern::Printf("Exec::HandleAttributes"));
+	TUint attributes = RHandleBase::EReadAccess | RHandleBase::EDirectReadAccess;
+	NKern::LockSystem();
+	DObject* pO = K::ObjectFromHandle(aHandle);
+	if (pO->UniqueID() - 1 == EChunk)
+		{
+		DChunk* pChunk = (DChunk*) pO;
+		if (!(pChunk->iAttributes & DChunk::EReadOnly) ||
+			(TheCurrentThread->iOwningProcess->iId == pChunk->iControllingOwner))
+			{
+			attributes |= (RHandleBase::EWriteAccess | RHandleBase::EDirectWriteAccess);
+			}
+		}
+	else
+		{
+		attributes |= (RHandleBase::EWriteAccess | RHandleBase::EDirectWriteAccess);
+		}
+	NKern::UnlockSystem();
+	return attributes;
 	}
 
 TLibraryFunction ExecHandler::LibraryLookup(TInt aLibraryHandle, TInt aOrdinal)