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
6c3399a9
Commit
6c3399a9
authored
Sep 07, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Sep 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wtsapi32: Improve WTSEnumerateSessionsW() stub.
parent
7c94e424
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
7 deletions
+53
-7
wtsapi.c
dlls/wtsapi32/tests/wtsapi.c
+33
-0
wtsapi32.c
dlls/wtsapi32/wtsapi32.c
+20
-7
No files found.
dlls/wtsapi32/tests/wtsapi.c
View file @
6c3399a9
...
...
@@ -306,6 +306,38 @@ static void test_WTSQueryUserToken(void)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got: %ld
\n
"
,
GetLastError
());
}
static
void
test_WTSEnumerateSessions
(
void
)
{
BOOL
console_found
=
FALSE
,
services_found
=
FALSE
;
WTS_SESSION_INFOW
*
info
;
unsigned
int
i
;
DWORD
count
;
BOOL
bret
;
bret
=
WTSEnumerateSessionsW
(
WTS_CURRENT_SERVER_HANDLE
,
0
,
1
,
&
info
,
&
count
);
ok
(
bret
,
"got error %lu.
\n
"
,
GetLastError
());
todo_wine_if
(
count
==
1
)
ok
(
count
>=
2
,
"got %lu.
\n
"
,
count
);
for
(
i
=
0
;
i
<
count
;
++
i
)
{
trace
(
"SessionId %lu, name %s, State %d.
\n
"
,
info
[
i
].
SessionId
,
debugstr_w
(
info
[
i
].
pWinStationName
),
info
[
i
].
State
);
if
(
!
wcscmp
(
info
[
i
].
pWinStationName
,
L"Console"
))
{
console_found
=
TRUE
;
ok
(
info
[
i
].
State
==
WTSActive
,
"got State %d.
\n
"
,
info
[
i
].
State
);
}
else
if
(
!
wcscmp
(
info
[
i
].
pWinStationName
,
L"Services"
))
{
services_found
=
TRUE
;
ok
(
info
[
i
].
State
==
WTSDisconnected
,
"got State %d.
\n
"
,
info
[
i
].
State
);
}
}
ok
(
console_found
,
"Console session not found.
\n
"
);
todo_wine
ok
(
services_found
,
"Services session not found.
\n
"
);
WTSFreeMemory
(
info
);
}
START_TEST
(
wtsapi
)
{
pWTSEnumerateProcessesExW
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"wtsapi32"
),
"WTSEnumerateProcessesExW"
);
...
...
@@ -314,4 +346,5 @@ START_TEST (wtsapi)
test_WTSEnumerateProcessesW
();
test_WTSQuerySessionInformation
();
test_WTSQueryUserToken
();
test_WTSEnumerateSessions
();
}
dlls/wtsapi32/wtsapi32.c
View file @
6c3399a9
...
...
@@ -309,16 +309,29 @@ BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version,
/************************************************************
* WTSEnumerateEnumerateSessionsW (WTSAPI32.@)
*/
BOOL
WINAPI
WTSEnumerateSessionsW
(
HANDLE
hServer
,
DWORD
Reserved
,
DWORD
V
ersion
,
PWTS_SESSION_INFOW
*
ppSessionInfo
,
DWORD
*
pC
ount
)
BOOL
WINAPI
WTSEnumerateSessionsW
(
HANDLE
server
,
DWORD
reserved
,
DWORD
v
ersion
,
PWTS_SESSION_INFOW
*
session_info
,
DWORD
*
c
ount
)
{
FIXME
(
"Stub %p 0x%08lx 0x%08lx %p %p
\n
"
,
hServer
,
Reserved
,
Version
,
ppSessionInfo
,
pCount
);
static
const
WCHAR
session_name
[]
=
L"Console"
;
if
(
!
ppSessionInfo
||
!
pCount
)
return
FALSE
;
FIXME
(
"%p 0x%08lx 0x%08lx %p %p semi-stub.
\n
"
,
server
,
reserved
,
version
,
session_info
,
count
)
;
*
pCount
=
0
;
*
ppSessionInfo
=
NULL
;
if
(
!
session_info
||
!
count
)
return
FALSE
;
if
(
!
(
*
session_info
=
heap_alloc
(
sizeof
(
**
session_info
)
+
sizeof
(
session_name
))))
{
SetLastError
(
ERROR_OUTOFMEMORY
);
return
FALSE
;
}
if
(
!
ProcessIdToSessionId
(
GetCurrentProcessId
(),
&
(
*
session_info
)
->
SessionId
))
{
WTSFreeMemory
(
*
session_info
);
return
FALSE
;
}
*
count
=
1
;
(
*
session_info
)
->
State
=
WTSActive
;
(
*
session_info
)
->
pWinStationName
=
(
WCHAR
*
)((
char
*
)
*
session_info
+
sizeof
(
**
session_info
));
memcpy
((
*
session_info
)
->
pWinStationName
,
session_name
,
sizeof
(
session_name
));
return
TRUE
;
}
...
...
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