Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

delay.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 delay.c 00008 00009 Abstract: 00010 00011 This module implements the executive delay execution system service. 00012 00013 Author: 00014 00015 David N. Cutler (davec) 13-May-1989 00016 00017 Environment: 00018 00019 Kernel mode only. 00020 00021 Revision History: 00022 00023 --*/ 00024 00025 #include "exp.h" 00026 00027 #ifdef ALLOC_PRAGMA 00028 #pragma alloc_text(PAGE, NtDelayExecution) 00029 #endif 00030 00031 00032 NTSTATUS 00033 NtDelayExecution ( 00034 IN BOOLEAN Alertable, 00035 IN PLARGE_INTEGER DelayInterval 00036 ) 00037 00038 /*++ 00039 00040 Routine Description: 00041 00042 This function delays the execution of the current thread for the specified 00043 interval of time. 00044 00045 Arguments: 00046 00047 Alertable - Supplies a boolean value that specifies whether the delay 00048 is alertable. 00049 00050 DelayInterval - Supplies the absolute of relative time over which the 00051 delay is to occur. 00052 00053 Return Value: 00054 00055 TBS 00056 00057 --*/ 00058 00059 { 00060 00061 LARGE_INTEGER Interval; 00062 KPROCESSOR_MODE PreviousMode; 00063 NTSTATUS Status; 00064 00065 // 00066 // Establish an exception handler and probe delay interval address. If 00067 // the probe fails, then return the exception code as the service status. 00068 // Otherwise return the status value returned by the delay execution 00069 // routine. 00070 // 00071 00072 try { 00073 00074 // 00075 // Get previous processor mode and probe delay interval address if 00076 // necessary. 00077 // 00078 00079 PreviousMode = KeGetPreviousMode(); 00080 if (PreviousMode != KernelMode) { 00081 ProbeForRead(DelayInterval, sizeof(LARGE_INTEGER), sizeof(ULONG)); 00082 } 00083 Interval = *DelayInterval; 00084 00085 // 00086 // Delay execution for the specified amount of time. 00087 // 00088 00089 Status = KeDelayExecutionThread(PreviousMode, Alertable, &Interval); 00090 00091 // 00092 // If an exception occurs during the probing of the delay interval address, 00093 // then always handle the exception and return the exception code as the 00094 // status value. 00095 // 00096 00097 } except(EXCEPTION_EXECUTE_HANDLER) { 00098 return GetExceptionCode(); 00099 } 00100 00101 // 00102 // Return service status. 00103 // 00104 00105 return Status; 00106 }

Generated on Sat May 15 19:39:39 2004 for test by doxygen 1.3.7