Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johnny Cai
wine
Commits
8640716a
Commit
8640716a
authored
26 years ago
by
Juergen Schmied
Committed by
Alexandre Julliard
26 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix for trailing slashes, repetition of '/' or '\' and
SetLastError() in GetFullPathname.
parent
f7b0de3f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/dos_fs.c
+56
-30
56 additions, 30 deletions
files/dos_fs.c
with
56 additions
and
30 deletions
files/dos_fs.c
+
56
−
30
View file @
8640716a
...
...
@@ -970,27 +970,37 @@ static DWORD DOSFS_DoGetFullPathName( LPCSTR name, DWORD len, LPSTR result,
char
buffer
[
MAX_PATHNAME_LEN
];
int
drive
;
char
*
p
;
DWORD
ret
;
/* last possible position for a char != 0 */
char
*
endchar
=
buffer
+
sizeof
(
buffer
)
-
2
;
*
endchar
=
'\0'
;
TRACE
(
dosfs
,
"converting '%s'
\n
"
,
name
);
TRACE
(
dosfs
,
"converting %s
\n
"
,
name
);
if
(
!
name
||
!
result
)
return
0
;
if
(
!
name
||
!
result
||
((
drive
=
DOSFS_GetPathDrive
(
&
name
))
==
-
1
)
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
if
((
drive
=
DOSFS_GetPathDrive
(
&
name
))
==
-
1
)
return
0
;
p
=
buffer
;
*
p
++
=
'A'
+
drive
;
*
p
++
=
':'
;
if
(
IS_END_OF_NAME
(
*
name
)
&&
(
*
name
))
/* Absolute path */
{
while
((
*
name
==
'\\'
)
||
(
*
name
==
'/'
))
name
++
;
while
(((
*
name
==
'\\'
)
||
(
*
name
==
'/'
))
&&
(
!*
endchar
)
)
*
p
++
=
*
name
++
;
}
else
/* Relative path or empty path */
{
*
p
++
=
'\\'
;
lstrcpyn32A
(
p
,
DRIVE_GetDosCwd
(
drive
),
sizeof
(
buffer
)
-
3
);
if
(
*
p
)
p
+=
strlen
(
p
);
else
p
--
;
lstrcpyn32A
(
p
,
DRIVE_GetDosCwd
(
drive
),
sizeof
(
buffer
)
-
4
);
if
(
*
p
)
{
p
+=
strlen
(
p
);
*
p
++
=
'\\'
;
}
}
if
(
!*
name
)
/* empty path */
*
p
++
=
'\\'
;
*
p
=
'\0'
;
while
(
*
name
)
...
...
@@ -1007,41 +1017,54 @@ static DWORD DOSFS_DoGetFullPathName( LPCSTR name, DWORD len, LPSTR result,
{
name
+=
2
;
while
((
*
name
==
'\\'
)
||
(
*
name
==
'/'
))
name
++
;
while
((
p
>
buffer
+
2
)
&&
(
*
p
!=
'\\'
))
p
--
;
*
p
=
'\0'
;
/* Remove trailing separator */
if
(
p
<
buffer
+
3
)
/* no previous dir component */
continue
;
p
--
;
/* skip previously added '\\' */
while
((
*
p
==
'\\'
)
||
(
*
p
==
'/'
))
p
--
;
/* skip previous dir component */
while
((
*
p
!=
'\\'
)
&&
(
*
p
!=
'/'
))
p
--
;
p
++
;
continue
;
}
}
if
(
p
>=
buffer
+
sizeof
(
buffer
)
-
1
)
{
DOS_ERROR
(
ER_PathNotFound
,
EC_NotFound
,
SA_Abort
,
EL_Disk
);
if
(
*
endchar
)
{
DOS_ERROR
(
ER_PathNotFound
,
EC_NotFound
,
SA_Abort
,
EL_Disk
);
return
0
;
}
*
p
++
=
'\\'
;
while
(
!
IS_END_OF_NAME
(
*
name
)
&&
(
p
<
buffer
+
sizeof
(
buffer
)
-
1
))
while
(
!
IS_END_OF_NAME
(
*
name
)
&&
(
!*
endchar
)
)
*
p
++
=
*
name
++
;
*
p
=
'\
0'
;
while
((
*
name
==
'\\'
)
||
(
*
name
==
'/'
))
name
++
;
while
(((
*
name
=
=
'\
\'
)
||
(
*
name
==
'/'
))
&&
(
!*
endchar
)
)
*
p
++
=
*
name
++
;
}
*
p
=
'\0'
;
if
(
!
buffer
[
2
])
{
buffer
[
2
]
=
'\\'
;
buffer
[
3
]
=
'\0'
;
}
if
(
!
(
DRIVE_GetFlags
(
drive
)
&
DRIVE_CASE_PRESERVING
))
CharUpper32A
(
buffer
);
if
(
unicode
)
lstrcpynAtoW
(
(
LPWSTR
)
result
,
buffer
,
len
);
else
lstrcpyn32A
(
result
,
buffer
,
len
);
if
(
unicode
)
lstrcpynAtoW
(
(
LPWSTR
)
result
,
buffer
,
len
);
else
lstrcpyn32A
(
result
,
buffer
,
len
);
TRACE
(
dosfs
,
"returning '%s'
\n
"
,
buffer
);
TRACE
(
dosfs
,
"returning %s
\n
"
,
buffer
);
return
strlen
(
buffer
);
/* If the lpBuffer buffer is too small, the return value is the
size of the buffer, in characters, required to hold the path. */
ret
=
strlen
(
buffer
);
if
(
ret
>=
len
)
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
ret
;
}
/***********************************************************************
* GetFullPathName32A (KERNEL32.272)
* NOTES
* if the path closed with '\', *lastpart is 0
*/
DWORD
WINAPI
GetFullPathName32A
(
LPCSTR
name
,
DWORD
len
,
LPSTR
buffer
,
LPSTR
*
lastpart
)
...
...
@@ -1051,7 +1074,6 @@ DWORD WINAPI GetFullPathName32A( LPCSTR name, DWORD len, LPSTR buffer,
{
LPSTR
p
=
buffer
+
strlen
(
buffer
);
/* if the path closed with '\', *lastpart is 0 */
if
(
*
p
!=
'\\'
)
{
while
((
p
>
buffer
+
2
)
&&
(
*
p
!=
'\\'
))
p
--
;
...
...
@@ -1075,8 +1097,12 @@ DWORD WINAPI GetFullPathName32W( LPCWSTR name, DWORD len, LPWSTR buffer,
if
(
ret
&&
lastpart
)
{
LPWSTR
p
=
buffer
+
lstrlen32W
(
buffer
);
while
((
p
>
buffer
+
2
)
&&
(
*
p
!=
'\\'
))
p
--
;
*
lastpart
=
p
+
1
;
if
(
*
p
!=
(
WCHAR
)
'\\'
)
{
while
((
p
>
buffer
+
2
)
&&
(
*
p
!=
(
WCHAR
)
'\\'
))
p
--
;
*
lastpart
=
p
+
1
;
}
else
*
lastpart
=
NULL
;
}
return
ret
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment