[PATCH 2/6] ntoskrnl.exe: Implement KeReleaseSemaphore() and waiting on semaphores.

Dmitry Timoshkov dmitry at baikal.ru
Tue Nov 27 00:58:28 CST 2018


Zebediah Figura <z.figura12 at gmail.com> wrote:

> +            case TYPE_SEMAPHORE:
> +            {
> +                KSEMAPHORE *semaphore = CONTAINING_RECORD(objs[i], KSEMAPHORE, Header);
> +                objs[i]->WaitListHead.Blink = CreateSemaphoreW( NULL,
> +                    semaphore->Header.SignalState, semaphore->Limit, NULL );
> +                break;
> +            }
...
> +    EnterCriticalSection( &sync_cs );
> +    ret = InterlockedExchangeAdd( &semaphore->Header.SignalState, count );
> +    if (handle)
> +        ReleaseSemaphore( handle, count, NULL );
> +    LeaveCriticalSection( &sync_cs );

Wouldn't it be better to use native instead of win32 APIs? This way you would
be able to propagate errors instead of ignoring them.

-- 
Dmitry.



More information about the wine-devel mailing list