kernelbase: Convert DOS to NT path for FileRenameInfo in SetFileInformationByHandle.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50756
Signed-off-by: Roman Pišl <rpisl@seznam.cz>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 33c6a6cb28
)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
parent
6260a41277
commit
ef574b5e0c
|
@ -5288,24 +5288,20 @@ static void test_SetFileRenameInfo(void)
|
|||
fri->FileNameLength = wcslen(tempFileTo1) * sizeof(WCHAR);
|
||||
memcpy(fri->FileName, tempFileTo1, fri->FileNameLength + sizeof(WCHAR));
|
||||
ret = pSetFileInformationByHandle(file, FileRenameInfo, fri, size);
|
||||
todo_wine
|
||||
ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS, "FileRenameInfo unexpected result %d\n", GetLastError());
|
||||
|
||||
fri->ReplaceIfExists = TRUE;
|
||||
ret = pSetFileInformationByHandle(file, FileRenameInfo, fri, size);
|
||||
todo_wine
|
||||
ok(ret, "FileRenameInfo failed, error %d\n", GetLastError());
|
||||
|
||||
fri->ReplaceIfExists = FALSE;
|
||||
fri->FileNameLength = wcslen(tempFileTo2) * sizeof(WCHAR);
|
||||
memcpy(fri->FileName, tempFileTo2, fri->FileNameLength + sizeof(WCHAR));
|
||||
ret = pSetFileInformationByHandle(file, FileRenameInfo, fri, size);
|
||||
todo_wine
|
||||
ok(ret, "FileRenameInfo failed, error %d\n", GetLastError());
|
||||
CloseHandle(file);
|
||||
|
||||
file = CreateFileW(tempFileTo2, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
|
||||
todo_wine
|
||||
ok(file != INVALID_HANDLE_VALUE, "file not renamed, error %d\n", GetLastError());
|
||||
|
||||
fri->FileNameLength = wcslen(tempFileTo1) * sizeof(WCHAR);
|
||||
|
|
|
@ -3554,8 +3554,27 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetFileInformationByHandle( HANDLE file, FILE_INFO
|
|||
status = NtSetInformationFile( file, &io, info, size, FileIoPriorityHintInformation );
|
||||
break;
|
||||
case FileRenameInfo:
|
||||
status = NtSetInformationFile( file, &io, info, size, FileRenameInformation );
|
||||
break;
|
||||
{
|
||||
FILE_RENAME_INFORMATION *rename_info;
|
||||
UNICODE_STRING nt_name;
|
||||
ULONG size;
|
||||
|
||||
if ((status = RtlDosPathNameToNtPathName_U_WithStatus( ((FILE_RENAME_INFORMATION *)info)->FileName,
|
||||
&nt_name, NULL, NULL )))
|
||||
break;
|
||||
|
||||
size = sizeof(*rename_info) + nt_name.Length;
|
||||
if ((rename_info = HeapAlloc( GetProcessHeap(), 0, size )))
|
||||
{
|
||||
memcpy( rename_info, info, sizeof(*rename_info) );
|
||||
memcpy( rename_info->FileName, nt_name.Buffer, nt_name.Length + sizeof(WCHAR) );
|
||||
rename_info->FileNameLength = nt_name.Length;
|
||||
status = NtSetInformationFile( file, &io, rename_info, size, FileRenameInformation );
|
||||
HeapFree( GetProcessHeap(), 0, rename_info );
|
||||
}
|
||||
RtlFreeUnicodeString( &nt_name );
|
||||
break;
|
||||
}
|
||||
case FileStandardInfo:
|
||||
case FileCompressionInfo:
|
||||
case FileAttributeTagInfo:
|
||||
|
|
Loading…
Reference in New Issue