diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 7f6a1c7946a..f8e1f18c459 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -549,16 +549,30 @@ PIRP WINAPI IoBuildSynchronousFsdRequest(ULONG majorfunc, PDEVICE_OBJECT device, PIRP irp; PIO_STACK_LOCATION irpsp; - FIXME("(%d %p %p %d %p %p %p) stub\n", majorfunc, device, buffer, length, startoffset, event, iosb); + TRACE("(%d %p %p %d %p %p %p)\n", majorfunc, device, buffer, length, startoffset, event, iosb); - irp = IoAllocateIrp( device->StackSize, FALSE ); - if (irp == NULL) - return NULL; + if (!(irp = IoAllocateIrp( device->StackSize, FALSE ))) return NULL; irpsp = IoGetNextIrpStackLocation( irp ); irpsp->MajorFunction = majorfunc; - /*irpsp->Parameters.DeviceIoControl.IoControlCode = IoControlCode;*/ + irpsp->DeviceObject = device; + irpsp->CompletionRoutine = NULL; + irp->AssociatedIrp.SystemBuffer = buffer; + if (device->Flags & DO_DIRECT_IO) IoAllocateMdl( buffer, length, FALSE, FALSE, irp ); + + switch (majorfunc) + { + case IRP_MJ_READ: + irpsp->Parameters.Read.Length = length; + irpsp->Parameters.Read.ByteOffset = *startoffset; + break; + case IRP_MJ_WRITE: + irpsp->Parameters.Write.Length = length; + irpsp->Parameters.Write.ByteOffset = *startoffset; + break; + } + irp->RequestorMode = KernelMode; irp->UserIosb = iosb; irp->UserEvent = event; irp->UserBuffer = buffer; diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index c2343757902..10832cf6fdf 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1201,6 +1201,7 @@ PVOID WINAPI IoAllocateErrorLogEntry(PVOID,UCHAR); PIRP WINAPI IoAllocateIrp(CCHAR,BOOLEAN); PMDL WINAPI IoAllocateMdl(PVOID,ULONG,BOOLEAN,BOOLEAN,IRP*); PIRP WINAPI IoBuildDeviceIoControlRequest(ULONG,DEVICE_OBJECT*,PVOID,ULONG,PVOID,ULONG,BOOLEAN,PKEVENT,IO_STATUS_BLOCK*); +PIRP WINAPI IoBuildSynchronousFsdRequest(ULONG,DEVICE_OBJECT*,PVOID,ULONG,PLARGE_INTEGER,PKEVENT,IO_STATUS_BLOCK*); NTSTATUS WINAPI IoCallDriver(DEVICE_OBJECT*,IRP*); VOID WINAPI IoCompleteRequest(IRP*,UCHAR); NTSTATUS WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**);