Zebediah Figura : ntdll/tests: Test renaming a file to the same name.
Alexandre Julliard
julliard at winehq.org
Mon Mar 9 17:42:35 CDT 2020
Module: wine
Branch: master
Commit: 42b7bf06920daa65ed3c22d5ffdcf9c7776343a4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=42b7bf06920daa65ed3c22d5ffdcf9c7776343a4
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu Mar 5 20:47:14 2020 -0600
ntdll/tests: Test renaming a file to the same name.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/tests/file.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 28a3e12334..e71f887c2b 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -2106,6 +2106,30 @@ static void test_file_rename_information(void)
HeapFree( GetProcessHeap(), 0, fri );
delete_object( oldpath );
delete_object( newpath );
+
+ /* oldpath == newpath */
+ res = GetTempFileNameW( tmp_path, fooW, 0, oldpath );
+ ok( res != 0, "failed to create temp file\n" );
+ handle = CreateFileW( oldpath, GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS, 0, 0 );
+ ok( handle != INVALID_HANDLE_VALUE, "CreateFileW failed\n" );
+
+ pRtlDosPathNameToNtPathName_U( oldpath, &name_str, NULL, NULL );
+ fri = HeapAlloc( GetProcessHeap(), 0, sizeof(FILE_RENAME_INFORMATION) + name_str.Length );
+ fri->ReplaceIfExists = FALSE;
+ fri->RootDirectory = NULL;
+ fri->FileNameLength = name_str.Length;
+ memcpy( fri->FileName, name_str.Buffer, name_str.Length );
+ pRtlFreeUnicodeString( &name_str );
+
+ U(io).Status = 0xdeadbeef;
+ res = pNtSetInformationFile( handle, &io, fri, sizeof(FILE_RENAME_INFORMATION) + fri->FileNameLength, FileRenameInformation );
+ todo_wine ok( U(io).Status == STATUS_SUCCESS, "got io status %#x\n", U(io).Status );
+ todo_wine ok( res == STATUS_SUCCESS, "got status %x\n", res );
+ ok( GetFileAttributesW( oldpath ) != INVALID_FILE_ATTRIBUTES, "file should exist\n" );
+
+ CloseHandle( handle );
+ HeapFree( GetProcessHeap(), 0, fri );
+ delete_object( oldpath );
}
static void test_file_link_information(void)
More information about the wine-cvs
mailing list