Author: tkreuzer
Date: Tue Nov 4 20:47:18 2014
New Revision: 65255
URL:
http://svn.reactos.org/svn/reactos?rev=65255&view=rev
Log:
Merged revision(s) 62353, 62531-62532, 62853, 64152, 64173-64174 from
branches/kernel-fun/reactos:
[NTOSKRNL]
Implement SystemPrioritySeperation case in NtSetSystemInformation
........
[NTOSKRNL]
Fix an ASSERT in ExfReleasePushLockExclusive
........
[NTOSKRNL]
Fix KiCallbackReturnHandler
........
[NTOSKRNL]
Don't expect a fully sized LOADER_PARAMETER_EXTENSION, since the win2003 loader
doesn't provide the full one.
........
[NTOSKRNL]
Implement a fake NtLockProductActivationKeys
........
[NTOSKRNL]
- Add some DPRINTs on errors
- Silence a DPRINT
- Only DPRINT on unimplemented affinity support on SMP builds
........
[NTOSKRNL]
- Remove an undocumented flag from the lpc request type in NtRequestWaitReplyPort. This is
required for some windows modules that use this flag, otherwise the function fails.
........
Modified:
trunk/reactos/ (props changed)
trunk/reactos/ntoskrnl/config/ntapi.c
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/ex/pushlock.c
trunk/reactos/ntoskrnl/ex/sysinfo.c
trunk/reactos/ntoskrnl/io/iomgr/file.c
trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
trunk/reactos/ntoskrnl/ke/thrdschd.c
trunk/reactos/ntoskrnl/lpc/connect.c
trunk/reactos/ntoskrnl/lpc/send.c
Propchange: trunk/reactos/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 4 20:47:18 2014
@@ -6,7 +6,7 @@
/branches/condrv_restructure:63104-64101
/branches/header-work:45691-47721
/branches/kd++:58883-58973
-/branches/kernel-fun/reactos:62304,65253
+/branches/kernel-fun/reactos:62304,62353,62531-62532,62853,64152,64173-64174,65253
/branches/ntvdm:59241-63176
/branches/reactos-yarotows:45219-46371,46373-48025,48027-49273
/branches/reactx/reactos:49994-49995
Modified: trunk/reactos/ntoskrnl/config/ntapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/ntapi.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -15,6 +15,7 @@
BOOLEAN CmBootAcceptFirstTime = TRUE;
BOOLEAN CmFirstTime = TRUE;
+extern ULONG InitSafeBootMode;
/* FUNCTIONS *****************************************************************/
@@ -947,7 +948,7 @@
/* Enough of the system has booted by now */
Ki386PerfEnd();
-
+
/* Validate flag */
if (Flag > CM_BOOT_FLAG_MAX) return STATUS_INVALID_PARAMETER;
@@ -1016,13 +1017,52 @@
return STATUS_NOT_IMPLEMENTED;
}
+// FIXME: different for different windows versions!
+#define PRODUCT_ACTIVATION_VERSION 7749
+
NTSTATUS
NTAPI
NtLockProductActivationKeys(IN PULONG pPrivateVer,
IN PULONG pSafeMode)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ KPROCESSOR_MODE PreviousMode;
+
+ PreviousMode = ExGetPreviousMode();
+ _SEH2_TRY
+ {
+ /* Check if the caller asked for the version */
+ if (pPrivateVer != NULL)
+ {
+ /* For user mode, probe it */
+ if (PreviousMode != KernelMode)
+ {
+ ProbeForRead(pPrivateVer, sizeof(ULONG), sizeof(ULONG));
+ }
+
+ /* Return the expected version */
+ *pPrivateVer = PRODUCT_ACTIVATION_VERSION;
+ }
+
+ /* Check if the caller asked for safe mode mode state */
+ if (pSafeMode != NULL)
+ {
+ /* For user mode, probe it */
+ if (PreviousMode != KernelMode)
+ {
+ ProbeForRead(pSafeMode, sizeof(ULONG), sizeof(ULONG));
+ }
+
+ /* Return the safe boot mode state */
+ *pSafeMode = InitSafeBootMode;
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ return _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
+
+ return STATUS_SUCCESS;
}
NTSTATUS
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=652…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -13,6 +13,10 @@
#include <reactos/buildno.h>
#define NDEBUG
#include <debug.h>
+
+/* This is the size that we can expect from the win 2003 loader */
+#define LOADER_PARAMETER_EXTENSION_MIN_SIZE \
+ RTL_SIZEOF_THROUGH_FIELD(LOADER_PARAMETER_EXTENSION, AcpiTableSize)
/* Temporary hack */
BOOLEAN
@@ -759,8 +763,8 @@
/* Get the loader extension */
Extension = LoaderBlock->Extension;
- /* Validate the size (larger structures are OK, we'll just ignore them) */
- if (Extension->Size < sizeof(LOADER_PARAMETER_EXTENSION)) return FALSE;
+ /* Validate the size (Windows 2003 loader doesn't provide more) */
+ if (Extension->Size < LOADER_PARAMETER_EXTENSION_MIN_SIZE) return FALSE;
/* Don't validate upper versions */
if (Extension->MajorVersion > VER_PRODUCTMAJORVERSION) return TRUE;
Modified: trunk/reactos/ntoskrnl/ex/pushlock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/pushlock.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/pushlock.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/pushlock.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -1130,7 +1130,7 @@
NewValue.Value = OldValue.Value &~ EX_PUSH_LOCK_LOCK;
/* Sanity check */
- ASSERT(NewValue.Waking && !NewValue.Waiting);
+ ASSERT(NewValue.Waking || !NewValue.Waiting);
/* Write the New Value */
NewValue.Ptr = InterlockedCompareExchangePointer(&PushLock->Ptr,
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -1788,9 +1788,22 @@
/* Class 39 - Priority Separation */
SSI_DEF(SystemPrioritySeperation)
{
- /* FIXME */
- DPRINT1("NtSetSystemInformation - SystemPrioritySeperation not
implemented\n");
- return STATUS_NOT_IMPLEMENTED;
+ /* Check if the size is correct */
+ if (Size != sizeof(ULONG))
+ {
+ return STATUS_INFO_LENGTH_MISMATCH;
+ }
+
+ /* We need the TCB privilege */
+ if (!SeSinglePrivilegeCheck(SeTcbPrivilege, ExGetPreviousMode()))
+ {
+ return STATUS_PRIVILEGE_NOT_HELD;
+ }
+
+ /* Modify the quantum table */
+ PsChangeQuantumTable(TRUE, *(PULONG)Buffer);
+
+ return STATUS_SUCCESS;
}
/* Class 40 - Plug Play Bus Information */
Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/file.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/file.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -1580,6 +1580,8 @@
if (OpenPacket.ParseCheck != TRUE)
{
/* Parse failed */
+ DPRINT1("IopQueryAttributesFile failed for '%wZ' with
0x%lx\n",
+ ObjectAttributes->ObjectName, Status);
return Status;
}
else
@@ -1802,6 +1804,7 @@
/* Make sure we have extra parameters */
if (!ExtraCreateParameters)
{
+ DPRINT1("Invalid parameter: ExtraCreateParameters == 0!\n");
return STATUS_INVALID_PARAMETER;
}
@@ -1815,6 +1818,7 @@
(CreateOptions & ~FILE_VALID_PIPE_OPTION_FLAGS))
{
/* Invalid named pipe create */
+ DPRINT1("Invalid named pipe create\n");
return STATUS_INVALID_PARAMETER;
}
}
@@ -1823,6 +1827,7 @@
/* Make sure we have extra parameters */
if (!ExtraCreateParameters)
{
+ DPRINT1("Invalid parameter: ExtraCreateParameters == 0!\n");
return STATUS_INVALID_PARAMETER;
}
@@ -1833,6 +1838,7 @@
(CreateOptions & ~FILE_VALID_MAILSLOT_OPTION_FLAGS))
{
/* Invalid mailslot create */
+ DPRINT1("Invalid mailslot create\n");
return STATUS_INVALID_PARAMETER;
}
}
@@ -1936,6 +1942,7 @@
if (!OpenPacket->EaBuffer)
{
ExFreePool(OpenPacket);
+ DPRINT1("Failed to allocate open packet EA buffer\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
Modified: trunk/reactos/ntoskrnl/ke/i386/traphdlr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/traphdlr.…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/traphdlr.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -1517,7 +1517,17 @@
FASTCALL
KiCallbackReturnHandler(IN PKTRAP_FRAME TrapFrame)
{
+ PKTHREAD Thread;
NTSTATUS Status;
+
+ /* Save the SEH chain, NtCallbackReturn will restore this */
+ TrapFrame->ExceptionList = KeGetPcr()->NtTib.ExceptionList;
+
+ /* Set thread fields */
+ Thread = KeGetCurrentThread();
+ Thread->TrapFrame = TrapFrame;
+ Thread->PreviousMode = KiUserTrap(TrapFrame);
+ NT_ASSERT(Thread->PreviousMode != KernelMode);
/* Pass the register parameters to NtCallbackReturn.
Result pointer is in ecx, result length in edx, status in eax */
Modified: trunk/reactos/ntoskrnl/ke/thrdschd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdschd.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -696,8 +696,10 @@
/* Check if system affinity is disabled */
if (!Thread->SystemAffinityActive)
{
+#ifdef CONFIG_SMP
/* FIXME: TODO */
DPRINT1("Affinity support disabled!\n");
+#endif
}
/* Return the old affinity */
Modified: trunk/reactos/ntoskrnl/lpc/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/connect.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/connect.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/lpc/connect.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -139,7 +139,11 @@
PreviousMode,
NULL,
(PVOID *)&Port);
- if (!NT_SUCCESS(Status)) return Status;
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to reference port '%wZ': 0x%lx\n", PortName,
Status);
+ return Status;
+ }
/* This has to be a connection port */
if ((Port->Flags & LPCP_PORT_TYPE_MASK) != LPCP_CONNECTION_PORT)
@@ -352,7 +356,7 @@
ConnectMessage->SectionToMap = SectionToMap;
/* Set the data for the connection request message */
- Message->Request.u1.s1.DataLength = (CSHORT)ConnectionInfoLength +
+ Message->Request.u1.s1.DataLength = (CSHORT)ConnectionInfoLength +
sizeof(LPCP_CONNECTION_MESSAGE);
Message->Request.u1.s1.TotalLength = sizeof(LPCP_MESSAGE) +
Message->Request.u1.s1.DataLength;
Modified: trunk/reactos/ntoskrnl/lpc/send.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/send.c?rev=65…
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/send.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/lpc/send.c [iso-8859-1] Tue Nov 4 20:47:18 2014
@@ -744,6 +744,9 @@
}
}
+ /* This flag is undocumented. Remove it before continuing */
+ LocalLpcRequest.u2.s2.Type &= ~0x4000;
+
/* Check if this is an LPC Request */
if (LpcpGetMessageType(&LocalLpcRequest) == LPC_REQUEST)
{