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
70bb23a9
Commit
70bb23a9
authored
Nov 17, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Implement BuildPath method.
parent
18f7f637
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
3 deletions
+143
-3
filesystem.c
dlls/scrrun/filesystem.c
+54
-3
filesystem.c
dlls/scrrun/tests/filesystem.c
+89
-0
No files found.
dlls/scrrun/filesystem.c
View file @
70bb23a9
...
...
@@ -1073,11 +1073,62 @@ static HRESULT WINAPI filesys_get_Drives(IFileSystem3 *iface, IDriveCollection *
}
static
HRESULT
WINAPI
filesys_BuildPath
(
IFileSystem3
*
iface
,
BSTR
Path
,
BSTR
Name
,
BSTR
*
pbstr
Result
)
BSTR
Name
,
BSTR
*
Result
)
{
FIXME
(
"%p %s %s %p
\n
"
,
iface
,
debugstr_w
(
Path
),
debugstr_w
(
Name
),
pbstrResult
)
;
BSTR
ret
;
return
E_NOTIMPL
;
TRACE
(
"%p %s %s %p
\n
"
,
iface
,
debugstr_w
(
Path
),
debugstr_w
(
Name
),
Result
);
if
(
!
Result
)
return
E_POINTER
;
if
(
Path
&&
Name
)
{
int
path_len
=
SysStringLen
(
Path
),
name_len
=
SysStringLen
(
Name
);
/* if both parts have backslashes strip one from Path */
if
(
Path
[
path_len
-
1
]
==
'\\'
&&
Name
[
0
]
==
'\\'
)
{
path_len
-=
1
;
ret
=
SysAllocStringLen
(
NULL
,
path_len
+
name_len
);
if
(
ret
)
{
strcpyW
(
ret
,
Path
);
ret
[
path_len
]
=
0
;
strcatW
(
ret
,
Name
);
}
}
else
if
(
Path
[
path_len
-
1
]
!=
'\\'
&&
Name
[
0
]
!=
'\\'
)
{
static
const
WCHAR
bsW
[]
=
{
'\\'
,
0
};
ret
=
SysAllocStringLen
(
NULL
,
path_len
+
name_len
+
1
);
if
(
ret
)
{
strcpyW
(
ret
,
Path
);
if
(
Path
[
path_len
-
1
]
!=
':'
)
strcatW
(
ret
,
bsW
);
strcatW
(
ret
,
Name
);
}
}
else
{
ret
=
SysAllocStringLen
(
NULL
,
path_len
+
name_len
);
if
(
ret
)
{
strcpyW
(
ret
,
Path
);
strcatW
(
ret
,
Name
);
}
}
}
else
if
(
Path
||
Name
)
ret
=
SysAllocString
(
Path
?
Path
:
Name
);
else
ret
=
SysAllocStringLen
(
NULL
,
0
);
if
(
!
ret
)
return
E_OUTOFMEMORY
;
*
Result
=
ret
;
return
S_OK
;
}
static
HRESULT
WINAPI
filesys_GetDriveName
(
IFileSystem3
*
iface
,
BSTR
Path
,
...
...
dlls/scrrun/tests/filesystem.c
View file @
70bb23a9
...
...
@@ -651,6 +651,94 @@ static void test_CopyFolder(void)
SysFreeString
(
bsrc
);
}
static
BSTR
bstr_from_str
(
const
char
*
str
)
{
int
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
BSTR
ret
=
SysAllocStringLen
(
NULL
,
len
-
1
);
/* NUL character added automatically */
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
}
struct
buildpath_test
{
const
char
*
path
;
const
char
*
name
;
const
char
*
result
;
};
static
struct
buildpath_test
buildpath_data
[]
=
{
{
"C:
\\
path"
,
"..
\\
name.tmp"
,
"C:
\\
path
\\
..
\\
name.tmp"
},
{
"C:
\\
path"
,
"
\\
name.tmp"
,
"C:
\\
path
\\
name.tmp"
},
{
"C:
\\
path"
,
"name.tmp"
,
"C:
\\
path
\\
name.tmp"
},
{
"C:
\\
path
\\
"
,
"name.tmp"
,
"C:
\\
path
\\
name.tmp"
},
{
"C:
\\
path"
,
"
\\\\
name.tmp"
,
"C:
\\
path
\\\\
name.tmp"
},
{
"C:
\\
path
\\
"
,
"
\\
name.tmp"
,
"C:
\\
path
\\
name.tmp"
},
{
"C:
\\
path
\\
"
,
"
\\\\
name.tmp"
,
"C:
\\
path
\\\\
name.tmp"
},
{
"C:
\\
path
\\\\
"
,
"
\\\\
name.tmp"
,
"C:
\\
path
\\\\\\
name.tmp"
},
{
"C:
\\\\
"
,
"
\\
name.tmp"
,
"C:
\\\\
name.tmp"
},
{
"C:"
,
"name.tmp"
,
"C:name.tmp"
},
{
"C:"
,
"
\\\\
name.tmp"
,
"C:
\\\\
name.tmp"
},
{
NULL
}
};
static
void
test_BuildPath
(
void
)
{
struct
buildpath_test
*
ptr
=
buildpath_data
;
BSTR
ret
,
path
;
HRESULT
hr
;
int
i
=
0
;
hr
=
IFileSystem3_BuildPath
(
fs3
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
ret
=
(
BSTR
)
0xdeadbeef
;
hr
=
IFileSystem3_BuildPath
(
fs3
,
NULL
,
NULL
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
*
ret
==
0
,
"got %p
\n
"
,
ret
);
SysFreeString
(
ret
);
ret
=
(
BSTR
)
0xdeadbeef
;
path
=
bstr_from_str
(
"path"
);
hr
=
IFileSystem3_BuildPath
(
fs3
,
path
,
NULL
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
ret
,
path
),
"got %s
\n
"
,
wine_dbgstr_w
(
ret
));
SysFreeString
(
ret
);
SysFreeString
(
path
);
ret
=
(
BSTR
)
0xdeadbeef
;
path
=
bstr_from_str
(
"path"
);
hr
=
IFileSystem3_BuildPath
(
fs3
,
NULL
,
path
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
ret
,
path
),
"got %s
\n
"
,
wine_dbgstr_w
(
ret
));
SysFreeString
(
ret
);
SysFreeString
(
path
);
while
(
ptr
->
path
)
{
BSTR
name
,
result
;
ret
=
NULL
;
path
=
bstr_from_str
(
ptr
->
path
);
name
=
bstr_from_str
(
ptr
->
name
);
result
=
bstr_from_str
(
ptr
->
result
);
hr
=
IFileSystem3_BuildPath
(
fs3
,
path
,
name
,
&
ret
);
ok
(
hr
==
S_OK
,
"%d: got 0x%08x
\n
"
,
i
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(
!
lstrcmpW
(
ret
,
result
),
"%d: got wrong path %s, expected %s
\n
"
,
i
,
wine_dbgstr_w
(
ret
),
wine_dbgstr_w
(
result
));
SysFreeString
(
ret
);
}
SysFreeString
(
path
);
SysFreeString
(
name
);
SysFreeString
(
result
);
i
++
;
ptr
++
;
}
}
START_TEST
(
filesystem
)
{
HRESULT
hr
;
...
...
@@ -674,6 +762,7 @@ START_TEST(filesystem)
test_GetAbsolutePathName
();
test_GetFile
();
test_CopyFolder
();
test_BuildPath
();
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