1 /* 2 * PROJECT: ReactOS api tests 3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 * PURPOSE: Tests for GetClassInfo 5 * COPYRIGHT: Copyright 2023 Timo Kreuzer <timo.kreuzer@reactos.org> 6 */ 7 8 #include "precomp.h" 9 10 START_TEST(GetSetWindowInt) 11 { 12 WNDCLASSEXW wcex = { 0 }; 13 ATOM atom; 14 HWND hwnd; 15 16 wcex.cbSize = sizeof(WNDCLASSEXW); 17 wcex.style = 0x1; 18 wcex.lpfnWndProc = DefWindowProcW; 19 wcex.cbClsExtra = 1; 20 wcex.cbWndExtra = 5; 21 wcex.hInstance = GetModuleHandle(NULL); 22 wcex.lpszClassName = L"ProTestClass1"; 23 24 atom = RegisterClassExW(&wcex); 25 ok(atom != 0, "Failed to register class!\n"); 26 27 hwnd = CreateWindowW(wcex.lpszClassName, 28 L"WindowTitle", 29 WS_POPUP, 30 CW_USEDEFAULT, 31 CW_USEDEFAULT, 32 CW_USEDEFAULT, 33 CW_USEDEFAULT, 34 NULL, 35 NULL, 36 GetModuleHandle(NULL), 37 NULL); 38 ok(hwnd != 0, "\n"); 39 40 SetLastError(0xdeadbeef); 41 ok_hex(SetWindowWord(hwnd, 0, 0x1234), 0); 42 ok_hex(GetWindowWord(hwnd, 0), 0x1234); 43 ok_hex(SetWindowWord(hwnd, 1, 0x2345), 0x12); 44 ok_hex(GetWindowWord(hwnd, 1), 0x2345); 45 ok_hex(SetWindowWord(hwnd, 2, 0x3456), 0x23); 46 ok_hex(GetWindowWord(hwnd, 2), 0x3456); 47 ok_hex(SetWindowWord(hwnd, 3, 0x4567), 0x34); 48 ok_hex(GetWindowWord(hwnd, 3), 0x4567); 49 ok_err(0xdeadbeef); 50 ok_hex(SetWindowWord(hwnd, 4, 0x5678), 0); 51 ok_err(ERROR_INVALID_INDEX); 52 SetLastError(0xdeadbeef); 53 ok_hex(GetWindowWord(hwnd, 4), 0); 54 ok_err(ERROR_INVALID_INDEX); 55 56 SetLastError(0xdeadbeef); 57 ok_hex(SetWindowLong(hwnd, 0, 0x12345678), 0x67564534); 58 ok_hex(GetWindowLong(hwnd, 0), 0x12345678); 59 ok_hex(SetWindowLong(hwnd, 1, 0x23456789), 0x45123456); 60 ok_hex(GetWindowLong(hwnd, 1), 0x23456789); 61 ok_err(0xdeadbeef); 62 ok_hex(SetWindowLong(hwnd, 2, 0x3456789a), 0); 63 ok_err(ERROR_INVALID_INDEX); 64 SetLastError(0xdeadbeef); 65 ok_hex(GetWindowLong(hwnd, 2), 0); 66 ok_err(ERROR_INVALID_INDEX); 67 68 #ifdef _WIN64 69 SetLastError(0xdeadbeef); 70 ok_hex(SetWindowLongPtr(hwnd, 0, 123), 0); 71 ok_err(ERROR_INVALID_INDEX); 72 SetLastError(0xdeadbeef); 73 ok_hex(GetWindowLongPtr(hwnd, 0), 0); 74 ok_err(ERROR_INVALID_INDEX); 75 #endif 76 77 } 78