From: Rémi Bernon rbernon@codeweavers.com
--- dlls/user32/tests/class.c | 6 +++--- server/atom.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index 76adaa1ce0b..0950b9f173a 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -2218,7 +2218,7 @@ static void test_actctx_classes(void) tmp_hwnd = FindWindowExA( NULL, NULL, MAKEINTRESOURCEA( class ), NULL ); todo_wine ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); tmp_hwnd = FindWindowExA( NULL, NULL, wc_integral.lpszClassName, NULL ); - todo_wine ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); + ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); tmp_hwnd = FindWindowExA(NULL, NULL, wc_integral_versioned.lpszClassName, NULL); ok( tmp_hwnd == NULL, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() );
@@ -2228,7 +2228,7 @@ static void test_actctx_classes(void) tmp_hwnd = FindWindowExA( NULL, NULL, MAKEINTRESOURCEA( class ), NULL ); todo_wine ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); tmp_hwnd = FindWindowExA( NULL, NULL, wc_integral.lpszClassName, NULL ); - todo_wine ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); + ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); tmp_hwnd = FindWindowExA(NULL, NULL, wc_integral_versioned.lpszClassName, NULL); ok( tmp_hwnd == NULL, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); DestroyWindow( hwnd ); @@ -2238,7 +2238,7 @@ static void test_actctx_classes(void) tmp_hwnd = FindWindowExA( NULL, NULL, MAKEINTRESOURCEA( class ), NULL ); todo_wine ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); tmp_hwnd = FindWindowExA( NULL, NULL, wc_integral.lpszClassName, NULL ); - todo_wine ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); + ok( tmp_hwnd == hwnd, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); tmp_hwnd = FindWindowExA( NULL, NULL, wc_integral_versioned.lpszClassName, NULL ); ok( tmp_hwnd == NULL, "FindWindowExA returned %p, error %lu\n", tmp_hwnd, GetLastError() ); DestroyWindow( hwnd ); diff --git a/server/atom.c b/server/atom.c index f3b0d1abffb..dcb3d275db0 100644 --- a/server/atom.c +++ b/server/atom.c @@ -248,6 +248,24 @@ static void atom_table_destroy( struct object *obj ) for (i = 0; i < table->count; i++) free( table->atoms[i] ); }
+static atom_t get_int_atom_value( const struct unicode_str *name ) +{ + const WCHAR *ptr = name->str; + const WCHAR *end = ptr + name->len / sizeof(WCHAR); + unsigned int ret = 0; + + if (IS_INTRESOURCE(ptr)) return LOWORD(ptr); + + if (*ptr++ != '#') return 0; + while (ptr < end) + { + if (*ptr < '0' || *ptr > '9') return 0; + ret = ret * 10 + *ptr++ - '0'; + if (ret >= MAXINTATOM) return 0; + } + return ret; +} + /* find an atom entry in its hash list */ static struct atom_entry *find_atom_entry( struct atom_table *table, const struct unicode_str *str, unsigned short hash ) @@ -278,6 +296,7 @@ atom_t add_atom( struct atom_table *table, const struct unicode_str *str ) set_error( STATUS_INVALID_PARAMETER ); return 0; } + if ((atom = get_int_atom_value( str ))) return atom;
hash = hash_strW( str->str, str->len, ARRAY_SIZE(table->entries) ); if ((entry = find_atom_entry( table, str, hash ))) /* exists already */ @@ -328,6 +347,7 @@ atom_t find_atom( struct atom_table *table, const struct unicode_str *str ) { struct atom_entry *entry; unsigned short hash; + atom_t atom;
if (!str->len) { @@ -339,6 +359,7 @@ atom_t find_atom( struct atom_table *table, const struct unicode_str *str ) set_error( STATUS_INVALID_PARAMETER ); return 0; } + if ((atom = get_int_atom_value( str ))) return atom;
hash = hash_strW( str->str, str->len, ARRAY_SIZE(table->entries) ); if (!(entry = find_atom_entry( table, str, hash )))