"Windows kernel security and driver development" and 4.3 times the timer

"Windows kernel security and driver development" reading notes - the index directory

"Windows kernel security and driver development" and 4.3 times the timer

First, get the number of milliseconds since system startup

/*
    Function role: find the number of milliseconds since the operating system starts experienced
    Parameter 1 mesc: calculation result (ms)
*/
void MyGetTickCount(PULONG msec) {
    LARGE_INTEGER tick_count;
    Myinc ULONG = KeQueryTimeIncrement (); // get the number of ticks 
    KeQueryTickCount (& Tick_count); // get a tick nanosecond event used 
    tick_count.QuadPart * = myinc;
    tick_count.QuadPart /= 10000;
    *msec = tick_count.LowPart;
}

 

Second, get the current system time

/*
    Function role: output current time
*/
VOID MyCurTimerStr() {
    LARGE_INTEGER snow, now;
    TIME_FIELDS now_fields;
    static WCHAR time_str [ 32 ] = { 0 };
     // Get Time 
    KeQuerySystemTime, (& Snow);
     // converted to local 
    ExSystemTimeToLocalTime (& Snow, & now);
     // conversion time for people to be understood that elements 
    RtlTimeToTimeFields (& snow, & now_fields);
     // output to the log 
    DbgPrint ( " % 2D- 4D -%%% 2D-% 2D- 2D% 2D " ,
        now_fields.Year, now_fields.Month,now_fields.Day,
        now_fields.Hour, now_fields.Minute, now_fields.Second);
}

 

Third, a timer - To be continued

 

 

 

Guess you like

Origin www.cnblogs.com/onetrainee/p/11995710.html