Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/atlthunk/tests/atlthunk.c
4389 views
1
/*
2
* Copyright 2019 Jacek Caban for CodeWeavers
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17
*/
18
19
#include "windows.h"
20
#include "atlthunk.h"
21
#include "wine/test.h"
22
23
static LRESULT WINAPI test_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
24
{
25
ok(msg == 1, "msg = %u\n", msg);
26
ok(wparam == 2, "wparam = %Id\n", wparam);
27
ok(lparam == 3, "lparam = %Id\n", lparam);
28
return (LRESULT)hwnd | 0x1000;
29
}
30
31
static void test_thunk_proc(void)
32
{
33
AtlThunkData_t *thunks[513];
34
WNDPROC thunk_proc;
35
LRESULT res;
36
int i;
37
38
for(i=0; i < ARRAY_SIZE(thunks); i++)
39
{
40
thunks[i] = AtlThunk_AllocateData();
41
ok(thunks[i] != NULL, "thunk = NULL\n");
42
43
AtlThunk_InitData(thunks[i], test_proc, i);
44
}
45
46
for(i=0; i < ARRAY_SIZE(thunks); i++)
47
{
48
thunk_proc = AtlThunk_DataToCode(thunks[i]);
49
ok(thunk_proc != NULL, "thunk_proc = NULL\n");
50
51
res = thunk_proc((HWND)0x1234, 1, 2, 3);
52
ok(res == (i | 0x1000), "res = %Iu\n", res);
53
}
54
55
for(i=0; i < ARRAY_SIZE(thunks); i++)
56
AtlThunk_FreeData(thunks[i]);
57
}
58
59
START_TEST(atlthunk)
60
{
61
test_thunk_proc();
62
}
63
64