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
4cc482bc
Commit
4cc482bc
authored
Jul 19, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: GetShortPathName for a non-existent short file name should fail.
parent
deff27e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
24 deletions
+8
-24
path.c
dlls/kernel32/path.c
+8
-22
path.c
dlls/kernel32/tests/path.c
+0
-2
No files found.
dlls/kernel32/path.c
View file @
4cc482bc
...
...
@@ -441,8 +441,6 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
DWORD
tmplen
;
WIN32_FIND_DATAW
wfd
;
HANDLE
goit
;
UNICODE_STRING
ustr
;
WCHAR
ustr_buf
[
8
+
1
+
3
+
1
];
TRACE
(
"%s
\n
"
,
debugstr_w
(
longpath
));
...
...
@@ -465,10 +463,6 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
sp
=
lp
=
2
;
}
ustr
.
Buffer
=
ustr_buf
;
ustr
.
Length
=
0
;
ustr
.
MaximumLength
=
sizeof
(
ustr_buf
);
while
(
longpath
[
lp
])
{
/* check for path delimiters and reproduce them */
...
...
@@ -485,29 +479,21 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
continue
;
}
for
(
p
=
longpath
+
lp
;
*
p
&&
*
p
!=
'/'
&&
*
p
!=
'\\'
;
p
++
);
tmplen
=
p
-
(
longpath
+
lp
);
lstrcpynW
(
tmpshortpath
+
sp
,
longpath
+
lp
,
tmplen
+
1
);
/* Check, if the current element is a valid dos name */
if
(
tmplen
<=
8
+
1
+
3
)
p
=
longpath
+
lp
;
if
(
lp
==
0
&&
p
[
0
]
==
'.'
&&
(
p
[
1
]
==
'/'
||
p
[
1
]
==
'\\'
))
{
BOOLEAN
spaces
;
memcpy
(
ustr_buf
,
longpath
+
lp
,
tmplen
*
sizeof
(
WCHAR
));
ustr_buf
[
tmplen
]
=
'\0'
;
ustr
.
Length
=
tmplen
*
sizeof
(
WCHAR
);
if
(
RtlIsNameLegalDOS8Dot3
(
&
ustr
,
NULL
,
&
spaces
)
&&
!
spaces
)
{
sp
+=
tmplen
;
lp
+=
tmplen
;
continue
;
}
tmpshortpath
[
sp
++
]
=
*
p
++
;
tmpshortpath
[
sp
++
]
=
*
p
++
;
}
for
(;
*
p
&&
*
p
!=
'/'
&&
*
p
!=
'\\'
;
p
++
);
tmplen
=
p
-
(
longpath
+
lp
);
lstrcpynW
(
tmpshortpath
+
sp
,
longpath
+
lp
,
tmplen
+
1
);
/* Check if the file exists and use the existing short file name */
goit
=
FindFirstFileW
(
tmpshortpath
,
&
wfd
);
if
(
goit
==
INVALID_HANDLE_VALUE
)
goto
notfound
;
FindClose
(
goit
);
strcpyW
(
tmpshortpath
+
sp
,
wfd
.
cAlternateFileName
);
strcpyW
(
tmpshortpath
+
sp
,
wfd
.
cAlternateFileName
[
0
]
?
wfd
.
cAlternateFileName
:
wfd
.
cFileName
);
sp
+=
strlenW
(
tmpshortpath
+
sp
);
lp
+=
tmplen
;
}
...
...
dlls/kernel32/tests/path.c
View file @
4cc482bc
...
...
@@ -1281,9 +1281,7 @@ static void test_GetShortPathNameW(void)
/* GetShortPathName for a non-existent short file name should fail */
SetLastError
(
0xdeadbeef
);
length
=
GetShortPathNameW
(
short_path
,
path
,
0
);
todo_wine
ok
(
!
length
,
"GetShortPathNameW should fail
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
GetLastError
());
file
=
CreateFileW
(
short_path
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
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