mirror of
https://github.com/reactos/reactos.git
synced 2025-02-21 16:04:57 +00:00
[KS] KsRead/WriteFile: finish IRP initialization and properly setup I/O stack location for it (#5784)
- Initialize the rest of IRP data which is not initialized by IoBuildSynchronousFsdRequest. - Setup an IO_STACK_LOCATION structure for the IRP before calling the driver's read/write routine. - Do this for both KsReadFile and KsWriteFile functions in our Kernel Streaming driver (ks.sys). This fixes several problems when calling these functions from outside, so now they are working correctly, as expected. Discovered during my audio investigations. CORE-19232
This commit is contained in:
parent
8451230753
commit
a6b281c228
1 changed files with 22 additions and 0 deletions
|
@ -150,6 +150,7 @@ KsReadFile(
|
|||
IN KPROCESSOR_MODE RequestorMode)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
BOOLEAN Result;
|
||||
|
@ -216,6 +217,16 @@ KsReadFile(
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* setup the rest of irp */
|
||||
Irp->RequestorMode = RequestorMode;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
|
||||
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
||||
|
||||
/* setup irp stack */
|
||||
IoStack = IoGetNextIrpStackLocation(Irp);
|
||||
IoStack->FileObject = FileObject;
|
||||
IoStack->Parameters.Read.Key = Key;
|
||||
|
||||
/* send the packet */
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
|
@ -250,6 +261,7 @@ KsWriteFile(
|
|||
IN KPROCESSOR_MODE RequestorMode)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
BOOLEAN Result;
|
||||
|
@ -316,6 +328,16 @@ KsWriteFile(
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* setup the rest of irp */
|
||||
Irp->RequestorMode = RequestorMode;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcContext = PortContext;
|
||||
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
||||
|
||||
/* setup irp stack */
|
||||
IoStack = IoGetNextIrpStackLocation(Irp);
|
||||
IoStack->FileObject = FileObject;
|
||||
IoStack->Parameters.Write.Key = Key;
|
||||
|
||||
/* send the packet */
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
|
|
Loading…
Reference in a new issue