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
47650c33
Commit
47650c33
authored
Sep 06, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Test to show that SendMessage/PostMessage don't force caller…
user32/tests: Test to show that SendMessage/PostMessage don't force caller activation context on window thread.
parent
fef18a42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
156 additions
and
2 deletions
+156
-2
msg.c
dlls/user32/tests/msg.c
+156
-2
No files found.
dlls/user32/tests/msg.c
View file @
47650c33
...
...
@@ -60,6 +60,20 @@
#define WM_LBTRACKPOINT 0x0131
#endif
#ifdef __i386__
#define ARCH "x86"
#elif defined __x86_64__
#define ARCH "amd64"
#else
#define ARCH "none"
#endif
static
BOOL
(
WINAPI
*
pActivateActCtx
)(
HANDLE
,
ULONG_PTR
*
);
static
HANDLE
(
WINAPI
*
pCreateActCtxW
)(
PCACTCTXW
);
static
BOOL
(
WINAPI
*
pDeactivateActCtx
)(
DWORD
,
ULONG_PTR
);
static
BOOL
(
WINAPI
*
pGetCurrentActCtx
)(
HANDLE
*
);
static
void
(
WINAPI
*
pReleaseActCtx
)(
HANDLE
);
/* encoded DRAWITEMSTRUCT into an LPARAM */
typedef
struct
{
...
...
@@ -6728,9 +6742,66 @@ static DWORD CALLBACK create_child_thread( void *param )
return
0
;
}
static
const
char
manifest_dep
[]
=
"<assembly xmlns=
\"
urn:schemas-microsoft-com:asm.v1
\"
manifestVersion=
\"
1.0
\"
>"
"<assemblyIdentity version=
\"
1.2.3.4
\"
name=
\"
testdep1
\"
type=
\"
win32
\"
processorArchitecture=
\"
"
ARCH
"
\"
/>"
" <file name=
\"
testdep.dll
\"
/>"
"</assembly>"
;
static
const
char
manifest_main
[]
=
"<assembly xmlns=
\"
urn:schemas-microsoft-com:asm.v1
\"
manifestVersion=
\"
1.0
\"
>"
"<assemblyIdentity version=
\"
1.2.3.4
\"
name=
\"
Wine.Test
\"
type=
\"
win32
\"
/>"
"<dependency>"
" <dependentAssembly>"
" <assemblyIdentity type=
\"
win32
\"
name=
\"
testdep1
\"
version=
\"
1.2.3.4
\"
processorArchitecture=
\"
"
ARCH
"
\"
/>"
" </dependentAssembly>"
"</dependency>"
"</assembly>"
;
static
void
create_manifest_file
(
const
char
*
filename
,
const
char
*
manifest
)
{
WCHAR
path
[
MAX_PATH
];
HANDLE
file
;
DWORD
size
;
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
path
,
MAX_PATH
);
file
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile failed: %u
\n
"
,
GetLastError
());
WriteFile
(
file
,
manifest
,
strlen
(
manifest
),
&
size
,
NULL
);
CloseHandle
(
file
);
}
static
HANDLE
test_create
(
const
char
*
file
)
{
WCHAR
path
[
MAX_PATH
];
ACTCTXW
actctx
;
HANDLE
handle
;
MultiByteToWideChar
(
CP_ACP
,
0
,
file
,
-
1
,
path
,
MAX_PATH
);
memset
(
&
actctx
,
0
,
sizeof
(
ACTCTXW
));
actctx
.
cbSize
=
sizeof
(
ACTCTXW
);
actctx
.
lpSource
=
path
;
handle
=
pCreateActCtxW
(
&
actctx
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create context, error %u
\n
"
,
GetLastError
());
ok
(
actctx
.
cbSize
==
sizeof
(
actctx
),
"cbSize=%d
\n
"
,
actctx
.
cbSize
);
ok
(
actctx
.
dwFlags
==
0
,
"dwFlags=%d
\n
"
,
actctx
.
dwFlags
);
ok
(
actctx
.
lpSource
==
path
,
"lpSource=%p
\n
"
,
actctx
.
lpSource
);
ok
(
actctx
.
wProcessorArchitecture
==
0
,
"wProcessorArchitecture=%d
\n
"
,
actctx
.
wProcessorArchitecture
);
ok
(
actctx
.
wLangId
==
0
,
"wLangId=%d
\n
"
,
actctx
.
wLangId
);
ok
(
actctx
.
lpAssemblyDirectory
==
NULL
,
"lpAssemblyDirectory=%p
\n
"
,
actctx
.
lpAssemblyDirectory
);
ok
(
actctx
.
lpResourceName
==
NULL
,
"lpResourceName=%p
\n
"
,
actctx
.
lpResourceName
);
ok
(
actctx
.
lpApplicationName
==
NULL
,
"lpApplicationName=%p
\n
"
,
actctx
.
lpApplicationName
);
ok
(
actctx
.
hModule
==
NULL
,
"hModule=%p
\n
"
,
actctx
.
hModule
);
return
handle
;
}
static
void
test_interthread_messages
(
void
)
{
HANDLE
hThread
;
HANDLE
hThread
,
context
,
handle
,
event
;
ULONG_PTR
cookie
;
DWORD
tid
;
WNDPROC
proc
;
MSG
msg
;
...
...
@@ -6828,6 +6899,60 @@ static void test_interthread_messages(void)
ok_sequence
(
WmExitThreadSeq
,
"destroy child on thread exit"
,
FALSE
);
log_all_parent_messages
--
;
DestroyWindow
(
wnd_event
.
hwnd
);
/* activation context tests */
if
(
!
pActivateActCtx
)
{
win_skip
(
"Activation contexts are not supported, skipping
\n
"
);
return
;
}
create_manifest_file
(
"testdep1.manifest"
,
manifest_dep
);
create_manifest_file
(
"main.manifest"
,
manifest_main
);
context
=
test_create
(
"main.manifest"
);
DeleteFileA
(
"testdep1.manifest"
);
DeleteFileA
(
"main.manifest"
);
handle
=
(
void
*
)
0xdeadbeef
;
ret
=
pGetCurrentActCtx
(
&
handle
);
ok
(
ret
,
"GetCurentActCtx failed: %u
\n
"
,
GetLastError
());
ok
(
handle
==
0
,
"active context %p
\n
"
,
handle
);
wnd_event
.
start_event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
hThread
=
CreateThread
(
NULL
,
0
,
thread_proc
,
&
wnd_event
,
0
,
&
tid
);
ok
(
hThread
!=
NULL
,
"CreateThread failed, error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
wnd_event
.
start_event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
wnd_event
.
start_event
);
/* context is activated after thread creation, so it doesn't inherit it by default */
ret
=
pActivateActCtx
(
context
,
&
cookie
);
ok
(
ret
,
"activation failed: %u
\n
"
,
GetLastError
());
handle
=
0
;
ret
=
pGetCurrentActCtx
(
&
handle
);
ok
(
ret
,
"GetCurentActCtx failed: %u
\n
"
,
GetLastError
());
ok
(
handle
!=
0
,
"active context %p
\n
"
,
handle
);
/* destination window will test for active context */
ret
=
SendMessageA
(
wnd_event
.
hwnd
,
WM_USER
+
10
,
0
,
0
);
ok
(
ret
,
"thread window returned %d
\n
"
,
ret
);
event
=
CreateEventW
(
NULL
,
0
,
0
,
NULL
);
ret
=
PostMessageA
(
wnd_event
.
hwnd
,
WM_USER
+
10
,
0
,
(
LPARAM
)
event
);
ok
(
ret
,
"thread window returned %d
\n
"
,
ret
);
ok
(
WaitForSingleObject
(
event
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
event
);
ret
=
PostMessageA
(
wnd_event
.
hwnd
,
WM_QUIT
,
0
,
0
);
ok
(
ret
,
"PostMessageA(WM_QUIT) error %d
\n
"
,
GetLastError
());
ok
(
WaitForSingleObject
(
hThread
,
INFINITE
)
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed
\n
"
);
CloseHandle
(
hThread
);
ret
=
pDeactivateActCtx
(
0
,
cookie
);
ok
(
ret
,
"DeactivateActCtx failed: %u
\n
"
,
GetLastError
());
pReleaseActCtx
(
context
);
}
...
...
@@ -7463,6 +7588,19 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message,
case
WM_NCHITTEST
:
return
HTCLIENT
;
case
WM_USER
+
10
:
{
HANDLE
handle
,
event
=
(
HANDLE
)
lParam
;
BOOL
ret
;
handle
=
(
void
*
)
0xdeadbeef
;
ret
=
pGetCurrentActCtx
(
&
handle
);
ok
(
ret
,
"failed to get current context, %u
\n
"
,
GetLastError
());
ok
(
handle
==
0
,
"got active context %p
\n
"
,
handle
);
if
(
event
)
SetEvent
(
event
);
return
1
;
}
/* ignore */
case
WM_MOUSEMOVE
:
case
WM_MOUSEACTIVATE
:
...
...
@@ -14105,6 +14243,19 @@ static void test_layered_window(void)
DeleteObject
(
bmp
);
}
static
void
init_funcs
(
void
)
{
HMODULE
hKernel32
=
GetModuleHandle
(
"kernel32"
);
#define X(f) p##f = (void*)GetProcAddress(hKernel32, #f)
X
(
ActivateActCtx
);
X
(
CreateActCtxW
);
X
(
DeactivateActCtx
);
X
(
GetCurrentActCtx
);
X
(
ReleaseActCtx
);
#undef X
}
START_TEST
(
msg
)
{
char
**
test_argv
;
...
...
@@ -14112,8 +14263,11 @@ START_TEST(msg)
BOOL
(
WINAPI
*
pIsWinEventHookInstalled
)(
DWORD
)
=
0
;
/*GetProcAddress(user32, "IsWinEventHookInstalled");*/
HMODULE
hModuleImm32
;
BOOL
(
WINAPI
*
pImmDisableIME
)(
DWORD
);
int
argc
;
init_funcs
();
int
argc
=
winetest_get_mainargs
(
&
test_argv
);
argc
=
winetest_get_mainargs
(
&
test_argv
);
if
(
argc
>=
3
)
{
unsigned
int
arg
;
...
...
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