Commit c9e1b6fb authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

ntdll/tests: Test opening a directory with NULL ObjectName.

parent 251e1685
...@@ -297,9 +297,10 @@ static void create_file_test(void) ...@@ -297,9 +297,10 @@ static void create_file_test(void)
static void open_file_test(void) static void open_file_test(void)
{ {
static const WCHAR fooW[] = {'f','o','o',0};
NTSTATUS status; NTSTATUS status;
HANDLE dir, root, handle; HANDLE dir, root, handle, file;
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH], tmpfile[MAX_PATH];
BYTE data[1024]; BYTE data[1024];
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io; IO_STATUS_BLOCK io;
...@@ -426,6 +427,33 @@ static void open_file_test(void) ...@@ -426,6 +427,33 @@ static void open_file_test(void)
CloseHandle( dir ); CloseHandle( dir );
CloseHandle( root ); CloseHandle( root );
GetTempPathW( MAX_PATH, path );
GetTempFileNameW( path, fooW, 0, tmpfile );
pRtlDosPathNameToNtPathName_U( tmpfile, &nameW, NULL, NULL );
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.ObjectName = &nameW;
attr.Attributes = OBJ_CASE_INSENSITIVE;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
status = pNtOpenFile( &file, SYNCHRONIZE|FILE_LIST_DIRECTORY, &attr, &io,
FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT );
ok( !status, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status );
pRtlFreeUnicodeString( &nameW );
nameW.Length = 0;
nameW.Buffer = NULL;
attr.RootDirectory = file;
attr.ObjectName = &nameW;
status = pNtOpenFile( &root, SYNCHRONIZE|FILE_LIST_DIRECTORY, &attr, &io,
FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT );
todo_wine ok( !status, "open %s failed %x\n", wine_dbgstr_w(tmpfile), status );
CloseHandle( file );
CloseHandle( root );
DeleteFileW( tmpfile );
} }
static void delete_file_test(void) static void delete_file_test(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment