Search code examples
windowsdrivers

ExSetTimerResolution does not work


I have got Windows XP installed on my computer. I want my DPC routine to be called every 10 ms.

That is why I wrote this code:

    ASSERT( KeGetCurrentIrql() <= APC_LEVEL );
    KeRaiseIrql( APC_LEVEL, &level );

    resolution = ExSetTimerResolution( 100000, TRUE );
    KdPrint((DRIVERNAME " - RESOLUTION = %d\n", resolution));

    KeLowerIrql( level );

    KeSetTimerEx( &pExt->timer, duetime, 10, &pExt->dpc );

DebugView shows me that return value (RESOLUTION) equals 156250.

As a result my DPC routine is called every 15.5 ms

What am I doing wrong?


Solution

  • Out of curiosity I tried ExSetTimerResolution with different values.

    Here is what I got:

    10000 -> 9766
    50000 -> 39063
    75000 -> 39063
    90000 -> 156250
    

    Left column contains values that I used as DesiredTime parameter. Right column contains return values.

    As you can see, it looks like Windows cannot change global timer resolution to any desired number.