Update wine to 1.2.
[sugaredwine.git] / patches / 0022-explorer-add-Run-command-to-the-start-menu.patch
blob0c861cb8e2205cf30a5a393dd6be3233ab0166db
1 From 80d556b051e9f76c797031620f0c6c3bfd4e751b Mon Sep 17 00:00:00 2001
2 From: Vincent Povirk <vincent@codeweavers.com>
3 Date: Tue, 21 Oct 2008 13:22:53 -0500
4 Subject: [PATCH] explorer: add Run command to the start menu
6 ---
7 programs/explorer/startmenu.c | 26 +++++++++++++++++++++++++-
8 1 files changed, 25 insertions(+), 1 deletions(-)
10 diff --git a/programs/explorer/startmenu.c b/programs/explorer/startmenu.c
11 index fcf9935..a9d6a05 100644
12 --- a/programs/explorer/startmenu.c
13 +++ b/programs/explorer/startmenu.c
14 @@ -399,6 +399,20 @@ static void exit_windows()
15 ExitWindows(0, 0);
18 +static void run_dialog()
20 + void WINAPI (*pRunFileDlg)(HWND hWndOwner, HICON hIcon, LPCSTR lpszDir,
21 + LPCSTR lpszTitle, LPCSTR lpszDesc, DWORD dwFlags);
22 + HMODULE hShell32;
24 + hShell32 = LoadLibraryA("shell32");
25 + pRunFileDlg = (void*)GetProcAddress(hShell32, (LPCSTR)61);
27 + pRunFileDlg(NULL, NULL, NULL, NULL, NULL, 0);
29 + FreeLibrary(hShell32);
32 static void destroy_menus()
34 if (!topmenu)
35 @@ -515,7 +529,8 @@ void do_startmenu(HWND hwnd, HWND button)
36 RECT rc={0,0,0,0};
37 TPMPARAMS tpm;
38 static WCHAR Exit[] = {'E','x','i','t',0};
39 - LPWSTR exit_str;
40 + static WCHAR Run[] = {'R','u','n','.','.','.',0};
41 + LPWSTR exit_str, run_str;
43 /* FIXME: Our existing menu is never destroyed if the user makes no
44 selection. It seems to be impossible to detect this situation. */
45 @@ -556,6 +571,15 @@ void do_startmenu(HWND hwnd, HWND button)
46 /* separator */
47 AppendMenuW(topmenu, MF_SEPARATOR, 0, NULL);
49 + /* since we'll be using LoadString for this, the "Run" caption will be
50 + heap-allocated; for now I just make a copy of the string */
51 + run_str = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (strlenW(Run)+1));
52 + strcpyW(run_str, Run);
53 + add_special_item(NULL, NULL, run_str, run_dialog, NULL, hwnd);
55 + /* separator */
56 + AppendMenuW(topmenu, MF_SEPARATOR, 0, NULL);
58 /* since we'll be using LoadString for this, the "Exit" caption will be
59 heap-allocated; for now I just make a copy of the string */
60 exit_str = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (strlenW(Exit)+1));
61 --
62 1.5.6.5