Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
22a33168
Commit
22a33168
authored
Sep 18, 2008
by
Jeff Zaroyko
Committed by
Alexandre Julliard
Sep 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Modify DeleteFileW to fail on directories.
parent
87292d81
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
file.c
dlls/kernel32/file.c
+9
-1
file.c
dlls/kernel32/tests/file.c
+3
-3
file.c
dlls/msvcrt/tests/file.c
+1
-1
No files found.
dlls/kernel32/file.c
View file @
22a33168
...
...
@@ -3,6 +3,7 @@
*
* Copyright 1993 John Burton
* Copyright 1996, 2004 Alexandre Julliard
* Copyright 2008 Jeff Zaroyko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -1528,6 +1529,8 @@ BOOL WINAPI DeleteFileW( LPCWSTR path )
UNICODE_STRING
nameW
;
OBJECT_ATTRIBUTES
attr
;
NTSTATUS
status
;
HANDLE
hFile
;
IO_STATUS_BLOCK
io
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
path
)
);
...
...
@@ -1544,7 +1547,12 @@ BOOL WINAPI DeleteFileW( LPCWSTR path )
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
status
=
NtDeleteFile
(
&
attr
);
status
=
NtCreateFile
(
&
hFile
,
GENERIC_READ
|
GENERIC_WRITE
|
DELETE
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
FILE_OPEN
,
FILE_DELETE_ON_CLOSE
|
FILE_NON_DIRECTORY_FILE
,
NULL
,
0
);
if
(
status
==
STATUS_SUCCESS
)
status
=
NtClose
(
hFile
);
RtlFreeUnicodeString
(
&
nameW
);
if
(
status
)
{
...
...
dlls/kernel32/tests/file.c
View file @
22a33168
...
...
@@ -871,9 +871,9 @@ static void test_DeleteFileW( void )
ret
=
CreateDirectoryW
(
pathW
,
NULL
);
ok
(
ret
==
TRUE
,
"couldn't create directory deletefile
\n
"
);
ret
=
DeleteFileW
(
pathW
);
todo_wine
ok
(
ret
==
FALSE
,
"DeleteFile should fail for empty directories
\n
"
);
ok
(
ret
==
FALSE
,
"DeleteFile should fail for empty directories
\n
"
);
ret
=
RemoveDirectoryW
(
pathW
);
todo_wine
ok
(
ret
==
TRUE
,
"expected to remove directory deletefile
\n
"
);
ok
(
ret
==
TRUE
,
"expected to remove directory deletefile
\n
"
);
/* test DeleteFile on non-empty directory */
ret
=
CreateDirectoryW
(
pathW
,
NULL
);
...
...
@@ -881,7 +881,7 @@ static void test_DeleteFileW( void )
ret
=
CreateDirectoryW
(
pathsubW
,
NULL
);
ok
(
ret
==
TRUE
,
"couldn't create directory deletefile
\\
sub
\n
"
);
ret
=
DeleteFileW
(
pathW
);
todo_wine
ok
(
ret
==
FALSE
,
"DeleteFile should fail for non-empty directories
\n
"
);
ok
(
ret
==
FALSE
,
"DeleteFile should fail for non-empty directories
\n
"
);
ret
=
RemoveDirectoryW
(
pathsubW
);
ok
(
ret
==
TRUE
,
"expected to remove directory deletefile
\\
sub
\n
"
);
ret
=
RemoveDirectoryW
(
pathW
);
...
...
dlls/msvcrt/tests/file.c
View file @
22a33168
...
...
@@ -1093,7 +1093,7 @@ static void test_unlink(void)
ok
(
file
!=
NULL
,
"unable to create test file
\n
"
);
if
(
file
)
fclose
(
file
);
todo_wine
ok
(
_unlink
(
"test_unlink"
)
!=
0
,
"unlinking a non-empty directory must fail
\n
"
);
ok
(
_unlink
(
"test_unlink"
)
!=
0
,
"unlinking a non-empty directory must fail
\n
"
);
unlink
(
"test_unlink
\\
empty"
);
rmdir
(
"test_unlink"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment