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.
........

svn path=/trunk/; revision=65255
This commit is contained in:
Timo Kreuzer 2014-11-04 20:47:18 +00:00
parent afc42dae68
commit f1f1a19b03
9 changed files with 94 additions and 11 deletions

View file

@ -15,6 +15,7 @@
BOOLEAN CmBootAcceptFirstTime = TRUE;
BOOLEAN CmFirstTime = TRUE;
extern ULONG InitSafeBootMode;
/* FUNCTIONS *****************************************************************/
@ -947,7 +948,7 @@ NtInitializeRegistry(IN USHORT Flag)
/* 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 @@ NtCompressKey(IN HANDLE Key)
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

View file

@ -14,6 +14,10 @@
#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
NTAPI
@ -759,8 +763,8 @@ ExpIsLoaderValid(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
/* 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;

View file

@ -1130,7 +1130,7 @@ ExfReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
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,

View file

@ -1788,9 +1788,22 @@ SSI_DEF(SystemExtendServiceTableInformation)
/* 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 */

View file

@ -1580,6 +1580,8 @@ IopQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
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 @@ IoCreateFile(OUT PHANDLE FileHandle,
/* Make sure we have extra parameters */
if (!ExtraCreateParameters)
{
DPRINT1("Invalid parameter: ExtraCreateParameters == 0!\n");
return STATUS_INVALID_PARAMETER;
}
@ -1815,6 +1818,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
(CreateOptions & ~FILE_VALID_PIPE_OPTION_FLAGS))
{
/* Invalid named pipe create */
DPRINT1("Invalid named pipe create\n");
return STATUS_INVALID_PARAMETER;
}
}
@ -1823,6 +1827,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
/* Make sure we have extra parameters */
if (!ExtraCreateParameters)
{
DPRINT1("Invalid parameter: ExtraCreateParameters == 0!\n");
return STATUS_INVALID_PARAMETER;
}
@ -1833,6 +1838,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
(CreateOptions & ~FILE_VALID_MAILSLOT_OPTION_FLAGS))
{
/* Invalid mailslot create */
DPRINT1("Invalid mailslot create\n");
return STATUS_INVALID_PARAMETER;
}
}
@ -1936,6 +1942,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
if (!OpenPacket->EaBuffer)
{
ExFreePool(OpenPacket);
DPRINT1("Failed to allocate open packet EA buffer\n");
return STATUS_INSUFFICIENT_RESOURCES;
}

View file

@ -1517,8 +1517,18 @@ VOID
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 */
Status = NtCallbackReturn((PVOID)TrapFrame->Ecx,

View file

@ -696,8 +696,10 @@ KiSetAffinityThread(IN PKTHREAD Thread,
/* Check if system affinity is disabled */
if (!Thread->SystemAffinityActive)
{
#ifdef CONFIG_SMP
/* FIXME: TODO */
DPRINT1("Affinity support disabled!\n");
#endif
}
/* Return the old affinity */

View file

@ -139,7 +139,11 @@ NtSecureConnectPort(OUT PHANDLE PortHandle,
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 @@ NtSecureConnectPort(OUT PHANDLE PortHandle,
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;

View file

@ -744,6 +744,9 @@ NtRequestWaitReplyPort(IN HANDLE PortHandle,
}
}
/* 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)
{