Index: dll/win32/advapi32/reg/reg.c =================================================================== --- dll/win32/advapi32/reg/reg.c (revision 75430) +++ dll/win32/advapi32/reg/reg.c (working copy) @@ -3429,6 +3429,39 @@ samDesired, &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)) { ErrorCode = RtlNtStatusToDosError(Status);