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
d51a35c5
Commit
d51a35c5
authored
Jul 23, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Add IFileSystem3::GetParentFolderName implementation.
parent
55c190d3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
2 deletions
+92
-2
filesystem.c
dlls/scrrun/filesystem.c
+43
-2
filesystem.c
dlls/scrrun/tests/filesystem.c
+49
-0
No files found.
dlls/scrrun/filesystem.c
View file @
d51a35c5
...
...
@@ -728,12 +728,53 @@ static HRESULT WINAPI filesys_GetDriveName(IFileSystem3 *iface, BSTR Path,
return
E_NOTIMPL
;
}
static
inline
DWORD
get_parent_folder_name
(
const
WCHAR
*
path
,
DWORD
len
)
{
int
i
;
if
(
!
path
)
return
0
;
for
(
i
=
len
-
1
;
i
>=
0
;
i
--
)
if
(
path
[
i
]
!=
'/'
&&
path
[
i
]
!=
'\\'
)
break
;
for
(;
i
>=
0
;
i
--
)
if
(
path
[
i
]
==
'/'
||
path
[
i
]
==
'\\'
)
break
;
for
(;
i
>=
0
;
i
--
)
if
(
path
[
i
]
!=
'/'
&&
path
[
i
]
!=
'\\'
)
break
;
if
(
i
<
0
)
return
0
;
if
(
path
[
i
]
==
':'
&&
i
==
1
)
i
++
;
return
i
+
1
;
}
static
HRESULT
WINAPI
filesys_GetParentFolderName
(
IFileSystem3
*
iface
,
BSTR
Path
,
BSTR
*
pbstrResult
)
{
FIXME
(
"%p %s %p
\n
"
,
iface
,
debugstr_w
(
Path
),
pbstrResult
)
;
DWORD
len
;
return
E_NOTIMPL
;
TRACE
(
"%p %s %p
\n
"
,
iface
,
debugstr_w
(
Path
),
pbstrResult
);
if
(
!
pbstrResult
)
return
E_POINTER
;
len
=
get_parent_folder_name
(
Path
,
SysStringLen
(
Path
));
if
(
!
len
)
{
*
pbstrResult
=
NULL
;
return
S_OK
;
}
*
pbstrResult
=
SysAllocStringLen
(
Path
,
len
);
if
(
!*
pbstrResult
)
return
E_OUTOFMEMORY
;
return
S_OK
;
}
static
HRESULT
WINAPI
filesys_GetFileName
(
IFileSystem3
*
iface
,
BSTR
Path
,
...
...
dlls/scrrun/tests/filesystem.c
View file @
d51a35c5
...
...
@@ -254,6 +254,54 @@ static void test_GetFileVersion(void)
SysFreeString
(
path
);
}
static
void
test_GetParentFolderName
(
void
)
{
static
const
WCHAR
path1
[]
=
{
'a'
,
0
};
static
const
WCHAR
path2
[]
=
{
'a'
,
'/'
,
'a'
,
'/'
,
'a'
,
0
};
static
const
WCHAR
path3
[]
=
{
'a'
,
'\\'
,
'a'
,
'\\'
,
'a'
,
0
};
static
const
WCHAR
path4
[]
=
{
'a'
,
'/'
,
'a'
,
'/'
,
'/'
,
'\\'
,
'\\'
,
0
};
static
const
WCHAR
path5
[]
=
{
'c'
,
':'
,
'\\'
,
'\\'
,
'a'
,
0
};
static
const
WCHAR
path6
[]
=
{
'a'
,
'c'
,
':'
,
'\\'
,
'a'
,
0
};
static
const
WCHAR
result2
[]
=
{
'a'
,
'/'
,
'a'
,
0
};
static
const
WCHAR
result3
[]
=
{
'a'
,
'\\'
,
'a'
,
0
};
static
const
WCHAR
result4
[]
=
{
'a'
,
0
};
static
const
WCHAR
result5
[]
=
{
'c'
,
':'
,
'\\'
,
0
};
static
const
WCHAR
result6
[]
=
{
'a'
,
'c'
,
':'
,
0
};
static
const
struct
{
const
WCHAR
*
path
;
const
WCHAR
*
result
;
}
tests
[]
=
{
{
NULL
,
NULL
},
{
path1
,
NULL
},
{
path2
,
result2
},
{
path3
,
result3
},
{
path4
,
result4
},
{
path5
,
result5
},
{
path6
,
result6
}
};
BSTR
path
,
result
;
HRESULT
hr
;
int
i
;
hr
=
IFileSystem3_GetParentFolderName
(
fs3
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"GetParentFolderName returned %x, expected E_POINTER
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
tests
[
0
]);
i
++
)
{
result
=
(
BSTR
)
0xdeadbeef
;
path
=
tests
[
i
].
path
?
SysAllocString
(
tests
[
i
].
path
)
:
NULL
;
hr
=
IFileSystem3_GetParentFolderName
(
fs3
,
path
,
&
result
);
ok
(
hr
==
S_OK
,
"%d) GetParentFolderName returned %x, expected S_OK
\n
"
,
i
,
hr
);
if
(
!
tests
[
i
].
result
)
ok
(
!
result
,
"%d) result = %s
\n
"
,
i
,
wine_dbgstr_w
(
result
));
else
ok
(
!
lstrcmpW
(
result
,
tests
[
i
].
result
),
"%d) result = %s
\n
"
,
i
,
wine_dbgstr_w
(
result
));
SysFreeString
(
path
);
SysFreeString
(
result
);
}
}
START_TEST
(
filesystem
)
{
HRESULT
hr
;
...
...
@@ -271,6 +319,7 @@ START_TEST(filesystem)
test_createfolder
();
test_textstream
();
test_GetFileVersion
();
test_GetParentFolderName
();
IFileSystem3_Release
(
fs3
);
...
...
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