diff --git a/src/CxbxKrnl/EmuKrnlOb.cpp b/src/CxbxKrnl/EmuKrnlOb.cpp index 073d9a9e5..f671400a0 100644 --- a/src/CxbxKrnl/EmuKrnlOb.cpp +++ b/src/CxbxKrnl/EmuKrnlOb.cpp @@ -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); } - - diff --git a/src/CxbxKrnl/EmuKrnlXe.cpp b/src/CxbxKrnl/EmuKrnlXe.cpp index 0b508aa78..f1d0da046 100644 --- a/src/CxbxKrnl/EmuKrnlXe.cpp +++ b/src/CxbxKrnl/EmuKrnlXe.cpp @@ -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); }