From 6f3e14b768d580f5191bd4a47c5dc1ad3acc4018 Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Mon, 4 Apr 2016 20:59:03 +0100 Subject: [PATCH] NtQueryVolumeInformationFile implementation modified to be more like Dxbx, allows some titles to progress further. --- src/CxbxKrnl/EmuKrnl.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/CxbxKrnl/EmuKrnl.cpp b/src/CxbxKrnl/EmuKrnl.cpp index 7a613bdb5..5c6c947a8 100644 --- a/src/CxbxKrnl/EmuKrnl.cpp +++ b/src/CxbxKrnl/EmuKrnl.cpp @@ -3261,7 +3261,7 @@ XBSYSAPI EXPORTNUM(206) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueueApcThread (NtDll::PIO_STATUS_BLOCK) ApcStatusBlock, ApcReserved ); if( FAILED( ret ) ) EmuWarning( "NtQueueApcThread failed!" ); - + EmuSwapFS(); // Xbox FS return ret; @@ -3567,10 +3567,6 @@ XBSYSAPI EXPORTNUM(218) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryVolumeInformat GetCurrentThreadId(), FileHandle, IoStatusBlock, FileInformation, Length, FileInformationClass); - // Safety/Sanity Check - if(FileInformationClass != FileFsSizeInformation) - CxbxKrnlCleanup("NtQueryVolumeInformationFile: Unsupported FileInformationClass"); - NTSTATUS ret = NtDll::NtQueryVolumeInformationFile ( FileHandle, @@ -3579,17 +3575,25 @@ XBSYSAPI EXPORTNUM(218) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryVolumeInformat (NtDll::FS_INFORMATION_CLASS)FileInformationClass ); - // NOTE: TODO: Dynamically fill in, or allow configuration? - if(FileInformationClass == FileFsSizeInformation) - { - FILE_FS_SIZE_INFORMATION *SizeInfo = (FILE_FS_SIZE_INFORMATION*)FileInformation; + if (ret == STATUS_SUCCESS) + { + // NOTE: TODO: Dynamically fill in, or allow configuration? + if (FileInformationClass == FileFsSizeInformation) + { + FILE_FS_SIZE_INFORMATION *SizeInfo = (FILE_FS_SIZE_INFORMATION*)FileInformation; - SizeInfo->TotalAllocationUnits.QuadPart = 0x4C468; - SizeInfo->AvailableAllocationUnits.QuadPart = 0x2F125; - SizeInfo->SectorsPerAllocationUnit = 32; - SizeInfo->BytesPerSector = 512; - } + SizeInfo->TotalAllocationUnits.QuadPart = 0x4C468; + SizeInfo->AvailableAllocationUnits.QuadPart = 0x2F125; + SizeInfo->SectorsPerAllocationUnit = 32; + SizeInfo->BytesPerSector = 512; + } + } + else + { + EmuWarning("NtQueryInformationFile failed! (%s)\n", NtStatusToString(ret)); + } + EmuSwapFS(); // Xbox FS return ret; @@ -4264,6 +4268,7 @@ XBSYSAPI EXPORTNUM(277) VOID NTAPI xboxkrnl::RtlEnterCriticalSection CriticalSection->RecursionCount = GlobalCriticalSections[iSection].NativeCriticalSection.RecursionCount; CriticalSection->OwningThread = GlobalCriticalSections[iSection].NativeCriticalSection.OwningThread; } + //if(CriticalSection->LockCount == -1) //NtDll::RtlInitializeCriticalSection((NtDll::_RTL_CRITICAL_SECTION*)CriticalSection);