mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
Implement EngFileIoControl and EngFileWrite
svn path=/trunk/; revision=42596
This commit is contained in:
parent
0b1191a6d8
commit
15e8102344
2 changed files with 133 additions and 25 deletions
|
@ -4,8 +4,7 @@
|
||||||
* PURPOSE: GDI Driver Device Functions
|
* PURPOSE: GDI Driver Device Functions
|
||||||
* FILE: subsys/win32k/eng/device.c
|
* FILE: subsys/win32k/eng/device.c
|
||||||
* PROGRAMER: Jason Filby
|
* PROGRAMER: Jason Filby
|
||||||
* REVISION HISTORY:
|
* Timo Kreuzer
|
||||||
* 3/7/1999: Created
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
@ -13,6 +12,138 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
static
|
||||||
|
DWORD
|
||||||
|
EngpFileIoRequest(
|
||||||
|
PFILE_OBJECT pFileObject,
|
||||||
|
ULONG ulMajorFunction,
|
||||||
|
LPVOID lpBuffer,
|
||||||
|
DWORD nBufferSize,
|
||||||
|
ULONGLONG ullStartOffset,
|
||||||
|
OUT LPDWORD lpInformation)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT pDeviceObject;
|
||||||
|
KEVENT Event;
|
||||||
|
PIRP pIrp;
|
||||||
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
NTSTATUS Status;
|
||||||
|
LARGE_INTEGER liStartOffset;
|
||||||
|
|
||||||
|
/* Get corresponding device object */
|
||||||
|
pDeviceObject = IoGetRelatedDeviceObject(pFileObject);
|
||||||
|
if (!pDeviceObject)
|
||||||
|
{
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize an event */
|
||||||
|
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
|
/* Build IPR */
|
||||||
|
liStartOffset.QuadPart = ullStartOffset;
|
||||||
|
pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
|
||||||
|
pDeviceObject,
|
||||||
|
lpBuffer,
|
||||||
|
nBufferSize,
|
||||||
|
&liStartOffset,
|
||||||
|
&Event,
|
||||||
|
&Iosb);
|
||||||
|
if (!pIrp)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call the driver */
|
||||||
|
Status = IoCallDriver(pDeviceObject, pIrp);
|
||||||
|
|
||||||
|
/* Wait if neccessary */
|
||||||
|
if (STATUS_PENDING == Status)
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, 0);
|
||||||
|
Status = Iosb.Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return information to the caller about the operation. */
|
||||||
|
*lpInformation = Iosb.Information;
|
||||||
|
|
||||||
|
return NT_SUCCESS(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
APIENTRY
|
||||||
|
EngFileWrite(
|
||||||
|
IN PFILE_OBJECT pFileObject,
|
||||||
|
IN PVOID lpBuffer,
|
||||||
|
IN SIZE_T nLength,
|
||||||
|
IN PSIZE_T lpBytesWritten)
|
||||||
|
{
|
||||||
|
EngpFileIoRequest(pFileObject,
|
||||||
|
IRP_MJ_WRITE,
|
||||||
|
lpBuffer,
|
||||||
|
nLength,
|
||||||
|
0,
|
||||||
|
lpBytesWritten);
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
APIENTRY
|
||||||
|
EngFileIoControl(
|
||||||
|
IN PFILE_OBJECT pFileObject,
|
||||||
|
IN DWORD dwIoControlCode,
|
||||||
|
IN PVOID lpInBuffer,
|
||||||
|
IN SIZE_T nInBufferSize,
|
||||||
|
OUT PVOID lpOutBuffer,
|
||||||
|
IN SIZE_T nOutBufferSize,
|
||||||
|
OUT LPDWORD lpInformation)
|
||||||
|
{
|
||||||
|
PDEVICE_OBJECT pDeviceObject;
|
||||||
|
KEVENT Event;
|
||||||
|
PIRP pIrp;
|
||||||
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Get corresponding device object */
|
||||||
|
pDeviceObject = IoGetRelatedDeviceObject(pFileObject);
|
||||||
|
if (!pDeviceObject)
|
||||||
|
{
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize an event */
|
||||||
|
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
|
/* Build IO control IPR */
|
||||||
|
pIrp = IoBuildDeviceIoControlRequest(dwIoControlCode,
|
||||||
|
pDeviceObject,
|
||||||
|
lpInBuffer,
|
||||||
|
nInBufferSize,
|
||||||
|
lpOutBuffer,
|
||||||
|
nOutBufferSize,
|
||||||
|
FALSE,
|
||||||
|
&Event,
|
||||||
|
&Iosb);
|
||||||
|
if (!pIrp)
|
||||||
|
{
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call the driver */
|
||||||
|
Status = IoCallDriver(pDeviceObject, pIrp);
|
||||||
|
|
||||||
|
/* Wait if neccessary */
|
||||||
|
if (Status == STATUS_PENDING)
|
||||||
|
{
|
||||||
|
KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, 0);
|
||||||
|
Status = Iosb.Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return information to the caller about the operation. */
|
||||||
|
*lpInformation = Iosb.Information;
|
||||||
|
|
||||||
|
/* This function returns NTSTATUS */
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2796,29 +2796,6 @@ EngAllocSectionMem(IN PVOID SectionObject,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
APIENTRY
|
|
||||||
EngFileIoControl(IN PFILE_OBJECT FileObject,
|
|
||||||
IN ULONG IoControlCode,
|
|
||||||
IN PVOID InputBuffer,
|
|
||||||
IN SIZE_T InputBufferLength,
|
|
||||||
OUT PVOID OutputBuffer,
|
|
||||||
IN SIZE_T OutputBufferLength,
|
|
||||||
OUT PULONG Information)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
APIENTRY
|
|
||||||
EngFileWrite(IN PFILE_OBJECT FileObject,
|
|
||||||
IN PVOID Buffer,
|
|
||||||
IN SIZE_T Length,
|
|
||||||
IN PSIZE_T BytesWritten)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
APIENTRY
|
APIENTRY
|
||||||
|
|
Loading…
Reference in a new issue