kernel32/tests: Add a IOCTL_DVD_READ_STRUCTURE (DvdCopyrightDescriptor) test.

This commit is contained in:
Alexandre Goujon 2012-07-11 22:26:51 +02:00 committed by Alexandre Julliard
parent a3b5dd2dff
commit 9fce6a37ec
2 changed files with 22 additions and 1 deletions

View File

@ -749,6 +749,7 @@ static void test_dvd_read_structure(HANDLE handle)
DVD_READ_STRUCTURE dvdReadStructure; DVD_READ_STRUCTURE dvdReadStructure;
DVD_LAYER_DESCRIPTOR dvdLayerDescriptor; DVD_LAYER_DESCRIPTOR dvdLayerDescriptor;
struct COMPLETE_DVD_LAYER_DESCRIPTOR completeDvdLayerDescriptor; struct COMPLETE_DVD_LAYER_DESCRIPTOR completeDvdLayerDescriptor;
DVD_COPYRIGHT_DESCRIPTOR dvdCopyrightDescriptor;
dvdReadStructure.BlockByteOffset.QuadPart = 0; dvdReadStructure.BlockByteOffset.QuadPart = 0;
dvdReadStructure.SessionId = 0; dvdReadStructure.SessionId = 0;
@ -818,6 +819,26 @@ static void test_dvd_read_structure(HANDLE handle)
ok( (!ret && GetLastError() == ERROR_INVALID_PARAMETER), ok( (!ret && GetLastError() == ERROR_INVALID_PARAMETER),
"IOCTL_DVD_READ_STRUCTURE should have failed\n"); "IOCTL_DVD_READ_STRUCTURE should have failed\n");
} }
/* DvdCopyrightDescriptor */
dvdReadStructure.Format = 1;
SetLastError(0xdeadbeef);
/* Strangely, with NULL lpOutBuffer, last error is insufficient buffer, not invalid parameter as we could expect */
ret = DeviceIoControl(handle, IOCTL_DVD_READ_STRUCTURE, &dvdReadStructure, sizeof(DVD_READ_STRUCTURE),
NULL, sizeof(DVD_COPYRIGHT_DESCRIPTOR), &nbBytes, NULL);
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "IOCTL_DVD_READ_STRUCTURE should have failed %d %u\n", ret, GetLastError());
for(i=0; i<sizeof(DVD_COPYRIGHT_DESCRIPTOR); i++)
{
SetLastError(0xdeadbeef);
ret = DeviceIoControl(handle, IOCTL_DVD_READ_STRUCTURE, &dvdReadStructure, sizeof(DVD_READ_STRUCTURE),
&dvdCopyrightDescriptor, i, &nbBytes, NULL);
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "IOCTL_DVD_READ_STRUCTURE should have failed %d %u\n", ret, GetLastError());
}
} }
static void test_cdrom_ioctl(void) static void test_cdrom_ioctl(void)

View File

@ -3083,7 +3083,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice,
case IOCTL_DVD_READ_STRUCTURE: case IOCTL_DVD_READ_STRUCTURE:
sz = sizeof(DVD_LAYER_DESCRIPTOR); sz = sizeof(DVD_LAYER_DESCRIPTOR);
if (lpInBuffer == NULL || nInBufferSize != sizeof(DVD_READ_STRUCTURE)) status = STATUS_INVALID_PARAMETER; if (lpInBuffer == NULL || nInBufferSize != sizeof(DVD_READ_STRUCTURE)) status = STATUS_INVALID_PARAMETER;
else if (nOutBufferSize < sz) status = STATUS_BUFFER_TOO_SMALL; else if (nOutBufferSize < sz || !lpOutBuffer) status = STATUS_BUFFER_TOO_SMALL;
else else
{ {
TRACE("doing DVD_READ_STRUCTURE\n"); TRACE("doing DVD_READ_STRUCTURE\n");