Author: gadamopoulos
Date: Thu Aug 17 14:37:24 2017
New Revision: 75592
URL:
http://svn.reactos.org/svn/reactos?rev=75592&view=rev
Log:
[ADVAPI32] -RegOpenKeyExW: Call NtOpenKey again with aligned parameters if
STATUS_DATATYPE_MISALIGNMENT was returned the first time. CORE-13689
Modified:
trunk/reactos/dll/win32/advapi32/reg/reg.c
Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Thu Aug 17 14:37:24 2017
@@ -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);