[Kernel] Fix NtReleaseSemaphore returning wrong status code

This commit is contained in:
Herman S.
2026-04-13 12:59:36 +09:00
parent c17a3b19fb
commit d42411ec2a
2 changed files with 2 additions and 3 deletions

View File

@@ -775,13 +775,11 @@ dword_result_t NtReleaseSemaphore_entry(dword_t sem_handle,
bool success =
sem->ReleaseSemaphore((int32_t)release_count, &previous_count);
if (!success) {
// Releasing would exceed the semaphore's maximum count
// Windows returns STATUS_SEMAPHORE_LIMIT_EXCEEDED (0x0000012B)
XELOGW(
"NtReleaseSemaphore: release_count={} would exceed maximum (current "
"count={})",
uint32_t(release_count), previous_count);
result = 0x0000012B;
result = X_STATUS_SEMAPHORE_LIMIT_EXCEEDED;
}
} else {
result = X_STATUS_INVALID_HANDLE;

View File

@@ -60,6 +60,7 @@ typedef uint32_t X_STATUS;
#define X_STATUS_OBJECT_NAME_COLLISION ((X_STATUS)0xC0000035L)
#define X_STATUS_INVALID_PAGE_PROTECTION ((X_STATUS)0xC0000045L)
#define X_STATUS_MUTANT_NOT_OWNED ((X_STATUS)0xC0000046L)
#define X_STATUS_SEMAPHORE_LIMIT_EXCEEDED ((X_STATUS)0xC0000047L)
#define X_STATUS_THREAD_IS_TERMINATING ((X_STATUS)0xC000004BL)
#define X_STATUS_PROCEDURE_NOT_FOUND ((X_STATUS)0xC000007AL)
#define X_STATUS_INVALID_IMAGE_FORMAT ((X_STATUS)0xC000007BL)