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
7c248ff4
Commit
7c248ff4
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: Implement WTSEnumerateSessionsA() on top of WTSEnumerateSessionsW().
parent
6c3399a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
10 deletions
+55
-10
wtsapi.c
dlls/wtsapi32/tests/wtsapi.c
+9
-1
wtsapi32.c
dlls/wtsapi32/wtsapi32.c
+46
-9
No files found.
dlls/wtsapi32/tests/wtsapi.c
View file @
7c248ff4
...
...
@@ -310,14 +310,19 @@ static void test_WTSEnumerateSessions(void)
{
BOOL
console_found
=
FALSE
,
services_found
=
FALSE
;
WTS_SESSION_INFOW
*
info
;
WTS_SESSION_INFOA
*
infoA
;
DWORD
count
,
count2
;
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
);
bret
=
WTSEnumerateSessionsA
(
WTS_CURRENT_SERVER_HANDLE
,
0
,
1
,
&
infoA
,
&
count2
);
ok
(
bret
,
"got error %lu.
\n
"
,
GetLastError
());
ok
(
count2
==
count
,
"got %lu.
\n
"
,
count2
);
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
);
...
...
@@ -325,17 +330,20 @@ static void test_WTSEnumerateSessions(void)
{
console_found
=
TRUE
;
ok
(
info
[
i
].
State
==
WTSActive
,
"got State %d.
\n
"
,
info
[
i
].
State
);
ok
(
!
strcmp
(
infoA
[
i
].
pWinStationName
,
"Console"
),
"got %s.
\n
"
,
debugstr_a
(
infoA
[
i
].
pWinStationName
));
}
else
if
(
!
wcscmp
(
info
[
i
].
pWinStationName
,
L"Services"
))
{
services_found
=
TRUE
;
ok
(
info
[
i
].
State
==
WTSDisconnected
,
"got State %d.
\n
"
,
info
[
i
].
State
);
ok
(
!
strcmp
(
infoA
[
i
].
pWinStationName
,
"Services"
),
"got %s.
\n
"
,
debugstr_a
(
infoA
[
i
].
pWinStationName
));
}
}
ok
(
console_found
,
"Console session not found.
\n
"
);
todo_wine
ok
(
services_found
,
"Services session not found.
\n
"
);
WTSFreeMemory
(
info
);
WTSFreeMemory
(
infoA
);
}
START_TEST
(
wtsapi
)
...
...
dlls/wtsapi32/wtsapi32.c
View file @
7c248ff4
...
...
@@ -266,7 +266,6 @@ BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Versi
return
FALSE
;
}
/************************************************************
* WTSEnumerateEnumerateSessionsExW (WTSAPI32.@)
*/
...
...
@@ -290,19 +289,57 @@ BOOL WINAPI WTSEnumerateSessionsExA(HANDLE server, DWORD *level, DWORD filter, W
/************************************************************
* WTSEnumerateEnumerateSessionsA (WTSAPI32.@)
*/
BOOL
WINAPI
WTSEnumerateSessionsA
(
HANDLE
hServer
,
DWORD
Reserved
,
DWORD
V
ersion
,
PWTS_SESSION_INFOA
*
ppSessionInfo
,
DWORD
*
pC
ount
)
BOOL
WINAPI
WTSEnumerateSessionsA
(
HANDLE
server
,
DWORD
reserved
,
DWORD
v
ersion
,
PWTS_SESSION_INFOA
*
session_info
,
DWORD
*
c
ount
)
{
static
int
once
;
PWTS_SESSION_INFOW
infoW
;
DWORD
size
,
offset
;
unsigned
int
i
;
int
len
;
if
(
!
once
++
)
FIXME
(
"Stub %p 0x%08lx 0x%08lx %p %p
\n
"
,
hServer
,
Reserved
,
Version
,
ppSessionInfo
,
pCount
);
TRACE
(
"%p 0x%08lx 0x%08lx %p %p.
\n
"
,
server
,
reserved
,
version
,
session_info
,
count
);
if
(
!
ppSessionInfo
||
!
pC
ount
)
return
FALSE
;
if
(
!
session_info
||
!
c
ount
)
return
FALSE
;
*
pCount
=
0
;
*
ppSessionInfo
=
NULL
;
if
(
!
WTSEnumerateSessionsW
(
server
,
reserved
,
version
,
&
infoW
,
count
))
return
FALSE
;
size
=
0
;
for
(
i
=
0
;
i
<
*
count
;
++
i
)
{
if
(
!
(
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
infoW
[
i
].
pWinStationName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
)))
{
ERR
(
"WideCharToMultiByte failed.
\n
"
);
WTSFreeMemory
(
infoW
);
return
FALSE
;
}
size
+=
sizeof
(
**
session_info
)
+
len
;
}
if
(
!
(
*
session_info
=
heap_alloc
(
size
)))
{
WTSFreeMemory
(
infoW
);
SetLastError
(
ERROR_OUTOFMEMORY
);
return
FALSE
;
}
offset
=
*
count
*
sizeof
(
**
session_info
);
for
(
i
=
0
;
i
<
*
count
;
++
i
)
{
(
*
session_info
)[
i
].
State
=
infoW
[
i
].
State
;
(
*
session_info
)[
i
].
SessionId
=
infoW
[
i
].
SessionId
;
(
*
session_info
)[
i
].
pWinStationName
=
(
char
*
)(
*
session_info
)
+
offset
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
infoW
[
i
].
pWinStationName
,
-
1
,
(
*
session_info
)[
i
].
pWinStationName
,
size
-
offset
,
NULL
,
NULL
);
if
(
!
len
)
{
ERR
(
"WideCharToMultiByte failed.
\n
"
);
WTSFreeMemory
(
*
session_info
);
WTSFreeMemory
(
infoW
);
}
offset
+=
len
;
}
WTSFreeMemory
(
infoW
);
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