2 * Copyright 2019 Jacek Caban for CodeWeavers
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.
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.
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
21 #include "wine/test.h"
23 static LRESULT WINAPI
test_proc(HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
)
25 ok(msg
== 1, "msg = %u\n", msg
);
26 ok(wparam
== 2, "wparam = %lu\n", wparam
);
27 ok(lparam
== 3, "lparam = %lu\n", lparam
);
28 return (LRESULT
)hwnd
| 0x1000;
31 static void test_thunk_proc(void)
33 AtlThunkData_t
*thunks
[513];
38 for(i
=0; i
< ARRAY_SIZE(thunks
); i
++)
40 thunks
[i
] = AtlThunk_AllocateData();
41 ok(thunks
[i
] != NULL
, "thunk = NULL\n");
43 AtlThunk_InitData(thunks
[i
], test_proc
, i
);
46 for(i
=0; i
< ARRAY_SIZE(thunks
); i
++)
48 thunk_proc
= AtlThunk_DataToCode(thunks
[i
]);
49 ok(thunk_proc
!= NULL
, "thunk_proc = NULL\n");
51 res
= thunk_proc((HWND
)0x1234, 1, 2, 3);
52 ok(res
== (i
| 0x1000), "res = %lu\n", res
);
55 for(i
=0; i
< ARRAY_SIZE(thunks
); i
++)
56 AtlThunk_FreeData(thunks
[i
]);