mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:33:04 +00:00
[NTOS:CM] Protect user memory access with SEH in NtQueryOpenSubKeys.
This commit is contained in:
parent
eb7be70007
commit
91cc1c3e4f
1 changed files with 14 additions and 2 deletions
|
@ -1473,6 +1473,7 @@ NtQueryOpenSubKeys(IN POBJECT_ATTRIBUTES TargetKey,
|
||||||
PCM_KEY_BODY KeyBody = NULL;
|
PCM_KEY_BODY KeyBody = NULL;
|
||||||
HANDLE KeyHandle;
|
HANDLE KeyHandle;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
ULONG SubKeys;
|
||||||
|
|
||||||
DPRINT("NtQueryOpenSubKeys()\n");
|
DPRINT("NtQueryOpenSubKeys()\n");
|
||||||
|
|
||||||
|
@ -1543,8 +1544,8 @@ NtQueryOpenSubKeys(IN POBJECT_ATTRIBUTES TargetKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the internal API */
|
/* Call the internal API */
|
||||||
*HandleCount = CmpEnumerateOpenSubKeys(KeyBody->KeyControlBlock,
|
SubKeys = CmpEnumerateOpenSubKeys(KeyBody->KeyControlBlock,
|
||||||
FALSE, FALSE);
|
FALSE, FALSE);
|
||||||
|
|
||||||
/* Unlock the registry */
|
/* Unlock the registry */
|
||||||
CmpUnlockRegistry();
|
CmpUnlockRegistry();
|
||||||
|
@ -1552,6 +1553,17 @@ NtQueryOpenSubKeys(IN POBJECT_ATTRIBUTES TargetKey,
|
||||||
/* Dereference the key object */
|
/* Dereference the key object */
|
||||||
ObDereferenceObject(KeyBody);
|
ObDereferenceObject(KeyBody);
|
||||||
|
|
||||||
|
/* Write back the result */
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
*HandleCount = SubKeys;
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
DPRINT("Done.\n");
|
DPRINT("Done.\n");
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue