the following code stops the interrupts on the both the processors , but
nothing happens, i am able use the mouse and keyboard as usual (was expecting
a reboot or bsod :S) whats going on here?
#include "ntddk.h"
#include <windef.h>
int i;
HANDLE thrHwnd;
KEVENT syncEvent;
BOOL processors[16];
int totalProcessors,processorsMarked;
void displayCpuName()
{
if (processors[KeGetCurrentProcessorNumber()]==TRUE)
{
DbgPrint("The Processor %d, ran the code
before!!",KeGetCurrentProcessorNumber());
KeSetEvent(&syncEvent,0,FALSE);
PsTerminateSystemThread(0);
return;
}
else
{
DbgPrint("The Processor %d, is running the code for the first
time",KeGetCurrentProcessorNumber());
__asm{
cli
}
processors[KeGetCurrentProcessorNumber()]=TRUE;
processorsMarked++;
KeSetEvent(&syncEvent,0,FALSE);
PsTerminateSystemThread(0);
return;
}
}
NTSTATUS onUnload (IN PDRIVER_OBJECT driverObject)
{
DbgPrint("Driver Unloaded Successfully");
return STATUS_SUCCESS;
}
NTSTATUS DriverEntry (IN PDRIVER_OBJECT driverObject, IN PUNICODE_STRING
registryPath)
{
DbgPrint("Driver Loaded Successfully");
driverObject->DriverUnload = onUnload;
processorsMarked = 0;
for(i = 0; i < 16;i++)
processors[i] = FALSE;
totalProcessors = KeNumberProcessors;
KeInitializeEvent(&syncEvent,SynchronizationEvent, FALSE);
while(TRUE)
{
PsCreateSystemThread(&thrHwnd,(ACCESS_MASK)
0L,NULL,NULL,NULL,(PKSTART_ROUTINE) displayCpuName,NULL);
KeWaitForSingleObject(&syncEvent,Executive,KernelM ode,FALSE,NULL);
if(processorsMarked == totalProcessors) break;
}
return STATUS_SUCCESS;
}
thanks!
|