server: Forbid deleting files with an open mapping.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7316122011
commit
73d0bb7740
|
@ -3329,14 +3329,14 @@ todo_wine
|
|||
|
||||
fdi.DoDeleteFile = TRUE;
|
||||
res = pNtSetInformationFile( handle, &io, &fdi, sizeof(fdi), FileDispositionInformation );
|
||||
todo_wine ok( res == STATUS_CANNOT_DELETE, "got %#x\n", res );
|
||||
ok( res == STATUS_CANNOT_DELETE, "got %#x\n", res );
|
||||
res = GetFileAttributesA( buffer );
|
||||
ok( res != INVALID_FILE_ATTRIBUTES, "expected file to exist\n" );
|
||||
|
||||
CloseHandle( mapping );
|
||||
CloseHandle( handle );
|
||||
res = DeleteFileA( buffer );
|
||||
todo_wine ok( res, "got error %u\n", GetLastError() );
|
||||
ok( res, "got error %u\n", GetLastError() );
|
||||
|
||||
GetTempFileNameA( tmp_path, "dis", 0, buffer );
|
||||
handle = CreateFileA( buffer, GENERIC_READ | GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS, 0, 0 );
|
||||
|
@ -3373,14 +3373,14 @@ todo_wine
|
|||
|
||||
fdi.DoDeleteFile = TRUE;
|
||||
res = pNtSetInformationFile( handle, &io, &fdi, sizeof(fdi), FileDispositionInformation );
|
||||
todo_wine ok( res == STATUS_CANNOT_DELETE, "got %#x\n", res );
|
||||
ok( res == STATUS_CANNOT_DELETE, "got %#x\n", res );
|
||||
res = GetFileAttributesA( buffer );
|
||||
ok( res != INVALID_FILE_ATTRIBUTES, "expected file to exist\n" );
|
||||
|
||||
UnmapViewOfFile( view );
|
||||
CloseHandle( handle );
|
||||
res = DeleteFileA( buffer );
|
||||
todo_wine ok( res, "got error %u\n", GetLastError() );
|
||||
ok( res, "got error %u\n", GetLastError() );
|
||||
|
||||
GetTempFileNameA( tmp_path, "dis", 0, buffer );
|
||||
handle = CreateFileA( buffer, GENERIC_READ | GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS, 0, 0 );
|
||||
|
|
11
server/fd.c
11
server/fd.c
|
@ -2452,6 +2452,17 @@ static void set_fd_disposition( struct fd *fd, int unlink )
|
|||
|
||||
if (unlink)
|
||||
{
|
||||
struct fd *fd_ptr;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( fd_ptr, &fd->inode->open, struct fd, inode_entry )
|
||||
{
|
||||
if (fd_ptr->access & FILE_MAPPING_ACCESS)
|
||||
{
|
||||
set_error( STATUS_CANNOT_DELETE );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fstat( fd->unix_fd, &st ) == -1)
|
||||
{
|
||||
file_set_error();
|
||||
|
|
Loading…
Reference in New Issue