- Do not report that ROS is running on 0 active processors, that's a bad idea.
- Actually check the affinity mask set by NtSetInformationThread
- Fix the check in KeSetAffinityThread
- Give a valid affinity to the system thread (corresponding to the active cpu affinity set).
This removes all bugchecks from the kernel32 thread winetest.
svn path=/trunk/; revision=17235
STDCALL
KeQueryBasePriorityThread(IN PKTHREAD Thread);
+VOID
+STDCALL
+KiSetPriorityThread(PKTHREAD Thread,
+ KPRIORITY Priority,
+ PBOOLEAN Released);
+
VOID
STDCALL
KeStackAttachProcess (
DPRINT("KeSetAffinityThread(Thread %x, Affinity %x)\n", Thread, Affinity);
- ASSERT(Affinity & ((1 << KeNumberProcessors) - 1));
+ /* Verify correct affinity */
+ if ((Affinity & Thread->ApcStatePointer[0]->Process->Affinity) !=
+ Affinity || !Affinity)
+ {
+ KEBUGCHECK(INVALID_AFFINITY_SET);
+ }
OldIrql = KeAcquireDispatcherDatabaseLock();
EXPORTED ULONG NtBuildNumber = KERNEL_VERSION_BUILD;
EXPORTED ULONG NtGlobalFlag = 0;
EXPORTED CHAR KeNumberProcessors;
-EXPORTED KAFFINITY KeActiveProcessors;
+EXPORTED KAFFINITY KeActiveProcessors = 1;
EXPORTED LOADER_PARAMETER_BLOCK KeLoaderBlock;
EXPORTED ULONG KeDcacheFlushCount = 0;
EXPORTED ULONG KeIcacheFlushCount = 0;
/* System threads may run on any processor. */
RtlZeroMemory(PsInitialSystemProcess, sizeof(EPROCESS));
- PsInitialSystemProcess->Pcb.Affinity = 0xFFFFFFFF;
+ PsInitialSystemProcess->Pcb.Affinity = KeActiveProcessors;
PsInitialSystemProcess->Pcb.IopmOffset = 0xffff;
PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIO_NORMAL;
PsInitialSystemProcess->Pcb.QuantumReset = 6;
SetInformationData[ThreadInformationClass].Size);
}
+ /* FIXME: This is REALLY wrong. Some types don't need THREAD_SET_INFORMATION */
+ /* FIXME: We should also check for certain things before doing the reference */
Status = ObReferenceObjectByHandle (ThreadHandle,
THREAD_SET_INFORMATION,
PsThreadType,
break;
case ThreadAffinityMask:
- Status = KeSetAffinityThread(&Thread->Tcb, u.Affinity);
+
+ /* Check if this is valid */
+ DPRINT1("%lx, %lx\n", Thread->ThreadsProcess->Pcb.Affinity, u.Affinity);
+ if ((Thread->ThreadsProcess->Pcb.Affinity & u.Affinity) !=
+ u.Affinity)
+ {
+ DPRINT1("Wrong affinity given\n");
+ Status = STATUS_INVALID_PARAMETER;
+ }
+ else
+ {
+ Status = KeSetAffinityThread(&Thread->Tcb, u.Affinity);
+ }
break;
case ThreadImpersonationToken: