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
fd69abab
Commit
fd69abab
authored
Mar 05, 2008
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Mar 15, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fix enumeration for EnumWindowStations and EnumDesktops.
parent
ed966469
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
6 deletions
+132
-6
winstation.c
dlls/user32/tests/winstation.c
+102
-0
winstation.c
dlls/user32/winstation.c
+30
-6
No files found.
dlls/user32/tests/winstation.c
View file @
fd69abab
...
...
@@ -22,6 +22,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#define DESKTOP_ALL_ACCESS 0x01ff
...
...
@@ -248,6 +249,105 @@ static void test_handles(void)
CloseHandle
(
hthread
);
}
/* Enumeration tests */
static
BOOL
CALLBACK
window_station_callbackA
(
LPSTR
winsta
,
LPARAM
lp
)
{
trace
(
"window_station_callbackA called with argument %s
\n
"
,
winsta
);
return
lp
;
}
static
BOOL
CALLBACK
open_window_station_callbackA
(
LPSTR
winsta
,
LPARAM
lp
)
{
HWINSTA
hwinsta
;
trace
(
"open_window_station_callbackA called with argument %s
\n
"
,
winsta
);
hwinsta
=
OpenWindowStationA
(
winsta
,
FALSE
,
WINSTA_ENUMERATE
);
ok
(
hwinsta
!=
NULL
,
"Could not open desktop %s!
\n
"
,
winsta
);
if
(
hwinsta
)
CloseWindowStation
(
hwinsta
);
return
lp
;
}
static
void
test_enumstations
(
void
)
{
BOOL
ret
;
if
(
0
)
/* Crashes instead */
{
SetLastError
(
0xbabefeed
);
ret
=
EnumWindowStationsA
(
NULL
,
0
);
ok
(
!
ret
,
"EnumWindowStationsA returned succesfully!
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"LastError is set to %08x
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
ret
=
EnumWindowStationsA
(
open_window_station_callbackA
,
0x12345
);
ok
(
ret
==
0x12345
,
"EnumWindowStationsA returned %x
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"LastError is set to %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
EnumWindowStationsA
(
window_station_callbackA
,
0
);
ok
(
!
ret
,
"EnumWindowStationsA returned %x
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"LastError is set to %08x
\n
"
,
GetLastError
());
}
static
BOOL
CALLBACK
desktop_callbackA
(
LPSTR
desktop
,
LPARAM
lp
)
{
trace
(
"desktop_callbackA called with argument %s
\n
"
,
desktop
);
return
lp
;
}
static
BOOL
CALLBACK
open_desktop_callbackA
(
LPSTR
desktop
,
LPARAM
lp
)
{
HDESK
hdesk
;
static
int
once
;
trace
(
"open_desktop_callbackA called with argument %s
\n
"
,
desktop
);
/* Only try to open one desktop */
if
(
once
++
)
return
lp
;
hdesk
=
OpenDesktopA
(
desktop
,
0
,
FALSE
,
DESKTOP_ENUMERATE
);
ok
(
hdesk
!=
NULL
,
"Could not open desktop %s!
\n
"
,
desktop
);
if
(
hdesk
)
CloseDesktop
(
hdesk
);
return
lp
;
}
static
void
test_enumdesktops
(
void
)
{
BOOL
ret
;
if
(
0
)
/* Crashes instead */
{
SetLastError
(
0xbabefeed
);
ret
=
EnumDesktopsA
(
GetProcessWindowStation
(),
NULL
,
0
);
ok
(
!
ret
,
"EnumDesktopsA returned succesfully!
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"LastError is set to %08x
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
ret
=
EnumDesktopsA
(
NULL
,
desktop_callbackA
,
0x12345
);
ok
(
ret
==
0x12345
,
"EnumDesktopsA returned %x
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"LastError is set to %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
EnumDesktopsA
(
GetProcessWindowStation
(),
open_desktop_callbackA
,
0x12345
);
ok
(
ret
==
0x12345
,
"EnumDesktopsA returned %x
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"LastError is set to %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
EnumDesktopsA
(
INVALID_HANDLE_VALUE
,
desktop_callbackA
,
0x12345
);
ok
(
!
ret
,
"EnumDesktopsA returned %x
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"LastError is set to %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
EnumDesktopsA
(
GetProcessWindowStation
(),
desktop_callbackA
,
0
);
ok
(
!
ret
,
"EnumDesktopsA returned %x
\n
"
,
ret
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"LastError is set to %08x
\n
"
,
GetLastError
());
}
START_TEST
(
winstation
)
{
/* Check whether this platform supports WindowStation calls */
...
...
@@ -260,5 +360,7 @@ START_TEST(winstation)
return
;
}
test_enumstations
();
test_enumdesktops
();
test_handles
();
}
dlls/user32/winstation.c
View file @
fd69abab
...
...
@@ -18,6 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
...
...
@@ -211,18 +214,27 @@ BOOL WINAPI EnumWindowStationsW( WINSTAENUMPROCW func, LPARAM lparam )
unsigned
int
index
=
0
;
WCHAR
name
[
MAX_PATH
];
BOOL
ret
=
TRUE
;
NTSTATUS
status
;
while
(
ret
)
{
SERVER_START_REQ
(
enum_winstation
)
{
req
->
index
=
index
;
wine_server_set_reply
(
req
,
name
,
sizeof
(
name
)
);
ret
=
!
wine_server_call
(
req
);
wine_server_set_reply
(
req
,
name
,
sizeof
(
name
)
-
sizeof
(
WCHAR
)
);
status
=
wine_server_call
(
req
);
name
[
wine_server_reply_size
(
reply
)
/
sizeof
(
WCHAR
)]
=
0
;
index
=
reply
->
next
;
}
SERVER_END_REQ
;
if
(
ret
)
ret
=
func
(
name
,
lparam
);
if
(
status
==
STATUS_NO_MORE_ENTRIES
)
break
;
if
(
status
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
FALSE
;
}
ret
=
func
(
name
,
lparam
);
}
return
ret
;
}
...
...
@@ -401,6 +413,10 @@ BOOL WINAPI EnumDesktopsW( HWINSTA winsta, DESKTOPENUMPROCW func, LPARAM lparam
unsigned
int
index
=
0
;
WCHAR
name
[
MAX_PATH
];
BOOL
ret
=
TRUE
;
NTSTATUS
status
;
if
(
!
winsta
)
winsta
=
GetProcessWindowStation
();
while
(
ret
)
{
...
...
@@ -408,12 +424,20 @@ BOOL WINAPI EnumDesktopsW( HWINSTA winsta, DESKTOPENUMPROCW func, LPARAM lparam
{
req
->
winstation
=
winsta
;
req
->
index
=
index
;
wine_server_set_reply
(
req
,
name
,
sizeof
(
name
)
);
ret
=
!
wine_server_call
(
req
);
wine_server_set_reply
(
req
,
name
,
sizeof
(
name
)
-
sizeof
(
WCHAR
)
);
status
=
wine_server_call
(
req
);
name
[
wine_server_reply_size
(
reply
)
/
sizeof
(
WCHAR
)]
=
0
;
index
=
reply
->
next
;
}
SERVER_END_REQ
;
if
(
ret
)
ret
=
func
(
name
,
lparam
);
if
(
status
==
STATUS_NO_MORE_ENTRIES
)
break
;
if
(
status
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
FALSE
;
}
ret
=
func
(
name
,
lparam
);
}
return
ret
;
}
...
...
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