Re: sleeping
- From: "Don Burn" <burn@xxxxxxxxxxxxxxxx>
- Date: Wed, 30 Nov 2005 12:27:39 -0500
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
.
- Follow-Ups:
- Re: sleeping
- From: Alexander Grigoriev
- Re: sleeping
- From: Torsten Curdt
- Re: sleeping
- References:
- sleeping
- From: Torsten Curdt
- sleeping
- Prev by Date: sleeping
- Next by Date: RE: StartService problem!
- Previous by thread: sleeping
- Next by thread: Re: sleeping
- Index(es):
Relevant Pages
|