Kernel : Slightly better implementation of XeLoadSection, XeUnloadSection and ObMakeTemporaryObject

Last one based on ReactOS
This commit is contained in:
PatrickvL 2017-02-18 23:34:36 +01:00
parent 814ad1e781
commit 4d14f14bd1
2 changed files with 25 additions and 14 deletions

View File

@ -62,6 +62,7 @@ namespace NtDll
#pragma warning(default:4005)
#define OB_FLAG_NAMED_OBJECT 1
#define OB_FLAG_PERMANENT_OBJECT 2
// ******************************************************************
// * 0x00EF - ObCreateObject()
@ -196,7 +197,21 @@ XBSYSAPI EXPORTNUM(242) xboxkrnl::VOID NTAPI xboxkrnl::ObMakeTemporaryObject
{
LOG_FUNC_ONE_ARG(Object);
LOG_UNIMPLEMENTED();
/* Get the header */
POBJECT_HEADER ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object);
/* Acquire object lock */
//ObpAcquireObjectLock(ObjectHeader);
LOG_INCOMPLETE(); // TODO : Lock, etc.
/* Remove the flag */
ObjectHeader->Flags &= ~OB_FLAG_PERMANENT_OBJECT;
/* Release the lock */
// ObpReleaseObjectLock(ObjectHeader);
/* Check if we should delete the object now */
//ObpDeleteNameCheck(ObjectBody);
}
// ******************************************************************
@ -422,5 +437,3 @@ XBSYSAPI EXPORTNUM(251) xboxkrnl::VOID FASTCALL xboxkrnl::ObfReferenceObject
InterlockedIncrement(&ObjectHeader->PointerCount);
}

View File

@ -78,10 +78,9 @@ XBSYSAPI EXPORTNUM(327) xboxkrnl::NTSTATUS NTAPI xboxkrnl::XeLoadSection
NTSTATUS ret = STATUS_SUCCESS;
if (Section->SectionReferenceCount > 0)
Section->SectionReferenceCount++;
else
LOG_UNIMPLEMENTED();
if (Section->SectionReferenceCount++ == 0) {
LOG_INCOMPLETE(); // TODO : Load section - probably lock this too
}
RETURN(ret);
}
@ -104,14 +103,13 @@ XBSYSAPI EXPORTNUM(328) xboxkrnl::NTSTATUS NTAPI xboxkrnl::XeUnloadSection
NTSTATUS ret = STATUS_SUCCESS;
if (Section->SectionReferenceCount > 0)
Section->SectionReferenceCount--;
else
{
LOG_UNIMPLEMENTED();
ret = STATUS_INVALID_PARAMETER;
if (Section->SectionReferenceCount > 0) {
if (--Section->SectionReferenceCount == 0) {
LOG_INCOMPLETE(); // TODO : Unload section - probably lock this too
}
}
else
ret = STATUS_INVALID_PARAMETER;
RETURN(ret);
}