Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6100749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:25:17+00:00 2026-05-23T13:25:17+00:00

I am developing a Windows device-driver and need to delay execution of a system

  • 0

I am developing a Windows device-driver and need to delay execution of a system shutdown for about 10 secs. I am using following code inside DispatchPower() function of my driver:

NTSTATUS DispatchPower(
  __in  struct _DEVICE_OBJECT *DeviceObject,
  __in  struct _IRP *Irp
)
{

    switch(stack->MinorFunction)
    {
        case IRP_MN_SET_POWER:            
            delay_time.QuadPart = WDF_REL_TIMEOUT_IN_SEC(10);
            KeDelayExecutionThread(KernelMode, FALSE, &delay_time);
    }

}

But it seems KeDelayExecutionThread() returns immediately without waiting? Any suggestions?

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:25:17+00:00Added an answer on May 23, 2026 at 1:25 pm

    Not certain, but here are some advices:

    1. Check the return value of KeDelayExecutionThread. According to the docs it seems that this function may return preliminary with either STATUS_ALERTED or STATUS_USER_APC. Well, since you’re performing a non-alertable state this should not happen, but OTOH I don’t quite understand what is the difference between STATUS_ALERTED and STATUS_USER_APC. Besides from this it may return you an error status, which may be informative.

    2. According to the docs you must run at IRQL <= APC_LEVEL. You should check your actual IRQL (KeGetCurrentIrql).

    3. Anyway, IMHO it’s a pretty weird design to block a thread in the kernel-mode. Usually this hangs the whole system. If you want to delay the IRP processing you’d better return STATUS_PENDING in the dispatch routine, and then, via timer DPC complete this IRP.

    If you’re not familiar with this read the MSDN about the following: KeInitializeDpc, KeInitializeTimer, KeSetTimer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'll be developing something for a Windows Mobile device using CompactFramework/C#. I wonder if
I'm currently developing for a handheld device running Windows XP Professional (not Tablet PC
I'm developing an application for Windows Mobile Devices using Visual Studio .NET 2008 whose
I am developing a Windows .NET application (WinForms) and I need to simulate a
I'm looking at developing a device which will need to support Ethernet over USB
I am developing CDC driver for USB device and I stumble on some problem.
I'm developing a turn-by-turn navigation software for Windows Mobile using C# and .NET CF.
I am using Visual C++ 2010 developing 32bit windows applications. There is something I
We are developing C#.Net 4.0 Windows form based application using Microsoft.Office.Interop.Word reference. Now I
I want to start developing for Windows Mobile Devices, as I plan to buy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.