Re: sleeping

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Well you have two problems here:

1. The simple one is that a positive timeout value means time since
1/1/1601 not one half second which you wanted. Make that -5000.

2. The bigger problem is what do you think you are accomplishing with the
half second delay? You are slowing down all executable invocation by a
significant amount here.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



"Torsten Curdt" <tcurdt@xxxxxxxxxxxxxx> wrote in message
news:O$sK0Jd9FHA.1332@xxxxxxxxxxxxxxxxxxxxxxx
> Inside the callback of a PsSetCreateProcessNotifyRoutine
> I am trying to delay the actual program execution.
>
> The usual Sleep(5000) does not work ...I assume since this
> is in kernel space. So I thought I could use the timeout of
> a WaitForSingleObject.
>
> But somehow this does not work as expected:
>
> VOID ProcessCallback(
> IN HANDLE hParentId,
> IN HANDLE hProcessId,
> IN BOOLEAN bCreate
> )
> {
>
> KEVENT event;
> __int64 timeout = 5000;
>
> KeInitializeEvent(&event, NotificationEvent, FALSE);
> KeClearEvent(&event);
> KeWaitForSingleObject(&event, Executive, KernelMode,
> FALSE, &timeout);
>
> // do some stuff
> }
>
>
> For some reason the "stuff being done" happens without a delay.
>
> What am I missing here?
>
> cheers
> --
> Torsten


.



Relevant Pages

  • Re: Timeout Clarification (All 5 of them)
    ... WebService Asmx = Unlimited? ... IIS ASP.NET Execution Timeout = 110secs ... Is there a way to terminate the server execution when the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: sleeping
    ... > I am trying to delay the actual program execution. ... > is in kernel space. ... So I thought I could use the timeout of ... > For some reason the "stuff being done" happens without a delay. ...
    (microsoft.public.development.device.drivers)
  • sleeping
    ... I am trying to delay the actual program execution. ... is in kernel space. ... So I thought I could use the timeout of a WaitForSingleObject. ...
    (microsoft.public.development.device.drivers)
  • Re: ASP.NET SQL Timeout! help!
    ... The SQL Connection timeout is just how long the attempt to make a connection ... It has nothing to do with execution of SQL ... You need to change the timeout on the command object. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Read Timeout Error
    ... The requested URL could not be retrieved ... While trying to retrieve the URL: ... Read Timeout ... read in manual that set_time_limitwill increase only the execution ...
    (comp.lang.php)