Alexandre Julliard : explorer: Store the graphics driver name for the desktop in the registry.

Alexandre Julliard julliard at winehq.org
Tue Oct 22 13:30:42 CDT 2013


Module: wine
Branch: master
Commit: a6c7f6a4bad1c4eed36c2f061265980186e8eea2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a6c7f6a4bad1c4eed36c2f061265980186e8eea2

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 22 16:14:36 2013 +0200

explorer: Store the graphics driver name for the desktop in the registry.

---

 programs/explorer/desktop.c |   42 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index 3ea3e60..d85483c 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -633,24 +633,49 @@ static BOOL get_default_desktop_size( const WCHAR *name, unsigned int *width, un
     return found;
 }
 
-static void initialize_display_settings( HWND desktop )
+static void set_desktop_guid( HWND desktop, HMODULE driver )
 {
     static const WCHAR display_device_guid_propW[] = {
         '_','_','w','i','n','e','_','d','i','s','p','l','a','y','_',
         'd','e','v','i','c','e','_','g','u','i','d',0 };
+    static const WCHAR device_keyW[] = {
+        'S','y','s','t','e','m','\\',
+        'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+        'C','o','n','t','r','o','l','\\',
+        'V','i','d','e','o','\\',
+        '{','%','s','}','\\','0','0','0','0',0};
+    static const WCHAR driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0};
+
     GUID guid;
-    RPC_CSTR guid_str;
+    RPC_WSTR guid_str;
     ATOM guid_atom;
-    DEVMODEW dmW;
+    HKEY hkey;
+    WCHAR key[sizeof(device_keyW)/sizeof(WCHAR) + 39];
 
     UuidCreate( &guid );
-    UuidToStringA( &guid, &guid_str );
-    WINE_TRACE( "display guid %s\n", guid_str );
+    UuidToStringW( &guid, &guid_str );
+    TRACE( "display guid %s\n", debugstr_w(guid_str) );
 
-    guid_atom = GlobalAddAtomA( (LPCSTR)guid_str );
+    guid_atom = GlobalAddAtomW( guid_str );
     SetPropW( desktop, display_device_guid_propW, ULongToHandle(guid_atom) );
+    sprintfW( key, device_keyW, guid_str );
+    RpcStringFreeW( &guid_str );
 
-    RpcStringFreeA( &guid_str );
+    if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, key, 0, NULL,
+                          REG_OPTION_VOLATILE, KEY_SET_VALUE, NULL, &hkey, NULL  ))
+    {
+        WCHAR path[MAX_PATH];
+
+        GetModuleFileNameW( driver, path, MAX_PATH );
+        RegSetValueExW( hkey, driverW, 0, REG_SZ, (BYTE *)path, (strlenW(path) + 1) * sizeof(WCHAR) );
+        RegCloseKey( hkey );
+    }
+    else ERR( "failed to create %s\n", debugstr_w(key) );
+}
+
+static void initialize_display_settings(void)
+{
+    DEVMODEW dmW;
 
     /* Store current display mode in the registry */
     if (EnumDisplaySettingsExW( NULL, ENUM_CURRENT_SETTINGS, &dmW, 0 ))
@@ -760,6 +785,7 @@ void manage_desktop( WCHAR *arg )
         ReleaseDC( hwnd, hdc );
 
         SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)desktop_wnd_proc );
+        set_desktop_guid( hwnd, graphics_driver );
         SendMessageW( hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW( 0, MAKEINTRESOURCEW(OIC_WINLOGO)));
         if (name) set_desktop_window_title( hwnd, name );
         SetWindowPos( hwnd, 0, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN),
@@ -767,7 +793,7 @@ void manage_desktop( WCHAR *arg )
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW );
         SystemParametersInfoW( SPI_SETDESKWALLPAPER, 0, NULL, FALSE );
         ClipCursor( NULL );
-        initialize_display_settings( hwnd );
+        initialize_display_settings();
         initialize_appbar();
         initialize_systray( graphics_driver, using_root );
         if (!using_root) initialize_launchers( hwnd );




More information about the wine-cvs mailing list