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
63a5d81c
Commit
63a5d81c
authored
May 14, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better fix for removing trailing spaces in RtlGetFullPathName_U.
Need to remove trailing dots too (reported by Ken Belleau).
parent
ad546918
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
path.c
dlls/ntdll/path.c
+10
-8
path.c
dlls/ntdll/tests/path.c
+6
-1
No files found.
dlls/ntdll/path.c
View file @
63a5d81c
...
...
@@ -506,6 +506,10 @@ static inline void collapse_path( WCHAR *path, UINT mark )
while
(
*
p
&&
*
p
!=
'\\'
)
p
++
;
if
(
*
p
==
'\\'
)
p
++
;
}
/* remove trailing spaces and dots (yes, Windows really does that, don't ask) */
while
(
p
>
path
+
mark
&&
(
p
[
-
1
]
==
' '
||
p
[
-
1
]
==
'.'
))
p
--
;
*
p
=
0
;
}
...
...
@@ -533,17 +537,16 @@ static const WCHAR *skip_unc_prefix( const WCHAR *ptr )
*/
static
ULONG
get_full_path_helper
(
LPCWSTR
name
,
LPWSTR
buffer
,
ULONG
size
)
{
ULONG
reqsize
=
0
,
mark
=
0
,
dep
=
0
,
deplen
,
name_len
;
ULONG
reqsize
=
0
,
mark
=
0
,
dep
=
0
,
deplen
;
DOS_PATHNAME_TYPE
type
;
LPWSTR
ins_str
=
NULL
;
LPCWSTR
ptr
;
const
UNICODE_STRING
*
cd
;
WCHAR
tmp
[
4
];
/* remove trailing spaces (yes, Windows really does that, don't ask) */
name_len
=
strlenW
(
name
);
while
(
name_len
&&
name
[
name_len
-
1
]
==
' '
)
name_len
--
;
if
(
!
name_len
)
return
0
;
/* return error if name only consists of spaces */
for
(
ptr
=
name
;
*
ptr
;
ptr
++
)
if
(
*
ptr
!=
' '
)
break
;
if
(
!*
ptr
)
return
0
;
RtlAcquirePebLock
();
...
...
@@ -679,7 +682,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
}
/* enough space ? */
deplen
=
(
name_len
-
dep
)
*
sizeof
(
WCHAR
);
deplen
=
strlenW
(
name
+
dep
)
*
sizeof
(
WCHAR
);
if
(
reqsize
+
deplen
+
sizeof
(
WCHAR
)
>
size
)
{
/* not enough space, return need size (including terminating '\0') */
...
...
@@ -687,8 +690,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
goto
done
;
}
memmove
(
buffer
+
reqsize
/
sizeof
(
WCHAR
),
name
+
dep
,
deplen
);
buffer
[(
reqsize
+
deplen
)
/
sizeof
(
WCHAR
)]
=
0
;
memmove
(
buffer
+
reqsize
/
sizeof
(
WCHAR
),
name
+
dep
,
deplen
+
sizeof
(
WCHAR
));
if
(
reqsize
)
memcpy
(
buffer
,
ins_str
,
reqsize
);
reqsize
+=
deplen
;
...
...
dlls/ntdll/tests/path.c
View file @
63a5d81c
...
...
@@ -240,6 +240,11 @@ static void test_RtlGetFullPathName_U()
{
{
"c:/test"
,
"c:
\\
test"
,
"test"
},
{
"c:/test "
,
"c:
\\
test"
,
"test"
},
{
"c:/test."
,
"c:
\\
test"
,
"test"
},
{
"c:/test .... .. "
,
"c:
\\
test"
,
"test"
},
{
"c:/test/ .... .. "
,
"c:
\\
test
\\
"
,
NULL
},
{
"c:/test/.."
,
"c:
\\
"
,
NULL
},
{
"c:/test/.. "
,
"c:
\\
test
\\
"
,
NULL
},
{
"c:/TEST"
,
"c:
\\
test"
,
"test"
},
{
"c:/test/file"
,
"c:
\\
test
\\
file"
,
"file"
},
{
"c:/test/././file"
,
"c:
\\
test
\\
file"
,
"file"
},
...
...
@@ -265,7 +270,7 @@ static void test_RtlGetFullPathName_U()
len
=
strlen
(
test
->
rname
)
*
sizeof
(
WCHAR
);
pRtlMultiByteToUnicodeN
(
pathbufW
,
sizeof
(
pathbufW
),
NULL
,
test
->
path
,
strlen
(
test
->
path
)
+
1
);
ret
=
pRtlGetFullPathName_U
(
pathbufW
,
MAX_PATH
,
rbufferW
,
&
file_part
);
ok
(
ret
==
len
,
"Wrong result %ld/%d for
%s
\n
"
,
ret
,
len
,
test
->
path
);
ok
(
ret
==
len
,
"Wrong result %ld/%d for
\"
%s
\"
\n
"
,
ret
,
len
,
test
->
path
);
ok
(
pRtlUnicodeToMultiByteN
(
rbufferA
,
MAX_PATH
,
&
reslen
,
rbufferW
,
MAX_PATH
)
==
STATUS_SUCCESS
,
"RtlUnicodeToMultiByteN failed
\n
"
);
ok
(
strcasecmp
(
rbufferA
,
test
->
rname
)
==
0
,
"Got
\"
%s
\"
expected
\"
%s
\"\n
"
,
rbufferA
,
test
->
rname
);
...
...
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