mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:53:40 +00:00
[ADVAPI32] -RegOpenKeyExW: Call NtOpenKey again with aligned parameters if STATUS_DATATYPE_MISALIGNMENT was returned the first time. CORE-13689
svn path=/trunk/; revision=75592
This commit is contained in:
parent
fb160be266
commit
58edf0b679
1 changed files with 33 additions and 0 deletions
|
@ -3429,6 +3429,39 @@ RegOpenKeyExW(HKEY hKey,
|
||||||
samDesired,
|
samDesired,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
|
|
||||||
|
if (Status == STATUS_DATATYPE_MISALIGNMENT)
|
||||||
|
{
|
||||||
|
HANDLE hAligned;
|
||||||
|
UNICODE_STRING AlignedString;
|
||||||
|
|
||||||
|
Status = RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
|
||||||
|
&SubKeyString,
|
||||||
|
&AlignedString);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* Try again with aligned parameters */
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&AlignedString,
|
||||||
|
Attributes,
|
||||||
|
KeyHandle,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
Status = NtOpenKey(&hAligned,
|
||||||
|
samDesired,
|
||||||
|
&ObjectAttributes);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString(&AlignedString);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
*phkResult = hAligned;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Restore the original error */
|
||||||
|
Status = STATUS_DATATYPE_MISALIGNMENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ErrorCode = RtlNtStatusToDosError(Status);
|
ErrorCode = RtlNtStatusToDosError(Status);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue