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
17eb0040
Commit
17eb0040
authored
Dec 17, 2009
by
Paul Vriens
Committed by
Alexandre Julliard
Dec 17, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add some tests for GetLongPathNameW.
parent
d58bd680
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
4 deletions
+78
-4
path.c
dlls/kernel32/tests/path.c
+78
-4
No files found.
dlls/kernel32/tests/path.c
View file @
17eb0040
...
...
@@ -1065,12 +1065,20 @@ static void test_GetLongPathNameA(void)
static
void
test_GetLongPathNameW
(
void
)
{
DWORD
length
;
DWORD
length
,
expanded
;
BOOL
ret
;
HANDLE
file
;
WCHAR
empty
[
MAX_PATH
];
WCHAR
tempdir
[
MAX_PATH
],
name
[
200
];
WCHAR
dirpath
[
4
+
MAX_PATH
+
200
];
/* To ease removal */
WCHAR
shortpath
[
4
+
MAX_PATH
+
200
+
1
+
200
];
static
const
WCHAR
prefix
[]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
,
0
};
static
const
WCHAR
backslash
[]
=
{
'\\'
,
0
};
static
const
WCHAR
letterX
[]
=
{
'X'
,
0
};
if
(
!
pGetLongPathNameW
)
return
;
/* Not present in all windows versions */
if
(
pGetLongPathNameW
)
{
SetLastError
(
0xdeadbeef
);
length
=
pGetLongPathNameW
(
NULL
,
NULL
,
0
);
if
(
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
...
...
@@ -1086,7 +1094,73 @@ static void test_GetLongPathNameW(void)
length
=
pGetLongPathNameW
(
empty
,
NULL
,
0
);
ok
(
0
==
length
,
"GetLongPathNameW returned %d but expected 0
\n
"
,
length
);
ok
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"GetLastError returned %d but expected ERROR_PATH_NOT_FOUND
\n
"
,
GetLastError
());
/* Create a long path name. The path needs to exist for these tests to
* succeed so we need the "\\?\" prefix when creating directories and
* files.
*/
name
[
0
]
=
0
;
while
(
lstrlenW
(
name
)
<
(
sizeof
(
name
)
/
sizeof
(
WCHAR
)
-
1
))
lstrcatW
(
name
,
letterX
);
GetTempPathW
(
MAX_PATH
,
tempdir
);
lstrcpyW
(
shortpath
,
prefix
);
lstrcatW
(
shortpath
,
tempdir
);
lstrcatW
(
shortpath
,
name
);
lstrcpyW
(
dirpath
,
shortpath
);
ret
=
CreateDirectoryW
(
shortpath
,
NULL
);
ok
(
ret
,
"Could not create the temporary directory : %d
\n
"
,
GetLastError
());
lstrcatW
(
shortpath
,
backslash
);
lstrcatW
(
shortpath
,
name
);
/* Path does not exist yet and we know it overruns MAX_PATH */
/* No prefix */
SetLastError
(
0xdeadbeef
);
length
=
pGetLongPathNameW
(
shortpath
+
4
,
NULL
,
0
);
ok
(
length
==
0
,
"Expected 0, got %d
\n
"
,
length
);
todo_wine
ok
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"Expected ERROR_PATH_NOT_FOUND, got %d
\n
"
,
GetLastError
());
/* With prefix */
SetLastError
(
0xdeadbeef
);
length
=
pGetLongPathNameW
(
shortpath
,
NULL
,
0
);
todo_wine
{
ok
(
length
==
0
,
"Expected 0, got %d
\n
"
,
length
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_PATH_NOT_FOUND, got %d
\n
"
,
GetLastError
());
}
file
=
CreateFileW
(
shortpath
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Could not create the temporary file : %d.
\n
"
,
GetLastError
());
CloseHandle
(
file
);
/* Path exists */
/* No prefix */
SetLastError
(
0xdeadbeef
);
length
=
pGetLongPathNameW
(
shortpath
+
4
,
NULL
,
0
);
todo_wine
{
ok
(
length
==
0
,
"Expected 0, got %d
\n
"
,
length
);
ok
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"Expected ERROR_PATH_NOT_FOUND, got %d
\n
"
,
GetLastError
());
}
/* With prefix */
expanded
=
4
+
(
pGetLongPathNameW
(
tempdir
,
NULL
,
0
)
-
1
)
+
lstrlenW
(
name
)
+
1
+
lstrlenW
(
name
)
+
1
;
SetLastError
(
0xdeadbeef
);
length
=
pGetLongPathNameW
(
shortpath
,
NULL
,
0
);
ok
(
length
==
expanded
,
"Expected %d, got %d
\n
"
,
expanded
,
length
);
/* NULL buffer with length crashes on Windows */
if
(
0
)
length
=
pGetLongPathNameW
(
shortpath
,
NULL
,
20
);
ok
(
DeleteFileW
(
shortpath
),
"Could not delete temporary file
\n
"
);
ok
(
RemoveDirectoryW
(
dirpath
),
"Could not delete temporary directory
\n
"
);
}
static
void
test_GetShortPathNameW
(
void
)
...
...
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