mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
[ntdll]
- Implement LdrLockLoaderLock and LdrUnlockLoaderLock. svn path=/trunk/; revision=44318
This commit is contained in:
parent
637f171861
commit
15fff6abae
1 changed files with 58 additions and 4 deletions
|
@ -3382,8 +3382,55 @@ LdrLockLoaderLock(IN ULONG Flags,
|
|||
OUT PULONG Disposition OPTIONAL,
|
||||
OUT PULONG Cookie OPTIONAL)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
NTSTATUS Status;
|
||||
BOOLEAN Ret;
|
||||
BOOLEAN CookieSet = FALSE;
|
||||
|
||||
if ((Flags != 0x01) && (Flags != 0x02))
|
||||
return STATUS_INVALID_PARAMETER_1;
|
||||
|
||||
if (!Cookie) return STATUS_INVALID_PARAMETER_3;
|
||||
|
||||
/* Set some defaults for failure while verifying params */
|
||||
_SEH2_TRY
|
||||
{
|
||||
*Cookie = 0;
|
||||
CookieSet = TRUE;
|
||||
if (Disposition) *Disposition = 0;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
if (CookieSet)
|
||||
Status = STATUS_INVALID_PARAMETER_3;
|
||||
else
|
||||
Status = STATUS_INVALID_PARAMETER_2;
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (Flags == 0x01)
|
||||
{
|
||||
DPRINT1("Warning: Reporting errors with exception not supported yet!\n");
|
||||
RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Disposition) return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
Ret = RtlTryEnterCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||
|
||||
if (Ret)
|
||||
*Disposition = 0x01;
|
||||
else
|
||||
*Disposition = 0x02;
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* FIXME: Cookie is based on part of the thread id */
|
||||
*Cookie = (ULONG)NtCurrentTeb()->RealClientId.UniqueThread;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -3391,8 +3438,15 @@ NTAPI
|
|||
LdrUnlockLoaderLock(IN ULONG Flags,
|
||||
IN ULONG Cookie OPTIONAL)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
if (Flags != 0x01)
|
||||
return STATUS_INVALID_PARAMETER_1;
|
||||
|
||||
if (Cookie != (ULONG)NtCurrentTeb()->RealClientId.UniqueThread)
|
||||
return STATUS_INVALID_PARAMETER_2;
|
||||
|
||||
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
|
Loading…
Reference in a new issue