From: Rémi Bernon rbernon@codeweavers.com
--- programs/explorer/appbar.c | 5 ++- programs/explorer/desktop.c | 66 ++++++++++-------------------------- programs/explorer/explorer.c | 23 ++++++------- programs/explorer/systray.c | 5 ++- 4 files changed, 31 insertions(+), 68 deletions(-)
diff --git a/programs/explorer/appbar.c b/programs/explorer/appbar.c index af2ede55ba3..18b125257ee 100644 --- a/programs/explorer/appbar.c +++ b/programs/explorer/appbar.c @@ -288,14 +288,13 @@ static LRESULT CALLBACK appbar_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARA void initialize_appbar(void) { WNDCLASSEXW class; - static const WCHAR classname[] = {'W','i','n','e','A','p','p','B','a','r',0};
/* register the appbar window class */ ZeroMemory(&class, sizeof(class)); class.cbSize = sizeof(class); class.lpfnWndProc = appbar_wndproc; class.hInstance = NULL; - class.lpszClassName = classname; + class.lpszClassName = L"WineAppBar";
if (!RegisterClassExW(&class)) { @@ -303,7 +302,7 @@ void initialize_appbar(void) return; }
- appbarmsg_window = CreateWindowW(classname, classname, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); + appbarmsg_window = CreateWindowW(class.lpszClassName, class.lpszClassName, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); if (!appbarmsg_window) { ERR( "Could not create appbar message window\n" ); diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 6a9724a6a2d..9945f689313 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -276,12 +276,6 @@ static void draw_launchers( HDC hdc, RECT update_rect ) SetBkMode( hdc, mode ); }
-static void do_launch( const struct launcher *launcher ) -{ - static const WCHAR openW[] = {'o','p','e','n',0}; - ShellExecuteW( NULL, openW, launcher->path, NULL, NULL, 0 ); -} - static WCHAR *append_path( const WCHAR *path, const WCHAR *filename, int len_filename ) { int len_path = lstrlenW( path ); @@ -547,7 +541,7 @@ error:
static void add_folder( const WCHAR *folder ) { - static const WCHAR lnkW[] = {'\','*','.','l','n','k',0}; + static const WCHAR lnkW[] = L"\*.lnk"; int len = lstrlenW( folder ) + lstrlenW( lnkW ); WIN32_FIND_DATAW data; HANDLE handle; @@ -747,7 +741,7 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR if (!using_root) { const struct launcher *launcher = launcher_from_point( (short)LOWORD(lp), (short)HIWORD(lp) ); - if (launcher) do_launch( launcher ); + if (launcher) ShellExecuteW( NULL, L"open", launcher->path, NULL, NULL, 0 ); } return 0;
@@ -784,10 +778,6 @@ static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *he /* retrieve the desktop name to use if not specified on the command line */ static const WCHAR *get_default_desktop_name(void) { - static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0}; - static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',0}; - static const WCHAR explorer_keyW[] = {'S','o','f','t','w','a','r','e','\','W','i','n','e','\', - 'E','x','p','l','o','r','e','r',0}; static WCHAR buffer[MAX_PATH]; DWORD size = sizeof(buffer); HDESK desk = GetThreadDesktop( GetCurrentThreadId() ); @@ -796,13 +786,13 @@ static const WCHAR *get_default_desktop_name(void)
if (desk && GetUserObjectInformationW( desk, UOI_NAME, buffer, ARRAY_SIZE( buffer ), NULL )) { - if (wcsicmp( buffer, defaultW )) return buffer; + if (wcsicmp( buffer, L"Default" )) return buffer; }
/* @@ Wine registry key: HKCU\Software\Wine\Explorer */ - if (!RegOpenKeyW( HKEY_CURRENT_USER, explorer_keyW, &hkey )) + if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Software\Wine\Explorer", &hkey )) { - if (!RegQueryValueExW( hkey, desktopW, 0, NULL, (LPBYTE)buffer, &size ) && *buffer) ret = buffer; + if (!RegQueryValueExW( hkey, L"Desktop", 0, NULL, (LPBYTE)buffer, &size ) && *buffer) ret = buffer; RegCloseKey( hkey ); } return ret; @@ -811,9 +801,6 @@ static const WCHAR *get_default_desktop_name(void) /* retrieve the default desktop size from the registry */ static BOOL get_default_desktop_size( const WCHAR *name, unsigned int *width, unsigned int *height ) { - static const WCHAR desktop_keyW[] = {'S','o','f','t','w','a','r','e','\','W','i','n','e','\', - 'E','x','p','l','o','r','e','r','\', - 'D','e','s','k','t','o','p','s',0}; HKEY hkey; WCHAR buffer[64]; DWORD size = sizeof(buffer); @@ -823,7 +810,7 @@ static BOOL get_default_desktop_size( const WCHAR *name, unsigned int *width, un *height = 600;
/* @@ Wine registry key: HKCU\Software\Wine\Explorer\Desktops */ - if (!RegOpenKeyW( HKEY_CURRENT_USER, desktop_keyW, &hkey )) + if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Software\Wine\Explorer\Desktops", &hkey )) { if (!RegQueryValueExW( hkey, name, 0, NULL, (LPBYTE)buffer, &size )) { @@ -837,44 +824,26 @@ static BOOL get_default_desktop_size( const WCHAR *name, unsigned int *width, un
static BOOL get_default_enable_shell( const WCHAR *name ) { - static const WCHAR desktop_keyW[] = {'S','o','f','t','w','a','r','e','\','W','i','n','e','\', - 'E','x','p','l','o','r','e','r','\', - 'D','e','s','k','t','o','p','s',0}; - static const WCHAR enable_shellW[] = {'E','n','a','b','l','e','S','h','e','l','l',0}; - static const WCHAR shellW[] = {'s','h','e','l','l',0}; HKEY hkey; BOOL found = FALSE; BOOL result; DWORD size = sizeof(result);
/* @@ Wine registry key: HKCU\Software\Wine\Explorer\Desktops */ - if (!RegOpenKeyW( HKEY_CURRENT_USER, desktop_keyW, &hkey )) + if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Software\Wine\Explorer\Desktops", &hkey )) { - if (!RegGetValueW( hkey, name, enable_shellW, RRF_RT_REG_DWORD, NULL, &result, &size )) + if (!RegGetValueW( hkey, name, L"EnableShell", RRF_RT_REG_DWORD, NULL, &result, &size )) found = TRUE; RegCloseKey( hkey ); } /* Default off, except for the magic desktop name "shell" */ - if (!found) - result = (lstrcmpiW( name, shellW ) == 0); + if (!found) result = (lstrcmpiW( name, L"shell" ) == 0); return result; }
static HMODULE load_graphics_driver( const WCHAR *driver, GUID *guid ) { - 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','\', - '{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-', - '%','0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x','%','0','2','x', - '%','0','2','x','%','0','2','x','%','0','2','x','}','\','0','0','0','0',0}; - static const WCHAR graphics_driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0}; - static const WCHAR driversW[] = {'S','o','f','t','w','a','r','e','\', - 'W','i','n','e','\','D','r','i','v','e','r','s',0}; - static const WCHAR graphicsW[] = {'G','r','a','p','h','i','c','s',0}; - static const WCHAR drv_formatW[] = {'w','i','n','e','%','s','.','d','r','v',0}; + static const WCHAR device_keyW[] = L"System\CurrentControlSet\Control\Video\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\0000";
WCHAR buffer[MAX_PATH], libname[32], *name, *next; WCHAR key[ARRAY_SIZE( device_keyW ) + 39]; @@ -888,10 +857,10 @@ static HMODULE load_graphics_driver( const WCHAR *driver, GUID *guid ) lstrcpyW( buffer, default_driver );
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */ - if (!RegOpenKeyW( HKEY_CURRENT_USER, driversW, &hkey )) + if (!RegOpenKeyW( HKEY_CURRENT_USER, L"Software\Wine\Drivers", &hkey )) { DWORD count = sizeof(buffer); - RegQueryValueExW( hkey, graphicsW, 0, NULL, (LPBYTE)buffer, &count ); + RegQueryValueExW( hkey, L"Graphics", 0, NULL, (LPBYTE)buffer, &count ); RegCloseKey( hkey ); } } @@ -912,7 +881,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, GUID *guid ) break; }
- swprintf( libname, ARRAY_SIZE( libname ), drv_formatW, name ); + swprintf( libname, ARRAY_SIZE( libname ), L"wine%s.drv", name ); if ((module = LoadLibraryW( libname )) != 0) break; switch (GetLastError()) { @@ -939,7 +908,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, GUID *guid ) REG_OPTION_VOLATILE, KEY_SET_VALUE, NULL, &hkey, NULL )) { if (module || null_driver) - RegSetValueExW( hkey, graphics_driverW, 0, REG_SZ, + RegSetValueExW( hkey, L"GraphicsDriver", 0, REG_SZ, (BYTE *)libname, (lstrlenW(libname) + 1) * sizeof(WCHAR) ); else RegSetValueExA( hkey, "DriverError", 0, REG_SZ, (BYTE *)error, strlen(error) + 1 ); @@ -979,8 +948,8 @@ static void initialize_display_settings(void)
static void set_desktop_window_title( HWND hwnd, const WCHAR *name ) { - static const WCHAR desktop_nameW[] = {'W','i','n','e',' ','d','e','s','k','t','o','p',0}; - static const WCHAR desktop_name_separatorW[] = {' ', '-', ' ', 0}; + static const WCHAR desktop_nameW[] = L"Wine desktop"; + static const WCHAR desktop_name_separatorW[] = L" - "; WCHAR *window_titleW = NULL; int window_title_len;
@@ -1016,7 +985,6 @@ static inline BOOL is_whitespace(WCHAR c) /* main desktop management function */ void manage_desktop( WCHAR *arg ) { - static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0}; HDESK desktop = 0; GUID guid; MSG msg; @@ -1088,7 +1056,7 @@ void manage_desktop( WCHAR *arg ) if (hwnd) { /* create the HWND_MESSAGE parent */ - CreateWindowExW( 0, messageW, NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + CreateWindowExW( 0, L"Message", NULL, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 100, 100, 0, 0, 0, NULL );
desktop_orig_wndproc = (WNDPROC)SetWindowLongPtrW( hwnd, GWLP_WNDPROC, diff --git a/programs/explorer/explorer.c b/programs/explorer/explorer.c index 66636d374ff..879fda42135 100644 --- a/programs/explorer/explorer.c +++ b/programs/explorer/explorer.c @@ -50,9 +50,6 @@ static int default_width; static int default_height;
-static const WCHAR EXPLORER_CLASS[] = {'E','x','p','l','o','r','e','r','W','C','l','a','s','s',0}; -static const WCHAR PATH_BOX_NAME[] = {'\0'}; - HINSTANCE explorer_hInstance;
typedef struct parametersTAG { @@ -462,7 +459,7 @@ static void make_explorer_window(parameters_struct *params) } info->rebar_height=0; info->main_window - = CreateWindowW(EXPLORER_CLASS,explorer_title,WS_OVERLAPPEDWINDOW, + = CreateWindowW(L"ExplorerWClass",explorer_title,WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT,default_width, default_height,NULL,NULL,explorer_hInstance,NULL);
@@ -519,7 +516,7 @@ static void make_explorer_window(parameters_struct *params) band_info.cyMinChild=nav_toolbar_height; band_info.cxMinChild=0; SendMessageW(rebar,RB_INSERTBANDW,-1,(LPARAM)&band_info); - info->path_box = CreateWindowW(WC_COMBOBOXEXW,PATH_BOX_NAME, + info->path_box = CreateWindowW(WC_COMBOBOXEXW,L"", WS_CHILD | WS_VISIBLE | CBS_DROPDOWN, 0,0,default_width,pathbox_height,rebar,NULL, explorer_hInstance,NULL); @@ -771,7 +768,7 @@ static void register_explorer_window_class(void) window_class.hCursor = NULL; window_class.hbrBackground = (HBRUSH)COLOR_BACKGROUND; window_class.lpszMenuName = NULL; - window_class.lpszClassName = EXPLORER_CLASS; + window_class.lpszClassName = L"ExplorerWClass"; window_class.hIconSm = NULL; RegisterClassExW(&window_class); } @@ -834,13 +831,13 @@ static void copy_path_root(LPWSTR root, LPWSTR path) */ static void parse_command_line(LPWSTR commandline,parameters_struct *parameters) { - static const WCHAR arg_n[] = {'/','n'}; - static const WCHAR arg_e[] = {'/','e',','}; - static const WCHAR arg_cd[] = {'/','c','d',','}; - static const WCHAR arg_root[] = {'/','r','o','o','t',','}; - static const WCHAR arg_select[] = {'/','s','e','l','e','c','t',','}; - static const WCHAR arg_desktop[] = {'/','d','e','s','k','t','o','p'}; - static const WCHAR arg_desktop_quotes[] = {'"','/','d','e','s','k','t','o','p'}; + static const WCHAR arg_n[] = L"/n"; + static const WCHAR arg_e[] = L"/e,"; + static const WCHAR arg_cd[] = L"/cd,"; + static const WCHAR arg_root[] = L"/root,"; + static const WCHAR arg_select[] = L"/select,"; + static const WCHAR arg_desktop[] = L"/desktop"; + static const WCHAR arg_desktop_quotes[] = L""/desktop";
LPWSTR p = commandline;
diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 7be26f4026f..6253b65cf35 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -892,7 +892,6 @@ void handle_parent_notify( HWND hwnd, WPARAM wp ) void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enable_shell ) { WNDCLASSEXW class; - static const WCHAR classname[] = {'S','h','e','l','l','_','T','r','a','y','W','n','d',0}; RECT work_rect, primary_rect, taskbar_rect;
if (using_root && graphics_driver) wine_notify_icon = (void *)GetProcAddress( graphics_driver, "wine_notify_icon" ); @@ -911,7 +910,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab class.hIcon = LoadIconW(0, (LPCWSTR)IDI_WINLOGO); class.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW); class.hbrBackground = (HBRUSH) COLOR_WINDOW; - class.lpszClassName = classname; + class.lpszClassName = L"Shell_TrayWnd";
if (!RegisterClassExW(&class)) { @@ -923,7 +922,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab SetRect( &primary_rect, 0, 0, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ) ); SubtractRect( &taskbar_rect, &primary_rect, &work_rect );
- tray_window = CreateWindowExW( WS_EX_NOACTIVATE, classname, NULL, WS_POPUP, taskbar_rect.left, + tray_window = CreateWindowExW( WS_EX_NOACTIVATE, class.lpszClassName, NULL, WS_POPUP, taskbar_rect.left, taskbar_rect.top, taskbar_rect.right - taskbar_rect.left, taskbar_rect.bottom - taskbar_rect.top, 0, 0, 0, 0 ); if (!tray_window)