diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 20:38:18 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-09 20:38:18 +0000 |
commit | 7a66b99fbf5cd967ba12e643fc0072fc20514990 (patch) | |
tree | d4bec32782951f4c63a4aca99b655222017c6002 /remoting | |
parent | decd4114476cb68ef734dd91cbea6d56c404bee5 (diff) | |
download | chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.zip chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.tar.gz chromium_src-7a66b99fbf5cd967ba12e643fc0072fc20514990.tar.bz2 |
Added base::win::InitializeWindowClass() wrapper to make sure that window classes are properly associated with the modules containing their window procedures.
TEST=win,win_rel
Review URL: https://chromiumcodereview.appspot.com/10315012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/host_service_win.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/remoting/host/host_service_win.cc b/remoting/host/host_service_win.cc index c96c6e0..77d8cc7 100644 --- a/remoting/host/host_service_win.cc +++ b/remoting/host/host_service_win.cc @@ -19,7 +19,6 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/path_service.h" -#include "base/process_util.h" #include "base/stringize_macros.h" #include "base/stringprintf.h" #include "base/threading/thread.h" @@ -255,26 +254,24 @@ int HostService::RunInConsole() { } // Create a window for receiving session change notifications. - LPCWSTR atom = NULL; HWND window = NULL; - WNDPROC window_proc = - base::win::WrappedWindowProc<SessionChangeNotificationProc>; - HINSTANCE instance = base::GetModuleFromAddress(window_proc); - - WNDCLASSEX wc = {0}; - wc.cbSize = sizeof(wc); - wc.lpfnWndProc = window_proc; - wc.hInstance = instance; - wc.lpszClassName = kSessionNotificationWindowClass; - atom = reinterpret_cast<LPCWSTR>(RegisterClassExW(&wc)); - if (atom == NULL) { + WNDCLASSEX window_class; + base::win::InitializeWindowClass( + kSessionNotificationWindowClass, + &base::win::WrappedWindowProc<SessionChangeNotificationProc>, + 0, 0, 0, NULL, NULL, NULL, NULL, NULL, + &window_class); + HINSTANCE instance = window_class.hInstance; + ATOM atom = RegisterClassExW(&window_class); + if (atom == 0) { LOG_GETLASTERROR(ERROR) << "Failed to register the window class '" << kSessionNotificationWindowClass << "'"; goto cleanup; } - window = CreateWindowW(atom, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, instance, 0); + window = CreateWindowW(MAKEINTATOM(atom), 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, + instance, 0); if (window == NULL) { LOG_GETLASTERROR(ERROR) << "Failed to creat the session notificationwindow"; @@ -302,7 +299,7 @@ cleanup: } if (atom != 0) { - UnregisterClass(atom, instance); + UnregisterClass(MAKEINTATOM(atom), instance); } // Unsubscribe from console events. Ignore the exit code. There is nothing |