Prev: cursor position
Next: playing audio file
From: JG on 3 Feb 2010 08:37 I try but i get a crash... This is my DPC routine what s wrong with it??? VOID ObdhCtuEvtInterruptDpc( IN WDFINTERRUPT Interrupt, IN WDFDEVICE Device ) { NTSTATUS status; POBDHCTU_CONTEXT deviceContext; WDFREQUEST Request; USHORT interruptState; struct PciCtuWaitItOutput* bufferOut; LARGE_INTEGER delay; KTIMER timer; int iCnt; deviceContext = WdfObjectGet_OBDHCTU_CONTEXT(Device); WdfInterruptAcquireLock(Interrupt); Request = deviceContext->WaitingRequest; //Request pending waiting the right interruption.... interruptState = deviceContext->InterruptState; WdfInterruptReleaseLock( Interrupt ); if (Request) { if( ( interruptState & 0x01) && ( (interruptState & 0x10)==0)) { delay.QuadPart = WDF_REL_TIMEOUT_IN_US(100); KeInitializeTimerEx(&timer, SynchronizationTimer); KeSetTimer(&timer, delay, NULL); while (TRUE) { status = KeWaitForSingleObject( &timer, Executive, KernelMode, FALSE, NULL); if (status!=STATUS_TIMEOUT ) //Ok my timer is ended { //DbgPrint(("KeWaitForMultipleObjects failed\n")); break; }//else i wait again } KeCancelTimer(&timer); } //i save the interrupt state IT status = WdfRequestRetrieveOutputBuffer( Request, 2, &bufferOut, NULL ); if (NT_SUCCESS(status)) bufferOut->ushStateIt = interruptState; //i complete the request WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, 2); deviceContext->WaitingRequest = NULL; } return; } "JG" <jerome.gil(a)dactem.com> a �crit dans le message de news: O%23Ps2eKpKHA.4836(a)TK2MSFTNGP05.phx.gbl... > Thanks i will try a KTimer > > I will let you know... > > "JG" <jerome.gil(a)dactem.com> a �crit dans le message de news: > OO8iNTCpKHA.1556(a)TK2MSFTNGP05.phx.gbl... >> Hi, >> >> I want to wait a delay in a DPC routine. This DPC is running from a queue >> after an interrupt routine. >> I try KeWaitEvent but i get a bluescreen... >> Can someone help me to make a wait(2ms) >> Thanks >> > >
From: Don Burn on 3 Feb 2010 08:39 No you cannot do a KeWaitForSingleObject( &timer, Executive, KernelMode, FALSE, NULL) at DPC_LEVEL this will crash. Change your call to KeSetTimer to have another DPC in it that is run when the timer is expired and does the work. -- Don Burn (MVP, Windows DKD) Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr Remove StopSpam to reply "JG" <jerome.gil(a)dactem.com> wrote in message news:u6%237nVNpKHA.5508(a)TK2MSFTNGP02.phx.gbl... >I try but i get a crash... > This is my DPC routine what s wrong with it??? > > > VOID > ObdhCtuEvtInterruptDpc( > IN WDFINTERRUPT Interrupt, > IN WDFDEVICE Device > ) > { > NTSTATUS status; > POBDHCTU_CONTEXT deviceContext; > WDFREQUEST Request; > USHORT interruptState; > struct PciCtuWaitItOutput* bufferOut; > LARGE_INTEGER delay; > KTIMER timer; > > int iCnt; > > > deviceContext = WdfObjectGet_OBDHCTU_CONTEXT(Device); > > > WdfInterruptAcquireLock(Interrupt); > > Request = deviceContext->WaitingRequest; //Request pending waiting the > right interruption.... > > interruptState = deviceContext->InterruptState; > > > WdfInterruptReleaseLock( Interrupt ); > > > if (Request) > { > > if( ( interruptState & 0x01) && ( (interruptState & 0x10)==0)) > { > > delay.QuadPart = WDF_REL_TIMEOUT_IN_US(100); > > KeInitializeTimerEx(&timer, SynchronizationTimer); > KeSetTimer(&timer, delay, NULL); > while (TRUE) > { > status = KeWaitForSingleObject( &timer, > Executive, KernelMode, > FALSE, NULL); > > if (status!=STATUS_TIMEOUT ) //Ok my timer is ended > { > //DbgPrint(("KeWaitForMultipleObjects failed\n")); > break; > }//else i wait again > } > KeCancelTimer(&timer); > > > } > //i save the interrupt state IT > status = WdfRequestRetrieveOutputBuffer( > Request, > 2, > &bufferOut, > NULL > ); > if (NT_SUCCESS(status)) > bufferOut->ushStateIt = interruptState; > //i complete the request > WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, 2); > deviceContext->WaitingRequest = NULL; > > } > return; > } > "JG" <jerome.gil(a)dactem.com> a �crit dans le message de news: > O%23Ps2eKpKHA.4836(a)TK2MSFTNGP05.phx.gbl... >> Thanks i will try a KTimer >> >> I will let you know... >> >> "JG" <jerome.gil(a)dactem.com> a �crit dans le message de news: >> OO8iNTCpKHA.1556(a)TK2MSFTNGP05.phx.gbl... >>> Hi, >>> >>> I want to wait a delay in a DPC routine. This DPC is running from a >>> queue after an interrupt routine. >>> I try KeWaitEvent but i get a bluescreen... >>> Can someone help me to make a wait(2ms) >>> Thanks >>> >> >> > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4831 (20100203) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4831 (20100203) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
From: eagersh on 3 Feb 2010 11:40 On Feb 3, 6:37 am, "JG" <jerome....(a)dactem.com> wrote: > I try but i get a crash... > This is my DPC routine what s wrong with it??? > > VOID > ObdhCtuEvtInterruptDpc( > IN WDFINTERRUPT Interrupt, > IN WDFDEVICE Device > ) > { > NTSTATUS status; > POBDHCTU_CONTEXT deviceContext; > WDFREQUEST Request; > USHORT interruptState; > struct PciCtuWaitItOutput* bufferOut; > LARGE_INTEGER delay; > KTIMER timer; > > int iCnt; > > deviceContext = WdfObjectGet_OBDHCTU_CONTEXT(Device); > > WdfInterruptAcquireLock(Interrupt); > > Request = deviceContext->WaitingRequest; //Request pending waiting the > right interruption.... > > interruptState = deviceContext->InterruptState; > > WdfInterruptReleaseLock( Interrupt ); > > if (Request) > { > > if( ( interruptState & 0x01) && ( (interruptState & 0x10)==0)) > { > > delay.QuadPart = WDF_REL_TIMEOUT_IN_US(100); > > KeInitializeTimerEx(&timer, SynchronizationTimer); > KeSetTimer(&timer, delay, NULL); > while (TRUE) > { > status = KeWaitForSingleObject( &timer, > Executive, KernelMode, > FALSE, NULL); > > if (status!=STATUS_TIMEOUT ) //Ok my timer is ended > { > //DbgPrint(("KeWaitForMultipleObjects failed\n")); > break; > }//else i wait again > } > KeCancelTimer(&timer); > > } > //i save the interrupt state IT > status = WdfRequestRetrieveOutputBuffer( > Request, > 2, > &bufferOut, > NULL > ); > if (NT_SUCCESS(status)) > bufferOut->ushStateIt = interruptState; > //i complete the request > WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, 2); > deviceContext->WaitingRequest = NULL; > > } > return;} > > "JG" <jerome....(a)dactem.com> a écrit dans le message de news: > O%23Ps2eKpKHA.4...(a)TK2MSFTNGP05.phx.gbl... > Look at documentation for using KeWaitForSingleObject in Dispatch Level. http://msdn.microsoft.com/en-us/library/ms801959.aspx You could find restrictions of using KeWaitForSingleObject in the end of "Comments" of the web page. Igor Sharovar
From: JG on 4 Feb 2010 10:57 Ok it seems to work... Thanks a lot!!! "Don Burn" <burn(a)stopspam.windrvr.com> a �crit dans le message de news: evW0fZNpKHA.4836(a)TK2MSFTNGP02.phx.gbl... > No you cannot do a KeWaitForSingleObject( &timer, Executive, KernelMode, > FALSE, NULL) at DPC_LEVEL this will crash. Change your call to KeSetTimer > to have another DPC in it that is run when the timer is expired and does > the work. > > > -- > Don Burn (MVP, Windows DKD) > Windows Filesystem and Driver Consulting > Website: http://www.windrvr.com > Blog: http://msmvps.com/blogs/WinDrvr > Remove StopSpam to reply > > > > > "JG" <jerome.gil(a)dactem.com> wrote in message > news:u6%237nVNpKHA.5508(a)TK2MSFTNGP02.phx.gbl... >>I try but i get a crash... >> This is my DPC routine what s wrong with it??? >> >> >> VOID >> ObdhCtuEvtInterruptDpc( >> IN WDFINTERRUPT Interrupt, >> IN WDFDEVICE Device >> ) >> { >> NTSTATUS status; >> POBDHCTU_CONTEXT deviceContext; >> WDFREQUEST Request; >> USHORT interruptState; >> struct PciCtuWaitItOutput* bufferOut; >> LARGE_INTEGER delay; >> KTIMER timer; >> >> int iCnt; >> >> >> deviceContext = WdfObjectGet_OBDHCTU_CONTEXT(Device); >> >> >> WdfInterruptAcquireLock(Interrupt); >> >> Request = deviceContext->WaitingRequest; //Request pending waiting the >> right interruption.... >> >> interruptState = deviceContext->InterruptState; >> >> >> WdfInterruptReleaseLock( Interrupt ); >> >> >> if (Request) >> { >> >> if( ( interruptState & 0x01) && ( (interruptState & 0x10)==0)) >> { >> >> delay.QuadPart = WDF_REL_TIMEOUT_IN_US(100); >> >> KeInitializeTimerEx(&timer, SynchronizationTimer); >> KeSetTimer(&timer, delay, NULL); >> while (TRUE) >> { >> status = KeWaitForSingleObject( &timer, >> Executive, KernelMode, >> FALSE, NULL); >> >> if (status!=STATUS_TIMEOUT ) //Ok my timer is ended >> { >> //DbgPrint(("KeWaitForMultipleObjects failed\n")); >> break; >> }//else i wait again >> } >> KeCancelTimer(&timer); >> >> >> } >> //i save the interrupt state IT >> status = WdfRequestRetrieveOutputBuffer( >> Request, >> 2, >> &bufferOut, >> NULL >> ); >> if (NT_SUCCESS(status)) >> bufferOut->ushStateIt = interruptState; >> //i complete the request >> WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, 2); >> deviceContext->WaitingRequest = NULL; >> >> } >> return; >> } >> "JG" <jerome.gil(a)dactem.com> a �crit dans le message de news: >> O%23Ps2eKpKHA.4836(a)TK2MSFTNGP05.phx.gbl... >>> Thanks i will try a KTimer >>> >>> I will let you know... >>> >>> "JG" <jerome.gil(a)dactem.com> a �crit dans le message de news: >>> OO8iNTCpKHA.1556(a)TK2MSFTNGP05.phx.gbl... >>>> Hi, >>>> >>>> I want to wait a delay in a DPC routine. This DPC is running from a >>>> queue after an interrupt routine. >>>> I try KeWaitEvent but i get a bluescreen... >>>> Can someone help me to make a wait(2ms) >>>> Thanks >>>> >>> >>> >> >> >> >> __________ Information from ESET NOD32 Antivirus, version of virus >> signature database 4831 (20100203) __________ >> >> The message was checked by ESET NOD32 Antivirus. >> >> http://www.eset.com >> >> >> > > > > __________ Information from ESET NOD32 Antivirus, version of virus > signature database 4831 (20100203) __________ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > > > >
|
Pages: 1 Prev: cursor position Next: playing audio file |