Figure 1   OEMIdle Pseudocode

//---------------------------------------------------------------------
//  This routine is called by the kernel when there are no threads
//  ready to run. The CPU should be put into a reduced power mode and
//  halted. It is important to be able to resume execution quickly upon
//  receiving an interrupt.
//---------------------------------------------------------------------

void OEMIdle (DWORD dwIdleParam) {

    DWORD dwIdleMSec, dwIdleElapsed;
    DWORD dwDiffMSecPrev = *pDiffMSec;
    static dwPartialMSec = 0;

    // If SleepMin zero, standard idle cycle
    if (dwSleepMin == 0) {
        CPUEnterIdle (dwIdleParam);
        return;
    }
    if (dwDiffMSecPrev >= dwSleepMin) {
        // According to the globals, sleep time has already passed!
        return;
    }
    // Compute sleep time, the next necessary scheduler interrupt
    dwIdleMSec = dwSleepMin - dwDiffMSecPrev;

    // Set scheduler timer to wake up
    CPUSetSysTimerCount(dwIdleMSec);

    // Enable wakeup on any interrupt, then go to sleep.
    CPUEnterIdle (dwIdleParam);

    // We're awake! The wake-up ISR has already run.
    if (dwDiffMSecPrev != *pDiffMSec) {
        //
        // We completed the full period we asked to sleep. Update 
        // the counters and return.
        //
        *pCurMSec  += (dwIdleMSec - 1); // Subtract one, because
        *pDiffMSec += (dwIdleMSec - 1); // ISR also incremented.
    } else {
        //
        // Some other interrupt woke us up before the full idle
        // period was complete. Determine how far we got, update 
        // the counters, and rearm the countdown for normal
        // operation.
        //
        dwIdleElapsed = CPUGetSysTimerCountElapsed(dwIdleMSec,
                                                   &dwPartialMSec);
        *pCurMSec  += dwIdleElapsed;
        *pDiffMSec += dwIdleElapsed;
    }
}

Figure 2   Scheduler Timer ISR Pseudocode

//---------------------------------------------------------------------
//
//  SchTimerISR - Interrupt handler for the timer.
//
//---------------------------------------------------------------------
DWORD SchTimerISR (void) {

    // Reschedule next timer interrupt
    CPUSetSysTimerCount (TimerIncrement)

    // Update CurMSec and DiffMSec by scheduler period: 1mS
    *pCurMSec += 1
    *pDiffMSec += 1

    // Only return SYSINTR_RESCHED when needed, specifically...
    if (ticksleft || (dwSleepMin && (*pDiffMSec >= dwSleepMin)) || 
                      (dwPreempt && (*pDiffMSec >= dwPreempt)))
        return SYSINTR_RESCHED;
    else
        return SYSINTR_NOP;
}


Figure 3   Security Functions

Function
Description
CertifyModuleInit
Starts the certification of a signed module
CertifyModule
Processes the binary data of a signed module
CertifyModuleFinal
Completes the certification of a signed module
InitPubKey
Initializes the public key used for signature verification


Figure 4   Functions for Trusted Modules


SystemStarted
SetInterruptEvent
SetSystemMemoryDivision
CeSetThreadPriority
CeSetThreadQuantum
ForcePageout
VirtualCopy
LockPages
UnlockPages
SetProcPermissions
SetKMode
ReadProcessMemory
WriteProcessMemory
SetCleanRebootFlag
DebugActiveProcess


Figure 5   Notification Type Flags

Flag
Description
CNT_EVENT
Creates a system event notification
CNT_TIME
Creates a time-based notification
CNT_PERIOD
Creates a notification active between a start and end time
CNT_CLASSICTIME
Creates an old user notification equivalent to CeSetUserNotification


Figure 6   BatteryDrvrGetStatus

Old:

BOOL BatteryDrvrGetStatus(PBATTERY_STATUS pstatus);
New:
BOOL BatteryDrvrGetStatus(PSYSTEM_POWER_STATUS_EX2 pstatus, 
                          PBOOL pfBatteriesChangedSinceLastCall);

typedef struct _SYSTEM_POWER_STATUS_EX2 {
    BYTE ACLineStatus;
    BYTE BatteryFlag;
    BYTE BatteryLifePercent;
    BYTE Reserved1;
    DWORD BatteryLifeTime;
    DWORD BatteryFullLifeTime;
    BYTE Reserved2;
    BYTE BackupBatteryFlag;
    BYTE BackupBatteryLifePercent;
    BYTE Reserved3;
    DWORD BackupBatteryLifeTime;
    DWORD BackupBatteryFullLifeTime;
    // Above here is old struct, below are new fields
    DWORD BatteryVoltage;             
    DWORD BatteryCurrent;            
    DWORD BatteryAverageCurrent;     
    DWORD BatteryAverageInterval;    
    DWORD BatterymAHourConsumed;     
    DWORD BatteryTemperature;        
    DWORD BackupBatteryVoltage;        
    BYTE  BatteryChemistry;         
} SYSTEM_POWER_STATUS_EX2;