ntdll: Check for passing a NULL handle to NtCreateMailslotFile and add a test.

This commit is contained in:
Jeff Latimer 2007-02-27 23:42:02 +11:00 committed by Alexandre Julliard
parent 2775db3b79
commit cb489f7a25
2 changed files with 11 additions and 1 deletions

View File

@ -2210,6 +2210,8 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess,
pHandle, DesiredAccess, attr, IoStatusBlock, pHandle, DesiredAccess, attr, IoStatusBlock,
CreateOptions, MailslotQuota, MaxMessageSize, TimeOut); CreateOptions, MailslotQuota, MaxMessageSize, TimeOut);
if (!pHandle) return STATUS_ACCESS_VIOLATION;
if (attr->ObjectName->Length < sizeof(leadin) || if (attr->ObjectName->Length < sizeof(leadin) ||
strncmpiW( attr->ObjectName->Buffer, strncmpiW( attr->ObjectName->Buffer,
leadin, sizeof(leadin)/sizeof(leadin[0]) )) leadin, sizeof(leadin)/sizeof(leadin[0]) ))

View File

@ -55,11 +55,19 @@ static void nt_mailslot_test(void)
WCHAR buffer1[] = { '\\','?','?','\\','M','A','I','L','S','L','O','T','\\', WCHAR buffer1[] = { '\\','?','?','\\','M','A','I','L','S','L','O','T','\\',
'R',':','\\','F','R','E','D','\0' }; 'R',':','\\','F','R','E','D','\0' };
TimeOut.QuadPart = -1;
pRtlInitUnicodeString(&str, buffer1); pRtlInitUnicodeString(&str, buffer1);
InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL); InitializeObjectAttributes(&attr, &str, OBJ_CASE_INSENSITIVE, 0, NULL);
DesiredAccess = CreateOptions = MailslotQuota = MaxMessageSize = 0; DesiredAccess = CreateOptions = MailslotQuota = MaxMessageSize = 0;
TimeOut.QuadPart = -1;
/*
* Check for NULL pointer handling
*/
rc = pNtCreateMailslotFile(NULL, DesiredAccess,
&attr, &IoStatusBlock, CreateOptions, MailslotQuota, MaxMessageSize,
&TimeOut);
ok( rc == STATUS_ACCESS_VIOLATION, "rc = %x not c0000005 STATUS_ACCESS_VIOLATION\n", rc);
/* /*
* Test a valid call * Test a valid call