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
5b9a11a0
Commit
5b9a11a0
authored
Jan 28, 2016
by
Joachim Priesner
Committed by
Alexandre Julliard
Jan 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Implement filesys_DriveExists.
Signed-off-by:
Joachim Priesner
<
joachim.priesner@web.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c9516970
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
2 deletions
+98
-2
filesystem.c
dlls/scrrun/filesystem.c
+20
-2
filesystem.c
dlls/scrrun/tests/filesystem.c
+78
-0
No files found.
dlls/scrrun/filesystem.c
View file @
5b9a11a0
...
...
@@ -3221,9 +3221,27 @@ static HRESULT WINAPI filesys_GetTempName(IFileSystem3 *iface, BSTR *pbstrResult
static
HRESULT
WINAPI
filesys_DriveExists
(
IFileSystem3
*
iface
,
BSTR
DriveSpec
,
VARIANT_BOOL
*
pfExists
)
{
FIXME
(
"%p %s %p
\n
"
,
iface
,
debugstr_w
(
DriveSpec
),
pfExists
);
UINT
len
;
WCHAR
driveletter
;
TRACE
(
"%p %s %p
\n
"
,
iface
,
debugstr_w
(
DriveSpec
),
pfExists
);
if
(
!
pfExists
)
return
E_POINTER
;
*
pfExists
=
VARIANT_FALSE
;
len
=
SysStringLen
(
DriveSpec
);
if
(
len
>=
1
)
{
driveletter
=
toupperW
(
DriveSpec
[
0
]);
if
(
driveletter
>=
'A'
&&
driveletter
<=
'Z'
&&
(
len
<
2
||
DriveSpec
[
1
]
==
':'
)
&&
(
len
<
3
||
DriveSpec
[
2
]
==
'\\'
))
{
const
WCHAR
root
[]
=
{
driveletter
,
':'
,
'\\'
,
0
};
UINT
drivetype
=
GetDriveTypeW
(
root
);
*
pfExists
=
drivetype
!=
DRIVE_NO_ROOT_DIR
&&
drivetype
!=
DRIVE_UNKNOWN
?
VARIANT_TRUE
:
VARIANT_FALSE
;
}
}
return
E_NOTIMPL
;
return
S_OK
;
}
static
HRESULT
WINAPI
filesys_FileExists
(
IFileSystem3
*
iface
,
BSTR
path
,
VARIANT_BOOL
*
ret
)
...
...
dlls/scrrun/tests/filesystem.c
View file @
5b9a11a0
...
...
@@ -1790,6 +1790,83 @@ todo_wine
SysFreeString
(
nameW
);
}
struct
driveexists_test
{
const
WCHAR
drivespec
[
10
];
const
INT
drivetype
;
const
VARIANT_BOOL
expected_ret
;
};
/* If 'drivetype' != -1, the first character of 'drivespec' will be replaced
* with the drive letter of a drive of this type. If such a drive does not exist,
* the test will be skipped. */
static
const
struct
driveexists_test
driveexiststestdata
[]
=
{
{
{
'N'
,
':'
,
'\\'
,
0
},
DRIVE_NO_ROOT_DIR
,
VARIANT_FALSE
},
{
{
'R'
,
':'
,
'\\'
,
0
},
DRIVE_REMOVABLE
,
VARIANT_TRUE
},
{
{
'F'
,
':'
,
'\\'
,
0
},
DRIVE_FIXED
,
VARIANT_TRUE
},
{
{
'F'
,
':'
,
0
},
DRIVE_FIXED
,
VARIANT_TRUE
},
{
{
'F'
,
'?'
,
0
},
DRIVE_FIXED
,
VARIANT_FALSE
},
{
{
'F'
,
0
},
DRIVE_FIXED
,
VARIANT_TRUE
},
{
{
'?'
,
0
},
-
1
,
VARIANT_FALSE
},
{
{
0
}
}
};
static
void
test_DriveExists
(
void
)
{
const
struct
driveexists_test
*
ptr
=
driveexiststestdata
;
HRESULT
hr
;
VARIANT_BOOL
ret
;
BSTR
drivespec
;
WCHAR
root
[]
=
{
'?'
,
':'
,
'\\'
,
0
};
hr
=
IFileSystem3_DriveExists
(
fs3
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
ret
=
VARIANT_TRUE
;
hr
=
IFileSystem3_DriveExists
(
fs3
,
NULL
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
ret
==
VARIANT_FALSE
,
"got %x
\n
"
,
ret
);
drivespec
=
SysAllocString
(
root
);
hr
=
IFileSystem3_DriveExists
(
fs3
,
drivespec
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
drivespec
);
for
(;
*
ptr
->
drivespec
;
ptr
++
)
{
drivespec
=
SysAllocString
(
ptr
->
drivespec
);
if
(
ptr
->
drivetype
!=
-
1
)
{
for
(
root
[
0
]
=
'A'
;
root
[
0
]
<=
'Z'
;
root
[
0
]
++
)
if
(
GetDriveTypeW
(
root
)
==
ptr
->
drivetype
)
break
;
if
(
root
[
0
]
>
'Z'
)
{
skip
(
"No drive with type 0x%x found, skipping test %s.
\n
"
,
ptr
->
drivetype
,
wine_dbgstr_w
(
ptr
->
drivespec
));
SysFreeString
(
drivespec
);
continue
;
}
/* Test both upper and lower case drive letters. */
drivespec
[
0
]
=
root
[
0
];
ret
=
ptr
->
expected_ret
==
VARIANT_TRUE
?
VARIANT_FALSE
:
VARIANT_TRUE
;
hr
=
IFileSystem3_DriveExists
(
fs3
,
drivespec
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x for drive spec %s (%s)
\n
"
,
hr
,
wine_dbgstr_w
(
drivespec
),
wine_dbgstr_w
(
ptr
->
drivespec
));
ok
(
ret
==
ptr
->
expected_ret
,
"got %d, expected %d for drive spec %s (%s)
\n
"
,
ret
,
ptr
->
expected_ret
,
wine_dbgstr_w
(
drivespec
),
wine_dbgstr_w
(
ptr
->
drivespec
));
drivespec
[
0
]
=
tolower
(
root
[
0
]);
}
ret
=
ptr
->
expected_ret
==
VARIANT_TRUE
?
VARIANT_FALSE
:
VARIANT_TRUE
;
hr
=
IFileSystem3_DriveExists
(
fs3
,
drivespec
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x for drive spec %s (%s)
\n
"
,
hr
,
wine_dbgstr_w
(
drivespec
),
wine_dbgstr_w
(
ptr
->
drivespec
));
ok
(
ret
==
ptr
->
expected_ret
,
"got %d, expected %d for drive spec %s (%s)
\n
"
,
ret
,
ptr
->
expected_ret
,
wine_dbgstr_w
(
drivespec
),
wine_dbgstr_w
(
ptr
->
drivespec
));
SysFreeString
(
drivespec
);
}
}
struct
getdrivename_test
{
const
WCHAR
path
[
10
];
const
WCHAR
drive
[
5
];
...
...
@@ -2019,6 +2096,7 @@ START_TEST(filesystem)
test_WriteLine
();
test_ReadAll
();
test_Read
();
test_DriveExists
();
test_GetDriveName
();
test_SerialNumber
();
test_GetExtensionName
();
...
...
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