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
f0c165ed
Commit
f0c165ed
authored
Mar 08, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userenv/tests: Enable compilation with long types.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0f430425
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
24 deletions
+23
-24
Makefile.in
dlls/userenv/tests/Makefile.in
+0
-1
userenv.c
dlls/userenv/tests/userenv.c
+23
-23
No files found.
dlls/userenv/tests/Makefile.in
View file @
f0c165ed
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
TESTDLL
=
userenv.dll
IMPORTS
=
userenv advapi32
...
...
dlls/userenv/tests/userenv.c
View file @
f0c165ed
...
...
@@ -33,7 +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())
#define expect_gle(EXPECTED) ok(GetLastError() == (EXPECTED), "Expected %d, got %
l
d\n", (EXPECTED), GetLastError())
static
BOOL
(
WINAPI
*
pIsWow64Process
)(
HANDLE
,
PBOOL
);
...
...
@@ -115,13 +115,13 @@ static void test_create_env(void)
expect
(
TRUE
,
r
);
r
=
GetEnvironmentVariableA
(
"SystemRoot"
,
systemroot
,
sizeof
(
systemroot
));
ok
(
r
!=
0
,
"GetEnvironmentVariable failed (%d)
\n
"
,
GetLastError
());
ok
(
r
!=
0
,
"GetEnvironmentVariable failed (%
l
d)
\n
"
,
GetLastError
());
r
=
SetEnvironmentVariableA
(
"SystemRoot"
,
"overwrite"
);
expect
(
TRUE
,
r
);
r
=
GetEnvironmentVariableA
(
"ProgramData"
,
programdata
,
sizeof
(
programdata
));
ok
(
r
!=
0
,
"GetEnvironmentVariable failed (%d)
\n
"
,
GetLastError
());
ok
(
r
!=
0
,
"GetEnvironmentVariable failed (%
l
d)
\n
"
,
GetLastError
());
r
=
SetEnvironmentVariableA
(
"ProgramData"
,
"overwrite"
);
expect
(
TRUE
,
r
);
...
...
@@ -250,7 +250,7 @@ static void test_get_profiles_dir(void)
char
*
profiles_dir
,
*
buf
,
small_buf
[
1
];
l
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
ProfileListA
,
0
,
KEY_READ
,
&
key
);
ok
(
!
l
,
"RegOpenKeyExA failed: %d
\n
"
,
GetLastError
());
ok
(
!
l
,
"RegOpenKeyExA failed: %
l
d
\n
"
,
GetLastError
());
l
=
RegQueryValueExA
(
key
,
ProfilesDirectory
,
NULL
,
NULL
,
NULL
,
&
cch
);
if
(
l
)
...
...
@@ -282,7 +282,7 @@ static void test_get_profiles_dir(void)
/* 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.
*/
ok
(
cch
==
profiles_len
-
1
,
"expected %
d, got %
d
\n
"
,
profiles_len
-
1
,
cch
);
ok
(
cch
==
profiles_len
-
1
,
"expected %
ld, got %l
d
\n
"
,
profiles_len
-
1
,
cch
);
/* Allocate one more character than the return value to prevent a buffer
* overrun.
*/
...
...
@@ -291,7 +291,7 @@ static void test_get_profiles_dir(void)
/* Rather than a BOOL, the return value is also the number of characters
* stored in the buffer.
*/
expect
(
profiles_len
-
1
,
r
);
ok
(
profiles_len
-
1
==
r
,
"expected %ld, got %d
\n
"
,
profiles_len
-
1
,
r
);
ok
(
!
strcmp
(
buf
,
profiles_dir
),
"expected %s, got %s
\n
"
,
profiles_dir
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
...
...
@@ -330,26 +330,26 @@ static void test_get_user_profile_dir(void)
}
ret
=
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
);
ok
(
ret
,
"expected success %u
\n
"
,
GetLastError
());
ok
(
ret
,
"expected success %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryA
(
NULL
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %
l
u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryA
(
token
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %
l
u
\n
"
,
error
);
dirA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
32
);
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryA
(
token
,
dirA
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %
l
u
\n
"
,
error
);
HeapFree
(
GetProcessHeap
(),
0
,
dirA
);
len
=
0
;
...
...
@@ -357,8 +357,8 @@ static void test_get_user_profile_dir(void)
ret
=
GetUserProfileDirectoryA
(
token
,
NULL
,
&
len
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ok
(
!
len
,
"expected 0, got %u
\n
"
,
len
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %
l
u
\n
"
,
error
);
ok
(
!
len
,
"expected 0, got %
l
u
\n
"
,
len
);
len
=
0
;
dirA
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
32
);
...
...
@@ -374,34 +374,34 @@ static void test_get_user_profile_dir(void)
dirA
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
);
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryA
(
token
,
dirA
,
&
len
);
ok
(
ret
,
"expected success %u
\n
"
,
GetLastError
());
ok
(
ret
,
"expected success %
l
u
\n
"
,
GetLastError
());
ok
(
len
,
"expected len > 0
\n
"
);
ok
(
lstrlenA
(
dirA
)
==
len
-
1
,
"length mismatch %d != %d - 1
\n
"
,
lstrlenA
(
dirA
),
len
);
ok
(
lstrlenA
(
dirA
)
==
len
-
1
,
"length mismatch %d != %
l
d - 1
\n
"
,
lstrlenA
(
dirA
),
len
);
trace
(
"%s
\n
"
,
dirA
);
HeapFree
(
GetProcessHeap
(),
0
,
dirA
);
}
else
ok
(
broken
(
error
==
ERROR_INVALID_PARAMETER
)
/* win10 1809+ */
,
"unexpected error %u
\n
"
,
error
);
"unexpected error %
l
u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryW
(
NULL
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %u
\n
"
,
error
);
todo_wine
ok
(
error
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %
l
u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryW
(
token
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %
l
u
\n
"
,
error
);
dirW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
32
);
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryW
(
token
,
dirW
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %
l
u
\n
"
,
error
);
HeapFree
(
GetProcessHeap
(),
0
,
dirW
);
len
=
0
;
...
...
@@ -409,15 +409,15 @@ static void test_get_user_profile_dir(void)
ret
=
GetUserProfileDirectoryW
(
token
,
NULL
,
&
len
);
error
=
GetLastError
();
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
error
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER, got %u
\n
"
,
error
);
ok
(
error
==
ERROR_INSUFFICIENT_BUFFER
,
"expected ERROR_INSUFFICIENT_BUFFER, got %
l
u
\n
"
,
error
);
ok
(
len
,
"expected len > 0
\n
"
);
dirW
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
*
sizeof
(
WCHAR
)
);
SetLastError
(
0xdeadbeef
);
ret
=
GetUserProfileDirectoryW
(
token
,
dirW
,
&
len
);
ok
(
ret
,
"expected success %u
\n
"
,
GetLastError
());
ok
(
ret
,
"expected success %
l
u
\n
"
,
GetLastError
());
ok
(
len
,
"expected len > 0
\n
"
);
ok
(
lstrlenW
(
dirW
)
==
len
-
1
,
"length mismatch %d != %d - 1
\n
"
,
lstrlenW
(
dirW
),
len
);
ok
(
lstrlenW
(
dirW
)
==
len
-
1
,
"length mismatch %d != %
l
d - 1
\n
"
,
lstrlenW
(
dirW
),
len
);
HeapFree
(
GetProcessHeap
(),
0
,
dirW
);
len2
=
0
;
...
...
@@ -428,10 +428,10 @@ static void test_get_user_profile_dir(void)
ok
(
!
ret
,
"expected failure
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
dirW
);
if
(
error
==
ERROR_INSUFFICIENT_BUFFER
)
ok
(
len2
==
len
,
"expected %
d, got %
d
\n
"
,
len
,
len2
);
ok
(
len2
==
len
,
"expected %
ld, got %l
d
\n
"
,
len
,
len2
);
else
ok
(
broken
(
error
==
ERROR_INVALID_PARAMETER
)
/* win10 1809+ */
,
"unexpected error %u
\n
"
,
error
);
"unexpected error %
l
u
\n
"
,
error
);
CloseHandle
(
token
);
}
...
...
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