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
2c242728
Commit
2c242728
authored
Feb 09, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services/tests: Test creating windows inside non-interactive service.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
af4294a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletion
+66
-1
Makefile.in
programs/services/tests/Makefile.in
+1
-1
service.c
programs/services/tests/service.c
+65
-0
No files found.
programs/services/tests/Makefile.in
View file @
2c242728
TESTDLL
=
services.exe
IMPORTS
=
advapi32
IMPORTS
=
user32
advapi32
C_SRCS
=
\
service.c
programs/services/tests/service.c
View file @
2c242728
...
...
@@ -19,6 +19,8 @@
#include <windef.h>
#include <winsvc.h>
#include <stdio.h>
#include <winbase.h>
#include <winuser.h>
#include "wine/test.h"
...
...
@@ -62,6 +64,67 @@ static void service_ok(int cnd, const char *msg, ...)
send_msg
(
cnd
?
"OK"
:
"FAIL"
,
buf
);
}
static
void
test_winstation
(
void
)
{
HWINSTA
winstation
;
USEROBJECTFLAGS
flags
;
BOOL
r
;
winstation
=
GetProcessWindowStation
();
service_ok
(
winstation
!=
NULL
,
"winstation = NULL
\n
"
);
r
=
GetUserObjectInformationA
(
winstation
,
UOI_FLAGS
,
&
flags
,
sizeof
(
flags
),
NULL
);
service_ok
(
r
,
"GetUserObjectInformation(UOI_NAME) failed: %u
\n
"
,
GetLastError
());
service_ok
(
!
(
flags
.
dwFlags
&
WSF_VISIBLE
),
"winstation has flags %x
\n
"
,
flags
.
dwFlags
);
}
/*
* Test creating window in a service process. Although services run in non-interactive,
* they may create windows that will never be visible.
*/
static
void
test_create_window
(
void
)
{
DWORD
style
;
ATOM
class
;
HWND
hwnd
;
BOOL
r
;
static
WNDCLASSEXA
wndclass
=
{
sizeof
(
WNDCLASSEXA
),
0
,
DefWindowProcA
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
"service_test"
,
NULL
};
hwnd
=
GetDesktopWindow
();
service_ok
(
IsWindow
(
hwnd
),
"GetDesktopWindow returned invalid window %p
\n
"
,
hwnd
);
class
=
RegisterClassExA
(
&
wndclass
);
service_ok
(
class
,
"RegisterClassFailed
\n
"
);
hwnd
=
CreateWindowA
(
"service_test"
,
"service_test"
,
WS_OVERLAPPEDWINDOW
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
515
,
530
,
NULL
,
NULL
,
NULL
,
NULL
);
service_ok
(
hwnd
!=
NULL
,
"CreateWindow failed: %u
\n
"
,
GetLastError
());
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
service_ok
(
!
(
style
&
WS_VISIBLE
),
"style = %x, expected invisible
\n
"
,
style
);
r
=
ShowWindow
(
hwnd
,
SW_SHOW
);
service_ok
(
!
r
,
"ShowWindow returned %x
\n
"
,
r
);
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
service_ok
(
style
&
WS_VISIBLE
,
"style = %x, expected visible
\n
"
,
style
);
r
=
ShowWindow
(
hwnd
,
SW_SHOW
);
service_ok
(
r
,
"ShowWindow returned %x
\n
"
,
r
);
r
=
DestroyWindow
(
hwnd
);
service_ok
(
r
,
"DestroyWindow failed: %08x
\n
"
,
GetLastError
());
}
static
DWORD
WINAPI
service_handler
(
DWORD
ctrl
,
DWORD
event_type
,
void
*
event_data
,
void
*
context
)
{
SERVICE_STATUS
status
;
...
...
@@ -84,6 +147,8 @@ static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_da
SetEvent
(
service_stop_event
);
return
NO_ERROR
;
case
128
:
test_winstation
();
test_create_window
();
service_event
(
"CUSTOM"
);
return
0xdeadbeef
;
default:
...
...
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