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
ef851bc6
Commit
ef851bc6
authored
Dec 03, 2006
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Dec 06, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add tests for GetSystemDirectory.
parent
d01e76de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
1 deletion
+63
-1
path.c
dlls/kernel32/tests/path.c
+63
-1
No files found.
dlls/kernel32/tests/path.c
View file @
ef851bc6
/*
* Unit test suite for
Get*PathNamesA and (Get|Set)CurrentDirectoryA.
* Unit test suite for
various Path and Directory Functions
*
* Copyright 2002 Geoffrey Hausheer
* Copyright 2006 Detlef Riekenberg
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -951,6 +952,66 @@ static void test_GetLongPathNameW(void)
}
}
static
void
test_GetSystemDirectory
(
void
)
{
CHAR
buffer
[
MAX_PATH
+
4
];
DWORD
res
;
DWORD
total
;
SetLastError
(
0xdeadbeef
);
res
=
GetSystemDirectory
(
NULL
,
0
);
/* res includes the terminating Zero */
ok
(
res
>
0
,
"returned %d with 0x%x (expected '>0')
\n
"
,
res
,
GetLastError
());
total
=
res
;
#if 0
/* this test crash on XP */
res = GetSystemDirectory(NULL, total);
#endif
SetLastError
(
0xdeadbeef
);
res
=
GetSystemDirectory
(
NULL
,
total
-
1
);
/* 95+NT: total (includes the terminating Zero)
98+ME: 0 with ERROR_INVALID_PARAMETER */
ok
(
(
res
==
total
)
||
(
!
res
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
)),
"returned %d with 0x%x (expected '%d' or: '0' with "
\
"ERROR_INVALID_PARAMETER)
\n
"
,
res
,
GetLastError
(),
total
);
if
(
total
>
MAX_PATH
)
return
;
buffer
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetSystemDirectory
(
buffer
,
total
);
/* res does not include the terminating Zero */
ok
(
(
res
==
(
total
-
1
))
&&
(
buffer
[
0
]),
"returned %d with 0x%x and '%s' (expected '%d' and a string)
\n
"
,
res
,
GetLastError
(),
buffer
,
total
-
1
);
buffer
[
0
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetSystemDirectory
(
buffer
,
total
+
1
);
/* res does not include the terminating Zero */
ok
(
(
res
==
(
total
-
1
))
&&
(
buffer
[
0
]),
"returned %d with 0x%x and '%s' (expected '%d' and a string)
\n
"
,
res
,
GetLastError
(),
buffer
,
total
-
1
);
memset
(
buffer
,
'#'
,
total
+
1
);
buffer
[
total
+
2
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetSystemDirectory
(
buffer
,
total
-
1
);
/* res includes the terminating Zero) */
ok
(
res
==
total
,
"returned %d with 0x%x and '%s' (expected '%d')
\n
"
,
res
,
GetLastError
(),
buffer
,
total
);
memset
(
buffer
,
'#'
,
total
+
1
);
buffer
[
total
+
2
]
=
'\0'
;
SetLastError
(
0xdeadbeef
);
res
=
GetSystemDirectory
(
buffer
,
total
-
2
);
/* res includes the terminating Zero) */
ok
(
res
==
total
,
"returned %d with 0x%x and '%s' (expected '%d')
\n
"
,
res
,
GetLastError
(),
buffer
,
total
);
}
START_TEST
(
path
)
{
CHAR
origdir
[
MAX_PATH
],
curdir
[
MAX_PATH
],
curDrive
,
otherDrive
;
...
...
@@ -964,4 +1025,5 @@ START_TEST(path)
test_CleanupPathA
(
origdir
,
curdir
);
test_GetTempPath
();
test_GetLongPathNameW
();
test_GetSystemDirectory
();
}
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