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
4e19b7ae
Commit
4e19b7ae
authored
Aug 26, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Aug 27, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userenv/tests: Add tests for GetProfilesDirectory.
parent
90c615aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
userenv.c
dlls/userenv/tests/userenv.c
+68
-0
No files found.
dlls/userenv/tests/userenv.c
View file @
4e19b7ae
...
...
@@ -25,6 +25,7 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winreg.h"
#include "userenv.h"
...
...
@@ -32,6 +33,7 @@
#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
#define expect_env(EXPECTED,GOT,VAR) ok((GOT)==(EXPECTED), "Expected %d, got %d for %s (%d)\n", (EXPECTED), (GOT), (VAR), j)
#define expect_gle(EXPECTED) ok(GetLastError() == (EXPECTED), "Expected %d, got %d\n", (EXPECTED), GetLastError())
struct
profile_item
{
...
...
@@ -205,7 +207,73 @@ static void test_create_env(void)
}
}
static
void
test_get_profiles_dir
(
void
)
{
static
const
char
ProfileListA
[]
=
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
ProfileList"
;
static
const
char
ProfilesDirectory
[]
=
"ProfilesDirectory"
;
BOOL
r
;
DWORD
cch
,
profiles_len
;
LONG
l
;
HKEY
key
;
char
*
profiles_dir
,
*
buf
,
small_buf
[
1
];
l
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
ProfileListA
,
0
,
KEY_READ
,
&
key
);
if
(
l
)
{
win_skip
(
"No ProfileList key (Win9x), skipping tests
\n
"
);
return
;
}
l
=
RegQueryValueExA
(
key
,
ProfilesDirectory
,
NULL
,
NULL
,
NULL
,
&
cch
);
if
(
l
)
{
win_skip
(
"No ProfilesDirectory value, skipping tests
\n
"
);
return
;
}
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cch
);
RegQueryValueExA
(
key
,
ProfilesDirectory
,
NULL
,
NULL
,
(
BYTE
*
)
buf
,
&
cch
);
RegCloseKey
(
key
);
profiles_len
=
ExpandEnvironmentStringsA
(
buf
,
NULL
,
0
);
profiles_dir
=
HeapAlloc
(
GetProcessHeap
(),
0
,
profiles_len
);
ExpandEnvironmentStringsA
(
buf
,
profiles_dir
,
profiles_len
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
SetLastError
(
0xdeadbeef
);
r
=
GetProfilesDirectoryA
(
NULL
,
NULL
);
expect
(
FALSE
,
r
);
todo_wine
expect_gle
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
0xdeadbeef
);
r
=
GetProfilesDirectoryA
(
NULL
,
&
cch
);
expect
(
FALSE
,
r
);
todo_wine
expect_gle
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
0xdeadbeef
);
cch
=
1
;
r
=
GetProfilesDirectoryA
(
small_buf
,
&
cch
);
expect
(
FALSE
,
r
);
todo_wine
expect_gle
(
ERROR_INSUFFICIENT_BUFFER
);
/* MSDN claims the returned character count includes the NULL terminator
* when the buffer is too small, but that's not in fact what gets returned.
*/
todo_wine
ok
(
cch
==
profiles_len
-
1
,
"expected %d, got %d
\n
"
,
profiles_len
-
1
,
cch
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cch
);
r
=
GetProfilesDirectoryA
(
buf
,
&
cch
);
/* Rather than a BOOL, the return value is also the number of characters
* stored in the buffer.
*/
todo_wine
expect
(
profiles_len
-
1
,
r
);
todo_wine
ok
(
!
strcmp
(
buf
,
profiles_dir
),
"expected %s, got %s
\n
"
,
profiles_dir
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
profiles_dir
);
}
START_TEST
(
userenv
)
{
test_create_env
();
test_get_profiles_dir
();
}
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