diff --git a/reactos/ntoskrnl/dbgk/debug.c b/reactos/ntoskrnl/dbgk/debug.c index 4371ac7aea9..17fea61c51f 100644 --- a/reactos/ntoskrnl/dbgk/debug.c +++ b/reactos/ntoskrnl/dbgk/debug.c @@ -131,7 +131,7 @@ DbgkpQueueMessage(IN PEPROCESS Process, KeInitializeEvent(&DebugEvent->ContinueEvent, SynchronizationEvent, FALSE); DebugEvent->Process = Process; DebugEvent->Thread = Thread; - RtlMoveMemory(&DebugEvent->ApiMsg, Message, sizeof(DBGKM_MSG)); + RtlCopyMemory(&DebugEvent->ApiMsg, Message, sizeof(DBGKM_MSG)); DebugEvent->ClientId = Thread->Cid; /* Check if we have a port object */ @@ -190,7 +190,7 @@ DbgkpQueueMessage(IN PEPROCESS Process, NULL); /* Copy API Message back */ - RtlMoveMemory(Message, &DebugEvent->ApiMsg, sizeof(DBGKM_MSG)); + RtlCopyMemory(Message, &DebugEvent->ApiMsg, sizeof(DBGKM_MSG)); /* Set return status */ Status = DebugEvent->Status; @@ -246,7 +246,7 @@ DbgkpSendApiMessageLpc(IN OUT PDBGKM_MSG Message, ZwFlushInstructionCache(NtCurrentProcess(), NULL, 0); /* Copy the buffer back */ - if (NT_SUCCESS(Status)) RtlMoveMemory(Message, Buffer, sizeof(DBGKM_MSG)); + if (NT_SUCCESS(Status)) RtlCopyMemory(Message, Buffer, sizeof(DBGKM_MSG)); /* Resume the process if it was suspended */ if (SuspendProcess) DbgkpResumeProcess(); @@ -1499,7 +1499,7 @@ NtWaitForDebugEvent(IN HANDLE DebugHandle, _SEH_TRY { /* Return our wait state change structure */ - RtlMoveMemory(StateChange, + RtlCopyMemory(StateChange, &WaitStateChange, sizeof(DBGUI_WAIT_STATE_CHANGE)); } diff --git a/reactos/ntoskrnl/ex/atom.c b/reactos/ntoskrnl/ex/atom.c index 541de681bb5..969655086b2 100644 --- a/reactos/ntoskrnl/ex/atom.c +++ b/reactos/ntoskrnl/ex/atom.c @@ -134,7 +134,7 @@ NtAddAtom(IN PWSTR AtomName, else { /* Copy the name and null-terminate it */ - RtlMoveMemory(CapturedName, AtomName, AtomNameLength); + RtlCopyMemory(CapturedName, AtomName, AtomNameLength); CapturedName[AtomNameLength / sizeof(WCHAR)] = UNICODE_NULL; } @@ -288,7 +288,7 @@ NtFindAtom(IN PWSTR AtomName, else { /* Copy the name and null-terminate it */ - RtlMoveMemory(CapturedName, AtomName, AtomNameLength); + RtlCopyMemory(CapturedName, AtomName, AtomNameLength); CapturedName[AtomNameLength / sizeof(WCHAR)] = UNICODE_NULL; } diff --git a/reactos/ntoskrnl/ex/error.c b/reactos/ntoskrnl/ex/error.c index 0664e2682e5..2a39bf99c5d 100644 --- a/reactos/ntoskrnl/ex/error.c +++ b/reactos/ntoskrnl/ex/error.c @@ -281,7 +281,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus, TAG_ERR); /* Copy them */ - RtlMoveMemory(SafeParams, Parameters, ParamSize); + RtlCopyMemory(SafeParams, Parameters, ParamSize); /* Nowo check if there's strings in it */ if (UnicodeStringParameterMask) @@ -298,7 +298,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus, sizeof(ULONG_PTR)); /* Capture it */ - RtlMoveMemory(&SafeString, + RtlCopyMemory(&SafeString, (PVOID)SafeParams[i], sizeof(UNICODE_STRING)); diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index 1866d407df2..0377683c325 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -206,7 +206,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock) if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED); /* Copy the codepage data in its new location. */ - RtlMoveMemory(ExpNlsTableBase, + RtlCopyMemory(ExpNlsTableBase, LoaderBlock->NlsData->AnsiCodePageData, ExpNlsTableSize); @@ -264,7 +264,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock) } /* Copy the codepage data in its new location. */ - RtlMoveMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize); + RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize); /* Free the previously allocated buffer and set the new location */ ExFreePool(ExpNlsTableBase); @@ -301,7 +301,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock) } /* Copy the table into the system process and set this as the base */ - RtlMoveMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize); + RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize); ExpNlsTableBase = SectionBase; } diff --git a/reactos/ntoskrnl/ex/time.c b/reactos/ntoskrnl/ex/time.c index c0e17281e93..cb35557030a 100644 --- a/reactos/ntoskrnl/ex/time.c +++ b/reactos/ntoskrnl/ex/time.c @@ -106,7 +106,7 @@ ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation) ExpTimeZoneId = TIME_ZONE_ID_STANDARD; /* Copy the timezone information */ - RtlMoveMemory(&ExpTimeZoneInfo, + RtlCopyMemory(&ExpTimeZoneInfo, TimeZoneInformation, sizeof(TIME_ZONE_INFORMATION)); diff --git a/reactos/ntoskrnl/io/iomgr/arcname.c b/reactos/ntoskrnl/io/iomgr/arcname.c index 1b761e774a8..eeac14b39b8 100644 --- a/reactos/ntoskrnl/io/iomgr/arcname.c +++ b/reactos/ntoskrnl/io/iomgr/arcname.c @@ -403,7 +403,7 @@ IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock) if (IoLoaderArcBootDeviceName) { /* Copy the name */ - RtlMoveMemory(IoLoaderArcBootDeviceName, + RtlCopyMemory(IoLoaderArcBootDeviceName, LoaderBlock->ArcBootDeviceName, Length); } diff --git a/reactos/ntoskrnl/io/iomgr/driver.c b/reactos/ntoskrnl/io/iomgr/driver.c index f33c1111719..316715cc2d9 100644 --- a/reactos/ntoskrnl/io/iomgr/driver.c +++ b/reactos/ntoskrnl/io/iomgr/driver.c @@ -1325,7 +1325,7 @@ IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL, /* Fill out the key data and copy the buffer */ ServiceKeyName.Length = LocalDriverName.Length; ServiceKeyName.MaximumLength = LocalDriverName.MaximumLength; - RtlMoveMemory(ServiceKeyName.Buffer, + RtlCopyMemory(ServiceKeyName.Buffer, LocalDriverName.Buffer, LocalDriverName.Length); @@ -1334,7 +1334,7 @@ IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL, DriverObject->DriverExtension->ServiceKeyName = ServiceKeyName; /* Also store it in the Driver Object. This is a bit of a hack. */ - RtlMoveMemory(&DriverObject->DriverName, + RtlCopyMemory(&DriverObject->DriverName, &ServiceKeyName, sizeof(UNICODE_STRING)); diff --git a/reactos/ntoskrnl/io/iomgr/error.c b/reactos/ntoskrnl/io/iomgr/error.c index c9579dc3d28..84382def016 100644 --- a/reactos/ntoskrnl/io/iomgr/error.c +++ b/reactos/ntoskrnl/io/iomgr/error.c @@ -192,7 +192,7 @@ IopLogWorker(IN PVOID Parameter) LogEntry->Size; /* Copy the packet */ - RtlMoveMemory(&ErrorMessage->EntryData, + RtlCopyMemory(&ErrorMessage->EntryData, Packet, LogEntry->Size - sizeof(ERROR_LOG_ENTRY)); @@ -290,7 +290,7 @@ IopLogWorker(IN PVOID Parameter) */ DriverNameLength = min(DriverNameLength, RemainingLength - 3 * sizeof(UNICODE_NULL)); - RtlMoveMemory(StringBuffer, p, DriverNameLength); + RtlCopyMemory(StringBuffer, p, DriverNameLength); } /* Null-terminate the driver name */ @@ -358,7 +358,7 @@ IopLogWorker(IN PVOID Parameter) */ DeviceNameLength = min(ObjectNameInfo->Name.Length, RemainingLength - 2 * sizeof(UNICODE_NULL)); - RtlMoveMemory(StringBuffer, + RtlCopyMemory(StringBuffer, ObjectNameInfo->Name.Buffer, DeviceNameLength); @@ -391,7 +391,7 @@ IopLogWorker(IN PVOID Parameter) } /* Now copy the extra strings */ - RtlMoveMemory(StringBuffer, + RtlCopyMemory(StringBuffer, (PCHAR)Packet + Packet->StringOffset, ExtraStringLength); diff --git a/reactos/ntoskrnl/io/iomgr/file.c b/reactos/ntoskrnl/io/iomgr/file.c index 31b25aa5d6f..f1f15c27792 100644 --- a/reactos/ntoskrnl/io/iomgr/file.c +++ b/reactos/ntoskrnl/io/iomgr/file.c @@ -991,7 +991,7 @@ IopQueryNameFile(IN PVOID ObjectBody, LocalFileInfo->FileNameLength; /* Write the Name and null-terminate it */ - RtlMoveMemory(p, LocalFileInfo->FileName, FileLength); + RtlCopyMemory(p, LocalFileInfo->FileName, FileLength); p += (FileLength / sizeof(WCHAR)); *p = UNICODE_NULL; LocalReturnLength += sizeof(UNICODE_NULL); @@ -1185,7 +1185,7 @@ IopQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, _SEH_TRY { /* Copy the buffer back */ - RtlMoveMemory(FileInformation, + RtlCopyMemory(FileInformation, &NetworkOpenInfo, FileInformationSize); } diff --git a/reactos/ntoskrnl/io/iomgr/mdl.c b/reactos/ntoskrnl/io/iomgr/mdl.c index b3d7b316bfc..60af4ce7736 100644 --- a/reactos/ntoskrnl/io/iomgr/mdl.c +++ b/reactos/ntoskrnl/io/iomgr/mdl.c @@ -131,7 +131,7 @@ IoBuildPartialMdl(IN PMDL SourceMdl, Offset = ((ULONG_PTR)TargetMdl->StartVa - (ULONG_PTR)SourceMdl->StartVa) >> PAGE_SHIFT; SourcePages += Offset; - RtlMoveMemory(TargetPages, SourcePages, Length * sizeof(PFN_TYPE)); + RtlCopyMemory(TargetPages, SourcePages, Length * sizeof(PFN_TYPE)); } /* diff --git a/reactos/ntoskrnl/io/iomgr/rawfs.c b/reactos/ntoskrnl/io/iomgr/rawfs.c index 4553107d7af..69ffeec00f3 100755 --- a/reactos/ntoskrnl/io/iomgr/rawfs.c +++ b/reactos/ntoskrnl/io/iomgr/rawfs.c @@ -780,20 +780,20 @@ RawQueryFsAttributeInfo(IN PVCB Vcb, IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer, IN OUT PULONG Length) { + const WCHAR szRawFSName[] = L"RAW"; ULONG ReturnLength; PAGED_CODE(); /* Check if the buffer is large enough for our name ("RAW") */ ReturnLength = FIELD_OFFSET(FILE_FS_ATTRIBUTE_INFORMATION, - FileSystemName[0]); - ReturnLength += sizeof(L"RAW"); + FileSystemName[sizeof(szRawFSName) / sizeof(szRawFSName[0])]); if (*Length < ReturnLength) return STATUS_BUFFER_OVERFLOW; /* Output the data */ Buffer->FileSystemAttributes = 0; Buffer->MaximumComponentNameLength = 0; Buffer->FileSystemNameLength = 6; - RtlMoveMemory(&Buffer->FileSystemName[0], L"RAW", 6); + RtlCopyMemory(&Buffer->FileSystemName[0], szRawFSName, sizeof(szRawFSName)); /* Return length and success */ *Length -= ReturnLength; diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c index f6b671c8071..5188df7d79b 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -932,7 +932,7 @@ IopInitiatePnpIrp(PDEVICE_OBJECT DeviceObject, if (Stack) { - RtlMoveMemory(&IrpSp->Parameters, + RtlCopyMemory(&IrpSp->Parameters, &Stack->Parameters, sizeof(Stack->Parameters)); } diff --git a/reactos/ntoskrnl/kd/kdio.c b/reactos/ntoskrnl/kd/kdio.c index c0c140493e0..8beb0238b5f 100644 --- a/reactos/ntoskrnl/kd/kdio.c +++ b/reactos/ntoskrnl/kd/kdio.c @@ -64,7 +64,7 @@ KdpPrintToLog(PCH String, if ((CurrentPosition + StringLength) > BufferSize) return; /* Add the string to the buffer */ - RtlMoveMemory(&DebugBuffer[CurrentPosition], String, StringLength); + RtlCopyMemory(&DebugBuffer[CurrentPosition], String, StringLength); /* Update the Current Position */ CurrentPosition += StringLength; diff --git a/reactos/ntoskrnl/ke/except.c b/reactos/ntoskrnl/ke/except.c index 86ad261bbea..188c4c5fcea 100644 --- a/reactos/ntoskrnl/ke/except.c +++ b/reactos/ntoskrnl/ke/except.c @@ -24,7 +24,7 @@ KiContinuePreviousModeUser(IN PCONTEXT Context, /* We'll have to make a copy and probe it */ ProbeForRead(Context, sizeof(CONTEXT), sizeof(ULONG)); - RtlMoveMemory(&LocalContext, Context, sizeof(CONTEXT)); + RtlCopyMemory(&LocalContext, Context, sizeof(CONTEXT)); Context = &LocalContext; /* Convert the context into Exception/Trap Frames */ @@ -128,8 +128,8 @@ KiRaiseException(IN PEXCEPTION_RECORD ExceptionRecord, ProbeForRead(ExceptionRecord, Size, sizeof(ULONG)); /* Now make copies in the stack */ - RtlMoveMemory(&LocalContext, Context, sizeof(CONTEXT)); - RtlMoveMemory(&LocalExceptionRecord, ExceptionRecord, Size); + RtlCopyMemory(&LocalContext, Context, sizeof(CONTEXT)); + RtlCopyMemory(&LocalExceptionRecord, ExceptionRecord, Size); Context = &LocalContext; ExceptionRecord = &LocalExceptionRecord; diff --git a/reactos/ntoskrnl/ke/i386/exp.c b/reactos/ntoskrnl/ke/i386/exp.c index 798c69540e3..46b02d513f5 100644 --- a/reactos/ntoskrnl/ke/i386/exp.c +++ b/reactos/ntoskrnl/ke/i386/exp.c @@ -26,7 +26,7 @@ _SEH_FILTER(KiCopyInformation) _SEH_ACCESS_LOCALS(KiCopyInfo); /* Copy the exception records and return to the handler */ - RtlMoveMemory((PVOID)&_SEH_VAR(SehExceptRecord), + RtlCopyMemory((PVOID)&_SEH_VAR(SehExceptRecord), _SEH_GetExceptionPointers()->ExceptionRecord, sizeof(EXCEPTION_RECORD)); return EXCEPTION_EXECUTE_HANDLER; @@ -776,7 +776,7 @@ DispatchToUser: /* Copy the exception address and record */ _SEH_VAR(SehExceptRecord).ExceptionAddress = ExceptionRecord->ExceptionAddress; - RtlMoveMemory(ExceptionRecord, + RtlCopyMemory(ExceptionRecord, (PVOID)&_SEH_VAR(SehExceptRecord), sizeof(EXCEPTION_RECORD)); diff --git a/reactos/ntoskrnl/ke/i386/thread.c b/reactos/ntoskrnl/ke/i386/thread.c index b7469485525..8072a40a4e4 100644 --- a/reactos/ntoskrnl/ke/i386/thread.c +++ b/reactos/ntoskrnl/ke/i386/thread.c @@ -88,7 +88,7 @@ Ke386InitThreadWithContext(PKTHREAD Thread, DPRINT("Setting up a user-mode thread. InitFrame at: %p\n", InitFrame); /* Copy over the context we got */ - RtlMoveMemory(&LocalContext, ContextPointer, sizeof(CONTEXT)); + RtlCopyMemory(&LocalContext, ContextPointer, sizeof(CONTEXT)); Context = &LocalContext; ContextFlags = CONTEXT_CONTROL; diff --git a/reactos/ntoskrnl/ke/i386/usercall.c b/reactos/ntoskrnl/ke/i386/usercall.c index 65b83380c02..03438a6c124 100644 --- a/reactos/ntoskrnl/ke/i386/usercall.c +++ b/reactos/ntoskrnl/ke/i386/usercall.c @@ -24,7 +24,7 @@ _SEH_FILTER(KiCopyInformation2) _SEH_ACCESS_LOCALS(KiCopyInfo); /* Copy the exception records and return to the handler */ - RtlMoveMemory((PVOID)&_SEH_VAR(SehExceptRecord), + RtlCopyMemory((PVOID)&_SEH_VAR(SehExceptRecord), _SEH_GetExceptionPointers()->ExceptionRecord, sizeof(EXCEPTION_RECORD)); return EXCEPTION_EXECUTE_HANDLER; @@ -93,7 +93,7 @@ KiInitializeUserApc(IN PKEXCEPTION_FRAME ExceptionFrame, ASSERT(!(Stack & 3)); /* Copy data into it */ - RtlMoveMemory((PVOID)(Stack + (4 * sizeof(ULONG_PTR))), + RtlCopyMemory((PVOID)(Stack + (4 * sizeof(ULONG_PTR))), &Context, sizeof(CONTEXT)); diff --git a/reactos/ntoskrnl/ke/i386/v86vdm.c b/reactos/ntoskrnl/ke/i386/v86vdm.c index 733ae101db2..6039657a7e8 100644 --- a/reactos/ntoskrnl/ke/i386/v86vdm.c +++ b/reactos/ntoskrnl/ke/i386/v86vdm.c @@ -60,7 +60,7 @@ Ke386CallBios(IN ULONG Int, *VdmState = 0; /* Copy the context */ - RtlMoveMemory(&VdmTib->VdmContext, Context, ContextSize); + RtlCopyMemory(&VdmTib->VdmContext, Context, ContextSize); VdmTib->VdmContext.SegCs = (ULONG_PTR)Trampoline >> 4; VdmTib->VdmContext.SegSs = (ULONG_PTR)Trampoline >> 4; VdmTib->VdmContext.Eip = 0; @@ -88,7 +88,7 @@ Ke386CallBios(IN ULONG Int, /* Make sure there's space for two IOPMs, then copy & clear the current */ //ASSERT(((PKGDTENTRY)&KeGetPcr()->GDT[KGDT_TSS / 8])->LimitLow >= // (0x2000 + IOPM_OFFSET - 1)); - RtlMoveMemory(Ki386IopmSaveArea, &Tss->IoMaps[0].IoMap, PAGE_SIZE * 2); + RtlCopyMemory(Ki386IopmSaveArea, &Tss->IoMaps[0].IoMap, PAGE_SIZE * 2); RtlZeroMemory(&Tss->IoMaps[0].IoMap, PAGE_SIZE * 2); /* Save the old offset and base, and set the new ones */ @@ -101,7 +101,7 @@ Ke386CallBios(IN ULONG Int, Ki386SetupAndExitToV86Mode(VdmTeb); /* Restore IOPM */ - RtlMoveMemory(&Tss->IoMaps[0].IoMap, Ki386IopmSaveArea, PAGE_SIZE * 2); + RtlCopyMemory(&Tss->IoMaps[0].IoMap, Ki386IopmSaveArea, PAGE_SIZE * 2); Process->IopmOffset = OldOffset; Tss->IoMapBase = OldBase; @@ -109,7 +109,7 @@ Ke386CallBios(IN ULONG Int, KeRevertToUserAffinityThread(); /* Restore context */ - RtlMoveMemory(Context, &VdmTib->VdmContext, ContextSize); + RtlCopyMemory(Context, &VdmTib->VdmContext, ContextSize); Context->ContextFlags = CONTEXT_FULL; /* Free VDM objects */ diff --git a/reactos/ntoskrnl/ob/obdir.c b/reactos/ntoskrnl/ob/obdir.c index 454d84883d1..9c6df161363 100644 --- a/reactos/ntoskrnl/ob/obdir.c +++ b/reactos/ntoskrnl/ob/obdir.c @@ -343,7 +343,7 @@ NtOpenDirectoryObject (OUT PHANDLE DirectoryHandle, /* Write back the handle to the caller */ *DirectoryHandle = hDirectory; } - _SEH_HANDLE + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { /* Get the exception code */ Status = _SEH_GetExceptionCode(); @@ -585,7 +585,7 @@ Quickie: while (Count--) { /* Copy the name buffer */ - RtlMoveMemory(p, + RtlCopyMemory(p, DirectoryInfo->Name.Buffer, DirectoryInfo->Name.Length); @@ -599,7 +599,7 @@ Quickie: *p++ = UNICODE_NULL; /* Now copy the type name buffer */ - RtlMoveMemory(p, + RtlCopyMemory(p, DirectoryInfo->TypeName.Buffer, DirectoryInfo->TypeName.Length); @@ -620,14 +620,22 @@ Quickie: *Context = CurrentEntry; } - /* Copy the buffer */ - RtlMoveMemory(Buffer, - LocalBuffer, - (TotalLength <= BufferLength) ? - TotalLength : BufferLength); + _SEH_TRY + { + /* Copy the buffer */ + RtlCopyMemory(Buffer, + LocalBuffer, + (TotalLength <= BufferLength) ? + TotalLength : BufferLength); - /* Check if the caller requested the return length and return it*/ - if (ReturnLength) *ReturnLength = TotalLength; + /* Check if the caller requested the return length and return it*/ + if (ReturnLength) *ReturnLength = TotalLength; + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; /* Dereference the directory and free our buffer */ ObDereferenceObject(Directory); @@ -718,7 +726,7 @@ NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, /* Return the handle back to the caller */ *DirectoryHandle = hDirectory; } - _SEH_HANDLE + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { /* Get the exception code */ Status = _SEH_GetExceptionCode(); diff --git a/reactos/ntoskrnl/ob/oblife.c b/reactos/ntoskrnl/ob/oblife.c index 37ded7f4833..4dd515dddb5 100644 --- a/reactos/ntoskrnl/ob/oblife.c +++ b/reactos/ntoskrnl/ob/oblife.c @@ -1251,143 +1251,142 @@ NtQueryObject(IN HANDLE ObjectHandle, ObjectHeader = OBJECT_TO_OBJECT_HEADER(Object); } - /* Check the information class */ - switch (ObjectInformationClass) + _SEH_TRY { - /* Basic info */ - case ObjectBasicInformation: + /* Check the information class */ + switch (ObjectInformationClass) + { + /* Basic info */ + case ObjectBasicInformation: - /* Validate length */ - InfoLength = sizeof(OBJECT_BASIC_INFORMATION); - if (Length != sizeof(OBJECT_BASIC_INFORMATION)) - { - /* Fail */ - Status = STATUS_INFO_LENGTH_MISMATCH; + /* Validate length */ + InfoLength = sizeof(OBJECT_BASIC_INFORMATION); + if (Length != sizeof(OBJECT_BASIC_INFORMATION)) + { + /* Fail */ + Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } + + /* Fill out the basic information */ + BasicInfo = (POBJECT_BASIC_INFORMATION)ObjectInformation; + BasicInfo->Attributes = HandleInfo.HandleAttributes; + BasicInfo->GrantedAccess = HandleInfo.GrantedAccess; + BasicInfo->HandleCount = ObjectHeader->HandleCount; + BasicInfo->PointerCount = ObjectHeader->PointerCount; + + /* Permanent/Exclusive Flags are NOT in Handle attributes! */ + if (ObjectHeader->Flags & OB_FLAG_EXCLUSIVE) + { + /* Set the flag */ + BasicInfo->Attributes |= OBJ_EXCLUSIVE; + } + if (ObjectHeader->Flags & OB_FLAG_PERMANENT) + { + /* Set the flag */ + BasicInfo->Attributes |= OBJ_PERMANENT; + } + + /* Copy quota information */ + BasicInfo->PagedPoolUsage = 0; /* FIXME*/ + BasicInfo->NonPagedPoolUsage = 0; /* FIXME*/ + + /* Copy name information */ + BasicInfo->NameInformationLength = 0; /* FIXME*/ + BasicInfo->TypeInformationLength = 0; /* FIXME*/ + + /* Copy security information */ + BasicInfo->SecurityDescriptorLength = 0; /* FIXME*/ + + /* Check if this is a symlink */ + if (ObjectHeader->Type == ObSymbolicLinkType) + { + /* Return the creation time */ + BasicInfo->CreateTime.QuadPart = + ((POBJECT_SYMBOLIC_LINK)Object)->CreationTime.QuadPart; + } + else + { + /* Otherwise return 0 */ + BasicInfo->CreateTime.QuadPart = (ULONGLONG)0; + } + + /* Break out with success */ + Status = STATUS_SUCCESS; break; - } - /* Fill out the basic information */ - BasicInfo = (POBJECT_BASIC_INFORMATION)ObjectInformation; - BasicInfo->Attributes = HandleInfo.HandleAttributes; - BasicInfo->GrantedAccess = HandleInfo.GrantedAccess; - BasicInfo->HandleCount = ObjectHeader->HandleCount; - BasicInfo->PointerCount = ObjectHeader->PointerCount; + /* Name information */ + case ObjectNameInformation: - /* Permanent/Exclusive Flags are NOT in Handle attributes! */ - if (ObjectHeader->Flags & OB_FLAG_EXCLUSIVE) - { - /* Set the flag */ - BasicInfo->Attributes |= OBJ_EXCLUSIVE; - } - if (ObjectHeader->Flags & OB_FLAG_PERMANENT) - { - /* Set the flag */ - BasicInfo->Attributes |= OBJ_PERMANENT; - } - - /* Copy quota information */ - BasicInfo->PagedPoolUsage = 0; /* FIXME*/ - BasicInfo->NonPagedPoolUsage = 0; /* FIXME*/ - - /* Copy name information */ - BasicInfo->NameInformationLength = 0; /* FIXME*/ - BasicInfo->TypeInformationLength = 0; /* FIXME*/ - - /* Copy security information */ - BasicInfo->SecurityDescriptorLength = 0; /* FIXME*/ - - /* Check if this is a symlink */ - if (ObjectHeader->Type == ObSymbolicLinkType) - { - /* Return the creation time */ - BasicInfo->CreateTime.QuadPart = - ((POBJECT_SYMBOLIC_LINK)Object)->CreationTime.QuadPart; - } - else - { - /* Otherwise return 0 */ - BasicInfo->CreateTime.QuadPart = (ULONGLONG)0; - } - - /* Break out with success */ - Status = STATUS_SUCCESS; - break; - - /* Name information */ - case ObjectNameInformation: - - /* Call the helper and break out */ - Status = ObQueryNameString(Object, - (POBJECT_NAME_INFORMATION) - ObjectInformation, - Length, - &InfoLength); - break; - - /* Information about this type */ - case ObjectTypeInformation: - DPRINT1("NOT IMPLEMENTED!\n"); - Status = STATUS_NOT_IMPLEMENTED; - break; - - /* Information about all types */ - case ObjectAllTypesInformation: - DPRINT1("NOT IMPLEMENTED!\n"); - Status = STATUS_NOT_IMPLEMENTED; - break; - - /* Information about the handle flags */ - case ObjectHandleInformation: - - /* Validate length */ - InfoLength = sizeof (OBJECT_HANDLE_ATTRIBUTE_INFORMATION); - if (Length != sizeof (OBJECT_HANDLE_ATTRIBUTE_INFORMATION)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; + /* Call the helper and break out */ + Status = ObQueryNameString(Object, + (POBJECT_NAME_INFORMATION) + ObjectInformation, + Length, + &InfoLength); break; - } - /* Get the structure */ - HandleFlags = (POBJECT_HANDLE_ATTRIBUTE_INFORMATION) - ObjectInformation; + /* Information about this type */ + case ObjectTypeInformation: + DPRINT1("NOT IMPLEMENTED!\n"); + Status = STATUS_NOT_IMPLEMENTED; + break; - /* Set the flags */ - HandleFlags->Inherit = (HandleInfo.HandleAttributes & - EX_HANDLE_ENTRY_INHERITABLE) != 0; - HandleFlags->ProtectFromClose = (HandleInfo.HandleAttributes & - EX_HANDLE_ENTRY_PROTECTFROMCLOSE) != 0; + /* Information about all types */ + case ObjectAllTypesInformation: + DPRINT1("NOT IMPLEMENTED!\n"); + Status = STATUS_NOT_IMPLEMENTED; + break; - /* Break out with success */ - Status = STATUS_SUCCESS; - break; + /* Information about the handle flags */ + case ObjectHandleInformation: - /* Anything else */ - default: + /* Validate length */ + InfoLength = sizeof (OBJECT_HANDLE_ATTRIBUTE_INFORMATION); + if (Length != sizeof (OBJECT_HANDLE_ATTRIBUTE_INFORMATION)) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } - /* Fail it */ - Status = STATUS_INVALID_INFO_CLASS; - break; - } + /* Get the structure */ + HandleFlags = (POBJECT_HANDLE_ATTRIBUTE_INFORMATION) + ObjectInformation; - /* Dereference the object if we had referenced it */ - if (Object) ObDereferenceObject (Object); + /* Set the flags */ + HandleFlags->Inherit = (HandleInfo.HandleAttributes & + EX_HANDLE_ENTRY_INHERITABLE) != 0; + HandleFlags->ProtectFromClose = (HandleInfo.HandleAttributes & + EX_HANDLE_ENTRY_PROTECTFROMCLOSE) != 0; - /* Check if the caller wanted the return length */ - if (ResultLength) - { - /* Protect the write to user mode */ - _SEH_TRY + /* Break out with success */ + Status = STATUS_SUCCESS; + break; + + /* Anything else */ + default: + + /* Fail it */ + Status = STATUS_INVALID_INFO_CLASS; + break; + } + + /* Check if the caller wanted the return length */ + if (ResultLength) { /* Write the length */ *ResultLength = Length; } - _SEH_HANDLE - { - /* Otherwise, get the exception code */ - Status = _SEH_GetExceptionCode(); - } - _SEH_END; } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { + /* Otherwise, get the exception code */ + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + /* Dereference the object if we had referenced it */ + if (Object) ObDereferenceObject (Object); /* Return status */ return Status; @@ -1446,8 +1445,28 @@ NtSetInformationObject(IN HANDLE ObjectHandle, /* Save the previous mode and actual information */ Context.PreviousMode = ExGetPreviousMode(); - Context.Information = *(POBJECT_HANDLE_ATTRIBUTE_INFORMATION) - ObjectInformation; + + if (Context.PreviousMode != KernelMode) + { + _SEH_TRY + { + ProbeForRead(ObjectInformation, + sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION), + sizeof(ULONG)); + Context.Information = *(POBJECT_HANDLE_ATTRIBUTE_INFORMATION) + ObjectInformation; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if (!NT_SUCCESS(Status)) return Status; + } + else + Context.Information = *(POBJECT_HANDLE_ATTRIBUTE_INFORMATION) + ObjectInformation; /* Check if this is a kernel handle */ if (ObIsKernelHandle(ObjectHandle, Context.PreviousMode)) diff --git a/reactos/ntoskrnl/ob/obname.c b/reactos/ntoskrnl/ob/obname.c index 1d8f3c7afcd..ca610e698b0 100644 --- a/reactos/ntoskrnl/ob/obname.c +++ b/reactos/ntoskrnl/ob/obname.c @@ -500,7 +500,7 @@ ReparseNewDir: ObjectNameInfo = OBJECT_HEADER_TO_NAME_INFO(CurrentHeader); /* Copy the Name */ - RtlMoveMemory(NewName, PartName.Buffer, PartName.MaximumLength); + RtlCopyMemory(NewName, PartName.Buffer, PartName.MaximumLength); /* Free old name */ if (ObjectNameInfo->Name.Buffer) ExFreePool(ObjectNameInfo->Name.Buffer); @@ -792,7 +792,7 @@ ObQueryNameString(IN PVOID Object, /* Start by adding the Object's Name */ ObjectName = (PWCH)((ULONG_PTR)ObjectName - LocalInfo->Name.Length); - RtlMoveMemory(ObjectName, + RtlCopyMemory(ObjectName, LocalInfo->Name.Buffer, LocalInfo->Name.Length); @@ -813,7 +813,7 @@ ObQueryNameString(IN PVOID Object, /* Add the name */ ObjectName = (PWCH)((ULONG_PTR)ObjectName - LocalInfo->Name.Length); - RtlMoveMemory(ObjectName, + RtlCopyMemory(ObjectName, LocalInfo->Name.Buffer, LocalInfo->Name.Length); @@ -859,7 +859,7 @@ ObQueryDeviceMapInformation(IN PEPROCESS Process, /* Make a copy */ DeviceMapInfo->Query.DriveMap = ObSystemDeviceMap->DriveMap; - RtlMoveMemory(DeviceMapInfo->Query.DriveType, + RtlCopyMemory(DeviceMapInfo->Query.DriveType, ObSystemDeviceMap->DriveType, sizeof(ObSystemDeviceMap->DriveType)); diff --git a/reactos/ntoskrnl/ob/obsecure.c b/reactos/ntoskrnl/ob/obsecure.c index d1d5126b570..8cef3fa0ca3 100644 --- a/reactos/ntoskrnl/ob/obsecure.c +++ b/reactos/ntoskrnl/ob/obsecure.c @@ -620,7 +620,7 @@ ObLogSecurityDescriptor(IN PSECURITY_DESCRIPTOR InputSecurityDescriptor, InputSecurityDescriptor); SdCopy = ExAllocatePool(PagedPool, sizeof(*SdCopy)); - RtlMoveMemory(SdCopy, InputSecurityDescriptor, sizeof(*SdCopy)); + RtlCopyMemory(SdCopy, InputSecurityDescriptor, sizeof(*SdCopy)); *OutputSecurityDescriptor = SdCopy; return STATUS_SUCCESS; } diff --git a/reactos/ntoskrnl/ob/symlink.c b/reactos/ntoskrnl/ob/symlink.c index 37479e6ca6b..088db566081 100644 --- a/reactos/ntoskrnl/ob/symlink.c +++ b/reactos/ntoskrnl/ob/symlink.c @@ -152,13 +152,13 @@ ObpParseSymbolicLink(IN PVOID ParsedObject, if (RemainingName->Length) { /* Copy the new path */ - RtlMoveMemory((PVOID)((ULONG_PTR)NewTargetPath + TargetPath->Length), + RtlCopyMemory((PVOID)((ULONG_PTR)NewTargetPath + TargetPath->Length), RemainingName->Buffer, RemainingName->Length); } /* Copy the target path and null-terminate it */ - RtlMoveMemory(NewTargetPath, TargetPath->Buffer, TargetPath->Length); + RtlCopyMemory(NewTargetPath, TargetPath->Buffer, TargetPath->Length); NewTargetPath[LengthUsed / sizeof(WCHAR)] = UNICODE_NULL; /* If the optimization didn't work, free the old buffer */ @@ -287,7 +287,7 @@ NtCreateSymbolicLinkObject(OUT PHANDLE LinkHandle, if (!SymbolicLink->LinkTarget.Buffer) return STATUS_NO_MEMORY; /* Copy it */ - RtlMoveMemory(SymbolicLink->LinkTarget.Buffer, + RtlCopyMemory(SymbolicLink->LinkTarget.Buffer, CapturedLinkTarget.Buffer, CapturedLinkTarget.MaximumLength); diff --git a/reactos/ntoskrnl/ps/query.c b/reactos/ntoskrnl/ps/query.c index 40b30338132..1bd888df605 100644 --- a/reactos/ntoskrnl/ps/query.c +++ b/reactos/ntoskrnl/ps/query.c @@ -376,7 +376,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle, _SEH_TRY { /* Copy it */ - RtlMoveMemory(ProcessInformation, + RtlCopyMemory(ProcessInformation, ImageName, Length); diff --git a/reactos/ntoskrnl/se/audit.c b/reactos/ntoskrnl/se/audit.c index de86dc6eb5c..2dbcef2ffc7 100644 --- a/reactos/ntoskrnl/se/audit.c +++ b/reactos/ntoskrnl/se/audit.c @@ -160,7 +160,7 @@ SeLocateProcessImageName(IN PEPROCESS Process, if (ImageName) { /* Make a copy of it */ - RtlMoveMemory(ImageName, + RtlCopyMemory(ImageName, &AuditName->Name, AuditName->Name.MaximumLength + sizeof(UNICODE_STRING)); diff --git a/reactos/ntoskrnl/vdm/vdmexec.c b/reactos/ntoskrnl/vdm/vdmexec.c index 4371f46fa36..252d908b235 100644 --- a/reactos/ntoskrnl/vdm/vdmexec.c +++ b/reactos/ntoskrnl/vdm/vdmexec.c @@ -251,7 +251,7 @@ VdmEndExecution(IN PKTRAP_FRAME TrapFrame, VdmTib->MonitorContext.Eax = STATUS_SUCCESS; /* Make a copy of the monitor context */ - RtlMoveMemory(&Context, &VdmTib->MonitorContext, sizeof(CONTEXT)); + RtlCopyMemory(&Context, &VdmTib->MonitorContext, sizeof(CONTEXT)); /* Switch contexts */ VdmSwapContext(TrapFrame, &VdmTib->VdmContext, &Context);