2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * COPYRIGHT: See COPYING in the top level directory
22 * PROJECT: ReactOS kernel
23 * PURPOSE: GDI Driver Device Functions
24 * FILE: subsys/win32k/eng/device.c
25 * PROGRAMER: Jason Filby
35 EngDeviceIoControl(HANDLE hDevice
,
36 DWORD dwIoControlCode
,
41 DWORD
*lpBytesReturned
)
47 PDEVICE_OBJECT DeviceObject
;
49 DPRINT("EngDeviceIoControl() called\n");
51 KeInitializeEvent(&Event
, SynchronizationEvent
, FALSE
);
53 DeviceObject
= (PDEVICE_OBJECT
) hDevice
;
55 Irp
= IoBuildDeviceIoControlRequest(dwIoControlCode
,
60 nOutBufferSize
, FALSE
, &Event
, &Iosb
);
62 Status
= IoCallDriver(DeviceObject
, Irp
);
64 if (Status
== STATUS_PENDING
)
66 (VOID
)KeWaitForSingleObject(&Event
, Executive
, KernelMode
, TRUE
, 0);
70 DPRINT("EngDeviceIoControl(): Returning %X/%X\n", Iosb
.Status
,
73 /* Return information to the caller about the operation. */
74 *lpBytesReturned
= Iosb
.Information
;
76 /* Convert NT status values to win32 error codes. */
79 case STATUS_INSUFFICIENT_RESOURCES
: return ERROR_NOT_ENOUGH_MEMORY
;
80 case STATUS_BUFFER_OVERFLOW
: return ERROR_MORE_DATA
;
81 case STATUS_NOT_IMPLEMENTED
: return ERROR_INVALID_FUNCTION
;
82 case STATUS_INVALID_PARAMETER
: return ERROR_INVALID_PARAMETER
;
83 case STATUS_BUFFER_TOO_SMALL
: return ERROR_INSUFFICIENT_BUFFER
;
84 case STATUS_DEVICE_DOES_NOT_EXIST
: return ERROR_DEV_NOT_EXIST
;
85 case STATUS_PENDING
: return ERROR_IO_PENDING
;