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
c9f78fde
Commit
c9f78fde
authored
Mar 10, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Mar 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wtsapi32/tests: Enable compilation with long types.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1cc29845
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
46 deletions
+45
-46
Makefile.in
dlls/wtsapi32/tests/Makefile.in
+0
-1
wtsapi.c
dlls/wtsapi32/tests/wtsapi.c
+45
-45
No files found.
dlls/wtsapi32/tests/Makefile.in
View file @
c9f78fde
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
TESTDLL
=
wtsapi32.dll
IMPORTS
=
wtsapi32 advapi32 psapi
...
...
dlls/wtsapi32/tests/wtsapi.c
View file @
c9f78fde
...
...
@@ -64,7 +64,7 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count)
nt_length
*=
2
;
nt_info
=
realloc
(
nt_info
,
nt_length
);
}
ok
(
!
status
,
"got %#x
\n
"
,
status
);
ok
(
!
status
,
"got %#
l
x
\n
"
,
status
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -75,11 +75,11 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count)
DWORD
size
;
nt_process
=
find_nt_process_info
(
nt_info
,
info
[
i
].
ProcessId
);
ok
(
!!
nt_process
,
"failed to find pid %#x
\n
"
,
info
[
i
].
ProcessId
);
ok
(
!!
nt_process
,
"failed to find pid %#
l
x
\n
"
,
info
[
i
].
ProcessId
);
winetest_push_context
(
"pid %#x"
,
info
[
i
].
ProcessId
);
winetest_push_context
(
"pid %#
l
x"
,
info
[
i
].
ProcessId
);
ok
(
info
[
i
].
SessionId
==
nt_process
->
SessionId
,
"expected session id %#
x, got %#
x
\n
"
,
ok
(
info
[
i
].
SessionId
==
nt_process
->
SessionId
,
"expected session id %#
lx, got %#l
x
\n
"
,
nt_process
->
SessionId
,
info
[
i
].
SessionId
);
ok
(
!
memcmp
(
info
[
i
].
pProcessName
,
nt_process
->
ProcessName
.
Buffer
,
nt_process
->
ProcessName
.
Length
),
...
...
@@ -89,9 +89,9 @@ static void check_wts_process_info(const WTS_PROCESS_INFOW *info, DWORD count)
if
((
process
=
OpenProcess
(
PROCESS_QUERY_INFORMATION
,
FALSE
,
info
[
i
].
ProcessId
)))
{
ret
=
OpenProcessToken
(
process
,
TOKEN_QUERY
,
&
token
);
ok
(
ret
,
"failed to open token, error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"failed to open token, error %
l
u
\n
"
,
GetLastError
());
ret
=
GetTokenInformation
(
token
,
TokenUser
,
sid_buffer
,
sizeof
(
sid_buffer
),
&
size
);
ok
(
ret
,
"failed to get token user, error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"failed to get token user, error %
l
u
\n
"
,
GetLastError
());
ok
(
EqualSid
(
info
[
i
].
pUserSid
,
sid
->
Sid
),
"SID did not match
\n
"
);
CloseHandle
(
token
);
CloseHandle
(
process
);
...
...
@@ -117,33 +117,33 @@ static void test_WTSEnumerateProcessesW(void)
SetLastError
(
0xdeadbeef
);
ret
=
WTSEnumerateProcessesW
(
WTS_CURRENT_SERVER_HANDLE
,
1
,
1
,
&
info
,
&
count
);
ok
(
!
ret
,
"expected WTSEnumerateProcessesW to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %
l
d
\n
"
,
GetLastError
());
WTSFreeMemory
(
info
);
info
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
WTSEnumerateProcessesW
(
WTS_CURRENT_SERVER_HANDLE
,
0
,
0
,
&
info
,
&
count
);
ok
(
!
ret
,
"expected WTSEnumerateProcessesW to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %
l
d
\n
"
,
GetLastError
());
WTSFreeMemory
(
info
);
info
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
WTSEnumerateProcessesW
(
WTS_CURRENT_SERVER_HANDLE
,
0
,
2
,
&
info
,
&
count
);
ok
(
!
ret
,
"expected WTSEnumerateProcessesW to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %
l
d
\n
"
,
GetLastError
());
WTSFreeMemory
(
info
);
SetLastError
(
0xdeadbeef
);
ret
=
WTSEnumerateProcessesW
(
WTS_CURRENT_SERVER_HANDLE
,
0
,
1
,
NULL
,
&
count
);
ok
(
!
ret
,
"expected WTSEnumerateProcessesW to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %
l
d
\n
"
,
GetLastError
());
info
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
WTSEnumerateProcessesW
(
WTS_CURRENT_SERVER_HANDLE
,
0
,
1
,
&
info
,
NULL
);
ok
(
!
ret
,
"expected WTSEnumerateProcessesW to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %
l
d
\n
"
,
GetLastError
());
WTSFreeMemory
(
info
);
count
=
0
;
...
...
@@ -151,7 +151,7 @@ static void test_WTSEnumerateProcessesW(void)
SetLastError
(
0xdeadbeef
);
ret
=
WTSEnumerateProcessesW
(
WTS_CURRENT_SERVER_HANDLE
,
0
,
1
,
&
info
,
&
count
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
!
GetLastError
(),
"got error %u
\n
"
,
GetLastError
());
ok
(
!
GetLastError
(),
"got error %
l
u
\n
"
,
GetLastError
());
check_wts_process_info
(
info
,
count
);
WTSFreeMemory
(
info
);
...
...
@@ -167,14 +167,14 @@ static void test_WTSEnumerateProcessesW(void)
count
=
0xdeadbeef
;
ret
=
pWTSEnumerateProcessesExW
(
WTS_CURRENT_SERVER_HANDLE
,
&
level
,
WTS_ANY_SESSION
,
NULL
,
&
count
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
());
ok
(
count
==
0xdeadbeef
,
"got count %u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %
l
u
\n
"
,
GetLastError
());
ok
(
count
==
0xdeadbeef
,
"got count %
l
u
\n
"
,
count
);
info
=
(
void
*
)
0xdeadbeef
;
SetLastError
(
0xdeadbeef
);
ret
=
pWTSEnumerateProcessesExW
(
WTS_CURRENT_SERVER_HANDLE
,
&
level
,
WTS_ANY_SESSION
,
(
WCHAR
**
)
&
info
,
NULL
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %
l
u
\n
"
,
GetLastError
());
ok
(
info
==
(
void
*
)
0xdeadbeef
,
"got info %p
\n
"
,
info
);
info
=
NULL
;
...
...
@@ -182,7 +182,7 @@ static void test_WTSEnumerateProcessesW(void)
SetLastError
(
0xdeadbeef
);
ret
=
pWTSEnumerateProcessesExW
(
WTS_CURRENT_SERVER_HANDLE
,
&
level
,
WTS_ANY_SESSION
,
(
WCHAR
**
)
&
info
,
&
count
);
ok
(
ret
,
"expected success
\n
"
);
ok
(
!
GetLastError
(),
"got error %u
\n
"
,
GetLastError
());
ok
(
!
GetLastError
(),
"got error %
l
u
\n
"
,
GetLastError
());
check_wts_process_info
(
info
,
count
);
pWTSFreeMemoryExW
(
WTSTypeProcessInfoLevel0
,
info
,
count
);
}
...
...
@@ -197,91 +197,91 @@ static void test_WTSQuerySessionInformation(void)
SetLastError
(
0xdeadbeef
);
count
=
0
;
ret
=
WTSQuerySessionInformationW
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
NULL
,
&
count
);
ok
(
!
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
count
==
0
,
"got %u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %u
\n
"
,
GetLastError
());
ok
(
!
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
count
==
0
,
"got %
l
u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
count
=
1
;
ret
=
WTSQuerySessionInformationW
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
NULL
,
&
count
);
ok
(
!
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
count
==
1
,
"got %u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %u
\n
"
,
GetLastError
());
ok
(
!
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
count
==
1
,
"got %
l
u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WTSQuerySessionInformationW
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
&
buf1
,
NULL
);
ok
(
!
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %u
\n
"
,
GetLastError
());
ok
(
!
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %
l
u
\n
"
,
GetLastError
());
count
=
0
;
buf1
=
NULL
;
ret
=
WTSQuerySessionInformationW
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
&
buf1
,
&
count
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
buf1
!=
NULL
,
"buf not set
\n
"
);
ok
(
count
==
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
"expected %
u, got %
u
\n
"
,
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
count
);
ok
(
count
==
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
"expected %
Iu, got %l
u
\n
"
,
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
count
);
tempsize
=
UNLEN
+
1
;
GetUserNameW
(
usernameW
,
&
tempsize
);
/* Windows Vista, 7 and 8 return uppercase username, while the rest return lowercase. */
ok
(
!
wcsicmp
(
buf1
,
usernameW
),
"expected %s, got %s
\n
"
,
wine_dbgstr_w
(
usernameW
),
wine_dbgstr_w
(
buf1
));
ok
(
count
==
tempsize
*
sizeof
(
WCHAR
),
"expected %
u, got %
u
\n
"
,
tempsize
*
sizeof
(
WCHAR
),
count
);
ok
(
count
==
tempsize
*
sizeof
(
WCHAR
),
"expected %
Iu, got %l
u
\n
"
,
tempsize
*
sizeof
(
WCHAR
),
count
);
WTSFreeMemory
(
buf1
);
count
=
0
;
buf1
=
NULL
;
ret
=
WTSQuerySessionInformationW
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSDomainName
,
&
buf1
,
&
count
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
buf1
!=
NULL
,
"buf not set
\n
"
);
ok
(
count
==
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
"expected %
u, got %
u
\n
"
,
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
count
);
ok
(
count
==
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
"expected %
Iu, got %l
u
\n
"
,
(
lstrlenW
(
buf1
)
+
1
)
*
sizeof
(
WCHAR
),
count
);
tempsize
=
MAX_COMPUTERNAME_LENGTH
+
1
;
GetComputerNameW
(
computernameW
,
&
tempsize
);
/* Windows Vista, 7 and 8 return uppercase computername, while the rest return lowercase. */
ok
(
!
wcsicmp
(
buf1
,
computernameW
),
"expected %s, got %s
\n
"
,
wine_dbgstr_w
(
computernameW
),
wine_dbgstr_w
(
buf1
));
ok
(
count
==
(
tempsize
+
1
)
*
sizeof
(
WCHAR
),
"expected %
u, got %
u
\n
"
,
(
tempsize
+
1
)
*
sizeof
(
WCHAR
),
count
);
ok
(
count
==
(
tempsize
+
1
)
*
sizeof
(
WCHAR
),
"expected %
Iu, got %l
u
\n
"
,
(
tempsize
+
1
)
*
sizeof
(
WCHAR
),
count
);
WTSFreeMemory
(
buf1
);
SetLastError
(
0xdeadbeef
);
count
=
0
;
ret
=
WTSQuerySessionInformationA
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
NULL
,
&
count
);
ok
(
!
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
count
==
0
,
"got %u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %u
\n
"
,
GetLastError
());
ok
(
!
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
count
==
0
,
"got %
l
u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
count
=
1
;
ret
=
WTSQuerySessionInformationA
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
NULL
,
&
count
);
ok
(
!
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
count
==
1
,
"got %u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %u
\n
"
,
GetLastError
());
ok
(
!
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
count
==
1
,
"got %
l
u
\n
"
,
count
);
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %
l
u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
WTSQuerySessionInformationA
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
&
buf2
,
NULL
);
ok
(
!
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %u
\n
"
,
GetLastError
());
ok
(
!
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"got %
l
u
\n
"
,
GetLastError
());
count
=
0
;
buf2
=
NULL
;
ret
=
WTSQuerySessionInformationA
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSUserName
,
&
buf2
,
&
count
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
buf2
!=
NULL
,
"buf not set
\n
"
);
ok
(
count
==
lstrlenA
(
buf2
)
+
1
,
"expected %u, got %u
\n
"
,
lstrlenA
(
buf2
)
+
1
,
count
);
ok
(
count
==
lstrlenA
(
buf2
)
+
1
,
"expected %u, got %
l
u
\n
"
,
lstrlenA
(
buf2
)
+
1
,
count
);
tempsize
=
UNLEN
+
1
;
GetUserNameA
(
username
,
&
tempsize
);
/* Windows Vista, 7 and 8 return uppercase username, while the rest return lowercase. */
ok
(
!
stricmp
(
buf2
,
username
),
"expected %s, got %s
\n
"
,
username
,
buf2
);
ok
(
count
==
tempsize
,
"expected %
u, got %
u
\n
"
,
tempsize
,
count
);
ok
(
count
==
tempsize
,
"expected %
lu, got %l
u
\n
"
,
tempsize
,
count
);
WTSFreeMemory
(
buf2
);
count
=
0
;
buf2
=
NULL
;
ret
=
WTSQuerySessionInformationA
(
WTS_CURRENT_SERVER_HANDLE
,
WTS_CURRENT_SESSION
,
WTSDomainName
,
&
buf2
,
&
count
);
ok
(
ret
,
"got %u
\n
"
,
GetLastError
());
ok
(
ret
,
"got %
l
u
\n
"
,
GetLastError
());
ok
(
buf2
!=
NULL
,
"buf not set
\n
"
);
ok
(
count
==
lstrlenA
(
buf2
)
+
1
,
"expected %u, got %u
\n
"
,
lstrlenA
(
buf2
)
+
1
,
count
);
ok
(
count
==
lstrlenA
(
buf2
)
+
1
,
"expected %u, got %
l
u
\n
"
,
lstrlenA
(
buf2
)
+
1
,
count
);
tempsize
=
MAX_COMPUTERNAME_LENGTH
+
1
;
GetComputerNameA
(
computername
,
&
tempsize
);
/* Windows Vista, 7 and 8 return uppercase computername, while the rest return lowercase. */
ok
(
!
stricmp
(
buf2
,
computername
),
"expected %s, got %s
\n
"
,
computername
,
buf2
);
ok
(
count
==
tempsize
+
1
,
"expected %
u, got %
u
\n
"
,
tempsize
+
1
,
count
);
ok
(
count
==
tempsize
+
1
,
"expected %
lu, got %l
u
\n
"
,
tempsize
+
1
,
count
);
WTSFreeMemory
(
buf2
);
}
...
...
@@ -292,7 +292,7 @@ static void test_WTSQueryUserToken(void)
SetLastError
(
0xdeadbeef
);
ret
=
WTSQueryUserToken
(
WTS_CURRENT_SESSION
,
NULL
);
ok
(
!
ret
,
"expected WTSQueryUserToken to fail
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %d
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %
l
d
\n
"
,
GetLastError
());
}
START_TEST
(
wtsapi
)
...
...
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