2021-10-12 15:33:30 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2021 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2021-12-10 02:06:58 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
|
2021-10-12 15:33:30 +02:00
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "ntuser.h"
|
|
|
|
|
|
|
|
|
2021-12-10 02:06:58 +01:00
|
|
|
static void test_NtUserEnumDisplayDevices(void)
|
|
|
|
{
|
|
|
|
NTSTATUS ret;
|
|
|
|
DISPLAY_DEVICEW info = { sizeof(DISPLAY_DEVICEW) };
|
|
|
|
|
|
|
|
SetLastError( 0xdeadbeef );
|
|
|
|
ret = NtUserEnumDisplayDevices( NULL, 0, &info, 0 );
|
2021-12-10 02:06:59 +01:00
|
|
|
ok( !ret && GetLastError() == 0xdeadbeef,
|
|
|
|
"NtUserEnumDisplayDevices returned %x %u\n", ret, GetLastError() );
|
2021-12-10 02:06:58 +01:00
|
|
|
|
|
|
|
SetLastError( 0xdeadbeef );
|
|
|
|
ret = NtUserEnumDisplayDevices( NULL, 12345, &info, 0 );
|
2021-12-10 02:06:59 +01:00
|
|
|
ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
|
2021-12-10 02:06:58 +01:00
|
|
|
"NtUserEnumDisplayDevices returned %x %u\n", ret,
|
|
|
|
GetLastError() );
|
|
|
|
|
|
|
|
info.cb = 0;
|
|
|
|
|
|
|
|
SetLastError( 0xdeadbeef );
|
|
|
|
ret = NtUserEnumDisplayDevices( NULL, 0, &info, 0 );
|
|
|
|
todo_wine ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
|
|
|
|
"NtUserEnumDisplayDevices returned %x %u\n", ret,
|
|
|
|
GetLastError() );
|
|
|
|
|
|
|
|
SetLastError( 0xdeadbeef );
|
|
|
|
ret = NtUserEnumDisplayDevices( NULL, 12345, &info, 0 );
|
2021-12-10 02:06:59 +01:00
|
|
|
ok( ret == STATUS_UNSUCCESSFUL && GetLastError() == 0xdeadbeef,
|
2021-12-10 02:06:58 +01:00
|
|
|
"NtUserEnumDisplayDevices returned %x %u\n", ret,
|
|
|
|
GetLastError() );
|
|
|
|
}
|
|
|
|
|
2021-10-12 15:33:30 +02:00
|
|
|
static void test_NtUserCloseWindowStation(void)
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
SetLastError( 0xdeadbeef );
|
|
|
|
ret = NtUserCloseWindowStation( 0 );
|
|
|
|
ok( !ret && GetLastError() == ERROR_INVALID_HANDLE,
|
|
|
|
"NtUserCloseWindowStation returned %x %u\n", ret, GetLastError() );
|
|
|
|
}
|
|
|
|
|
2021-11-08 14:48:37 +01:00
|
|
|
static void test_window_props(void)
|
|
|
|
{
|
|
|
|
HANDLE prop;
|
|
|
|
ATOM atom;
|
|
|
|
HWND hwnd;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
hwnd = CreateWindowExA( 0, "static", NULL, WS_POPUP, 0,0,0,0,0,0,0, NULL );
|
|
|
|
|
|
|
|
atom = GlobalAddAtomW( L"test" );
|
|
|
|
|
|
|
|
ret = NtUserSetProp( hwnd, UlongToPtr(atom), UlongToHandle(0xdeadbeef) );
|
|
|
|
ok( ret, "NtUserSetProp failed: %u\n", GetLastError() );
|
|
|
|
|
|
|
|
prop = GetPropW( hwnd, L"test" );
|
|
|
|
ok( prop == UlongToHandle(0xdeadbeef), "prop = %p\n", prop );
|
|
|
|
|
2021-11-08 14:48:45 +01:00
|
|
|
prop = NtUserGetProp( hwnd, UlongToPtr(atom) );
|
|
|
|
ok( prop == UlongToHandle(0xdeadbeef), "prop = %p\n", prop );
|
|
|
|
|
2021-11-08 14:48:55 +01:00
|
|
|
prop = NtUserRemoveProp( hwnd, UlongToPtr(atom) );
|
|
|
|
ok( prop == UlongToHandle(0xdeadbeef), "prop = %p\n", prop );
|
|
|
|
|
|
|
|
prop = GetPropW(hwnd, L"test");
|
|
|
|
ok(!prop, "prop = %p\n", prop);
|
|
|
|
|
2021-11-08 14:48:37 +01:00
|
|
|
GlobalDeleteAtom( atom );
|
|
|
|
DestroyWindow( hwnd );
|
|
|
|
}
|
2021-10-12 15:33:30 +02:00
|
|
|
|
|
|
|
START_TEST(win32u)
|
|
|
|
{
|
|
|
|
/* native win32u.dll fails if user32 is not loaded, so make sure it's fully initialized */
|
|
|
|
GetDesktopWindow();
|
|
|
|
|
2021-12-10 02:06:58 +01:00
|
|
|
test_NtUserEnumDisplayDevices(); /* Must run before test_NtUserCloseWindowStation. */
|
2021-10-12 15:33:30 +02:00
|
|
|
test_NtUserCloseWindowStation();
|
2021-11-08 14:48:37 +01:00
|
|
|
test_window_props();
|
2021-10-12 15:33:30 +02:00
|
|
|
}
|