Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
23e38d4d
Commit
23e38d4d
authored
Jul 30, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Add IFileSystem3::DeleteFile implementation.
parent
c7abcd74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
4 deletions
+61
-4
filesystem.c
dlls/scrrun/filesystem.c
+50
-2
filesystem.c
dlls/scrrun/tests/filesystem.c
+11
-2
No files found.
dlls/scrrun/filesystem.c
View file @
23e38d4d
...
...
@@ -1360,12 +1360,60 @@ static HRESULT WINAPI filesys_GetSpecialFolder(IFileSystem3 *iface,
return
E_NOTIMPL
;
}
static
inline
HRESULT
delete_file
(
const
WCHAR
*
file
,
DWORD
file_len
,
VARIANT_BOOL
force
)
{
WCHAR
path
[
MAX_PATH
];
DWORD
len
,
name_len
;
WIN32_FIND_DATAW
ffd
;
HANDLE
f
;
f
=
FindFirstFileW
(
file
,
&
ffd
);
if
(
f
==
INVALID_HANDLE_VALUE
)
return
create_error
(
GetLastError
());
len
=
get_parent_folder_name
(
file
,
file_len
);
if
(
len
+
1
>=
MAX_PATH
)
return
E_FAIL
;
if
(
len
)
{
memcpy
(
path
,
file
,
len
*
sizeof
(
WCHAR
));
path
[
len
++
]
=
'\\'
;
}
do
{
if
(
ffd
.
dwFileAttributes
&
(
FILE_ATTRIBUTE_DIRECTORY
|
FILE_ATTRIBUTE_DEVICE
))
continue
;
name_len
=
strlenW
(
ffd
.
cFileName
);
if
(
len
+
name_len
+
1
>=
MAX_PATH
)
{
FindClose
(
f
);
return
E_FAIL
;
}
memcpy
(
path
+
len
,
ffd
.
cFileName
,
(
name_len
+
1
)
*
sizeof
(
WCHAR
));
TRACE
(
"deleting %s
\n
"
,
debugstr_w
(
path
));
if
(
!
DeleteFileW
(
path
))
{
if
(
!
force
||
!
SetFileAttributesW
(
path
,
FILE_ATTRIBUTE_NORMAL
)
||
!
DeleteFileW
(
path
))
{
FindClose
(
f
);
return
create_error
(
GetLastError
());
}
}
}
while
(
FindNextFileW
(
f
,
&
ffd
));
FindClose
(
f
);
return
S_OK
;
}
static
HRESULT
WINAPI
filesys_DeleteFile
(
IFileSystem3
*
iface
,
BSTR
FileSpec
,
VARIANT_BOOL
Force
)
{
FIXM
E
(
"%p %s %d
\n
"
,
iface
,
debugstr_w
(
FileSpec
),
Force
);
TRAC
E
(
"%p %s %d
\n
"
,
iface
,
debugstr_w
(
FileSpec
),
Force
);
return
E_NOTIMPL
;
if
(
!
FileSpec
)
return
E_POINTER
;
return
delete_file
(
FileSpec
,
SysStringLen
(
FileSpec
),
Force
);
}
static
HRESULT
WINAPI
filesys_DeleteFolder
(
IFileSystem3
*
iface
,
BSTR
FolderSpec
,
...
...
dlls/scrrun/tests/filesystem.c
View file @
23e38d4d
...
...
@@ -491,7 +491,7 @@ static void test_GetFile(void)
ok
(
!
file
,
"file != NULL
\n
"
);
ok
(
hr
==
CTL_E_FILENOTFOUND
,
"GetFile returned %x, expected CTL_E_FILENOTFOUND
\n
"
,
hr
);
hf
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
FILE_ATTRIBUTE_
NORMAL
,
NULL
);
hf
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
FILE_ATTRIBUTE_
READONLY
,
NULL
);
if
(
hf
==
INVALID_HANDLE_VALUE
)
{
skip
(
"Can't create temporary file
\n
"
);
SysFreeString
(
path
);
...
...
@@ -513,7 +513,16 @@ static void test_GetFile(void)
ok
(
V_I4
(
&
size
)
==
0
,
"V_I4(&size) = %d, expected 0
\n
"
,
V_I4
(
&
size
));
IFile_Release
(
file
);
DeleteFileW
(
path
);
hr
=
IFileSystem3_DeleteFile
(
fs3
,
path
,
FALSE
);
ok
(
hr
==
CTL_E_PERMISSIONDENIED
||
broken
(
hr
==
S_OK
),
"DeleteFile returned %x, expected CTL_E_PERMISSIONDENIED
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
{
hr
=
IFileSystem3_DeleteFile
(
fs3
,
path
,
TRUE
);
ok
(
hr
==
S_OK
,
"DeleteFile returned %x, expected S_OK
\n
"
,
hr
);
}
hr
=
IFileSystem3_DeleteFile
(
fs3
,
path
,
TRUE
);
ok
(
hr
==
CTL_E_FILENOTFOUND
,
"DeleteFile returned %x, expected CTL_E_FILENOTFOUND
\n
"
,
hr
);
SysFreeString
(
path
);
}
...
...
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