From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/tests/win32u.c | 16 ++++++++++++++-- server/atom.c | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index acbc5bc3034..ac044c30f83 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -341,6 +341,17 @@ static void test_class(void) "NtUserGetAtomName returned %lx %lu\n", ret, GetLastError() ); ok( buf[0] == 0xcccc, "buf = %s\n", debugstr_w(buf) );
+ status = NtQueryInformationAtom( 0xc000, AtomBasicInformation, abi, sizeof(abi_buf), NULL ); + ok( status == STATUS_INVALID_HANDLE, "NtQueryInformationAtom returned %#lx\n", status ); + + memset( buf, 0xcc, sizeof(buf) ); + name.Buffer = buf; + name.Length = 0xdead; + name.MaximumLength = sizeof(buf); + ret = NtUserGetAtomName( 0xc000, &name ); + ok( !ret && GetLastError() == ERROR_INVALID_HANDLE, + "NtUserGetAtomName returned %lx %lu\n", ret, GetLastError() ); + for (int i = 0; i < ARRAY_SIZE(global_atoms); i++) { winetest_push_context( "%#x: %s", global_atoms[i].atom, debugstr_w(global_atoms[i].name) ); @@ -354,6 +365,7 @@ static void test_class(void) name.Length = 0xdead; name.MaximumLength = sizeof(buf); ret = NtUserGetAtomName( global_atoms[i].atom, &name ); + todo_wine_if( i == 0 || i == 8 || i == 11 ) ok( ret != wcslen( global_atoms[i].name ), "NtUserGetAtomName returned %lu\n", ret ); ok( name.Length == 0xdead, "Length = %u\n", name.Length ); ok( name.MaximumLength == sizeof(buf), "MaximumLength = %u\n", name.MaximumLength ); @@ -381,7 +393,7 @@ static void test_class(void) win_skip( "Skipping user atoms check on W11\n" ); break; } - todo_wine_if( i != 0 && i != 2 && i != 6 ) + todo_wine_if( i != 6 && i != 12 ) ok( ret == wcslen( user_atoms[i].name ), "NtUserGetAtomName returned %lu\n", ret ); ok( name.Length == 0xdead, "Length = %u\n", name.Length ); ok( name.MaximumLength == sizeof(buf), "MaximumLength = %u\n", name.MaximumLength ); @@ -392,7 +404,7 @@ static void test_class(void) CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 0, NULL, 0 ); if (!user_atoms[i].class) { - todo_wine_if( i < 9 ) ok( !hwnd, "CreateWindowW succeeded\n" ); + todo_wine_if( i < 10 ) ok( !hwnd, "CreateWindowW succeeded\n" ); todo_wine ok( GetLastError() == ERROR_CANNOT_FIND_WND_CLASS, "got error %lu\n", GetLastError() ); if (hwnd) DestroyWindow( hwnd ); } diff --git a/server/atom.c b/server/atom.c index 7c58f286b31..70e454d3cc3 100644 --- a/server/atom.c +++ b/server/atom.c @@ -115,7 +115,7 @@ static struct atom_table *create_table(int entries_count) } memset( table->atoms, 0, sizeof(*table->atoms) * ARRAY_SIZE(table->atoms) ); memset( table->entries, 0, sizeof(*table->entries) * table->entries_count ); - table->count = 0; + table->count = 1; /* atom 0xc000 is reserved */ return table; fail: release_object( table ); @@ -138,7 +138,7 @@ static struct atom_entry *get_atom_entry( struct atom_table *table, atom_t atom static atom_t add_atom_entry( struct atom_table *table, struct atom_entry *entry ) { int i; - for (i = 0; i < table->count; i++) if (!table->atoms[i]) break; + for (i = 1 /* atom 0xc000 is reserved */; i < table->count; i++) if (!table->atoms[i]) break; if (i == ARRAY_SIZE(table->atoms)) return 0; if (i == table->count) table->count++; table->atoms[i] = entry;