- started implementing ntdll.NtDeviceIoControlFile and made
kernel32.DeviceIoControl call it - changed cdrom ioctl function's prototype to stick to ntdll.NtDeviceIoControlFile signature
This commit is contained in:
parent
d9df64609b
commit
583bb3fd3e
|
@ -621,6 +621,8 @@ static NTSTATUS CDROM_GetStatusCode(int io)
|
|||
case EINVAL:
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
/* case EBADF: Bad file descriptor */
|
||||
case EOPNOTSUPP:
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
FIXME("Unmapped error code %d: %s\n", errno, strerror(errno));
|
||||
return STATUS_IO_DEVICE_ERROR;
|
||||
|
@ -1684,20 +1686,23 @@ static NTSTATUS CDROM_GetAddress(int dev, SCSI_ADDRESS* address)
|
|||
*
|
||||
*
|
||||
*/
|
||||
NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, DWORD dwIoControlCode,
|
||||
NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice,
|
||||
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
|
||||
PVOID UserApcContext,
|
||||
PIO_STATUS_BLOCK piosb,
|
||||
ULONG dwIoControlCode,
|
||||
LPVOID lpInBuffer, DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer, DWORD nOutBufferSize,
|
||||
LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped)
|
||||
LPVOID lpOutBuffer, DWORD nOutBufferSize)
|
||||
{
|
||||
DWORD sz;
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
int dev;
|
||||
|
||||
TRACE("%lx[%c] %s %lx %ld %lx %ld %lx %lx\n",
|
||||
TRACE("%lx[%c] %s %lx %ld %lx %ld %p\n",
|
||||
(DWORD)hDevice, 'A' + LOWORD(clientID), iocodex(dwIoControlCode), (DWORD)lpInBuffer, nInBufferSize,
|
||||
(DWORD)lpOutBuffer, nOutBufferSize, (DWORD)lpBytesReturned, (DWORD)lpOverlapped);
|
||||
(DWORD)lpOutBuffer, nOutBufferSize, piosb);
|
||||
|
||||
if (lpBytesReturned) *lpBytesReturned = 0;
|
||||
piosb->Information = 0;
|
||||
|
||||
if ((status = CDROM_Open(hDevice, clientID, &dev))) goto error;
|
||||
|
||||
|
@ -1889,13 +1894,10 @@ NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, DWORD dwIoControl
|
|||
break;
|
||||
}
|
||||
error:
|
||||
if (lpOverlapped)
|
||||
{
|
||||
lpOverlapped->Internal = status;
|
||||
lpOverlapped->InternalHigh = sz;
|
||||
NtSetEvent(lpOverlapped->hEvent, NULL);
|
||||
}
|
||||
if (lpBytesReturned) *lpBytesReturned = sz;
|
||||
piosb->u.Status = status;
|
||||
piosb->Information = sz;
|
||||
if (hEvent) NtSetEvent(hEvent, NULL);
|
||||
|
||||
CDROM_Close(clientID);
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -285,22 +285,51 @@ NTSTATUS WINAPI NtWriteFile (
|
|||
* NtDeviceIoControlFile [NTDLL.@]
|
||||
* ZwDeviceIoControlFile [NTDLL.@]
|
||||
*/
|
||||
NTSTATUS WINAPI NtDeviceIoControlFile(
|
||||
IN HANDLE DeviceHandle,
|
||||
IN HANDLE Event OPTIONAL,
|
||||
IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
|
||||
IN PVOID UserApcContext OPTIONAL,
|
||||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||||
IN ULONG IoControlCode,
|
||||
IN PVOID InputBuffer,
|
||||
IN ULONG InputBufferSize,
|
||||
OUT PVOID OutputBuffer,
|
||||
IN ULONG OutputBufferSize)
|
||||
NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE DeviceHandle, HANDLE hEvent,
|
||||
PIO_APC_ROUTINE UserApcRoutine,
|
||||
PVOID UserApcContext,
|
||||
PIO_STATUS_BLOCK IoStatusBlock,
|
||||
ULONG IoControlCode,
|
||||
PVOID InputBuffer,
|
||||
ULONG InputBufferSize,
|
||||
PVOID OutputBuffer,
|
||||
ULONG OutputBufferSize)
|
||||
{
|
||||
FIXME("(%p,%p,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx): empty stub\n",
|
||||
DeviceHandle, Event, UserApcRoutine, UserApcContext,
|
||||
IoStatusBlock, IoControlCode, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize);
|
||||
return 0;
|
||||
DWORD clientID = 0;
|
||||
char str[3];
|
||||
|
||||
TRACE("(%p,%p,%p,%p,%p,0x%08lx,%p,0x%08lx,%p,0x%08lx)\n",
|
||||
DeviceHandle, hEvent, UserApcRoutine, UserApcContext,
|
||||
IoStatusBlock, IoControlCode,
|
||||
InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize);
|
||||
|
||||
/* FIXME: clientID hack should disappear */
|
||||
SERVER_START_REQ( get_device_id )
|
||||
{
|
||||
req->handle = DeviceHandle;
|
||||
if (!wine_server_call( req )) clientID = reply->id;
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
|
||||
if (!clientID) return STATUS_INVALID_PARAMETER;
|
||||
strcpy(str, "A:");
|
||||
str[0] += LOBYTE(clientID);
|
||||
|
||||
/* FIXME: should use the NTDLL equivalent */
|
||||
if (GetDriveTypeA(str) == DRIVE_CDROM)
|
||||
{
|
||||
return CDROM_DeviceIoControl(clientID, DeviceHandle, hEvent,
|
||||
UserApcRoutine, UserApcContext,
|
||||
IoStatusBlock, IoControlCode,
|
||||
InputBuffer, InputBufferSize,
|
||||
OutputBuffer, OutputBufferSize);
|
||||
}
|
||||
|
||||
FIXME("Unimplemented dwIoControlCode=%08lx\n", IoControlCode);
|
||||
IoStatusBlock->u.Status = STATUS_NOT_IMPLEMENTED;
|
||||
IoStatusBlock->Information = 0;
|
||||
if (hEvent) NtSetEvent(hEvent, NULL);
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -49,4 +49,15 @@ static inline RTL_USER_PROCESS_PARAMETERS* ntdll_get_process_pmts(void)
|
|||
{
|
||||
return NtCurrentTeb()->Peb->ProcessParameters;
|
||||
}
|
||||
|
||||
/* Device IO */
|
||||
/* ntdll/cdrom.c.c */
|
||||
extern NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice,
|
||||
HANDLE hEvent, PIO_APC_ROUTINE UserApcRoutine,
|
||||
PVOID UserApcContext,
|
||||
PIO_STATUS_BLOCK piosb,
|
||||
ULONG IoControlCode,
|
||||
LPVOID lpInBuffer, DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer, DWORD nOutBufferSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -118,10 +118,4 @@ extern int PROFILE_GetWineIniBool( LPCWSTR section, LPCWSTR key_name, int def );
|
|||
/* win32/device.c */
|
||||
extern HANDLE DEVICE_Open( LPCWSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );
|
||||
|
||||
/* ntdll/cdrom.c.c */
|
||||
extern NTSTATUS CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, DWORD dwIoControlCode,
|
||||
LPVOID lpInBuffer, DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer, DWORD nOutBufferSize,
|
||||
LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
|
||||
|
||||
#endif /* __WINE_FILE_H */
|
||||
|
|
|
@ -433,62 +433,32 @@ BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char str[3];
|
||||
|
||||
strcpy(str, "A:");
|
||||
str[0] += LOBYTE(clientID);
|
||||
if (GetDriveTypeA(str) == DRIVE_CDROM)
|
||||
{
|
||||
NTSTATUS status;
|
||||
status = CDROM_DeviceIoControl(clientID, hDevice, dwIoControlCode, lpvInBuffer, cbInBuffer,
|
||||
lpvOutBuffer, cbOutBuffer, lpcbBytesReturned,
|
||||
lpOverlapped);
|
||||
|
||||
if (lpOverlapped)
|
||||
{
|
||||
status = NtDeviceIoControlFile(hDevice, lpOverlapped->hEvent,
|
||||
NULL, NULL,
|
||||
(PIO_STATUS_BLOCK)lpOverlapped,
|
||||
dwIoControlCode,
|
||||
lpvInBuffer, cbInBuffer,
|
||||
lpvOutBuffer, cbOutBuffer);
|
||||
if (status) SetLastError(RtlNtStatusToDosError(status));
|
||||
if (lpcbBytesReturned) *lpcbBytesReturned = lpOverlapped->InternalHigh;
|
||||
return !status;
|
||||
}
|
||||
else switch( dwIoControlCode )
|
||||
else
|
||||
{
|
||||
case FSCTL_DELETE_REPARSE_POINT:
|
||||
case FSCTL_DISMOUNT_VOLUME:
|
||||
case FSCTL_GET_COMPRESSION:
|
||||
case FSCTL_GET_REPARSE_POINT:
|
||||
case FSCTL_LOCK_VOLUME:
|
||||
case FSCTL_QUERY_ALLOCATED_RANGES:
|
||||
case FSCTL_SET_COMPRESSION:
|
||||
case FSCTL_SET_REPARSE_POINT:
|
||||
case FSCTL_SET_SPARSE:
|
||||
case FSCTL_SET_ZERO_DATA:
|
||||
case FSCTL_UNLOCK_VOLUME:
|
||||
case IOCTL_DISK_CHECK_VERIFY:
|
||||
case IOCTL_DISK_EJECT_MEDIA:
|
||||
case IOCTL_DISK_FORMAT_TRACKS:
|
||||
case IOCTL_DISK_GET_DRIVE_GEOMETRY:
|
||||
case IOCTL_DISK_GET_DRIVE_LAYOUT:
|
||||
case IOCTL_DISK_GET_MEDIA_TYPES:
|
||||
case IOCTL_DISK_GET_PARTITION_INFO:
|
||||
case IOCTL_DISK_LOAD_MEDIA:
|
||||
case IOCTL_DISK_MEDIA_REMOVAL:
|
||||
case IOCTL_DISK_PERFORMANCE:
|
||||
case IOCTL_DISK_REASSIGN_BLOCKS:
|
||||
case IOCTL_DISK_SET_DRIVE_LAYOUT:
|
||||
case IOCTL_DISK_SET_PARTITION_INFO:
|
||||
case IOCTL_DISK_VERIFY:
|
||||
case IOCTL_SERIAL_LSRMST_INSERT:
|
||||
case IOCTL_STORAGE_CHECK_VERIFY:
|
||||
case IOCTL_STORAGE_EJECT_MEDIA:
|
||||
case IOCTL_STORAGE_GET_MEDIA_TYPES:
|
||||
case IOCTL_STORAGE_LOAD_MEDIA:
|
||||
case IOCTL_STORAGE_MEDIA_REMOVAL:
|
||||
FIXME( "unimplemented dwIoControlCode=%08lx\n", dwIoControlCode);
|
||||
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
FIXME( "ignored dwIoControlCode=%08lx\n",dwIoControlCode);
|
||||
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
|
||||
return FALSE;
|
||||
break;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
|
||||
status = NtDeviceIoControlFile(hDevice, NULL, NULL, NULL, &iosb,
|
||||
dwIoControlCode,
|
||||
lpvInBuffer, cbInBuffer,
|
||||
lpvOutBuffer, cbOutBuffer);
|
||||
if (status) SetLastError(RtlNtStatusToDosError(status));
|
||||
if (lpcbBytesReturned) *lpcbBytesReturned = iosb.Information;
|
||||
return !status;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue