David
Sun Jul 27 21:20:06 CDT 2008
Thank you for reply.
This buffer allocated at lower driver, can you explain more clearly? Thank
you
again.
"Don Burn" <burn@stopspam.windrvr.com> wrote in message
news:Oo6cynM7IHA.2224@TK2MSFTNGP05.phx.gbl...
>I may not be the right guy here because when someone mentions "kernel
>screaming" (oops kernel streaming) I run from the room. But if you cannot
>access the buffer address in the dispatch routine, you are going to have to
>request a worker thread with the context pointing to the IRP in the
>completion routine and return STATUS_MORE_PROCESSING required from
>completion. Then complete the IRP in the worker thread which runs at
>passive, after copying the buffer.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website:
http://www.windrvr.com
> Blog:
http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
>
>
>
> "David" <thuong101277@yahoo.com> wrote in message
> news:eDEDDaM7IHA.4108@TK2MSFTNGP04.phx.gbl...
>> Thank you for reply,
>>
>> but i do not know address buffer untill the SFDDeviceIoCompletion
>> function called.
>>
>> "Don Burn" <burn@stopspam.windrvr.com> wrote in message
>> news:OMoglMM7IHA.2332@TK2MSFTNGP03.phx.gbl...
>>> You need to lock the buffer in the SFDDispatchDeviceIoControl function,
>>> then unlock the buffer after the copy in the completion routine.
>>>
>>>
>>> --
>>> Don Burn (MVP, Windows DDK)
>>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>>> Website:
http://www.windrvr.com
>>> Blog:
http://msmvps.com/blogs/WinDrvr
>>> Remove StopSpam to reply
>>>
>>>
>>>
>>>
>>> "David" <thuong101277@yahoo.com> wrote in message
>>> news:uYM0wsL7IHA.4468@TK2MSFTNGP02.phx.gbl...
>>>> Thank you for reply,
>>>>
>>>> my problem is i have call function complete:
>>>>
>>>> NTSTATUS SFDDispatchDeviceIoControl(__in PDEVICE_OBJECT fido, __in
>>>> PIRP Irp)
>>>> {
>>>> PDEVICE_EXTENSION pdx;
>>>> NTSTATUS status;
>>>>
>>>> pdx = (PDEVICE_EXTENSION) fido->DeviceExtension;
>>>> IoCopyCurrentIrpStackLocationToNext(Irp);
>>>> IoSetCompletionRoutine(Irp, SFDDeviceIoCompletion, NULL, TRUE, TRUE,
>>>> TRUE );
>>>> status = IoCallDriver(pdx->NextLowerDriver,Irp);
>>>> return status;
>>>> }
>>>>
>>>> NTSTATUS SFDDeviceIoCompletion(__in PDEVICE_OBJECT fido, __in PIRP Irp,
>>>> __in PVOID Context)
>>>> {
>>>> NTSTATUS status = STATUS_UNSUCCESSFUL;
>>>> PIO_STACK_LOCATION stack = NULL;
>>>> ULONG IoControlCode = 0;
>>>> ULONG cbin, cbout;
>>>> ULONG info;
>>>> PKSSTREAM_HEADER KsStreamHeader;
>>>> PKSDATAFORMAT KsDataFormat;
>>>> PVOID sysBuffer;
>>>> LPBYTE buffer;
>>>> KIRQL oldirql;
>>>> BOOL isRaise = FALSE;
>>>>
>>>> if(!Irp)
>>>> return status;
>>>>
>>>> if(Irp->PendingReturned)
>>>> IoMarkIrpPending(Irp);
>>>>
>>>> stack = IoGetCurrentIrpStackLocation(Irp);
>>>>
>>>> if(!stack)
>>>> return status;
>>>>
>>>> IoControlCode = stack->Parameters.DeviceIoControl.IoControlCode;
>>>> cbin = stack->Parameters.DeviceIoControl.InputBufferLength;
>>>> cbout = stack->Parameters.DeviceIoControl.OutputBufferLength;
>>>>
>>>> switch(IoControlCode)
>>>> {
>>>> case IOCTL_KS_READ_STREAM:
>>>> {
>>>>
>>>> info = Irp->IoStatus.Information;
>>>> sysBuffer = Irp->AssociatedIrp.SystemBuffer;
>>>> KsStreamHeader = (PKSSTREAM_HEADER)sysBuffer;
>>>> KsDataFormat = (KSDATAFORMAT*)((LPBYTE)sysBuffer +
>>>> sizeof(KSSTREAM_HEADER));
>>>>
>>>> if(KsStreamHeader->Data && (KsStreamHeader->DataUsed > 0))
>>>> {
>>>> buffer = ExAllocatePool(NonPagedPool, KsStreamHeader->DataUsed);
>>>> if(buffer)
>>>> {
>>>> RtlCopyMemory(buffer, KsStreamHeader->Data,
>>>> KsStreamHeader->DataUsed);
>>>> ExFreePool(buffer);
>>>> }
>>>> }
>>>> }
>>>>
>>>> break;
>>>>
>>>> case IOCTL_KS_WRITE_STREAM:
>>>> DebugPrint(("IOCTL_KS_WRITE_STREAM\n"));
>>>> break;
>>>>
>>>> case IOCTL_KS_PROPERTY:
>>>> DebugPrint(("IOCTL_KS_WRITE_STREAM\n"));
>>>>
>>>> break;
>>>>
>>>> default:
>>>> break;
>>>>
>>>> }
>>>> return STATUS_CONTINUE_COMPLETION;
>>>> }
>>>>
>>>> When i open webcam it always at case IOCTL_KS_READ_STREAM, but i debug
>>>> try to get CurrentIrql by use function:
>>>>
>>>> KeGetCurrentIrql() then it is : DISPATH_LEVEL, in while i want to
>>>> accessed paged memory: KsStreamHeader->Data, i have not way or ideas to
>>>> access this memory.
>>>>
>>>> "Don Burn" <burn@stopspam.windrvr.com> wrote in message
>>>> news:OwyNtgL7IHA.4532@TK2MSFTNGP05.phx.gbl...
>>>>> The only way to access paged memory at DISPATCH is to lock it down so
>>>>> it is not paged before you run the code at DISPATCH. Take a look at
>>>>> MmProbeAndLockPages.
>>>>>
>>>>>
>>>>> --
>>>>> Don Burn (MVP, Windows DDK)
>>>>> Windows 2k/XP/2k3 Filesystem and Driver Consulting
>>>>> Website:
http://www.windrvr.com
>>>>> Blog:
http://msmvps.com/blogs/WinDrvr
>>>>> Remove StopSpam to reply
>>>>>
>>>>>
>>>>>
>>>>> "David" <thuong101277@yahoo.com> wrote in message
>>>>> news:%23ITk5XL7IHA.3736@TK2MSFTNGP06.phx.gbl...
>>>>>> hi all,
>>>>>>
>>>>>> such as document then we can not accessed paged memory at
>>>>>> DISPATCH_LEVEL, but my filter driver need to accessed paged memory at
>>>>>> DISPATCH_LEVEL, anybody pls help me, i can able to access or not.
>>>>>> have any ways to solve this problem.
>>>>>>
>>>>>> Thank very much.
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>