Author: tretiakov
Date: Fri Jan 5 20:12:10 2007
New Revision: 25308
URL:
http://svn.reactos.org/svn/reactos?rev=25308&view=rev
Log:
Fix bsod when executing IntLoadKeyboardLayout. (NtOpenKey() tryes to modify readonly
memory and it causes crash)
Modified:
trunk/reactos/ntoskrnl/cm/ntfunc.c
Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/ntfunc.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/ntfunc.c (original)
+++ trunk/reactos/ntoskrnl/cm/ntfunc.c Fri Jan 5 20:12:10 2007
@@ -1350,29 +1350,29 @@
}
}
- if
(ObjectAttributes->ObjectName->Buffer[(ObjectAttributes->ObjectName->Length /
sizeof(WCHAR)) - 1] == '\\')
- {
-
ObjectAttributes->ObjectName->Buffer[(ObjectAttributes->ObjectName->Length /
sizeof(WCHAR)) - 1] = UNICODE_NULL;
- ObjectAttributes->ObjectName->Length -= sizeof(WCHAR);
- ObjectAttributes->ObjectName->MaximumLength -= sizeof(WCHAR);
- }
-
/* WINE checks for the length also */
/*if (ObjectAttributes->ObjectName->Length > MAX_NAME_LENGTH)
return(STATUS_BUFFER_OVERFLOW);*/
- /* Capture all the info */
+ /* Capture all the info */
DPRINT("Capturing Create Info\n");
Status = ObpCaptureObjectAttributes(ObjectAttributes,
PreviousMode,
FALSE,
&ObjectCreateInfo,
&ObjectName);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("ObpCaptureObjectAttributes() failed (Status %lx)\n", Status);
- return Status;
- }
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("ObpCaptureObjectAttributes() failed (Status %lx)\n", Status);
+ return Status;
+ }
+
+ if (ObjectName.Buffer[(ObjectName.Length / sizeof(WCHAR)) - 1] == '\\')
+ {
+ ObjectName.Buffer[(ObjectName.Length / sizeof(WCHAR)) - 1] = UNICODE_NULL;
+ ObjectName.Length -= sizeof(WCHAR);
+ ObjectName.MaximumLength -= sizeof(WCHAR);
+ }
PostOpenKeyInfo.CompleteName = &ObjectName;
PreOpenKeyInfo.CompleteName = &ObjectName;