server: Support using a name to destroy a window class too.
diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 5d97823..dec82b5 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c
@@ -573,8 +573,15 @@ */ BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance ) { - ATOM atom = HIWORD(className) ? GlobalFindAtomA( className ) : LOWORD(className); - return UnregisterClassW( (LPCWSTR)MAKEINTATOM(atom), hInstance ); + if (!IS_INTRESOURCE(className)) + { + WCHAR name[MAX_ATOM_LEN + 1]; + + if (!MultiByteToWideChar( CP_ACP, 0, className, -1, name, MAX_ATOM_LEN + 1 )) + return FALSE; + return UnregisterClassW( name, hInstance ); + } + return UnregisterClassW( (LPCWSTR)className, hInstance ); } /*********************************************************************** @@ -583,20 +590,14 @@ BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance ) { CLASS *classPtr = NULL; - ATOM atom = HIWORD(className) ? GlobalFindAtomW( className ) : LOWORD(className); - TRACE("%s %p %x\n",debugstr_w(className), hInstance, atom); - - if (!atom) - { - SetLastError( ERROR_CLASS_DOES_NOT_EXIST ); - return FALSE; - } + TRACE("%s %p\n",debugstr_w(className), hInstance); SERVER_START_REQ( destroy_class ) { - req->atom = atom; req->instance = hInstance; + if (IS_INTRESOURCE(className)) req->atom = LOWORD(className); + else wine_server_add_data( req, className, strlenW(className)*sizeof(WCHAR) ); if (!wine_server_call_err( req )) classPtr = reply->client_ptr; } SERVER_END_REQ;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index da3c45b..8d1485e 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h
@@ -3609,6 +3609,7 @@ struct request_header __header; atom_t atom; void* instance; + /* VARARG(name,unicode_str); */ }; struct destroy_class_reply { @@ -4882,6 +4883,6 @@ struct set_completion_info_reply set_completion_info_reply; }; -#define SERVER_PROTOCOL_VERSION 325 +#define SERVER_PROTOCOL_VERSION 326 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/class.c b/server/class.c index ff39dc0..334542e 100644 --- a/server/class.c +++ b/server/class.c
@@ -186,9 +186,13 @@ /* destroy a window class */ DECL_HANDLER(destroy_class) { - struct window_class *class = find_class( current->process, req->atom, req->instance ); + struct window_class *class; + atom_t atom = req->atom; - if (!class) + if (get_req_data_size()) + atom = find_global_atom( NULL, get_req_data(), get_req_data_size() / sizeof(WCHAR) ); + + if (!(class = find_class( current->process, atom, req->instance ))) set_win32_error( ERROR_CLASS_DOES_NOT_EXIST ); else if (class->count) set_win32_error( ERROR_CLASS_HAS_WINDOWS );
diff --git a/server/protocol.def b/server/protocol.def index aa06bd5..f2e33ef 100644 --- a/server/protocol.def +++ b/server/protocol.def
@@ -2610,6 +2610,7 @@ @REQ(destroy_class) atom_t atom; /* class atom */ void* instance; /* module instance */ + VARARG(name,unicode_str); /* class name */ @REPLY void* client_ptr; /* pointer to class in client address space */ @END
diff --git a/server/trace.c b/server/trace.c index 3d5a3c5..a6d3ee5 100644 --- a/server/trace.c +++ b/server/trace.c
@@ -3205,7 +3205,9 @@ static void dump_destroy_class_request( const struct destroy_class_request *req ) { fprintf( stderr, " atom=%04x,", req->atom ); - fprintf( stderr, " instance=%p", req->instance ); + fprintf( stderr, " instance=%p,", req->instance ); + fprintf( stderr, " name=" ); + dump_varargs_unicode_str( cur_size ); } static void dump_destroy_class_reply( const struct destroy_class_reply *req )