/*1* Copyright 2019 Jacek Caban for CodeWeavers2*3* This library is free software; you can redistribute it and/or4* modify it under the terms of the GNU Lesser General Public5* License as published by the Free Software Foundation; either6* version 2.1 of the License, or (at your option) any later version.7*8* This library is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11* Lesser General Public License for more details.12*13* You should have received a copy of the GNU Lesser General Public14* License along with this library; if not, write to the Free Software15* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA16*/1718#include "windows.h"19#include "atlthunk.h"20#include "wine/test.h"2122static LRESULT WINAPI test_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)23{24ok(msg == 1, "msg = %u\n", msg);25ok(wparam == 2, "wparam = %Id\n", wparam);26ok(lparam == 3, "lparam = %Id\n", lparam);27return (LRESULT)hwnd | 0x1000;28}2930static void test_thunk_proc(void)31{32AtlThunkData_t *thunks[513];33WNDPROC thunk_proc;34LRESULT res;35int i;3637for(i=0; i < ARRAY_SIZE(thunks); i++)38{39thunks[i] = AtlThunk_AllocateData();40ok(thunks[i] != NULL, "thunk = NULL\n");4142AtlThunk_InitData(thunks[i], test_proc, i);43}4445for(i=0; i < ARRAY_SIZE(thunks); i++)46{47thunk_proc = AtlThunk_DataToCode(thunks[i]);48ok(thunk_proc != NULL, "thunk_proc = NULL\n");4950res = thunk_proc((HWND)0x1234, 1, 2, 3);51ok(res == (i | 0x1000), "res = %Iu\n", res);52}5354for(i=0; i < ARRAY_SIZE(thunks); i++)55AtlThunk_FreeData(thunks[i]);56}5758START_TEST(atlthunk)59{60test_thunk_proc();61}626364